From 3cfb81b8355b342ae44c3b971dbe498abac03d60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radam=C3=A9s=20Roriz?= Date: Sat, 18 Apr 2020 17:41:57 -0300 Subject: [PATCH] feat(deployer.js): add ignorematch config --- README.md | 3 ++- src/configuration.js | 1 + src/deployer.js | 2 +- src/prompts.js | 8 +++++++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e99ba81..e11eaff 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ s3-deploy for vue-cli CALL FOR CONTRIBUTORS === -If you'd like to participate in the development and maintenance of this plugin, please open a PR or an issue. Help is welcome. +If you'd like to participate in the development and maintenance of this plugin, please open a PR or an issue. Help is welcome. Thanks to all who have contributed so far! **NOTE:** This branch refers to version 4.0.0 and above. See the [3.0.0 branch](https://github.com/multiplegeorges/vue-cli-plugin-s3-deploy/tree/3.0.0) for the previous version. @@ -65,6 +65,7 @@ module.exports = { staticErrorPage: "Sets the default error file (default: error.html)", assetPath: "The path to the built assets (default: dist)", assetMatch: "Regex matcher for asset to deploy (default: **)", + ignoreMatch: "Regex matcher for ignore some files to deploy (default: '')", deployPath: "Path to deploy the app in the bucket (default: /)", acl: "Access control list permissions to apply in S3 (default: public-read)", pwa: "Sets max-age=0 for the PWA-related files specified (default: false)", diff --git a/src/configuration.js b/src/configuration.js index e3ee26f..1f5bb03 100644 --- a/src/configuration.js +++ b/src/configuration.js @@ -34,6 +34,7 @@ class Configuration { staticWebsiteConfiguration: Joi.object(), assetPath: Joi.string().default('dist'), assetMatch: Joi.string().default('**'), + ignoreMatch: Joi.string().default(''), deployPath: Joi.string().default('/'), acl: Joi.string().default('public-read'), pwa: Joi.boolean().default(false), diff --git a/src/deployer.js b/src/deployer.js index 7568e72..28ea312 100644 --- a/src/deployer.js +++ b/src/deployer.js @@ -30,7 +30,7 @@ class Deployer { config.deployPath = this.deployPath(config.options.deployPath) config.fileList = globby.sync( - config.options.assetMatch, + [config.options.assetMatch, config.options.ignoreMatch], { cwd: config.fullAssetPath } ).map(file => path.join(config.fullAssetPath, file)) diff --git a/src/prompts.js b/src/prompts.js index f3c5c81..8046b89 100644 --- a/src/prompts.js +++ b/src/prompts.js @@ -97,6 +97,12 @@ module.exports = [ message: 'Which files should be deployed?', default: '**' }, + { + name: 'ignoreMatch', + type: 'input', + message: 'Which files should be ignored?', + default: '' + }, { name: 'deployPath', type: 'input', @@ -146,4 +152,4 @@ module.exports = [ when: answers => answers.enableCloudfront === true, validate: input => input !== '' ? true : 'At least one invalidation path is required. To invalidate all files, enter /* ' } -] \ No newline at end of file +]