Skip to content

Commit

Permalink
Merge pull request #33 from adastradev/fix-file-metadata-params
Browse files Browse the repository at this point in the history
Fixes #31 by ignoring the first key (glob).
  • Loading branch information
k1LoW authored Nov 14, 2019
2 parents 30b801c + fee840c commit df955c1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class ServerlessS3Sync {
s.params.forEach((param) => {
const glob = Object.keys(param)[0];
if(minimatch(localFile, `${path.resolve(localDir)}/${glob}`)) {
Object.assign(s3Params, param[glob] || {});
Object.assign(s3Params, this.extractMetaParams(param) || {});
}
});
}
Expand Down Expand Up @@ -178,6 +178,15 @@ class ServerlessS3Sync {
cli.consoleLog(`${messagePrefix}${chalk.yellow('Removed.')}`);
});
}

extractMetaParams(config) {
const validParams = {};
const keys = Object.keys(config);
for (let i = 1; i < keys.length; i++) {
validParams[keys[i]] = config[keys[i]];
}
return validParams;
}
}

module.exports = ServerlessS3Sync;
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serverless-s3-sync",
"version": "1.9.0",
"version": "1.9.1",
"description": "A plugin to sync local directories and S3 prefixes for Serverless Framework.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit df955c1

Please sign in to comment.