@vamship/build-utils 2.2.2 → 2.3.2

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": "2.2.2",
3
+ "version": "2.3.2",
4
4
  "description": "Utility library for build tooling",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/project.js CHANGED
@@ -88,12 +88,15 @@ export class Project {
88
88
 
89
89
  this._containerTargets = Object.keys(this._container).reduce(
90
90
  (result, key) => {
91
- const { repo, buildFile, buildArgs } = this._container[key];
91
+ const { repo, buildFile, buildArgs, buildSecrets } =
92
+ this._container[key];
93
+
92
94
  result[key] = {
93
95
  name: key,
94
96
  repo,
95
- buildFile,
96
- buildArgs,
97
+ buildFile: buildFile || 'Dockerfile',
98
+ buildArgs: buildArgs || {},
99
+ buildSecrets: buildSecrets || {},
97
100
  };
98
101
  return result;
99
102
  },
@@ -276,11 +279,7 @@ export class Project {
276
279
  }
277
280
 
278
281
  /**
279
- * Returns a list of docker targets defined for the project. Every target
280
- * will define the following properties:
281
- * - repo: The docker repo
282
- * - buildFile: The name of the build file to use
283
- * - buildArgs: Arguments to be passed to the docker build
282
+ * Returns a list of docker targets defined for the project.
284
283
  *
285
284
  * @return {Array}
286
285
  */
@@ -289,9 +288,14 @@ export class Project {
289
288
  }
290
289
 
291
290
  /**
292
- * Gets CDK stack information based on the cdk stack key.
291
+ * Gets the definition for a specific container target. The definition will
292
+ * include the following properties:
293
+ * - repo: The docker repo
294
+ * - buildFile: The name of the build file to use
295
+ * - buildArgs: Arguments to be passed to the docker build
296
+ * - buildSecrets: Secrets to be passed to the docker build
293
297
  *
294
- * @param {String} target The CDK target name
298
+ * @param {String} target The container target name
295
299
  * @returns {Object} The container definition corresponding to the target.
296
300
  */
297
301
  getContainerDefinition(target) {
@@ -109,6 +109,35 @@ export default {
109
109
  },
110
110
  additionalProperties: false,
111
111
  },
112
+
113
+ /**
114
+ * Collection of secrets passed to the
115
+ * container build.
116
+ */
117
+ buildSecrets: {
118
+ type: 'object',
119
+ /**
120
+ * Individual build arguments
121
+ */
122
+ patternProperties: {
123
+ '^[a-zA-Z0-9-_]+$': {
124
+ type: 'object',
125
+ properties: {
126
+ type: {
127
+ type: 'string',
128
+ minLength: 1,
129
+ },
130
+ src: {
131
+ type: 'string',
132
+ minLength: 1,
133
+ },
134
+ },
135
+ required: ['type', 'src'],
136
+ additionalProperties: false,
137
+ },
138
+ },
139
+ additionalProperties: false,
140
+ },
112
141
  },
113
142
  required: ['repo'],
114
143
  additionalProperties: false,
@@ -35,12 +35,16 @@ export class DocsTsTaskBuilder extends TaskBuilder {
35
35
 
36
36
  const { rootDir } = project;
37
37
  const docsDir = rootDir.getChild('docs').getFilePath(project.version);
38
- const srcDir = rootDir.getChild('src');
38
+ const srcPath = rootDir.getChild('src').getAllFilesGlob('ts');
39
39
 
40
40
  const task = () =>
41
- _execa('typedoc', ['--out', docsDir, srcDir.absolutePath], {
42
- stdio: 'inherit',
43
- }).then(undefined, (err) => {
41
+ _execa(
42
+ 'typedoc',
43
+ ['--out', docsDir, srcPath, '--entryPointStrategy', 'resolve'],
44
+ {
45
+ stdio: 'inherit',
46
+ },
47
+ ).then(undefined, (err) => {
44
48
  /*
45
49
  * Do nothing. This handler prevents the gulp task from
46
50
  * crashing with an unhandled error.
@@ -67,7 +67,7 @@ export class PackageContainerTaskBuilder extends TaskBuilder {
67
67
 
68
68
  const repo =
69
69
  typeof this._repo === 'undefined' ? definition.repo : this._repo;
70
- const { buildFile, buildArgs } = definition;
70
+ const { buildFile, buildArgs, buildSecrets } = definition;
71
71
 
72
72
  const dockerBin = 'docker';
73
73
  const args = [
@@ -94,6 +94,12 @@ export class PackageContainerTaskBuilder extends TaskBuilder {
94
94
  args.push(`${key}=${buildArgs[key]}`);
95
95
  });
96
96
 
97
+ Object.keys(buildSecrets).forEach((key) => {
98
+ const { type, src } = buildSecrets[key];
99
+ args.push('--secret');
100
+ args.push(`id=${key},src=${src},type=${type}`);
101
+ });
102
+
97
103
  args.push('.');
98
104
 
99
105
  const task = () =>