@vamship/build-utils 2.2.1 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
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 } =
|
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
|
},
|
@@ -107,6 +110,7 @@ export class Project {
|
|
107
110
|
api: null,
|
108
111
|
},
|
109
112
|
infra: null,
|
113
|
+
scripts: null,
|
110
114
|
working: {
|
111
115
|
src: null,
|
112
116
|
test: {
|
@@ -275,11 +279,7 @@ export class Project {
|
|
275
279
|
}
|
276
280
|
|
277
281
|
/**
|
278
|
-
* Returns a list of docker targets defined for the project.
|
279
|
-
* will define the following properties:
|
280
|
-
* - repo: The docker repo
|
281
|
-
* - buildFile: The name of the build file to use
|
282
|
-
* - buildArgs: Arguments to be passed to the docker build
|
282
|
+
* Returns a list of docker targets defined for the project.
|
283
283
|
*
|
284
284
|
* @return {Array}
|
285
285
|
*/
|
@@ -288,9 +288,14 @@ export class Project {
|
|
288
288
|
}
|
289
289
|
|
290
290
|
/**
|
291
|
-
* Gets
|
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
|
292
297
|
*
|
293
|
-
* @param {String} target The
|
298
|
+
* @param {String} target The container target name
|
294
299
|
* @returns {Object} The container definition corresponding to the target.
|
295
300
|
*/
|
296
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,
|
@@ -36,7 +36,7 @@ export class CopyFilesTaskBuilder extends TaskBuilder {
|
|
36
36
|
}
|
37
37
|
|
38
38
|
const { rootDir } = project;
|
39
|
-
const dirs = ['src', 'test'];
|
39
|
+
const dirs = ['src', 'test', 'scripts'];
|
40
40
|
const extensions = ['json'].concat(project.getStaticFilePatterns());
|
41
41
|
const containerBuildFiles = project
|
42
42
|
.getContainerTargets()
|
@@ -56,7 +56,6 @@ export class CopyFilesTaskBuilder extends TaskBuilder {
|
|
56
56
|
'package.json',
|
57
57
|
'LICENSE',
|
58
58
|
'README.md',
|
59
|
-
'_scripts/*',
|
60
59
|
'nginx.conf',
|
61
60
|
'.env',
|
62
61
|
'.npmignore',
|
@@ -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
|
38
|
+
const srcPath = rootDir.getChild('src').getAllFilesGlob('ts');
|
39
39
|
|
40
40
|
const task = () =>
|
41
|
-
_execa(
|
42
|
-
|
43
|
-
|
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 = () =>
|