@catladder/cli 0.0.0-new-cli-52525b58 → 0.0.0-new-cli-b2300dd6
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/dist/bundles/catenv/index.js +103 -66
- package/dist/bundles/cli/index.js +43415 -43368
- package/dist/cli/src/adapters/baseContext.d.ts +2 -2
- package/dist/cli/src/adapters/baseContext.js +10 -1
- package/dist/cli/src/adapters/baseContext.js.map +1 -1
- package/dist/cli/src/catenv.js +4 -3
- package/dist/cli/src/catenv.js.map +1 -1
- package/dist/cli/src/commands/cloudSQL/commandRestoreDb.d.ts +2 -2
- package/dist/cli/src/commands/cloudSQL/commandRestoreDb.js +9 -9
- package/dist/cli/src/commands/cloudSQL/commandRestoreDb.js.map +1 -1
- package/dist/cli/src/commands/project/commandConfigSecrets.d.ts +1 -0
- package/dist/cli/src/commands/project/commandConfigSecrets.js +1 -0
- package/dist/cli/src/commands/project/commandConfigSecrets.js.map +1 -1
- package/dist/cli/src/commands/project/commandSetup.d.ts +1 -0
- package/dist/cli/src/commands/project/commandSetup.js +2 -1
- package/dist/cli/src/commands/project/commandSetup.js.map +1 -1
- package/dist/cli/src/core/types.d.ts +7 -2
- package/dist/cli/src/core/types.js.map +1 -1
- package/dist/pipeline/src/build/index.d.ts +2 -2
- package/dist/pipeline/src/build/index.js.map +1 -1
- package/dist/pipeline/src/build/node/buildJob.d.ts +3 -3
- package/dist/pipeline/src/build/node/buildJob.js +13 -12
- package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
- package/dist/pipeline/src/build/node/cache.d.ts +3 -3
- package/dist/pipeline/src/build/node/cache.js +12 -9
- package/dist/pipeline/src/build/node/cache.js.map +1 -1
- package/dist/pipeline/src/build/node/index.d.ts +3 -3
- package/dist/pipeline/src/build/node/index.js +8 -6
- package/dist/pipeline/src/build/node/index.js.map +1 -1
- package/dist/pipeline/src/build/node/meteor.d.ts +1 -1
- package/dist/pipeline/src/build/node/meteor.js +8 -7
- package/dist/pipeline/src/build/node/meteor.js.map +1 -1
- package/dist/pipeline/src/build/node/testJob.d.ts +1 -1
- package/dist/pipeline/src/build/node/testJob.js +5 -5
- package/dist/pipeline/src/build/node/testJob.js.map +1 -1
- package/dist/pipeline/src/build/node/yarn.d.ts +2 -2
- package/dist/pipeline/src/build/node/yarn.js +10 -8
- package/dist/pipeline/src/build/node/yarn.js.map +1 -1
- package/dist/pipeline/src/constants.js +1 -1
- package/dist/pipeline/src/context/createComponentContext.js +3 -3
- package/dist/pipeline/src/context/createComponentContext.js.map +1 -1
- package/dist/pipeline/src/context/createWorkspaceContext.js +1 -1
- package/dist/pipeline/src/context/createWorkspaceContext.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js.map +1 -1
- package/dist/pipeline/src/deploy/custom/deployJob.d.ts +1 -1
- package/dist/pipeline/src/deploy/custom/deployJob.js +2 -2
- package/dist/pipeline/src/deploy/custom/deployJob.js.map +1 -1
- package/dist/pipeline/src/deploy/index.d.ts +1 -1
- package/dist/pipeline/src/pipeline/createAllJobs.js +4 -4
- package/dist/pipeline/src/pipeline/createAllJobs.js.map +1 -1
- package/dist/pipeline/src/pipeline/createJobsForComponent.d.ts +1 -1
- package/dist/pipeline/src/pipeline/createJobsForComponent.js +2 -3
- package/dist/pipeline/src/pipeline/createJobsForComponent.js.map +1 -1
- package/dist/pipeline/src/pipeline/createJobsForWorkspace.d.ts +1 -1
- package/dist/pipeline/src/pipeline/createJobsForWorkspace.js +2 -2
- package/dist/pipeline/src/pipeline/createJobsForWorkspace.js.map +1 -1
- package/dist/pipeline/src/types/context.d.ts +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/adapters/baseContext.ts +15 -2
- package/src/catenv.ts +15 -8
- package/src/commands/cloudSQL/commandRestoreDb.ts +9 -9
- package/src/commands/project/commandConfigSecrets.ts +1 -0
- package/src/commands/project/commandSetup.ts +6 -1
- package/src/core/types.ts +8 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CommandContext, CommandDef, InputDef, InputResultType, InputsSchema } from "../core/types";
|
|
1
|
+
import type { CommandContext, CommandDef, InputDef, InputResultType, InputsSchema, OptionalInput } from "../core/types";
|
|
2
2
|
/**
|
|
3
3
|
* Base class for CommandContext implementations.
|
|
4
4
|
* Handles caching, the `get()` method, and `promptDirect` delegation.
|
|
@@ -15,7 +15,7 @@ export declare abstract class BaseContext<TInputs extends InputsSchema> implemen
|
|
|
15
15
|
* Implementations check pre-supplied values, prompt interactively, use defaults, or throw.
|
|
16
16
|
*/
|
|
17
17
|
protected abstract resolveInput<P extends InputDef>(name: string, spec: P): Promise<InputResultType<P>>;
|
|
18
|
-
get<K extends keyof TInputs & string>(name: K): Promise<
|
|
18
|
+
get<K extends keyof TInputs & string>(name: K): Promise<OptionalInput<TInputs[K]>>;
|
|
19
19
|
promptDirect<P extends InputDef>(spec: P & {
|
|
20
20
|
name: string;
|
|
21
21
|
}): Promise<InputResultType<P>>;
|
|
@@ -20,7 +20,16 @@ class BaseContext {
|
|
|
20
20
|
if (!spec) {
|
|
21
21
|
return Promise.reject(new Error(`Input "${name}" is not declared in command "${this.command.name}"`));
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
// For optional inputs (required: false), catch MissingInputError
|
|
24
|
+
// and return undefined instead of prompting
|
|
25
|
+
if (spec.required === false) {
|
|
26
|
+
this.cache.set(name, this.resolveInput(name, spec).catch(err => {
|
|
27
|
+
if ((err === null || err === void 0 ? void 0 : err.name) === "MissingInputError") return undefined;
|
|
28
|
+
throw err;
|
|
29
|
+
}));
|
|
30
|
+
} else {
|
|
31
|
+
this.cache.set(name, this.resolveInput(name, spec));
|
|
32
|
+
}
|
|
24
33
|
}
|
|
25
34
|
return this.cache.get(name);
|
|
26
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseContext.js","sourceRoot":"","sources":["../../../../src/adapters/baseContext.ts"],"names":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ED,KAAK,CAAC,YAAY,CAChB,IAA0B;QAE1B,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5C,CAAC;CACF;AArDD,kCAqDC"}
|
package/dist/cli/src/catenv.js
CHANGED
|
@@ -13,10 +13,11 @@ const catenv_1 = __importDefault(require("./apps/catenv/catenv"));
|
|
|
13
13
|
const parseChoice_1 = require("./config/parseChoice");
|
|
14
14
|
const packageInfos_1 = __importDefault(require("./packageInfos"));
|
|
15
15
|
const program = new commander_1.Command();
|
|
16
|
-
program.name("catenv").description("Environment variable and pipeline generation via direnv").version(packageInfos_1.default.version).argument("[envComponent]", "env or env:component").option("-v, --verbose", "verbose output").action((envComponent, opts) => {
|
|
17
|
-
var _a;
|
|
16
|
+
program.name("catenv").description("Environment variable and pipeline generation via direnv").version(packageInfos_1.default.version).argument("[envComponent]", "env or env:component").option("-v, --verbose", "verbose output").option("-p, --print-variables", "print variables").action((envComponent, opts) => {
|
|
17
|
+
var _a, _b;
|
|
18
18
|
(0, catenv_1.default)(envComponent ? (0, parseChoice_1.parseChoice)(envComponent) : null, {
|
|
19
|
-
verbose: (_a = opts.verbose) !== null && _a !== void 0 ? _a : false
|
|
19
|
+
verbose: (_a = opts.verbose) !== null && _a !== void 0 ? _a : false,
|
|
20
|
+
printVariables: (_b = opts.printVariables) !== null && _b !== void 0 ? _b : false
|
|
20
21
|
}).then(() => {
|
|
21
22
|
// we have to exit manually, because we have some file watches
|
|
22
23
|
process.exit();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catenv.js","sourceRoot":"","sources":["../../../src/catenv.ts"],"names":[],"mappings":";;;;;AAAA,yCAAoC;AACpC,kEAA0C;AAC1C,sDAAmD;AACnD,kEAA0C;AAE1C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CAAC,yDAAyD,CAAC;KACtE,OAAO,CAAC,sBAAY,CAAC,OAAO,CAAC;KAC7B,QAAQ,CAAC,gBAAgB,EAAE,sBAAsB,CAAC;KAClD,MAAM,CAAC,eAAe,EAAE,gBAAgB,CAAC;KACzC,MAAM,CAAC,CAAC,YAAgC,
|
|
1
|
+
{"version":3,"file":"catenv.js","sourceRoot":"","sources":["../../../src/catenv.ts"],"names":[],"mappings":";;;;;AAAA,yCAAoC;AACpC,kEAA0C;AAC1C,sDAAmD;AACnD,kEAA0C;AAE1C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CAAC,yDAAyD,CAAC;KACtE,OAAO,CAAC,sBAAY,CAAC,OAAO,CAAC;KAC7B,QAAQ,CAAC,gBAAgB,EAAE,sBAAsB,CAAC;KAClD,MAAM,CAAC,eAAe,EAAE,gBAAgB,CAAC;KACzC,MAAM,CAAC,uBAAuB,EAAE,iBAAiB,CAAC;KAClD,MAAM,CACL,CACE,YAAgC,EAChC,IAAqD,EACrD,EAAE;;IACF,IAAA,gBAAM,EAAC,YAAY,CAAC,CAAC,CAAC,IAAA,yBAAW,EAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;QACtD,OAAO,EAAE,MAAA,IAAI,CAAC,OAAO,mCAAI,KAAK;QAC9B,cAAc,EAAE,MAAA,IAAI,CAAC,cAAc,mCAAI,KAAK;KAC7C,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QACX,8DAA8D;QAC9D,OAAO,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC,CACF,CAAC;AAEJ,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const commandRestoreDb: import("../../core").CommandDef<{
|
|
2
|
-
readonly
|
|
2
|
+
readonly source: {
|
|
3
3
|
readonly type: "string";
|
|
4
4
|
readonly message: "Source instance (connection string or 'local')? 🤔 ";
|
|
5
5
|
};
|
|
@@ -21,7 +21,7 @@ export declare const commandRestoreDb: import("../../core").CommandDef<{
|
|
|
21
21
|
readonly type: "string";
|
|
22
22
|
readonly message: "Source DB name? 🤔 ";
|
|
23
23
|
};
|
|
24
|
-
readonly
|
|
24
|
+
readonly target: {
|
|
25
25
|
readonly type: "string";
|
|
26
26
|
readonly message: "Target INSTANCE (connection string or 'local')? 🤔 ";
|
|
27
27
|
};
|
|
@@ -12,7 +12,7 @@ exports.commandRestoreDb = (0, defineCommand_1.defineCommand)({
|
|
|
12
12
|
description: "restore a db from one source to another target",
|
|
13
13
|
group: "cloudSQL",
|
|
14
14
|
inputs: {
|
|
15
|
-
|
|
15
|
+
source: {
|
|
16
16
|
type: "string",
|
|
17
17
|
message: "Source instance (connection string or 'local')? 🤔 "
|
|
18
18
|
},
|
|
@@ -34,7 +34,7 @@ exports.commandRestoreDb = (0, defineCommand_1.defineCommand)({
|
|
|
34
34
|
type: "string",
|
|
35
35
|
message: "Source DB name? 🤔 "
|
|
36
36
|
},
|
|
37
|
-
|
|
37
|
+
target: {
|
|
38
38
|
type: "string",
|
|
39
39
|
message: "Target INSTANCE (connection string or 'local')? 🤔 "
|
|
40
40
|
},
|
|
@@ -58,37 +58,37 @@ exports.commandRestoreDb = (0, defineCommand_1.defineCommand)({
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
execute: async ctx => {
|
|
61
|
-
const
|
|
61
|
+
const source = await ctx.get("source");
|
|
62
62
|
let sourceProxy;
|
|
63
63
|
let targetProxy;
|
|
64
64
|
let sourcePort;
|
|
65
65
|
let targetPort;
|
|
66
|
-
if (
|
|
66
|
+
if (source === "local") {
|
|
67
67
|
sourcePort = await ctx.get("sourceLocalPort");
|
|
68
68
|
} else {
|
|
69
69
|
sourcePort = 54399;
|
|
70
70
|
sourceProxy = await (0, startProxy_1.startCloudSqlProxyInBackground)({
|
|
71
|
-
instanceName:
|
|
71
|
+
instanceName: source,
|
|
72
72
|
localPort: sourcePort
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
const sourceUsername = await ctx.get("sourceUsername");
|
|
76
76
|
const sourcePassword = await ctx.get("sourcePassword");
|
|
77
77
|
const sourceDbName = await ctx.get("sourceDbName");
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
78
|
+
const target = await ctx.get("target");
|
|
79
|
+
if (target === "local") {
|
|
80
80
|
targetPort = await ctx.get("targetLocalPort");
|
|
81
81
|
} else {
|
|
82
82
|
targetPort = 54499;
|
|
83
83
|
targetProxy = await (0, startProxy_1.startCloudSqlProxyInBackground)({
|
|
84
|
-
instanceName:
|
|
84
|
+
instanceName: target,
|
|
85
85
|
localPort: targetPort
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
const targetUsername = await ctx.get("targetUsername");
|
|
89
89
|
const targetPassword = await ctx.get("targetPassword");
|
|
90
90
|
const targetDbName = await ctx.get("targetDbName");
|
|
91
|
-
const shouldContinue = await ctx.confirm(`This will drop ${
|
|
91
|
+
const shouldContinue = await ctx.confirm(`This will drop ${target}/${targetDbName} and replace it with ${source}/${sourceDbName}. Continue? 🤔 `);
|
|
92
92
|
if (!shouldContinue) {
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandRestoreDb.js","sourceRoot":"","sources":["../../../../../src/commands/cloudSQL/commandRestoreDb.ts"],"names":[],"mappings":";;;AAAA,4DAAyD;AACzD,yDAA2D;AAE3D,iEAAkF;AAErE,QAAA,gBAAgB,GAAG,IAAA,6BAAa,EAAC;IAC5C,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,gDAAgD;IAC7D,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE;QACN,
|
|
1
|
+
{"version":3,"file":"commandRestoreDb.js","sourceRoot":"","sources":["../../../../../src/commands/cloudSQL/commandRestoreDb.ts"],"names":[],"mappings":";;;AAAA,4DAAyD;AACzD,yDAA2D;A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EAAE,CAAC;YACpB,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,MAAM,IAAA,oBAAW,EAAC;gBAChB,cAAc;gBACd,UAAU;gBACV,cAAc;gBACd,cAAc;gBACd,cAAc;gBACd,UAAU;gBACV,YAAY;gBACZ,YAAY;aACb,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,EAAE,CAAC;YACpB,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandConfigSecrets.js","sourceRoot":"","sources":["../../../../../src/commands/project/commandConfigSecrets.ts"],"names":[],"mappings":";;;AAAA,4DAAyD;AACzD,+FAA4F;AAC5F,2FAAyF;AAEzF,mEAAmE;AACnE,sEAAsE;AACtE,uEAAuE;AACvE,2BAA2B;AACd,QAAA,oBAAoB,GAAG,IAAA,6BAAa,EAAC;IAChD,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,qCAAqC;IAClD,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE;QACN,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,uBAAuB;YAChC,UAAU,EAAE,IAAI;YAChB,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,IAAA,kCAAgB,GAAE;SACxC;KACF;IACD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QACrB,MAAM,YAAY,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QACnD,mEAAmE;QACnE,iEAAiE;QACjE,+DAA+D;QAC/D,2DAA2D;QAC3D,2DAA2D;QAC3D,MAAM,IAAA,2CAAoB,EAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAChD,CAAC;CACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"commandConfigSecrets.js","sourceRoot":"","sources":["../../../../../src/commands/project/commandConfigSecrets.ts"],"names":[],"mappings":";;;AAAA,4DAAyD;AACzD,+FAA4F;AAC5F,2FAAyF;AAEzF,mEAAmE;AACnE,sEAAsE;AACtE,uEAAuE;AACvE,2BAA2B;AACd,QAAA,oBAAoB,GAAG,IAAA,6BAAa,EAAC;IAChD,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,qCAAqC;IAClD,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE;QACN,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,uBAAuB;YAChC,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,IAAA,kCAAgB,GAAE;SACxC;KACF;IACD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QACrB,MAAM,YAAY,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QACnD,mEAAmE;QACnE,iEAAiE;QACjE,+DAA+D;QAC/D,2DAA2D;QAC3D,2DAA2D;QAC3D,MAAM,IAAA,2CAAoB,EAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAChD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandSetup.js","sourceRoot":"","sources":["../../../../../src/commands/project/commandSetup.ts"],"names":[],"mappings":";;;AAAA,4DAAyD;AACzD,iEAAqE;AAExD,QAAA,YAAY,GAAG,IAAA,6BAAa,EAAC;IACxC,IAAI,EAAE,eAAe;IACrB,WAAW,EACT,qFAAqF;IACvF,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE;QACN,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"commandSetup.js","sourceRoot":"","sources":["../../../../../src/commands/project/commandSetup.ts"],"names":[],"mappings":";;;AAAA,4DAAyD;AACzD,iEAAqE;AAExD,QAAA,YAAY,GAAG,IAAA,6BAAa,EAAC;IACxC,IAAI,EAAE,eAAe;IACrB,WAAW,EACT,qFAAqF;IACvF,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE;QACN,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,gBAAgB;YACzB,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE,KAAK;SAChB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QACrB,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAC7C,MAAM,IAAA,oBAAY,EAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IACrC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -82,10 +82,15 @@ export interface CommandContext<TInputs extends InputsSchema> extends IO {
|
|
|
82
82
|
* Consume a declared input by name.
|
|
83
83
|
* - Compile error if `name` is not in TInputs
|
|
84
84
|
* - Return type matches the input's type (string, number, boolean, string[])
|
|
85
|
-
* -
|
|
85
|
+
* - If `required: false`, returns `undefined` when not provided (no prompt)
|
|
86
|
+
* - Otherwise: pre-supplied value > choices function + interactive prompt > default > throw
|
|
86
87
|
*/
|
|
87
|
-
get<K extends keyof TInputs & string>(name: K): Promise<
|
|
88
|
+
get<K extends keyof TInputs & string>(name: K): Promise<OptionalInput<TInputs[K]>>;
|
|
88
89
|
}
|
|
90
|
+
/** If the input has `required: false`, the result can be undefined */
|
|
91
|
+
export type OptionalInput<T extends InputDef> = T extends {
|
|
92
|
+
required: false;
|
|
93
|
+
} ? InputResultType<T> | undefined : InputResultType<T>;
|
|
89
94
|
export interface CommandDef<TInputs extends InputsSchema = InputsSchema> {
|
|
90
95
|
name: string;
|
|
91
96
|
description: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/core/types.ts"],"names":[],"mappings":";AAAA,wEAAwE;;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/core/types.ts"],"names":[],"mappings":";AAAA,wEAAwE;;;AAgIxE,wEAAwE;AAExE,MAAa,iBAAkB,SAAQ,KAAK;IAC1C,YACkB,SAAiB,EACjB,aAAqB;QAErC,KAAK,CACH,4BAA4B,SAAS,MAAM,aAAa,KAAK;YAC3D,oBAAoB,SAAS,2BAA2B,SAAS,UAAU,CAC9E,CAAC;QANc,cAAS,GAAT,SAAS,CAAQ;QACjB,kBAAa,GAAb,aAAa,CAAQ;QAMrC,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAXD,8CAWC"}
|
|
@@ -5,14 +5,14 @@ import type { BuildConfig, BuildConfigStandaloneType, WorkspaceBuildConfig } fro
|
|
|
5
5
|
export * from "./node";
|
|
6
6
|
export * from "./types";
|
|
7
7
|
export type BuildTypes = { [type in BuildConfigStandaloneType]: {
|
|
8
|
-
jobs: (context: ComponentContextWithBuild) => CatladderJob[]
|
|
8
|
+
jobs: (context: ComponentContextWithBuild) => CatladderJob[] | Promise<CatladderJob[]>;
|
|
9
9
|
defaults: (envContext: EnvironmentContext) => Partial<Extract<BuildConfig, {
|
|
10
10
|
type: type;
|
|
11
11
|
}>>;
|
|
12
12
|
} };
|
|
13
13
|
export declare const BUILD_TYPES: BuildTypes;
|
|
14
14
|
export type WorkspaceBuildTypes = { [type in WorkspaceBuildConfig["type"]]: {
|
|
15
|
-
jobs: (context: WorkspaceContext) => CatladderJob[]
|
|
15
|
+
jobs: (context: WorkspaceContext) => CatladderJob[] | Promise<CatladderJob[]>;
|
|
16
16
|
defaults: () => Partial<Extract<WorkspaceBuildConfig, {
|
|
17
17
|
type: type;
|
|
18
18
|
}>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../pipeline/src/build/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAOA,qCAA4C;AAC5C,iCAA+E;AAC/E,mCAA0C;AAO1C,y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BAC1B,WAAW,EAAE,QAAQ;aACtB;SACF,CAAC;KACH;CACF,CAAC;AAWW,QAAA,qBAAqB,GAAwB;IACxD,IAAI,EAAE;QACJ,IAAI,EAAE,qBAAc;QACpB,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;YACf,YAAY,EAAE,YAAY;YAC1B,IAAI,EAAE;gBACJ,OAAO,EAAE,WAAW;aACrB;YACD,IAAI,EAAE;gBACJ,OAAO,EAAE,WAAW;aACrB;SACF,CAAC;KACH;CACF,CAAC"}
|
|
@@ -2,8 +2,8 @@ import type { BuildContextStandalone, ComponentContextWithBuild, WorkspaceContex
|
|
|
2
2
|
import { type ComponentContext } from "../../types/context";
|
|
3
3
|
import type { AppBuildJobDefinition, DockerBuildJobDefinition } from "../../types/jobDefinition";
|
|
4
4
|
import type { CatladderJob } from "../../types/jobs";
|
|
5
|
-
export declare const createNodeBuildJobs: (context: ComponentContextWithBuild | WorkspaceContext) => CatladderJob[]
|
|
6
|
-
export declare const createNodeBuildJobDefinition: (context: ComponentContext<BuildContextStandalone> | WorkspaceContext) => AppBuildJobDefinition | undefined
|
|
5
|
+
export declare const createNodeBuildJobs: (context: ComponentContextWithBuild | WorkspaceContext) => Promise<CatladderJob[]>;
|
|
6
|
+
export declare const createNodeBuildJobDefinition: (context: ComponentContext<BuildContextStandalone> | WorkspaceContext) => Promise<AppBuildJobDefinition | undefined>;
|
|
7
7
|
type NewType = ComponentContextWithBuild;
|
|
8
|
-
export declare const createNodeDockerJobDefinition: (context: NewType) => DockerBuildJobDefinition
|
|
8
|
+
export declare const createNodeDockerJobDefinition: (context: NewType) => Promise<DockerBuildJobDefinition>;
|
|
9
9
|
export {};
|
|
@@ -10,38 +10,39 @@ const createBuildJobDefinition_1 = require("../base/createBuildJobDefinition");
|
|
|
10
10
|
const docker_1 = require("../docker");
|
|
11
11
|
const cache_1 = require("./cache");
|
|
12
12
|
const yarn_1 = require("./yarn");
|
|
13
|
-
const createNodeBuildJobs = context => {
|
|
13
|
+
const createNodeBuildJobs = async context => {
|
|
14
14
|
if (context.type === "workspace") {
|
|
15
15
|
return (0, base_1.createWorkspaceBuildJobs)(context, {
|
|
16
|
-
appBuild: (0, exports.createNodeBuildJobDefinition)(context)
|
|
16
|
+
appBuild: await (0, exports.createNodeBuildJobDefinition)(context)
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
return (0, base_1.createComponentBuildJobs)(context, {
|
|
20
|
-
appBuild: (0, context_1.componentContextIsStandaloneBuild)(context) ? (0, exports.createNodeBuildJobDefinition)(context) : undefined,
|
|
21
|
-
dockerBuild: (0, exports.createNodeDockerJobDefinition)(context)
|
|
20
|
+
appBuild: (0, context_1.componentContextIsStandaloneBuild)(context) ? await (0, exports.createNodeBuildJobDefinition)(context) : undefined,
|
|
21
|
+
dockerBuild: await (0, exports.createNodeDockerJobDefinition)(context)
|
|
22
22
|
});
|
|
23
23
|
};
|
|
24
24
|
exports.createNodeBuildJobs = createNodeBuildJobs;
|
|
25
|
-
const createNodeBuildJobDefinition = context => {
|
|
25
|
+
const createNodeBuildJobDefinition = async context => {
|
|
26
26
|
const buildConfig = context.build.config;
|
|
27
|
-
const yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
27
|
+
const [yarnInstall, nodeCache] = await Promise.all([(0, yarn_1.getYarnInstall)(context), (0, cache_1.getNodeCache)(context)]);
|
|
28
28
|
return (0, createBuildJobDefinition_1.createBuildJobDefinition)(context, buildConfig, {
|
|
29
29
|
prescript: yarnInstall,
|
|
30
|
-
cache:
|
|
30
|
+
cache: nodeCache
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
33
|
exports.createNodeBuildJobDefinition = createNodeBuildJobDefinition;
|
|
34
|
-
const createNodeDockerJobDefinition = context => {
|
|
35
|
-
var _a
|
|
34
|
+
const createNodeDockerJobDefinition = async context => {
|
|
35
|
+
var _a;
|
|
36
36
|
// get the default docker built-in type based on the build type
|
|
37
37
|
const dockerDefaultBuiltIn = context.build.buildType === "node-static" || context.build.buildType === "storybook" ? "nginx" : "node";
|
|
38
|
+
const [yarnCache, dockerAppCopyAndBuildScript, packageManagerInfo] = await Promise.all([(0, cache_1.getYarnCache)(context, "pull"), (0, yarn_1.getDockerAppCopyAndBuildScript)(context), context.packageManagerInfo]);
|
|
38
39
|
return {
|
|
39
40
|
script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, dockerDefaultBuiltIn),
|
|
40
|
-
cache: [...
|
|
41
|
+
cache: [...yarnCache],
|
|
41
42
|
variables: {
|
|
42
43
|
// only required for non static
|
|
43
|
-
DOCKER_COPY_AND_INSTALL_APP:
|
|
44
|
-
DOCKER_COPY_WORKSPACE_FILES: (
|
|
44
|
+
DOCKER_COPY_AND_INSTALL_APP: dockerAppCopyAndBuildScript,
|
|
45
|
+
DOCKER_COPY_WORKSPACE_FILES: (_a = packageManagerInfo === null || packageManagerInfo === void 0 ? void 0 : packageManagerInfo.pathsToCopyInDocker.map(dir => `COPY --chown=node:node ${dir} /app/${dir}`)) === null || _a === void 0 ? void 0 : _a.join("\n")
|
|
45
46
|
}
|
|
46
47
|
};
|
|
47
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildJob.js","sourceRoot":"","sources":["../../../../../../pipeline/src/build/node/buildJob.ts"],"names":[],"mappings":";;;AAKA,iDAG6B;AAM7B,kCAA6E;AAC7E,+EAA4E;AAC5E,sCAAsE;AAEtE,mCAAqD;AACrD,iCAAwE;AAEjE,MAAM,mBAAmB,GAAG,
|
|
1
|
+
{"version":3,"file":"buildJob.js","sourceRoot":"","sources":["../../../../../../pipeline/src/build/node/buildJob.ts"],"names":[],"mappings":";;;AAKA,iDAG6B;AAM7B,kCAA6E;AAC7E,+EAA4E;AAC5E,sCAAsE;AAEtE,mCAAqD;AACrD,iCAAwE;AAEjE,MAAM,mBAAmB,GAAG,KAAK,EACtC,OAAqD,EAC5B,EAAE;IAC3B,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,EAAE,C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QAChB,IAAA,oBAAY,EAAC,OAAO,EAAE,MAAM,CAAC;QAC7B,IAAA,qCAA8B,EAAC,OAAO,CAAC;QACvC,OAAO,CAAC,kBAAkB;KAC3B,CAAC,CAAC;IAEL,OAAO;QACL,MAAM,EAAE,IAAA,kDAAyC,EAC/C,OAAO,EACP,oBAAoB,CACrB;QACD,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;QACrB,SAAS,EAAE;YACT,+BAA+B;YAC/B,2BAA2B,EAAE,2BAA2B;YACxD,2BAA2B,EAAE,MAAA,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,mBAAmB,CACjE,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,0BAA0B,GAAG,SAAS,GAAG,EAAE,CAAC,0CACxD,IAAI,CAAC,IAAI,CAAC;SACf;KACF,CAAC;AACJ,CAAC,CAAC;AA/BW,QAAA,6BAA6B,iCA+BxC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Context } from "../../types/context";
|
|
2
2
|
import type { CacheConfig } from "../types";
|
|
3
|
-
export declare const getYarnCache: (context: Context, policy?: string) => CacheConfig[]
|
|
4
|
-
export declare const getNodeModulesCache: (context: Context, policy?: string) => CacheConfig[]
|
|
5
|
-
export declare const getNodeCache: (context: Context, policy?: string) => CacheConfig[]
|
|
3
|
+
export declare const getYarnCache: (context: Context, policy?: string) => Promise<CacheConfig[]>;
|
|
4
|
+
export declare const getNodeModulesCache: (context: Context, policy?: string) => Promise<CacheConfig[]>;
|
|
5
|
+
export declare const getNodeCache: (context: Context, policy?: string) => Promise<CacheConfig[]>;
|
|
@@ -12,8 +12,9 @@ exports.getNodeCache = exports.getNodeModulesCache = exports.getYarnCache = void
|
|
|
12
12
|
const lodash_1 = require("lodash");
|
|
13
13
|
const path_1 = require("path");
|
|
14
14
|
const slugify_1 = __importDefault(require("slugify"));
|
|
15
|
-
const getYarnCache = (context, policy = "pull-push") => {
|
|
16
|
-
const
|
|
15
|
+
const getYarnCache = async (context, policy = "pull-push") => {
|
|
16
|
+
const packageManagerInfo = await context.packageManagerInfo;
|
|
17
|
+
const componentIsInWorkspace = context.type === "component" && "componentIsInWorkspace" in packageManagerInfo && packageManagerInfo.componentIsInWorkspace;
|
|
17
18
|
return [{
|
|
18
19
|
scope: componentIsInWorkspace ? "global" : "buildDir",
|
|
19
20
|
pathMode: componentIsInWorkspace ? "absolute" : "relative",
|
|
@@ -23,12 +24,14 @@ const getYarnCache = (context, policy = "pull-push") => {
|
|
|
23
24
|
}];
|
|
24
25
|
};
|
|
25
26
|
exports.getYarnCache = getYarnCache;
|
|
26
|
-
const getNodeModulesCache = (context, policy = "pull-push") => {
|
|
27
|
+
const getNodeModulesCache = async (context, policy = "pull-push") => {
|
|
27
28
|
var _a, _b;
|
|
28
|
-
const
|
|
29
|
+
const packageManagerInfo = await context.packageManagerInfo;
|
|
30
|
+
const componentIsInWorkspace = context.type === "component" && "componentIsInWorkspace" in packageManagerInfo && packageManagerInfo.componentIsInWorkspace;
|
|
29
31
|
const {
|
|
30
|
-
isClassic
|
|
31
|
-
|
|
32
|
+
isClassic,
|
|
33
|
+
workspaces
|
|
34
|
+
} = packageManagerInfo;
|
|
32
35
|
// We intentionally do not use the contents of yarn.lock as a cache key, as yarn install should always guarantee that the files are updated, but it can still use part of the cache if not all packages are up-to-date.
|
|
33
36
|
// It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
|
|
34
37
|
return [{
|
|
@@ -38,11 +41,11 @@ const getNodeModulesCache = (context, policy = "pull-push") => {
|
|
|
38
41
|
key: componentIsInWorkspace ? "node-modules-workspace" : (0, slugify_1.default)(context.build.dir) + "-node-modules",
|
|
39
42
|
// we use the dirname, not the component name, because in certain cases we have two apps in the same directory and want to share the cache, e.g. when having storybook in the same package.json
|
|
40
43
|
policy,
|
|
41
|
-
paths: [...(componentIsInWorkspace ? (0, lodash_1.uniq)(["node_modules", ...((_a =
|
|
44
|
+
paths: [...(componentIsInWorkspace ? (0, lodash_1.uniq)(["node_modules", ...((_a = workspaces.map(w => (0, path_1.join)(w.location, "node_modules"))) !== null && _a !== void 0 ? _a : []), ...(!isClassic ? [".yarn/install-state.gz", ...((_b = workspaces.map(w => (0, path_1.join)(w.location, ".yarn/install-state.gz"))) !== null && _b !== void 0 ? _b : [])] : [])]) : [(0, path_1.join)(context.build.dir, "node_modules"), ...(!isClassic ? [(0, path_1.join)(context.build.dir, ".yarn/install-state.gz")] : [])])]
|
|
42
45
|
}];
|
|
43
46
|
};
|
|
44
47
|
exports.getNodeModulesCache = getNodeModulesCache;
|
|
45
|
-
const getNodeCache = (context, policy = "pull-push") => {
|
|
46
|
-
return [...(0, exports.getYarnCache)(context, policy), ...(0, exports.getNodeModulesCache)(context, policy)];
|
|
48
|
+
const getNodeCache = async (context, policy = "pull-push") => {
|
|
49
|
+
return [...(await (0, exports.getYarnCache)(context, policy)), ...(await (0, exports.getNodeModulesCache)(context, policy))];
|
|
47
50
|
};
|
|
48
51
|
exports.getNodeCache = getNodeCache;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../../../../pipeline/src/build/node/cache.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA8B;AAC9B,+BAA4B;AAC5B,sDAA8B;AAKvB,MAAM,YAAY,GAAG,
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../../../../pipeline/src/build/node/cache.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA8B;AAC9B,+BAA4B;AAC5B,sDAA8B;AAKvB,MAAM,YAAY,GAAG,KAAK,EAC/B,OAAgB,EAChB,MAAM,GAAG,WAAW,EACI,EAAE;IAC1B,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC,kBAAkB,CAAC;IAC5D,MAAM,sBAAsB,GAC1B,OAAO,CAAC,IAAI,KAAK,WAAW;QAC5B,wBAAwB,IAAI,kBAAkB;QAC9C,kBAAkB,CAAC,sBAAsB,CAAC;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xB,GAAG,CAAC,MAAA,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACvB,IAAA,WAAI,EAAC,CAAC,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAC3C,mCAAI,EAAE,CAAC;6BACT;4BACH,CAAC,CAAC,EAAE,CAAC;qBACR,CAAC;oBACJ,CAAC,CAAC;wBACE,IAAA,WAAI,EAAC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,cAAc,CAAC;wBACvC,GAAG,CAAC,CAAC,SAAS;4BACZ,CAAC,CAAC,CAAC,IAAA,WAAI,EAAC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,wBAAwB,CAAC,CAAC;4BACrD,CAAC,CAAC,EAAE,CAAC;qBACR,CAAC;aACP;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AAhDW,QAAA,mBAAmB,uBAgD9B;AACK,MAAM,YAAY,GAAG,KAAK,EAC/B,OAAgB,EAChB,MAAM,GAAG,WAAW,EACI,EAAE;IAC1B,OAAO;QACL,GAAG,CAAC,MAAM,IAAA,oBAAY,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACxC,GAAG,CAAC,MAAM,IAAA,2BAAmB,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KAChD,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,YAAY,gBAQvB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentContextWithBuild, WorkspaceContext } from "../../types/context";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
-
export declare const createNodeJobs: (context: ComponentContextWithBuild | WorkspaceContext) => CatladderJob[]
|
|
4
|
-
export declare const createStorybookJobs: (context: ComponentContextWithBuild) => CatladderJob[]
|
|
5
|
-
export declare const createMeteorJobs: (context: ComponentContextWithBuild) => CatladderJob[]
|
|
3
|
+
export declare const createNodeJobs: (context: ComponentContextWithBuild | WorkspaceContext) => Promise<CatladderJob[]>;
|
|
4
|
+
export declare const createStorybookJobs: (context: ComponentContextWithBuild) => Promise<CatladderJob[]>;
|
|
5
|
+
export declare const createMeteorJobs: (context: ComponentContextWithBuild) => Promise<CatladderJob[]>;
|
|
@@ -7,15 +7,17 @@ exports.createMeteorJobs = exports.createStorybookJobs = exports.createNodeJobs
|
|
|
7
7
|
const buildJob_1 = require("./buildJob");
|
|
8
8
|
const meteor_1 = require("./meteor");
|
|
9
9
|
const testJob_1 = require("./testJob");
|
|
10
|
-
const createNodeJobs = context => {
|
|
11
|
-
|
|
10
|
+
const createNodeJobs = async context => {
|
|
11
|
+
const [testJobs, buildJobs] = await Promise.all([(0, testJob_1.createNodeTestJobs)(context), (0, buildJob_1.createNodeBuildJobs)(context)]);
|
|
12
|
+
return [...testJobs, ...buildJobs];
|
|
12
13
|
};
|
|
13
14
|
exports.createNodeJobs = createNodeJobs;
|
|
14
|
-
const createStorybookJobs = context => {
|
|
15
|
-
return [...(0, buildJob_1.createNodeBuildJobs)(context)];
|
|
15
|
+
const createStorybookJobs = async context => {
|
|
16
|
+
return [...(await (0, buildJob_1.createNodeBuildJobs)(context))];
|
|
16
17
|
};
|
|
17
18
|
exports.createStorybookJobs = createStorybookJobs;
|
|
18
|
-
const createMeteorJobs = context => {
|
|
19
|
-
|
|
19
|
+
const createMeteorJobs = async context => {
|
|
20
|
+
const [testJobs, buildJobs] = await Promise.all([(0, testJob_1.createNodeTestJobs)(context), (0, meteor_1.createMeteorBuildJobs)(context)]);
|
|
21
|
+
return [...testJobs, ...buildJobs];
|
|
20
22
|
};
|
|
21
23
|
exports.createMeteorJobs = createMeteorJobs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../pipeline/src/build/node/index.ts"],"names":[],"mappings":";;;AAKA,yCAAiD;AACjD,qCAAiD;AACjD,uCAA+C;AAExC,MAAM,cAAc,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../pipeline/src/build/node/index.ts"],"names":[],"mappings":";;;AAKA,yCAAiD;AACjD,qCAAiD;AACjD,uCAA+C;AAExC,MAAM,cAAc,GAAG,KAAK,EACjC,OAAqD,EAC5B,EAAE;IAC3B,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC9C,IAAA,4BAAkB,EAAC,OAAO,CAAC;QAC3B,IAAA,8BAAmB,EAAC,OAAO,CAAC;KAC7B,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,QAAQ,EAAE,GAAG,SAAS,CAAC,CAAC;AACrC,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB;AAEK,MAAM,mBAAmB,GAAG,KAAK,EACtC,OAAkC,EACT,EAAE;IAC3B,OAAO,CAAC,GAAG,CAAC,MAAM,IAAA,8BAAmB,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC;AAJW,QAAA,mBAAmB,uBAI9B;AAEK,MAAM,gBAAgB,GAAG,KAAK,EACnC,OAAkC,EACT,EAAE;IAC3B,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC9C,IAAA,4BAAkB,EAAC,OAAO,CAAC;QAC3B,IAAA,8BAAqB,EAAC,OAAO,CAAC;KAC/B,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,QAAQ,EAAE,GAAG,SAAS,CAAC,CAAC;AACrC,CAAC,CAAC;AARW,QAAA,gBAAgB,oBAQ3B"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ComponentContextWithBuild } from "../../types/context";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
-
export declare const createMeteorBuildJobs: (context: ComponentContextWithBuild) => CatladderJob[]
|
|
3
|
+
export declare const createMeteorBuildJobs: (context: ComponentContextWithBuild) => Promise<CatladderJob[]>;
|
|
@@ -16,8 +16,9 @@ const getMeteorCache = context => [{
|
|
|
16
16
|
policy: "pull-push",
|
|
17
17
|
paths: [".meteor/local/resolver-result-cache.json", ".meteor/local/plugin-cache", ".meteor/local/isopacks", ".meteor/local/bundler-cache/scanner"]
|
|
18
18
|
}];
|
|
19
|
-
const getMeteorDockerInstallScripts = context => {
|
|
20
|
-
|
|
19
|
+
const getMeteorDockerInstallScripts = async context => {
|
|
20
|
+
const packageManagerInfo = await context.packageManagerInfo;
|
|
21
|
+
if (packageManagerInfo.isClassic) {
|
|
21
22
|
return new BashExpression_1.BashExpression(`
|
|
22
23
|
COPY $APP_DIR/package.json $APP_DIR/yarn.lock ./
|
|
23
24
|
|
|
@@ -27,7 +28,7 @@ RUN yarn --frozen-lockfile --production=true --ignore-engines
|
|
|
27
28
|
`.trim());
|
|
28
29
|
}
|
|
29
30
|
// yarn >= 4 ships with built-in plugins, see https://github.com/yarnpkg/berry/pull/4253
|
|
30
|
-
const doesNotShipWithBuiltInPlugins = ["2", "3"].some(v =>
|
|
31
|
+
const doesNotShipWithBuiltInPlugins = ["2", "3"].some(v => packageManagerInfo.version.startsWith(v));
|
|
31
32
|
const maybeAddWorkspaceToolsCommand = doesNotShipWithBuiltInPlugins ? "RUN yarn plugin import workspace-tools" : "";
|
|
32
33
|
return new BashExpression_1.BashExpression(`
|
|
33
34
|
ENV YARN_ENABLE_INLINE_BUILDS=1
|
|
@@ -36,15 +37,15 @@ ${maybeAddWorkspaceToolsCommand}
|
|
|
36
37
|
RUN yarn workspaces focus --production
|
|
37
38
|
`.trim());
|
|
38
39
|
};
|
|
39
|
-
const createMeteorBuildJobs = context => {
|
|
40
|
+
const createMeteorBuildJobs = async context => {
|
|
40
41
|
const buildConfig = context.build.config;
|
|
41
42
|
if (!(0, types_1.isOfBuildType)(buildConfig, "meteor")) {
|
|
42
43
|
throw new Error("deploy config is not meteor");
|
|
43
44
|
}
|
|
44
|
-
const yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
45
|
+
const [yarnInstall, nodeCache, meteorInstallScripts] = await Promise.all([(0, yarn_1.getYarnInstall)(context), (0, cache_1.getNodeCache)(context), buildConfig.installScripts ? getMeteorDockerInstallScripts(context) : Promise.resolve("")]);
|
|
45
46
|
return (0, base_1.createComponentBuildJobs)(context, {
|
|
46
47
|
appBuild: buildConfig.buildCommand !== null && buildConfig.buildCommand !== false ? {
|
|
47
|
-
cache: [...
|
|
48
|
+
cache: [...nodeCache, ...getMeteorCache(context)],
|
|
48
49
|
image: (0, runner_1.getRunnerImage)("jobs-meteor"),
|
|
49
50
|
variables: {
|
|
50
51
|
METEOR_DISABLE_OPTIMISTIC_CACHING: "1" // see https://forums.meteor.com/t/veeery-long-building-time-inside-docker-container/58673/17?u=macrozone
|
|
@@ -54,7 +55,7 @@ const createMeteorBuildJobs = context => {
|
|
|
54
55
|
dockerBuild: {
|
|
55
56
|
script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, "meteor"),
|
|
56
57
|
variables: {
|
|
57
|
-
METEOR_INSTALL_SCRIPTS:
|
|
58
|
+
METEOR_INSTALL_SCRIPTS: meteorInstallScripts
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meteor.js","sourceRoot":"","sources":["../../../../../../pipeline/src/build/node/meteor.ts"],"names":[],"mappings":";;;AAAA,8DAA2D;AAC3D,yCAA8C;AAQ9C,kCAAmD;AACnD,sCAAsE;AAEtE,oCAAyC;AACzC,mCAAuC;AACvC,iCAAwC;AAExC,MAAM,cAAc,GAAG,CAAC,OAAyB,EAAiB,EAAE,CAAC;IACnE;QACE,GAAG,EAAE,oBAAoB;QACzB,MAAM,EAAE,WAAW;QACnB,KAAK,EAAE;YACL,0CAA0C;YAC1C,4BAA4B;YAC5B,wBAAwB;YACxB,qCAAqC;SACtC;KACF;CACF,CAAC;AACF,MAAM,6BAA6B,GAAG,
|
|
1
|
+
{"version":3,"file":"meteor.js","sourceRoot":"","sources":["../../../../../../pipeline/src/build/node/meteor.ts"],"names":[],"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,SAAS,EAAE,oBAAoB,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACvE,IAAA,qBAAc,EAAC,OAAO,CAAC;QACvB,IAAA,oBAAY,EAAC,OAAO,CAAC;QACrB,WAAW,CAAC,cAAc;YACxB,CAAC,CAAC,6BAA6B,CAAC,OAAO,CAAC;YACxC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAW,CAAC;KACjC,CAAC,CAAC;IAEH,OAAO,IAAA,+BAAwB,EAAC,OAAO,EAAE;QACvC,QAAQ,EACN,WAAW,CAAC,YAAY,KAAK,IAAI,IAAI,WAAW,CAAC,YAAY,KAAK,KAAK;YACrE,CAAC,CAAC;gBACE,KAAK,EAAE,CAAC,GAAG,SAAS,EAAE,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;gBACjD,KAAK,EAAE,IAAA,uBAAc,EAAC,aAAa,CAAC;gBACpC,SAAS,EAAE;oBACT,iCAAiC,EAAE,GAAG,EAAE,yGAAyG;iBAClJ;gBACD,MAAM,EAAE;oBACN,GAAG,WAAW;oBAEd,kNAAkN;oBAElN,sDAAsD;iBACvD;aACF;YACH,CAAC,CAAC,SAAS;QACf,WAAW,EAAE;YACX,MAAM,EAAE,IAAA,kDAAyC,EAAC,OAAO,EAAE,QAAQ,CAAC;YACpE,SAAS,EAAE;gBACT,sBAAsB,EAAE,oBAAoB;aAC7C;SACF;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AA1CW,QAAA,qBAAqB,yBA0ChC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { WorkspaceContext } from "../../types/context";
|
|
2
2
|
import { type ComponentContext } from "../../types/context";
|
|
3
3
|
import type { CatladderJob } from "../../types/jobs";
|
|
4
|
-
export declare const createNodeTestJobs: (context: ComponentContext | WorkspaceContext) => CatladderJob[]
|
|
4
|
+
export declare const createNodeTestJobs: (context: ComponentContext | WorkspaceContext) => Promise<CatladderJob[]>;
|
|
@@ -12,7 +12,7 @@ const cache_1 = require("./cache");
|
|
|
12
12
|
const constants_1 = require("./constants");
|
|
13
13
|
const yarn_1 = require("./yarn");
|
|
14
14
|
const createJobCache_1 = require("../cache/createJobCache");
|
|
15
|
-
const createNodeTestJobs = context => {
|
|
15
|
+
const createNodeTestJobs = async context => {
|
|
16
16
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
17
17
|
// don't run tests after release
|
|
18
18
|
// TODO: this will be replaced by using rules
|
|
@@ -35,7 +35,7 @@ const createNodeTestJobs = context => {
|
|
|
35
35
|
needs: []
|
|
36
36
|
};
|
|
37
37
|
const buildConfig = context.build.config;
|
|
38
|
-
const yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
38
|
+
const [yarnInstall, packageManagerInfo, nodeCache] = await Promise.all([(0, yarn_1.getYarnInstall)(context), context.packageManagerInfo, (0, cache_1.getNodeCache)(context)]);
|
|
39
39
|
const auditJob = buildConfig.audit !== false ? {
|
|
40
40
|
name: "🛡 audit",
|
|
41
41
|
...base,
|
|
@@ -46,7 +46,7 @@ const createNodeTestJobs = context => {
|
|
|
46
46
|
image: (_d = (_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.jobImage) !== null && _d !== void 0 ? _d : defaultImage,
|
|
47
47
|
cache: undefined,
|
|
48
48
|
// audit does not need yarn install and no cache
|
|
49
|
-
script: [`cd ${context.build.dir}`, ...((_f = (0, utils_1.ensureArrayOrNull)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [
|
|
49
|
+
script: [`cd ${context.build.dir}`, ...((_f = (0, utils_1.ensureArrayOrNull)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [packageManagerInfo.isClassic ? "yarn audit --level critical" : "yarn npm audit --environment production --severity critical" // yarn 2
|
|
50
50
|
])],
|
|
51
51
|
allow_failure: (_h = (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.allowFailure) !== null && _h !== void 0 ? _h : true,
|
|
52
52
|
...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_j = buildConfig.audit) === null || _j === void 0 ? void 0 : _j.artifactsReports, (_k = buildConfig.audit) === null || _k === void 0 ? void 0 : _k.artifacts)
|
|
@@ -59,7 +59,7 @@ const createNodeTestJobs = context => {
|
|
|
59
59
|
...((_m = (_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.runnerVariables) !== null && _m !== void 0 ? _m : {})
|
|
60
60
|
},
|
|
61
61
|
image: (_p = (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.jobImage) !== null && _p !== void 0 ? _p : defaultImage,
|
|
62
|
-
cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context,
|
|
62
|
+
cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, nodeCache),
|
|
63
63
|
script: [...(0, yarn_1.ensureNodeVersion)(context), `cd ${context.build.dir}`, ...yarnInstall, ...((_r = (0, utils_1.ensureArrayOrNull)((_q = buildConfig.lint) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : ["yarn lint"])],
|
|
64
64
|
allow_failure: (_s = buildConfig.lint) === null || _s === void 0 ? void 0 : _s.allowFailure,
|
|
65
65
|
...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_t = buildConfig.lint) === null || _t === void 0 ? void 0 : _t.artifactsReports, (_u = buildConfig.lint) === null || _u === void 0 ? void 0 : _u.artifacts)
|
|
@@ -72,7 +72,7 @@ const createNodeTestJobs = context => {
|
|
|
72
72
|
...((_w = (_v = buildConfig.test) === null || _v === void 0 ? void 0 : _v.runnerVariables) !== null && _w !== void 0 ? _w : {})
|
|
73
73
|
},
|
|
74
74
|
image: (_y = (_x = buildConfig.test) === null || _x === void 0 ? void 0 : _x.jobImage) !== null && _y !== void 0 ? _y : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
|
|
75
|
-
cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context,
|
|
75
|
+
cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, nodeCache),
|
|
76
76
|
script: [...(0, yarn_1.ensureNodeVersion)(context), `cd ${context.build.dir}`, ...yarnInstall, ...((_0 = (0, utils_1.ensureArrayOrNull)((_z = buildConfig.test) === null || _z === void 0 ? void 0 : _z.command)) !== null && _0 !== void 0 ? _0 : ["yarn test"])],
|
|
77
77
|
allow_failure: (_1 = buildConfig.test) === null || _1 === void 0 ? void 0 : _1.allowFailure,
|
|
78
78
|
...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_2 = buildConfig.test) === null || _2 === void 0 ? void 0 : _2.artifactsReports, (_3 = buildConfig.test) === null || _3 === void 0 ? void 0 : _3.artifacts)
|