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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)",
Expand Down
1 change: 1 addition & 0 deletions src/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class Configuration {
staticWebsiteConfiguration: Joi.object(),
assetPath: Joi.string().default('dist'),
assetMatch: Joi.string().default('**'),
ignoreMatch: Joi.string().default(''),
Comment on lines 36 to +37

Choose a reason for hiding this comment

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

This could also be done by allowing assetMatch to be an array (I just did it like that locally before I had seen this PR).

Suggested change
assetMatch: Joi.string().default('**'),
ignoreMatch: Joi.string().default(''),
assetMatch: [Joi.string().default('**'), Joi.array().items(Joi.string())],

@nicekiwi looks like even at the current package.json globby version of 8.0.1, the globby.sync method can accept an array of patterns. I tested the change I've suggested locally, and it works with the following to upload all but my map files. Any estimate on when something like this could be merged and released?

pluginOptions: {
  s3Deploy: { 
    assetMatch: ['**', '!(**/*.map)'],
  }
}

deployPath: Joi.string().default('/'),
acl: Joi.string().default('public-read'),
pwa: Joi.boolean().default(false),
Expand Down
2 changes: 1 addition & 1 deletion src/deployer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
8 changes: 7 additions & 1 deletion src/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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 /* '
}
]
]