@vamship/build-utils 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vamship/build-utils",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Utility library for build tooling",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/project.js CHANGED
@@ -122,6 +122,7 @@ module.exports = class Project {
122
122
  requiredEnv,
123
123
  exportedTypes,
124
124
  aws,
125
+ staticFilePatterns,
125
126
  } = buildMetadata;
126
127
 
127
128
  if (SUPPORTED_PROJECT_TYPES.indexOf(projectType) < 0) {
@@ -144,6 +145,8 @@ module.exports = class Project {
144
145
  this._projectType = projectType;
145
146
  this._language = language;
146
147
  this._exportedTypes = exportedTypes;
148
+ this._staticFilePatterns =
149
+ staticFilePatterns instanceof Array ? staticFilePatterns : [];
147
150
 
148
151
  this._hasTypescript = this._language === 'ts';
149
152
  this._hasServer = this._projectType === 'api';
@@ -439,6 +442,16 @@ module.exports = class Project {
439
442
  return this._exportedTypes;
440
443
  }
441
444
 
445
+ /**
446
+ * Additional files to copy from the source directory to the build
447
+ * directory.
448
+ *
449
+ * @return {String}
450
+ */
451
+ get staticFilePatterns() {
452
+ return this._staticFilePatterns;
453
+ }
454
+
442
455
  /**
443
456
  * Determines whether or not the project can be packaged up as a docker
444
457
  * image.
@@ -36,9 +36,13 @@ module.exports = (project, options) => {
36
36
  extras.push('Dockerfile*');
37
37
  }
38
38
 
39
+ const staticFilePatterns = ['js', 'json'].concat(
40
+ project.staticFilePatterns
41
+ );
42
+
39
43
  const paths = dirs
40
44
  .map((dir) => rootDir.getChild(dir))
41
- .map((dir) => ['js', 'json'].map((ext) => dir.getAllFilesGlob(ext)))
45
+ .map((dir) => staticFilePatterns.map((ext) => dir.getAllFilesGlob(ext)))
42
46
  .reduce((result, arr) => result.concat(arr), [])
43
47
  .concat(extras.map((item) => rootDir.getFileGlob(item)));
44
48