@catladder/pipeline 3.48.0 → 4.0.0
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/build/index.d.ts +2 -2
- package/dist/build/node/buildJob.d.ts +3 -3
- package/dist/build/node/buildJob.js +185 -26
- package/dist/build/node/cache.d.ts +3 -3
- package/dist/build/node/cache.js +199 -36
- package/dist/build/node/index.d.ts +3 -3
- package/dist/build/node/index.js +151 -3
- package/dist/build/node/meteor.d.ts +1 -1
- package/dist/build/node/meteor.js +162 -27
- package/dist/build/node/testJob.d.ts +1 -1
- package/dist/build/node/testJob.js +174 -49
- package/dist/build/node/yarn.d.ts +2 -2
- package/dist/build/node/yarn.js +168 -21
- package/dist/constants.js +1 -1
- package/dist/context/createComponentContext.js +10 -12
- package/dist/context/createWorkspaceContext.js +29 -34
- package/dist/deploy/custom/deployJob.d.ts +1 -1
- package/dist/deploy/custom/deployJob.js +147 -23
- package/dist/deploy/index.d.ts +1 -1
- package/dist/pipeline/createAllJobs.js +30 -14
- package/dist/pipeline/createJobsForComponent.d.ts +1 -1
- package/dist/pipeline/createJobsForComponent.js +128 -4
- package/dist/pipeline/createJobsForWorkspace.d.ts +1 -1
- package/dist/pipeline/createJobsForWorkspace.js +127 -2
- package/dist/pipeline/yarn/yarnUtils.js +61 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/context.d.ts +3 -3
- package/examples/__snapshots__/automatic-releases.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-execute-script-on-deploy.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-health-check-defaults.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-health-check-only-startup.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-health-check.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-http2.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-session-affinity.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-with-agents.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-with-gpu.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-with-sql-legacy-jobs.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-with-sql-multiple-dbs.test.ts.snap +18 -30
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +14 -22
- package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +9 -13
- package/examples/__snapshots__/cloud-run-worker-pool.test.ts.snap +9 -13
- package/examples/__snapshots__/custom-deploy.test.ts.snap +9 -13
- package/examples/__snapshots__/custom-docker-file.test.ts.snap +9 -13
- package/examples/__snapshots__/custom-envs.test.ts.snap +14 -22
- package/examples/__snapshots__/custom-verify-job.test.ts.snap +9 -13
- package/examples/__snapshots__/git-submodule.test.ts.snap +9 -13
- package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +9 -13
- package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +9 -13
- package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +14 -22
- package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +9 -13
- package/examples/__snapshots__/local-dot-env.test.ts.snap +9 -13
- package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +9 -13
- package/examples/__snapshots__/modify-generated-files.test.ts.snap +9 -13
- package/examples/__snapshots__/modify-generated-yaml.test.ts.snap +9 -13
- package/examples/__snapshots__/multiline-var.test.ts.snap +18 -30
- package/examples/__snapshots__/native-app.test.ts.snap +14 -22
- package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +9 -13
- package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +9 -13
- package/examples/__snapshots__/override-secrets.test.ts.snap +9 -13
- package/examples/__snapshots__/referencing-other-vars.test.ts.snap +18 -30
- package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +14 -22
- package/examples/__snapshots__/workspace-api-www-turbo-cache.test.ts.snap +9 -13
- package/examples/__snapshots__/workspace-api-www.test.ts.snap +9 -13
- package/package.json +1 -1
- package/src/build/index.ts +6 -2
- package/src/build/node/buildJob.ts +26 -17
- package/src/build/node/cache.ts +18 -15
- package/src/build/node/index.ts +17 -9
- package/src/build/node/meteor.ts +16 -11
- package/src/build/node/testJob.ts +10 -6
- package/src/build/node/yarn.ts +10 -8
- package/src/context/createComponentContext.ts +6 -3
- package/src/context/createWorkspaceContext.ts +1 -1
- package/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.ts +3 -1
- package/src/deploy/custom/deployJob.ts +3 -3
- package/src/deploy/index.ts +1 -1
- package/src/pipeline/createAllJobs.ts +9 -7
- package/src/pipeline/createJobsForComponent.ts +6 -6
- package/src/pipeline/createJobsForWorkspace.ts +3 -3
- package/src/pipeline/yarn/yarnUtils.ts +34 -0
- package/src/types/context.ts +3 -3
package/dist/build/index.d.ts
CHANGED
|
@@ -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
|
}>>;
|
|
@@ -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 {};
|
|
@@ -1,5 +1,120 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) {
|
|
5
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
6
|
+
resolve(value);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
+
function fulfilled(value) {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.next(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function rejected(value) {
|
|
18
|
+
try {
|
|
19
|
+
step(generator["throw"](value));
|
|
20
|
+
} catch (e) {
|
|
21
|
+
reject(e);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function step(result) {
|
|
25
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
26
|
+
}
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
31
|
+
var _ = {
|
|
32
|
+
label: 0,
|
|
33
|
+
sent: function () {
|
|
34
|
+
if (t[0] & 1) throw t[1];
|
|
35
|
+
return t[1];
|
|
36
|
+
},
|
|
37
|
+
trys: [],
|
|
38
|
+
ops: []
|
|
39
|
+
},
|
|
40
|
+
f,
|
|
41
|
+
y,
|
|
42
|
+
t,
|
|
43
|
+
g;
|
|
44
|
+
return g = {
|
|
45
|
+
next: verb(0),
|
|
46
|
+
"throw": verb(1),
|
|
47
|
+
"return": verb(2)
|
|
48
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
49
|
+
return this;
|
|
50
|
+
}), g;
|
|
51
|
+
function verb(n) {
|
|
52
|
+
return function (v) {
|
|
53
|
+
return step([n, v]);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function step(op) {
|
|
57
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
58
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
59
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
60
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
61
|
+
switch (op[0]) {
|
|
62
|
+
case 0:
|
|
63
|
+
case 1:
|
|
64
|
+
t = op;
|
|
65
|
+
break;
|
|
66
|
+
case 4:
|
|
67
|
+
_.label++;
|
|
68
|
+
return {
|
|
69
|
+
value: op[1],
|
|
70
|
+
done: false
|
|
71
|
+
};
|
|
72
|
+
case 5:
|
|
73
|
+
_.label++;
|
|
74
|
+
y = op[1];
|
|
75
|
+
op = [0];
|
|
76
|
+
continue;
|
|
77
|
+
case 7:
|
|
78
|
+
op = _.ops.pop();
|
|
79
|
+
_.trys.pop();
|
|
80
|
+
continue;
|
|
81
|
+
default:
|
|
82
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
83
|
+
_ = 0;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
87
|
+
_.label = op[1];
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
91
|
+
_.label = t[1];
|
|
92
|
+
t = op;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
if (t && _.label < t[2]) {
|
|
96
|
+
_.label = t[2];
|
|
97
|
+
_.ops.push(op);
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
if (t[2]) _.ops.pop();
|
|
101
|
+
_.trys.pop();
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
op = body.call(thisArg, _);
|
|
105
|
+
} catch (e) {
|
|
106
|
+
op = [6, e];
|
|
107
|
+
y = 0;
|
|
108
|
+
} finally {
|
|
109
|
+
f = t = 0;
|
|
110
|
+
}
|
|
111
|
+
if (op[0] & 5) throw op[1];
|
|
112
|
+
return {
|
|
113
|
+
value: op[0] ? op[1] : void 0,
|
|
114
|
+
done: true
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
};
|
|
3
118
|
var __read = this && this.__read || function (o, n) {
|
|
4
119
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
5
120
|
if (!m) return o;
|
|
@@ -42,40 +157,84 @@ var docker_1 = require("../docker");
|
|
|
42
157
|
var cache_1 = require("./cache");
|
|
43
158
|
var yarn_1 = require("./yarn");
|
|
44
159
|
var createNodeBuildJobs = function (context) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
160
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
161
|
+
var _a, _b, _c, _d, _e;
|
|
162
|
+
var _f, _g;
|
|
163
|
+
return __generator(this, function (_h) {
|
|
164
|
+
switch (_h.label) {
|
|
165
|
+
case 0:
|
|
166
|
+
if (!(context.type === "workspace")) return [3 /*break*/, 2];
|
|
167
|
+
_a = base_1.createWorkspaceBuildJobs;
|
|
168
|
+
_b = [context];
|
|
169
|
+
_f = {};
|
|
170
|
+
return [4 /*yield*/, (0, exports.createNodeBuildJobDefinition)(context)];
|
|
171
|
+
case 1:
|
|
172
|
+
return [2 /*return*/, _a.apply(void 0, _b.concat([(_f.appBuild = _h.sent(), _f)]))];
|
|
173
|
+
case 2:
|
|
174
|
+
_c = base_1.createComponentBuildJobs;
|
|
175
|
+
_d = [context];
|
|
176
|
+
_g = {};
|
|
177
|
+
if (!(0, context_1.componentContextIsStandaloneBuild)(context)) return [3 /*break*/, 4];
|
|
178
|
+
return [4 /*yield*/, (0, exports.createNodeBuildJobDefinition)(context)];
|
|
179
|
+
case 3:
|
|
180
|
+
_e = _h.sent();
|
|
181
|
+
return [3 /*break*/, 5];
|
|
182
|
+
case 4:
|
|
183
|
+
_e = undefined;
|
|
184
|
+
_h.label = 5;
|
|
185
|
+
case 5:
|
|
186
|
+
_g.appBuild = _e;
|
|
187
|
+
return [4 /*yield*/, (0, exports.createNodeDockerJobDefinition)(context)];
|
|
188
|
+
case 6:
|
|
189
|
+
return [2 /*return*/, _c.apply(void 0, _d.concat([(_g.dockerBuild = _h.sent(), _g)]))];
|
|
190
|
+
}
|
|
48
191
|
});
|
|
49
|
-
}
|
|
50
|
-
return (0, base_1.createComponentBuildJobs)(context, {
|
|
51
|
-
appBuild: (0, context_1.componentContextIsStandaloneBuild)(context) ? (0, exports.createNodeBuildJobDefinition)(context) : undefined,
|
|
52
|
-
dockerBuild: (0, exports.createNodeDockerJobDefinition)(context)
|
|
53
192
|
});
|
|
54
193
|
};
|
|
55
194
|
exports.createNodeBuildJobs = createNodeBuildJobs;
|
|
56
195
|
var createNodeBuildJobDefinition = function (context) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
196
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
197
|
+
var buildConfig, _a, yarnInstall, nodeCache;
|
|
198
|
+
return __generator(this, function (_b) {
|
|
199
|
+
switch (_b.label) {
|
|
200
|
+
case 0:
|
|
201
|
+
buildConfig = context.build.config;
|
|
202
|
+
return [4 /*yield*/, Promise.all([(0, yarn_1.getYarnInstall)(context), (0, cache_1.getNodeCache)(context)])];
|
|
203
|
+
case 1:
|
|
204
|
+
_a = __read.apply(void 0, [_b.sent(), 2]), yarnInstall = _a[0], nodeCache = _a[1];
|
|
205
|
+
return [2 /*return*/, (0, createBuildJobDefinition_1.createBuildJobDefinition)(context, buildConfig, {
|
|
206
|
+
prescript: yarnInstall,
|
|
207
|
+
cache: nodeCache
|
|
208
|
+
})];
|
|
209
|
+
}
|
|
210
|
+
});
|
|
62
211
|
});
|
|
63
212
|
};
|
|
64
213
|
exports.createNodeBuildJobDefinition = createNodeBuildJobDefinition;
|
|
65
214
|
var createNodeDockerJobDefinition = function (context) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
215
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
216
|
+
var dockerDefaultBuiltIn, _a, yarnCache, dockerAppCopyAndBuildScript, packageManagerInfo;
|
|
217
|
+
var _b;
|
|
218
|
+
return __generator(this, function (_c) {
|
|
219
|
+
switch (_c.label) {
|
|
220
|
+
case 0:
|
|
221
|
+
dockerDefaultBuiltIn = context.build.buildType === "node-static" || context.build.buildType === "storybook" ? "nginx" : "node";
|
|
222
|
+
return [4 /*yield*/, Promise.all([(0, cache_1.getYarnCache)(context, "pull"), (0, yarn_1.getDockerAppCopyAndBuildScript)(context), context.packageManagerInfo])];
|
|
223
|
+
case 1:
|
|
224
|
+
_a = __read.apply(void 0, [_c.sent(), 3]), yarnCache = _a[0], dockerAppCopyAndBuildScript = _a[1], packageManagerInfo = _a[2];
|
|
225
|
+
return [2 /*return*/, {
|
|
226
|
+
script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, dockerDefaultBuiltIn),
|
|
227
|
+
cache: __spreadArray([], __read(yarnCache), false),
|
|
228
|
+
variables: {
|
|
229
|
+
// only required for non static
|
|
230
|
+
DOCKER_COPY_AND_INSTALL_APP: dockerAppCopyAndBuildScript,
|
|
231
|
+
DOCKER_COPY_WORKSPACE_FILES: (_b = packageManagerInfo === null || packageManagerInfo === void 0 ? void 0 : packageManagerInfo.pathsToCopyInDocker.map(function (dir) {
|
|
232
|
+
return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir);
|
|
233
|
+
})) === null || _b === void 0 ? void 0 : _b.join("\n")
|
|
234
|
+
}
|
|
235
|
+
}];
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
});
|
|
80
239
|
};
|
|
81
240
|
exports.createNodeDockerJobDefinition = createNodeDockerJobDefinition;
|
|
@@ -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[]>;
|
package/dist/build/node/cache.js
CHANGED
|
@@ -1,5 +1,120 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) {
|
|
5
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
6
|
+
resolve(value);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
+
function fulfilled(value) {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.next(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function rejected(value) {
|
|
18
|
+
try {
|
|
19
|
+
step(generator["throw"](value));
|
|
20
|
+
} catch (e) {
|
|
21
|
+
reject(e);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function step(result) {
|
|
25
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
26
|
+
}
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
31
|
+
var _ = {
|
|
32
|
+
label: 0,
|
|
33
|
+
sent: function () {
|
|
34
|
+
if (t[0] & 1) throw t[1];
|
|
35
|
+
return t[1];
|
|
36
|
+
},
|
|
37
|
+
trys: [],
|
|
38
|
+
ops: []
|
|
39
|
+
},
|
|
40
|
+
f,
|
|
41
|
+
y,
|
|
42
|
+
t,
|
|
43
|
+
g;
|
|
44
|
+
return g = {
|
|
45
|
+
next: verb(0),
|
|
46
|
+
"throw": verb(1),
|
|
47
|
+
"return": verb(2)
|
|
48
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
49
|
+
return this;
|
|
50
|
+
}), g;
|
|
51
|
+
function verb(n) {
|
|
52
|
+
return function (v) {
|
|
53
|
+
return step([n, v]);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function step(op) {
|
|
57
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
58
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
59
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
60
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
61
|
+
switch (op[0]) {
|
|
62
|
+
case 0:
|
|
63
|
+
case 1:
|
|
64
|
+
t = op;
|
|
65
|
+
break;
|
|
66
|
+
case 4:
|
|
67
|
+
_.label++;
|
|
68
|
+
return {
|
|
69
|
+
value: op[1],
|
|
70
|
+
done: false
|
|
71
|
+
};
|
|
72
|
+
case 5:
|
|
73
|
+
_.label++;
|
|
74
|
+
y = op[1];
|
|
75
|
+
op = [0];
|
|
76
|
+
continue;
|
|
77
|
+
case 7:
|
|
78
|
+
op = _.ops.pop();
|
|
79
|
+
_.trys.pop();
|
|
80
|
+
continue;
|
|
81
|
+
default:
|
|
82
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
83
|
+
_ = 0;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
87
|
+
_.label = op[1];
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
91
|
+
_.label = t[1];
|
|
92
|
+
t = op;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
if (t && _.label < t[2]) {
|
|
96
|
+
_.label = t[2];
|
|
97
|
+
_.ops.push(op);
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
if (t[2]) _.ops.pop();
|
|
101
|
+
_.trys.pop();
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
op = body.call(thisArg, _);
|
|
105
|
+
} catch (e) {
|
|
106
|
+
op = [6, e];
|
|
107
|
+
y = 0;
|
|
108
|
+
} finally {
|
|
109
|
+
f = t = 0;
|
|
110
|
+
}
|
|
111
|
+
if (op[0] & 5) throw op[1];
|
|
112
|
+
return {
|
|
113
|
+
value: op[0] ? op[1] : void 0,
|
|
114
|
+
done: true
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
};
|
|
3
118
|
var __read = this && this.__read || function (o, n) {
|
|
4
119
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
5
120
|
if (!m) return o;
|
|
@@ -43,48 +158,96 @@ exports.getNodeCache = exports.getNodeModulesCache = exports.getYarnCache = void
|
|
|
43
158
|
var lodash_1 = require("lodash");
|
|
44
159
|
var path_1 = require("path");
|
|
45
160
|
var slugify_1 = __importDefault(require("slugify"));
|
|
46
|
-
var getYarnCache = function (
|
|
47
|
-
|
|
48
|
-
|
|
161
|
+
var getYarnCache = function (context_1) {
|
|
162
|
+
var args_1 = [];
|
|
163
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
164
|
+
args_1[_i - 1] = arguments[_i];
|
|
49
165
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
166
|
+
return __awaiter(void 0, __spreadArray([context_1], __read(args_1), false), void 0, function (context, policy) {
|
|
167
|
+
var packageManagerInfo, componentIsInWorkspace;
|
|
168
|
+
if (policy === void 0) {
|
|
169
|
+
policy = "pull-push";
|
|
170
|
+
}
|
|
171
|
+
return __generator(this, function (_a) {
|
|
172
|
+
switch (_a.label) {
|
|
173
|
+
case 0:
|
|
174
|
+
return [4 /*yield*/, context.packageManagerInfo];
|
|
175
|
+
case 1:
|
|
176
|
+
packageManagerInfo = _a.sent();
|
|
177
|
+
componentIsInWorkspace = context.type === "component" && "componentIsInWorkspace" in packageManagerInfo && packageManagerInfo.componentIsInWorkspace;
|
|
178
|
+
return [2 /*return*/, [{
|
|
179
|
+
scope: componentIsInWorkspace ? "global" : "buildDir",
|
|
180
|
+
pathMode: componentIsInWorkspace ? "absolute" : "relative",
|
|
181
|
+
key: "yarn",
|
|
182
|
+
policy: policy,
|
|
183
|
+
paths: [".yarn"]
|
|
184
|
+
}]];
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
});
|
|
58
188
|
};
|
|
59
189
|
exports.getYarnCache = getYarnCache;
|
|
60
|
-
var getNodeModulesCache = function (
|
|
61
|
-
var
|
|
62
|
-
|
|
63
|
-
|
|
190
|
+
var getNodeModulesCache = function (context_1) {
|
|
191
|
+
var args_1 = [];
|
|
192
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
193
|
+
args_1[_i - 1] = arguments[_i];
|
|
64
194
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
195
|
+
return __awaiter(void 0, __spreadArray([context_1], __read(args_1), false), void 0, function (context, policy) {
|
|
196
|
+
var packageManagerInfo, componentIsInWorkspace, isClassic, workspaces;
|
|
197
|
+
var _a, _b;
|
|
198
|
+
if (policy === void 0) {
|
|
199
|
+
policy = "pull-push";
|
|
200
|
+
}
|
|
201
|
+
return __generator(this, function (_c) {
|
|
202
|
+
switch (_c.label) {
|
|
203
|
+
case 0:
|
|
204
|
+
return [4 /*yield*/, context.packageManagerInfo];
|
|
205
|
+
case 1:
|
|
206
|
+
packageManagerInfo = _c.sent();
|
|
207
|
+
componentIsInWorkspace = context.type === "component" && "componentIsInWorkspace" in packageManagerInfo && packageManagerInfo.componentIsInWorkspace;
|
|
208
|
+
isClassic = packageManagerInfo.isClassic, workspaces = packageManagerInfo.workspaces;
|
|
209
|
+
// 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.
|
|
210
|
+
// It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
|
|
211
|
+
return [2 /*return*/, [{
|
|
212
|
+
scope: "global",
|
|
213
|
+
pathMode: "absolute",
|
|
214
|
+
// if component is in a shared workspace, use workspace cache. use individual cache else
|
|
215
|
+
key: componentIsInWorkspace ? "node-modules-workspace" : (0, slugify_1.default)(context.build.dir) + "-node-modules",
|
|
216
|
+
// 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
|
|
217
|
+
policy: policy,
|
|
218
|
+
paths: __spreadArray([], __read(componentIsInWorkspace ? (0, lodash_1.uniq)(__spreadArray(__spreadArray(["node_modules"], __read((_a = workspaces.map(function (w) {
|
|
219
|
+
return (0, path_1.join)(w.location, "node_modules");
|
|
220
|
+
})) !== null && _a !== void 0 ? _a : []), false), __read(!isClassic ? __spreadArray([".yarn/install-state.gz"], __read((_b = workspaces.map(function (w) {
|
|
221
|
+
return (0, path_1.join)(w.location, ".yarn/install-state.gz");
|
|
222
|
+
})) !== null && _b !== void 0 ? _b : []), false) : []), false)) : __spreadArray([(0, path_1.join)(context.build.dir, "node_modules")], __read(!isClassic ? [(0, path_1.join)(context.build.dir, ".yarn/install-state.gz")] : []), false)), false)
|
|
223
|
+
}]];
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
});
|
|
82
227
|
};
|
|
83
228
|
exports.getNodeModulesCache = getNodeModulesCache;
|
|
84
|
-
var getNodeCache = function (
|
|
85
|
-
|
|
86
|
-
|
|
229
|
+
var getNodeCache = function (context_1) {
|
|
230
|
+
var args_1 = [];
|
|
231
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
232
|
+
args_1[_i - 1] = arguments[_i];
|
|
87
233
|
}
|
|
88
|
-
return
|
|
234
|
+
return __awaiter(void 0, __spreadArray([context_1], __read(args_1), false), void 0, function (context, policy) {
|
|
235
|
+
var _a, _b;
|
|
236
|
+
if (policy === void 0) {
|
|
237
|
+
policy = "pull-push";
|
|
238
|
+
}
|
|
239
|
+
return __generator(this, function (_c) {
|
|
240
|
+
switch (_c.label) {
|
|
241
|
+
case 0:
|
|
242
|
+
_a = [[]];
|
|
243
|
+
return [4 /*yield*/, (0, exports.getYarnCache)(context, policy)];
|
|
244
|
+
case 1:
|
|
245
|
+
_b = [__spreadArray.apply(void 0, _a.concat([__read.apply(void 0, [_c.sent()]), false]))];
|
|
246
|
+
return [4 /*yield*/, (0, exports.getNodeModulesCache)(context, policy)];
|
|
247
|
+
case 2:
|
|
248
|
+
return [2 /*return*/, __spreadArray.apply(void 0, _b.concat([__read.apply(void 0, [_c.sent()]), false]))];
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
});
|
|
89
252
|
};
|
|
90
253
|
exports.getNodeCache = getNodeCache;
|
|
@@ -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[]>;
|