Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[![NPM](https://nodei.co/npm/serverless-s3-remover.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/serverless-s3-remover/)
[![NPM](https://nodei.co/npm-dl/serverless-s3-remover.png?height=2)](https://nodei.co/npm/serverless-s3-remover/)
# serverless-s3-remover
plugin for serverless to make buckets empty before remove
plugin for serverless to empty S3 buckets before stack removal

# Usage
Run next command.
```bash
$ npm install serverless-s3-remover
```

Add to your serverless.yml
Add the following to your serverless.yml:
```yaml
plugins:
- serverless-s3-remover
Expand All @@ -21,21 +21,21 @@ custom:
- my-bucket-2
```

You can specify any number of `bucket`s that you want.
You can specify any number of S3 `bucket`s that you want.

Now you can make all buckets empty by running:
Now you can empty all S3 buckets by running:
```bash
$ sls s3remove
```

# When removing
When removing serverless stack, this plugin automatically make buckets empty before removing stack.
This plugin automatically empties S3 buckets before removing the serverless stack.
```sh
$ sls remove
```

# Using Prompt
You can use prompt before deleting bucket.
You can use prompt before deleting any S3 buckets.

```yaml
custom:
Expand All @@ -58,4 +58,4 @@ custom:
prompt: ${self:custom.boolean.${opt:s3-remover-prompt, 'true'}}
```

I can use the command line argument ```--s3-remover-prompt false``` to disable the prompt feature.
Please use the command line argument ```--s3-remover-prompt false``` to disable the prompt feature.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Remover {

this.commands = {
s3remove: {
usage: 'Remove all files in S3 buckets',
usage: 'Remove all objects in S3 buckets',
lifecycleEvents: [
'remove'
],
Expand Down Expand Up @@ -113,7 +113,7 @@ class Remover {
self.log(message);
self.serverless.cli.consoleLog(`${messagePrefix}${chalk.yellow(message)}`);
}).catch((err) => {
const message = `Faild: ${b} may not be empty.`;
const message = `Failed: ${b} may not be empty.`;
self.log(message);
self.log(err);
self.serverless.cli.consoleLog(`${messagePrefix}${chalk.yellow(message)}`);
Expand All @@ -130,7 +130,7 @@ class Remover {
message: `Make ${b} empty. Are you sure? [yes/no]:`,
validator: /(yes|no)/,
required: true,
warning: 'Must respond yes or no'
warning: 'Please respond with \'yes\' or \'no\'.'
};
});
prompt.get(schema, (err, result) => {
Expand All @@ -142,7 +142,7 @@ class Remover {
self.log(message);
self.serverless.cli.consoleLog(`${messagePrefix}${chalk.yellow(message)}`);
}).catch(() => {
const message = `Faild: ${b} may not be empty.`;
const message = `Failed: ${b} may not be empty.`;
self.log(message);
self.serverless.cli.consoleLog(`${messagePrefix}${chalk.yellow(message)}`);
}));
Expand Down