@expo/steps 1.0.271 → 18.0.1
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/LICENSE +21 -100
- package/README.md +1 -1
- package/dist/AbstractConfigParser.js +9 -7
- package/dist/BuildConfig.d.ts +1 -1
- package/dist/BuildConfig.js +8 -11
- package/dist/BuildConfigParser.d.ts +2 -2
- package/dist/BuildConfigParser.js +16 -24
- package/dist/BuildFunction.d.ts +1 -1
- package/dist/BuildFunction.js +18 -8
- package/dist/BuildFunctionGroup.js +5 -3
- package/dist/BuildRuntimePlatform.js +0 -1
- package/dist/BuildStep.d.ts +2 -2
- package/dist/BuildStep.js +44 -24
- package/dist/BuildStepContext.d.ts +2 -2
- package/dist/BuildStepContext.js +22 -16
- package/dist/BuildStepEnv.js +0 -1
- package/dist/BuildStepInput.js +13 -9
- package/dist/BuildStepOutput.js +6 -4
- package/dist/BuildTemporaryFiles.js +1 -2
- package/dist/BuildWorkflow.js +5 -3
- package/dist/BuildWorkflowValidator.js +7 -8
- package/dist/StepMetrics.js +0 -1
- package/dist/StepsConfigParser.d.ts +2 -2
- package/dist/StepsConfigParser.js +12 -16
- package/dist/cli/cli.d.ts +1 -1
- package/dist/cli/cli.js +11 -6
- package/dist/errors.js +7 -4
- package/dist/index.js +17 -8
- package/dist/interpolation.js +1 -2
- package/dist/scripts/runCustomFunction.js +2 -3
- package/dist/utils/customFunction.d.ts +1 -1
- package/dist/utils/customFunction.js +1 -2
- package/dist/utils/expodash/duplicates.js +0 -1
- package/dist/utils/expodash/uniq.js +0 -1
- package/dist/utils/hashFiles.js +1 -2
- package/dist/utils/jsepEval.js +4 -5
- package/dist/utils/nullthrows.js +1 -2
- package/dist/utils/shell/bin.js +0 -1
- package/dist/utils/shell/command.js +0 -1
- package/dist/utils/shell/spawn.d.ts +2 -2
- package/dist/utils/shell/spawn.js +0 -1
- package/dist/utils/template.js +4 -5
- package/package.json +26 -29
- package/dist/AbstractConfigParser.js.map +0 -1
- package/dist/BuildConfig.js.map +0 -1
- package/dist/BuildConfigParser.js.map +0 -1
- package/dist/BuildFunction.js.map +0 -1
- package/dist/BuildFunctionGroup.js.map +0 -1
- package/dist/BuildRuntimePlatform.js.map +0 -1
- package/dist/BuildStep.js.map +0 -1
- package/dist/BuildStepContext.js.map +0 -1
- package/dist/BuildStepEnv.js.map +0 -1
- package/dist/BuildStepInput.js.map +0 -1
- package/dist/BuildStepOutput.js.map +0 -1
- package/dist/BuildTemporaryFiles.js.map +0 -1
- package/dist/BuildWorkflow.js.map +0 -1
- package/dist/BuildWorkflowValidator.js.map +0 -1
- package/dist/StepMetrics.js.map +0 -1
- package/dist/StepsConfigParser.js.map +0 -1
- package/dist/cli/cli.js.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/interpolation.js.map +0 -1
- package/dist/scripts/runCustomFunction.js.map +0 -1
- package/dist/utils/customFunction.js.map +0 -1
- package/dist/utils/expodash/duplicates.js.map +0 -1
- package/dist/utils/expodash/uniq.js.map +0 -1
- package/dist/utils/hashFiles.js.map +0 -1
- package/dist/utils/jsepEval.js.map +0 -1
- package/dist/utils/nullthrows.js.map +0 -1
- package/dist/utils/shell/bin.js.map +0 -1
- package/dist/utils/shell/command.js.map +0 -1
- package/dist/utils/shell/spawn.js.map +0 -1
- package/dist/utils/template.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,100 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Notice
|
|
23
|
-
|
|
24
|
-
The Business Source License (this document, or the "License") is not an Open
|
|
25
|
-
Source license. However, the Licensed Work will eventually be made available
|
|
26
|
-
under an Open Source License, as stated in this License.
|
|
27
|
-
|
|
28
|
-
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
|
|
29
|
-
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
30
|
-
|
|
31
|
-
-----------------------------------------------------------------------------
|
|
32
|
-
|
|
33
|
-
Business Source License 1.1
|
|
34
|
-
|
|
35
|
-
Terms
|
|
36
|
-
|
|
37
|
-
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
38
|
-
works, redistribute, and make non-production use of the Licensed Work. The
|
|
39
|
-
Licensor may make an Additional Use Grant, above, permitting limited
|
|
40
|
-
production use.
|
|
41
|
-
|
|
42
|
-
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
43
|
-
available distribution of a specific version of the Licensed Work under this
|
|
44
|
-
License, whichever comes first, the Licensor hereby grants you rights under
|
|
45
|
-
the terms of the Change License, and the rights granted in the paragraph
|
|
46
|
-
above terminate.
|
|
47
|
-
|
|
48
|
-
If your use of the Licensed Work does not comply with the requirements
|
|
49
|
-
currently in effect as described in this License, you must purchase a
|
|
50
|
-
commercial license from the Licensor, its affiliated entities, or authorized
|
|
51
|
-
resellers, or you must refrain from using the Licensed Work.
|
|
52
|
-
|
|
53
|
-
All copies of the original and modified Licensed Work, and derivative works
|
|
54
|
-
of the Licensed Work, are subject to this License. This License applies
|
|
55
|
-
separately for each version of the Licensed Work and the Change Date may vary
|
|
56
|
-
for each version of the Licensed Work released by Licensor.
|
|
57
|
-
|
|
58
|
-
You must conspicuously display this License on each original or modified copy
|
|
59
|
-
of the Licensed Work. If you receive the Licensed Work in original or
|
|
60
|
-
modified form from a third party, the terms and conditions set forth in this
|
|
61
|
-
License apply to your use of that work.
|
|
62
|
-
|
|
63
|
-
Any use of the Licensed Work in violation of this License will automatically
|
|
64
|
-
terminate your rights under this License for the current and all other
|
|
65
|
-
versions of the Licensed Work.
|
|
66
|
-
|
|
67
|
-
This License does not grant you any right in any trademark or logo of
|
|
68
|
-
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
69
|
-
Licensor as expressly required by this License).
|
|
70
|
-
|
|
71
|
-
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
72
|
-
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
73
|
-
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
74
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
75
|
-
TITLE.
|
|
76
|
-
|
|
77
|
-
MariaDB hereby grants you permission to use this License’s text to license
|
|
78
|
-
your works, and to refer to it using the trademark "Business Source License",
|
|
79
|
-
as long as you comply with the Covenants of Licensor below.
|
|
80
|
-
|
|
81
|
-
Covenants of Licensor
|
|
82
|
-
|
|
83
|
-
In consideration of the right to use this License’s text and the "Business
|
|
84
|
-
Source License" name and trademark, Licensor covenants to MariaDB, and to all
|
|
85
|
-
other recipients of the licensed work to be provided by Licensor:
|
|
86
|
-
|
|
87
|
-
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
88
|
-
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
89
|
-
where "compatible" means that software provided under the Change License can
|
|
90
|
-
be included in a program with software provided under GPL Version 2.0 or a
|
|
91
|
-
later version. Licensor may specify additional Change Licenses without
|
|
92
|
-
limitation.
|
|
93
|
-
|
|
94
|
-
2. To either: (a) specify an additional grant of rights to use that does not
|
|
95
|
-
impose any additional restriction on the right granted in this License, as
|
|
96
|
-
the Additional Use Grant; or (b) insert the text "None".
|
|
97
|
-
|
|
98
|
-
3. To specify a Change Date.
|
|
99
|
-
|
|
100
|
-
4. Not to modify this License in any other way.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020-present 650 Industries, Inc. (aka Expo)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ TBD
|
|
|
7
7
|
If you want to run config examples from the **examples** directory, e.g. **examples/simple**, follow the steps:
|
|
8
8
|
|
|
9
9
|
- Run `yarn` and `yarn build` in the root of the monorepo.
|
|
10
|
-
- Add `alias eas-steps="/REPLACE/WITH/PATH/TO/eas-
|
|
10
|
+
- Add `alias eas-steps="/REPLACE/WITH/PATH/TO/eas-cli/packages/steps/cli.sh"` to your **.zshrc**/**.bashrc**/etc.
|
|
11
11
|
- cd into **examples/simple** and run `eas-steps config.yml project [darwin|linux]`. The first argument is the config file, and the second is the default working directory for the config file. The third argument is the platform for which you want to simulate running a custom build, it defaults to the platform of the device on which the CLI is currently being run.
|
|
12
12
|
|
|
13
13
|
### Example project
|
|
@@ -7,6 +7,9 @@ const errors_1 = require("./errors");
|
|
|
7
7
|
const duplicates_1 = require("./utils/expodash/duplicates");
|
|
8
8
|
const uniq_1 = require("./utils/expodash/uniq");
|
|
9
9
|
class AbstractConfigParser {
|
|
10
|
+
ctx;
|
|
11
|
+
externalFunctions;
|
|
12
|
+
externalFunctionGroups;
|
|
10
13
|
constructor(ctx, { externalFunctions, externalFunctionGroups, }) {
|
|
11
14
|
this.ctx = ctx;
|
|
12
15
|
this.validateExternalFunctions(externalFunctions);
|
|
@@ -24,42 +27,41 @@ class AbstractConfigParser {
|
|
|
24
27
|
if (externalFunctions === undefined) {
|
|
25
28
|
return;
|
|
26
29
|
}
|
|
27
|
-
const externalFunctionIds = externalFunctions.map(
|
|
30
|
+
const externalFunctionIds = externalFunctions.map(f => f.getFullId());
|
|
28
31
|
const duplicatedExternalFunctionIds = (0, duplicates_1.duplicates)(externalFunctionIds);
|
|
29
32
|
if (duplicatedExternalFunctionIds.length === 0) {
|
|
30
33
|
return;
|
|
31
34
|
}
|
|
32
35
|
throw new errors_1.BuildConfigError(`Provided external functions with duplicated IDs: ${duplicatedExternalFunctionIds
|
|
33
|
-
.map(
|
|
36
|
+
.map(id => `"${id}"`)
|
|
34
37
|
.join(', ')}`);
|
|
35
38
|
}
|
|
36
39
|
validateExternalFunctionGroups(externalFunctionGroups) {
|
|
37
40
|
if (externalFunctionGroups === undefined) {
|
|
38
41
|
return;
|
|
39
42
|
}
|
|
40
|
-
const externalFunctionGroupIds = externalFunctionGroups.map(
|
|
43
|
+
const externalFunctionGroupIds = externalFunctionGroups.map(f => f.getFullId());
|
|
41
44
|
const duplicatedExternalFunctionGroupIds = (0, duplicates_1.duplicates)(externalFunctionGroupIds);
|
|
42
45
|
if (duplicatedExternalFunctionGroupIds.length === 0) {
|
|
43
46
|
return;
|
|
44
47
|
}
|
|
45
48
|
throw new errors_1.BuildConfigError(`Provided external function groups with duplicated IDs: ${duplicatedExternalFunctionGroupIds
|
|
46
|
-
.map(
|
|
49
|
+
.map(id => `"${id}"`)
|
|
47
50
|
.join(', ')}`);
|
|
48
51
|
}
|
|
49
52
|
getExternalFunctionFullIds() {
|
|
50
53
|
if (this.externalFunctions === undefined) {
|
|
51
54
|
return [];
|
|
52
55
|
}
|
|
53
|
-
const ids = this.externalFunctions.map(
|
|
56
|
+
const ids = this.externalFunctions.map(f => f.getFullId());
|
|
54
57
|
return (0, uniq_1.uniq)(ids);
|
|
55
58
|
}
|
|
56
59
|
getExternalFunctionGroupFullIds() {
|
|
57
60
|
if (this.externalFunctionGroups === undefined) {
|
|
58
61
|
return [];
|
|
59
62
|
}
|
|
60
|
-
const ids = this.externalFunctionGroups.map(
|
|
63
|
+
const ids = this.externalFunctionGroups.map(f => f.getFullId());
|
|
61
64
|
return (0, uniq_1.uniq)(ids);
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
67
|
exports.AbstractConfigParser = AbstractConfigParser;
|
|
65
|
-
//# sourceMappingURL=AbstractConfigParser.js.map
|
package/dist/BuildConfig.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Joi from 'joi';
|
|
2
2
|
import { BuildRuntimePlatform } from './BuildRuntimePlatform';
|
|
3
|
-
import { BuildStepInputValueTypeName, BuildStepInputValueType } from './BuildStepInput';
|
|
4
3
|
import { BuildStepEnv } from './BuildStepEnv';
|
|
4
|
+
import { BuildStepInputValueType, BuildStepInputValueTypeName } from './BuildStepInput';
|
|
5
5
|
export type BuildFunctions = Record<string, BuildFunctionConfig>;
|
|
6
6
|
interface BuildFunctionsConfigFile {
|
|
7
7
|
configFilesToImport?: string[];
|
package/dist/BuildConfig.js
CHANGED
|
@@ -16,12 +16,12 @@ exports.isBuildStepBareFunctionOrFunctionGroupCall = isBuildStepBareFunctionOrFu
|
|
|
16
16
|
exports.validateAllFunctionsExist = validateAllFunctionsExist;
|
|
17
17
|
const assert_1 = __importDefault(require("assert"));
|
|
18
18
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
19
|
-
const path_1 = __importDefault(require("path"));
|
|
20
19
|
const joi_1 = __importDefault(require("joi"));
|
|
20
|
+
const path_1 = __importDefault(require("path"));
|
|
21
21
|
const yaml_1 = __importDefault(require("yaml"));
|
|
22
|
-
const errors_1 = require("./errors");
|
|
23
22
|
const BuildRuntimePlatform_1 = require("./BuildRuntimePlatform");
|
|
24
23
|
const BuildStepInput_1 = require("./BuildStepInput");
|
|
24
|
+
const errors_1 = require("./errors");
|
|
25
25
|
const template_1 = require("./utils/template");
|
|
26
26
|
const BuildFunctionInputsSchema = joi_1.default.array().items(joi_1.default.alternatives().conditional(joi_1.default.ref('.'), {
|
|
27
27
|
is: joi_1.default.string(),
|
|
@@ -170,7 +170,7 @@ async function importFunctionsAsync(baseConfigPath, configPathsToImport) {
|
|
|
170
170
|
const importedFunctions = {};
|
|
171
171
|
// this is a set of visited files identified by ABSOLUTE paths
|
|
172
172
|
const visitedFiles = new Set([baseConfigPath]);
|
|
173
|
-
const configFilesToVisit = (configPathsToImport
|
|
173
|
+
const configFilesToVisit = (configPathsToImport ?? []).map(childConfigRelativePath => path_1.default.resolve(baseConfigDir, childConfigRelativePath));
|
|
174
174
|
while (configFilesToVisit.length > 0) {
|
|
175
175
|
const childConfigPath = configFilesToVisit.shift();
|
|
176
176
|
(0, assert_1.default)(childConfigPath, 'Guaranteed by loop condition');
|
|
@@ -191,7 +191,7 @@ async function importFunctionsAsync(baseConfigPath, configPathsToImport) {
|
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
if (childConfig.configFilesToImport) {
|
|
194
|
-
configFilesToVisit.push(...childConfig.configFilesToImport.map(
|
|
194
|
+
configFilesToVisit.push(...childConfig.configFilesToImport.map(relativePath => path_1.default.resolve(childDir, relativePath)));
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
catch (err) {
|
|
@@ -231,11 +231,10 @@ function validateConfig(schema, config, configFilePath) {
|
|
|
231
231
|
return value;
|
|
232
232
|
}
|
|
233
233
|
function mergeConfigWithImportedFunctions(config, importedFunctions) {
|
|
234
|
-
var _a;
|
|
235
234
|
if (Object.keys(importedFunctions).length === 0) {
|
|
236
235
|
return;
|
|
237
236
|
}
|
|
238
|
-
config.functions =
|
|
237
|
+
config.functions = config.functions ?? {};
|
|
239
238
|
for (const functionName in importedFunctions) {
|
|
240
239
|
if (!(functionName in config.functions)) {
|
|
241
240
|
config.functions[functionName] = importedFunctions[functionName];
|
|
@@ -269,19 +268,18 @@ function validateAllFunctionsExist(config, { externalFunctionIds = [], externalF
|
|
|
269
268
|
const calledFunctionsOrFunctionGroup = Array.from(calledFunctionsOrFunctionGroupsSet);
|
|
270
269
|
const externalFunctionIdsSet = new Set(externalFunctionIds);
|
|
271
270
|
const externalFunctionGroupsIdsSet = new Set(externalFunctionGroupsIds);
|
|
272
|
-
const nonExistentFunctionsOrFunctionGroups = calledFunctionsOrFunctionGroup.filter(
|
|
273
|
-
var _a;
|
|
271
|
+
const nonExistentFunctionsOrFunctionGroups = calledFunctionsOrFunctionGroup.filter(calledFunctionOrFunctionGroup => {
|
|
274
272
|
if (isFullIdNamespaced(calledFunctionOrFunctionGroup) &&
|
|
275
273
|
skipNamespacedFunctionsOrFunctionGroupsCheck) {
|
|
276
274
|
return false;
|
|
277
275
|
}
|
|
278
|
-
return (!(calledFunctionOrFunctionGroup in (
|
|
276
|
+
return (!(calledFunctionOrFunctionGroup in (config.functions ?? {})) &&
|
|
279
277
|
!externalFunctionIdsSet.has(calledFunctionOrFunctionGroup) &&
|
|
280
278
|
!externalFunctionGroupsIdsSet.has(calledFunctionOrFunctionGroup));
|
|
281
279
|
});
|
|
282
280
|
if (nonExistentFunctionsOrFunctionGroups.length > 0) {
|
|
283
281
|
throw new errors_1.BuildConfigError(`Calling non-existent functions: ${nonExistentFunctionsOrFunctionGroups
|
|
284
|
-
.map(
|
|
282
|
+
.map(f => `"${f}"`)
|
|
285
283
|
.join(', ')}.`);
|
|
286
284
|
}
|
|
287
285
|
}
|
|
@@ -294,4 +292,3 @@ function maybeResolveCustomFunctionRelativePath(dir, customFunctionPath) {
|
|
|
294
292
|
function isFullIdNamespaced(fullId) {
|
|
295
293
|
return fullId.includes('/');
|
|
296
294
|
}
|
|
297
|
-
//# sourceMappingURL=BuildConfig.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { AbstractConfigParser } from './AbstractConfigParser';
|
|
1
2
|
import { BuildFunction, BuildFunctionById } from './BuildFunction';
|
|
3
|
+
import { BuildFunctionGroup } from './BuildFunctionGroup';
|
|
2
4
|
import { BuildStep } from './BuildStep';
|
|
3
5
|
import { BuildStepGlobalContext } from './BuildStepContext';
|
|
4
|
-
import { BuildFunctionGroup } from './BuildFunctionGroup';
|
|
5
|
-
import { AbstractConfigParser } from './AbstractConfigParser';
|
|
6
6
|
export declare class BuildConfigParser extends AbstractConfigParser {
|
|
7
7
|
private readonly configPath;
|
|
8
8
|
constructor(ctx: BuildStepGlobalContext, { configPath, externalFunctions, externalFunctionGroups, }: {
|
|
@@ -5,15 +5,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.BuildConfigParser = void 0;
|
|
7
7
|
const assert_1 = __importDefault(require("assert"));
|
|
8
|
+
const AbstractConfigParser_1 = require("./AbstractConfigParser");
|
|
8
9
|
const BuildConfig_1 = require("./BuildConfig");
|
|
9
10
|
const BuildFunction_1 = require("./BuildFunction");
|
|
11
|
+
const BuildFunctionGroup_1 = require("./BuildFunctionGroup");
|
|
10
12
|
const BuildStep_1 = require("./BuildStep");
|
|
11
13
|
const BuildStepInput_1 = require("./BuildStepInput");
|
|
12
14
|
const BuildStepOutput_1 = require("./BuildStepOutput");
|
|
13
15
|
const errors_1 = require("./errors");
|
|
14
|
-
const BuildFunctionGroup_1 = require("./BuildFunctionGroup");
|
|
15
|
-
const AbstractConfigParser_1 = require("./AbstractConfigParser");
|
|
16
16
|
class BuildConfigParser extends AbstractConfigParser_1.AbstractConfigParser {
|
|
17
|
+
configPath;
|
|
17
18
|
constructor(ctx, { configPath, externalFunctions, externalFunctionGroups, }) {
|
|
18
19
|
super(ctx, {
|
|
19
20
|
externalFunctions,
|
|
@@ -22,14 +23,13 @@ class BuildConfigParser extends AbstractConfigParser_1.AbstractConfigParser {
|
|
|
22
23
|
this.configPath = configPath;
|
|
23
24
|
}
|
|
24
25
|
async parseConfigToBuildStepsAndBuildFunctionByIdMappingAsync() {
|
|
25
|
-
var _a;
|
|
26
26
|
const config = await (0, BuildConfig_1.readAndValidateBuildConfigFromPathAsync)(this.configPath, {
|
|
27
27
|
externalFunctionIds: this.getExternalFunctionFullIds(),
|
|
28
28
|
externalFunctionGroupsIds: this.getExternalFunctionGroupFullIds(),
|
|
29
29
|
});
|
|
30
30
|
const configBuildFunctions = this.createBuildFunctionsFromConfig(config.functions);
|
|
31
31
|
const buildFunctions = this.mergeBuildFunctionsWithExternal(configBuildFunctions, this.externalFunctions);
|
|
32
|
-
const buildFunctionGroups = (0, BuildFunctionGroup_1.createBuildFunctionGroupByIdMapping)(
|
|
32
|
+
const buildFunctionGroups = (0, BuildFunctionGroup_1.createBuildFunctionGroupByIdMapping)(this.externalFunctionGroups ?? []);
|
|
33
33
|
const buildSteps = [];
|
|
34
34
|
for (const stepConfig of config.build.steps) {
|
|
35
35
|
buildSteps.push(...this.createBuildStepFromConfig(stepConfig, buildFunctions, buildFunctionGroups));
|
|
@@ -179,8 +179,7 @@ class BuildConfigParser extends AbstractConfigParser_1.AbstractConfigParser {
|
|
|
179
179
|
}));
|
|
180
180
|
}
|
|
181
181
|
createBuildStepInputProvidersFromBuildFunctionInputs(buildFunctionInputs) {
|
|
182
|
-
return buildFunctionInputs.map(
|
|
183
|
-
var _a;
|
|
182
|
+
return buildFunctionInputs.map(entry => {
|
|
184
183
|
return typeof entry === 'string'
|
|
185
184
|
? BuildStepInput_1.BuildStepInput.createProvider({
|
|
186
185
|
id: entry,
|
|
@@ -189,7 +188,7 @@ class BuildConfigParser extends AbstractConfigParser_1.AbstractConfigParser {
|
|
|
189
188
|
})
|
|
190
189
|
: BuildStepInput_1.BuildStepInput.createProvider({
|
|
191
190
|
id: entry.name,
|
|
192
|
-
required:
|
|
191
|
+
required: entry.required ?? true,
|
|
193
192
|
defaultValue: entry.defaultValue,
|
|
194
193
|
allowedValues: entry.allowedValues,
|
|
195
194
|
allowedValueTypeName: entry.allowedValueType,
|
|
@@ -197,24 +196,18 @@ class BuildConfigParser extends AbstractConfigParser_1.AbstractConfigParser {
|
|
|
197
196
|
});
|
|
198
197
|
}
|
|
199
198
|
createBuildStepOutputsFromDefinition(buildStepOutputs, stepDisplayName) {
|
|
200
|
-
return buildStepOutputs.map(
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
required: (_a = entry.required) !== null && _a !== void 0 ? _a : true,
|
|
208
|
-
});
|
|
209
|
-
});
|
|
199
|
+
return buildStepOutputs.map(entry => typeof entry === 'string'
|
|
200
|
+
? new BuildStepOutput_1.BuildStepOutput(this.ctx, { id: entry, stepDisplayName, required: true })
|
|
201
|
+
: new BuildStepOutput_1.BuildStepOutput(this.ctx, {
|
|
202
|
+
id: entry.name,
|
|
203
|
+
stepDisplayName,
|
|
204
|
+
required: entry.required ?? true,
|
|
205
|
+
}));
|
|
210
206
|
}
|
|
211
207
|
createBuildStepOutputProvidersFromBuildFunctionOutputs(buildFunctionOutputs) {
|
|
212
|
-
return buildFunctionOutputs.map(
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
? BuildStepOutput_1.BuildStepOutput.createProvider({ id: entry, required: true })
|
|
216
|
-
: BuildStepOutput_1.BuildStepOutput.createProvider({ id: entry.name, required: (_a = entry.required) !== null && _a !== void 0 ? _a : true });
|
|
217
|
-
});
|
|
208
|
+
return buildFunctionOutputs.map(entry => typeof entry === 'string'
|
|
209
|
+
? BuildStepOutput_1.BuildStepOutput.createProvider({ id: entry, required: true })
|
|
210
|
+
: BuildStepOutput_1.BuildStepOutput.createProvider({ id: entry.name, required: entry.required ?? true }));
|
|
218
211
|
}
|
|
219
212
|
mergeBuildFunctionsWithExternal(configFunctions, externalFunctions) {
|
|
220
213
|
const result = { ...configFunctions };
|
|
@@ -237,4 +230,3 @@ function getFunctionIdFromBuildStepFunctionCall(buildStepFunctionCall) {
|
|
|
237
230
|
(0, assert_1.default)(keys.length === 1, 'There must be at most one function call in the step (enforced by joi).');
|
|
238
231
|
return keys[0];
|
|
239
232
|
}
|
|
240
|
-
//# sourceMappingURL=BuildConfigParser.js.map
|
package/dist/BuildFunction.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BuildRuntimePlatform } from './BuildRuntimePlatform';
|
|
2
2
|
import { BuildStep, BuildStepFunction } from './BuildStep';
|
|
3
3
|
import { BuildStepGlobalContext } from './BuildStepContext';
|
|
4
|
+
import { BuildStepEnv } from './BuildStepEnv';
|
|
4
5
|
import { BuildStepInputProvider } from './BuildStepInput';
|
|
5
6
|
import { BuildStepOutputProvider } from './BuildStepOutput';
|
|
6
|
-
import { BuildStepEnv } from './BuildStepEnv';
|
|
7
7
|
export type BuildFunctionById = Record<string, BuildFunction>;
|
|
8
8
|
export type BuildFunctionCallInputs = Record<string, unknown>;
|
|
9
9
|
export declare class BuildFunction {
|
package/dist/BuildFunction.js
CHANGED
|
@@ -8,6 +8,17 @@ const assert_1 = __importDefault(require("assert"));
|
|
|
8
8
|
const BuildStep_1 = require("./BuildStep");
|
|
9
9
|
const customFunction_1 = require("./utils/customFunction");
|
|
10
10
|
class BuildFunction {
|
|
11
|
+
namespace;
|
|
12
|
+
id;
|
|
13
|
+
name;
|
|
14
|
+
supportedRuntimePlatforms;
|
|
15
|
+
inputProviders;
|
|
16
|
+
outputProviders;
|
|
17
|
+
command;
|
|
18
|
+
customFunctionModulePath;
|
|
19
|
+
fn;
|
|
20
|
+
shell;
|
|
21
|
+
__metricsId;
|
|
11
22
|
constructor({ namespace, id, name, supportedRuntimePlatforms, inputProviders, outputProviders, command, fn, customFunctionModulePath, shell, __metricsId, }) {
|
|
12
23
|
(0, assert_1.default)(command !== undefined || fn !== undefined || customFunctionModulePath !== undefined, 'Either command, fn or path must be defined.');
|
|
13
24
|
(0, assert_1.default)(!(command !== undefined && fn !== undefined), 'Command and fn cannot be both set.');
|
|
@@ -29,30 +40,30 @@ class BuildFunction {
|
|
|
29
40
|
return this.namespace === undefined ? this.id : `${this.namespace}/${this.id}`;
|
|
30
41
|
}
|
|
31
42
|
createBuildStepFromFunctionCall(ctx, { id, name, callInputs = {}, workingDirectory, shell, env, ifCondition, timeoutMs, } = {}) {
|
|
32
|
-
var _a, _b, _c;
|
|
33
43
|
const buildStepId = BuildStep_1.BuildStep.getNewId(id);
|
|
34
|
-
const buildStepName = name
|
|
44
|
+
const buildStepName = name ?? this.name;
|
|
35
45
|
const buildStepDisplayName = BuildStep_1.BuildStep.getDisplayName({
|
|
36
46
|
id: buildStepId,
|
|
37
47
|
command: this.command,
|
|
38
48
|
name: buildStepName,
|
|
39
49
|
});
|
|
40
|
-
const inputs =
|
|
50
|
+
const inputs = this.inputProviders?.map(inputProvider => {
|
|
41
51
|
const input = inputProvider(ctx, buildStepId);
|
|
42
52
|
if (input.id in callInputs) {
|
|
43
53
|
input.set(callInputs[input.id]);
|
|
44
54
|
}
|
|
45
55
|
return input;
|
|
46
56
|
});
|
|
47
|
-
const outputs =
|
|
57
|
+
const outputs = this.outputProviders?.map(outputProvider => outputProvider(ctx, buildStepId));
|
|
48
58
|
return new BuildStep_1.BuildStep(ctx, {
|
|
49
59
|
id: buildStepId,
|
|
50
60
|
name: buildStepName,
|
|
51
61
|
displayName: buildStepDisplayName,
|
|
52
62
|
command: this.command,
|
|
53
|
-
fn:
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
fn: this.fn ??
|
|
64
|
+
(this.customFunctionModulePath
|
|
65
|
+
? (0, customFunction_1.createCustomFunctionCall)(this.customFunctionModulePath)
|
|
66
|
+
: undefined),
|
|
56
67
|
workingDirectory,
|
|
57
68
|
inputs,
|
|
58
69
|
outputs,
|
|
@@ -66,4 +77,3 @@ class BuildFunction {
|
|
|
66
77
|
}
|
|
67
78
|
}
|
|
68
79
|
exports.BuildFunction = BuildFunction;
|
|
69
|
-
//# sourceMappingURL=BuildFunction.js.map
|
|
@@ -5,13 +5,16 @@ exports.createBuildFunctionGroupByIdMapping = createBuildFunctionGroupByIdMappin
|
|
|
5
5
|
const BuildStepInput_1 = require("./BuildStepInput");
|
|
6
6
|
const errors_1 = require("./errors");
|
|
7
7
|
class BuildFunctionGroup {
|
|
8
|
+
namespace;
|
|
9
|
+
id;
|
|
10
|
+
inputProviders;
|
|
11
|
+
createBuildStepsFromFunctionGroupCall;
|
|
8
12
|
constructor({ namespace, id, inputProviders, createBuildStepsFromFunctionGroupCall, }) {
|
|
9
13
|
this.namespace = namespace;
|
|
10
14
|
this.id = id;
|
|
11
15
|
this.inputProviders = inputProviders;
|
|
12
16
|
this.createBuildStepsFromFunctionGroupCall = (ctx, { callInputs = {} } = {}) => {
|
|
13
|
-
|
|
14
|
-
const inputs = (_a = this.inputProviders) === null || _a === void 0 ? void 0 : _a.map((inputProvider) => {
|
|
17
|
+
const inputs = this.inputProviders?.map(inputProvider => {
|
|
15
18
|
const input = inputProvider(ctx, id);
|
|
16
19
|
if (input.id in callInputs) {
|
|
17
20
|
input.set(callInputs[input.id]);
|
|
@@ -38,4 +41,3 @@ function createBuildFunctionGroupByIdMapping(buildFunctionGroups) {
|
|
|
38
41
|
}
|
|
39
42
|
return buildFunctionGroupById;
|
|
40
43
|
}
|
|
41
|
-
//# sourceMappingURL=BuildFunctionGroup.js.map
|
package/dist/BuildStep.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { BuildRuntimePlatform } from './BuildRuntimePlatform';
|
|
1
2
|
import { BuildStepContext, BuildStepGlobalContext } from './BuildStepContext';
|
|
3
|
+
import { BuildStepEnv } from './BuildStepEnv';
|
|
2
4
|
import { BuildStepInput } from './BuildStepInput';
|
|
3
5
|
import { BuildStepOutput, BuildStepOutputById, SerializedBuildStepOutput } from './BuildStepOutput';
|
|
4
|
-
import { BuildStepEnv } from './BuildStepEnv';
|
|
5
|
-
import { BuildRuntimePlatform } from './BuildRuntimePlatform';
|
|
6
6
|
export declare enum BuildStepStatus {
|
|
7
7
|
NEW = "new",
|
|
8
8
|
IN_PROGRESS = "in-progress",
|