Skip to content
Merged
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ plugins:
custom:
client:
bucketName: unique-s3-bucketname-for-your-website-files
distributionFolder: client/dist
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an optional configuration value. Can we change this to
# distributionFolder: client/dist

```

* **Warning:** The plugin will overwrite any data you have in the bucket name you set above if it already exists.
Expand Down
11 changes: 6 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,11 @@ class Client {
const Utils = this.serverless.utils;
const Error = this.serverless.classes.Error;

const _dist = _.get(this.serverless, 'service.custom.client.distributionFolder', 'dist');

if (!Utils.dirExistsSync(path.join(this.serverless.config.servicePath, 'client', _dist))) {
return BbPromise.reject(new Error('Could not find "client/' + _dist + ' folder in your project root.'));
const distributionFolder = _.get(this.serverless, 'service.custom.client.distributionFolder', path.join('client', 'dist'));
const clientPath = path.join(this.serverless.config.servicePath, distributionFolder);

if (!Utils.dirExistsSync(clientPath)) {
return BbPromise.reject(new Error('Could not find ' + clientPath + ' folder in your project root.'));
}

if (!this.serverless.service.custom ||
Expand All @@ -143,7 +144,7 @@ class Client {
}

this.bucketName = this.serverless.service.custom.client.bucketName;
this.clientPath = path.join(this.serverless.config.servicePath, 'client', _dist);
this.clientPath = clientPath;

return BbPromise.resolve();
}
Expand Down