Skip to content

Commit

Permalink
Add regex support for include/exclude
Browse files Browse the repository at this point in the history
  • Loading branch information
syndbg committed Oct 31, 2016
1 parent d2d37dd commit cc89418
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions dist/webpack-google-cloud-storage-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,23 +173,23 @@ return /******/ (function(modules) { // webpackBootstrap
}
}, {
key: 'isIncluded',
value: function isIncluded(file) {
value: function isIncluded(fileName) {
return this.options.include.some(function (include) {
return include.match(file);
return fileName.match(new RegExp(include));
});
}
}, {
key: 'isExcluded',
value: function isExcluded(file) {
value: function isExcluded(fileName) {
return this.options.exclude.some(function (exclude) {
return exclude.match(file);
return fileName.match(new RegExp(exclude));
});
}
}, {
key: 'isIgnored',
value: function isIgnored(file) {
value: function isIgnored(fileName) {
return this.options.ignoredFiles.some(function (ignoredFile) {
return ignoredFile === file;
return fileName.match(new RegExp(ignoredFile));
});
}
}, {
Expand Down
6 changes: 3 additions & 3 deletions examples/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ module.exports = {
plugins: [
new WebpackGoogleCloudStoragePlugin({
directory: './src',
// NOTE: Array of filenames to include in the uploading process
include: ['app.js'],
// NOTE: Array of filenames to exclude in the uploading process
// NOTE: Array of filename strings (or regex) to include in the uploading process
include: ['.js'],
// NOTE: Array of filename strings (or regex) to exclude in the uploading process
exclude: ['cats.js'],
// NOTE: Options passed directly to
// Google cloud Node Storage client.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webpack-google-cloud-storage-plugin",
"version": "0.2.0",
"version": "0.3.0",
"description": "A Webpack plugin to upload assets in Google Cloud Storage.",
"main": "dist/webpack-google-cloud-storage-plugin.js",
"scripts": {
Expand Down
12 changes: 6 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,16 @@ module.exports = class WebpackGoogleCloudStoragePlugin {
);
}

isIncluded(file) {
return this.options.include.some(include => include.match(file));
isIncluded(fileName) {
return this.options.include.some(include => fileName.match(new RegExp(include)));
}

isExcluded(file) {
return this.options.exclude.some(exclude => exclude.match(file));
isExcluded(fileName) {
return this.options.exclude.some(exclude => fileName.match(new RegExp(exclude)));
}

isIgnored(file) {
return this.options.ignoredFiles.some(ignoredFile => ignoredFile === file);
isIgnored(fileName) {
return this.options.ignoredFiles.some(ignoredFile => fileName.match(new RegExp(ignoredFile)));
}

handleFiles(files) {
Expand Down

0 comments on commit cc89418

Please sign in to comment.