@catladder/pipeline 0.0.0-main-d9bfb4f5 → 0.0.0-main-8a8ce056
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/base/createAppBuildJob.js +1 -1
- package/dist/build/node/buildJob.js +6 -6
- package/dist/build/node/cache.d.ts +4 -4
- package/dist/build/node/cache.js +5 -5
- package/dist/build/node/meteor.js +2 -2
- package/dist/build/node/testJob.js +6 -6
- package/dist/build/node/yarn.d.ts +4 -4
- package/dist/build/node/yarn.js +1 -1
- package/dist/build/sbom.js +1 -1
- package/dist/bundles/catladder-gitlab/index.js +28 -29
- package/dist/constants.js +1 -1
- package/dist/context/createComponentContext.js +1 -2
- package/dist/deploy/custom/deployJob.js +1 -1
- package/dist/pipeline/packageManager.d.ts +2 -2
- package/dist/pipeline/packageManager.js +3 -3
- package/dist/pipeline/yarn/yarnUtils.d.ts +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/context.d.ts +7 -13
- package/package.json +1 -1
- package/src/build/base/createAppBuildJob.ts +1 -1
- package/src/build/node/buildJob.ts +7 -9
- package/src/build/node/cache.ts +9 -9
- package/src/build/node/meteor.ts +2 -2
- package/src/build/node/testJob.ts +6 -6
- package/src/build/node/yarn.ts +8 -6
- package/src/build/sbom.ts +1 -1
- package/src/context/createComponentContext.ts +2 -3
- package/src/deploy/custom/deployJob.ts +1 -1
- package/src/pipeline/packageManager.ts +3 -3
- package/src/pipeline/yarn/yarnUtils.ts +2 -2
- package/src/types/context.ts +9 -13
|
@@ -76,7 +76,7 @@ var createAppBuildJob = function (context, _a) {
|
|
|
76
76
|
cache: [],
|
|
77
77
|
variables: __assign(__assign(__assign(__assign({}, variables !== null && variables !== void 0 ? variables : {}), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), (_b = context.build.config.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
78
78
|
runnerVariables: __assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), runnerVariables !== null && runnerVariables !== void 0 ? runnerVariables : {}), (_c = context.build.config.runnerVariables) !== null && _c !== void 0 ? _c : {}),
|
|
79
|
-
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(context) ? (0, writeDotEnv_1.writeDotEnv)(context) : []), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context
|
|
79
|
+
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(context) ? (0, writeDotEnv_1.writeDotEnv)(context) : []), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read((_d = (0, utils_1.ensureArray)(script)) !== null && _d !== void 0 ? _d : []), false),
|
|
80
80
|
artifacts: {
|
|
81
81
|
paths: [(0, path_1.join)(context.build.dir, "__build_info.json")],
|
|
82
82
|
reports: {
|
|
@@ -51,15 +51,15 @@ var createNodeBuildJobs = function (context) {
|
|
|
51
51
|
throw new Error("deploy config is not node, node-static or storybook");
|
|
52
52
|
}
|
|
53
53
|
var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
|
|
54
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context
|
|
54
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
55
55
|
return (0, base_1.createBuildJobs)(context, {
|
|
56
56
|
appBuild: buildConfig.buildCommand !== null ? {
|
|
57
57
|
image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
|
|
58
58
|
runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
59
|
-
cache: __spreadArray(__spreadArray(__spreadArray([], __read((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : []), false), __read((0, cache_1.getNodeCache)(context
|
|
59
|
+
cache: __spreadArray(__spreadArray(__spreadArray([], __read((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : []), false), __read((0, cache_1.getNodeCache)(context)), false), __read((0, cache_1.getNextCache)(context)), false),
|
|
60
60
|
script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : []), false),
|
|
61
61
|
artifacts: {
|
|
62
|
-
paths: __spreadArray([context.build.dir], __read((_d = context.
|
|
62
|
+
paths: __spreadArray([context.build.dir], __read((_d = context.packageManagerInfo.currentWorkspaceDependencies) !== null && _d !== void 0 ? _d : []), false).flatMap(function (dir) {
|
|
63
63
|
var _a, _b;
|
|
64
64
|
return __spreadArray([(0, path_1.join)(dir, "__build_info.json"), (0, path_1.join)(dir, "dist"), (0, path_1.join)(dir, ".next")], __read((_b = (_a = buildConfig.artifactsPaths) === null || _a === void 0 ? void 0 : _a.map(function (path) {
|
|
65
65
|
return (0, path_1.join)(dir, path);
|
|
@@ -72,11 +72,11 @@ var createNodeBuildJobs = function (context) {
|
|
|
72
72
|
} : undefined,
|
|
73
73
|
dockerBuild: {
|
|
74
74
|
script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook" ? "nginx" : "node"),
|
|
75
|
-
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context
|
|
75
|
+
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
|
|
76
76
|
variables: {
|
|
77
77
|
// only required for non static
|
|
78
|
-
DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context
|
|
79
|
-
DOCKER_COPY_WORKSPACE_FILES: (_e = context.
|
|
78
|
+
DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context),
|
|
79
|
+
DOCKER_COPY_WORKSPACE_FILES: (_e = context.packageManagerInfo.pathsToCopyInDocker.map(function (dir) {
|
|
80
80
|
return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir);
|
|
81
81
|
})) === null || _e === void 0 ? void 0 : _e.join("\n")
|
|
82
82
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext, Context } from "../../types/context";
|
|
2
2
|
import type { GitlabJobCache } from "../../types/gitlab-types";
|
|
3
|
-
export declare const getYarnCache: (context:
|
|
4
|
-
export declare const getNodeModulesCache: (context:
|
|
5
|
-
export declare const getNodeCache: (context:
|
|
3
|
+
export declare const getYarnCache: (context: Context, policy?: string) => GitlabJobCache[];
|
|
4
|
+
export declare const getNodeModulesCache: (context: Context, policy?: string) => GitlabJobCache[];
|
|
5
|
+
export declare const getNodeCache: (context: Context, policy?: string) => GitlabJobCache[];
|
|
6
6
|
export declare const getNextCache: (context: ComponentContext) => GitlabJobCache[];
|
package/dist/build/node/cache.js
CHANGED
|
@@ -40,9 +40,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
40
40
|
value: true
|
|
41
41
|
});
|
|
42
42
|
exports.getNextCache = exports.getNodeCache = exports.getNodeModulesCache = exports.getYarnCache = void 0;
|
|
43
|
+
var lodash_1 = require("lodash");
|
|
43
44
|
var path_1 = require("path");
|
|
44
45
|
var slugify_1 = __importDefault(require("slugify"));
|
|
45
|
-
var lodash_1 = require("lodash");
|
|
46
46
|
var getYarnCache = function (context, policy) {
|
|
47
47
|
if (policy === void 0) {
|
|
48
48
|
policy = "pull-push";
|
|
@@ -53,9 +53,9 @@ var getYarnCache = function (context, policy) {
|
|
|
53
53
|
policy: policy,
|
|
54
54
|
paths: [".yarn"]
|
|
55
55
|
} : {
|
|
56
|
-
key: (0, slugify_1.default)(context.dir) + "-yarn",
|
|
56
|
+
key: (0, slugify_1.default)(context.build.dir) + "-yarn",
|
|
57
57
|
policy: policy,
|
|
58
|
-
paths: [(0, path_1.join)(context.dir, ".yarn")]
|
|
58
|
+
paths: [(0, path_1.join)(context.build.dir, ".yarn")]
|
|
59
59
|
}];
|
|
60
60
|
};
|
|
61
61
|
exports.getYarnCache = getYarnCache;
|
|
@@ -69,12 +69,12 @@ var getNodeModulesCache = function (context, policy) {
|
|
|
69
69
|
// It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
|
|
70
70
|
return [{
|
|
71
71
|
// if component is in a shared workspace, use workspace cache. use individual cache else
|
|
72
|
-
key: componentIsInWorkspace ? "node-modules-workspace" : (0, slugify_1.default)(context.dir) + "-node-modules",
|
|
72
|
+
key: componentIsInWorkspace ? "node-modules-workspace" : (0, slugify_1.default)(context.build.dir) + "-node-modules",
|
|
73
73
|
// 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
|
|
74
74
|
policy: policy,
|
|
75
75
|
paths: __spreadArray([], __read(componentIsInWorkspace ? (0, lodash_1.uniq)(__spreadArray(["node_modules"], __read((_a = context.packageManagerInfo.workspaces.map(function (w) {
|
|
76
76
|
return (0, path_1.join)(w.location, "node_modules");
|
|
77
|
-
})) !== null && _a !== void 0 ? _a : []), false)) : [(0, path_1.join)(context.dir, "node_modules")]), false)
|
|
77
|
+
})) !== null && _a !== void 0 ? _a : []), false)) : [(0, path_1.join)(context.build.dir, "node_modules")]), false)
|
|
78
78
|
}];
|
|
79
79
|
};
|
|
80
80
|
exports.getNodeModulesCache = getNodeModulesCache;
|
|
@@ -54,10 +54,10 @@ var createMeteorBuildJobs = function (context) {
|
|
|
54
54
|
if (!(0, types_1.isOfBuildType)(buildConfig, "meteor")) {
|
|
55
55
|
throw new Error("deploy config is not meteor");
|
|
56
56
|
}
|
|
57
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context
|
|
57
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
58
58
|
return (0, base_1.createBuildJobs)(context, {
|
|
59
59
|
appBuild: buildConfig.buildCommand !== null ? {
|
|
60
|
-
cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context
|
|
60
|
+
cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context)), false), __read(getMeteorCache(context)), false),
|
|
61
61
|
image: (0, runner_1.getRunnerImage)("jobs-meteor"),
|
|
62
62
|
variables: {
|
|
63
63
|
METEOR_DISABLE_OPTIMISTIC_CACHING: "1" // see https://forums.meteor.com/t/veeery-long-building-time-inside-docker-container/58673/17?u=macrozone
|
|
@@ -69,13 +69,13 @@ var createNodeTestJobs = function (context) {
|
|
|
69
69
|
needs: [],
|
|
70
70
|
envMode: "none"
|
|
71
71
|
};
|
|
72
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context
|
|
72
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
73
73
|
var auditJob = buildConfig.audit !== false ? __assign(__assign(__assign({
|
|
74
74
|
name: "🛡 audit"
|
|
75
75
|
}, base), {
|
|
76
76
|
image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage,
|
|
77
77
|
cache: undefined,
|
|
78
|
-
script: __spreadArray(["cd ".concat(context.build.dir)], __read((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [context.
|
|
78
|
+
script: __spreadArray(["cd ".concat(context.build.dir)], __read((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [context.packageManagerInfo.isClassic ? "yarn audit" : "yarn npm audit --environment production" // yarn 2
|
|
79
79
|
]), false),
|
|
80
80
|
allow_failure: true
|
|
81
81
|
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifactsReports, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifacts)) : null;
|
|
@@ -83,15 +83,15 @@ var createNodeTestJobs = function (context) {
|
|
|
83
83
|
name: "👮 lint"
|
|
84
84
|
}, base), {
|
|
85
85
|
image: (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.jobImage) !== null && _j !== void 0 ? _j : defaultImage,
|
|
86
|
-
cache: (0, cache_1.getNodeCache)(context
|
|
87
|
-
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context
|
|
86
|
+
cache: (0, cache_1.getNodeCache)(context),
|
|
87
|
+
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : ["yarn lint"]), false)
|
|
88
88
|
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.artifactsReports, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifacts)) : null;
|
|
89
89
|
var testJob = buildConfig.test !== false ? __assign(__assign(__assign({
|
|
90
90
|
name: "🧪 test"
|
|
91
91
|
}, base), {
|
|
92
92
|
image: (_q = (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
|
|
93
|
-
cache: (0, cache_1.getNodeCache)(context
|
|
94
|
-
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context
|
|
93
|
+
cache: (0, cache_1.getNodeCache)(context),
|
|
94
|
+
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_s = (0, utils_1.ensureArray)((_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : ["yarn test"]), false)
|
|
95
95
|
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.artifactsReports, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifacts)) : null;
|
|
96
96
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
97
97
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BashExpression } from "../../bash/BashExpression";
|
|
2
|
-
import type {
|
|
3
|
-
export declare const ensureNodeVersion: (context:
|
|
4
|
-
export declare const getYarnInstall: (context:
|
|
2
|
+
import type { Context } from "../../types";
|
|
3
|
+
export declare const ensureNodeVersion: (context: Context) => string[];
|
|
4
|
+
export declare const getYarnInstall: (context: Context, options?: {
|
|
5
5
|
noCustomPostInstall: boolean;
|
|
6
6
|
}) => string[];
|
|
7
|
-
export declare const getDockerAppCopyAndBuildScript: (context:
|
|
7
|
+
export declare const getDockerAppCopyAndBuildScript: (context: Context) => BashExpression;
|
package/dist/build/node/yarn.js
CHANGED
|
@@ -53,7 +53,7 @@ var ensureNodeVersion = function (context) {
|
|
|
53
53
|
exports.ensureNodeVersion = ensureNodeVersion;
|
|
54
54
|
var getYarnInstall = function (context, options) {
|
|
55
55
|
var _a;
|
|
56
|
-
var postInstall = "postInstall" in context.config ? context.config.postInstall : null;
|
|
56
|
+
var postInstall = "postInstall" in context.build.config ? context.build.config.postInstall : null;
|
|
57
57
|
return __spreadArray(__spreadArray(__spreadArray([], __read((0, exports.ensureNodeVersion)(context)), false), __read((0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([getYarnInstallCommand(context)])), false), __read(postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall) ? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((_a = (0, utils_1.ensureArray)(postInstall)) !== null && _a !== void 0 ? _a : []) : []), false);
|
|
58
58
|
};
|
|
59
59
|
exports.getYarnInstall = getYarnInstall;
|
package/dist/build/sbom.js
CHANGED
|
@@ -11,7 +11,7 @@ var createSbomBuildJob = function (context) {
|
|
|
11
11
|
var _a, _b, _c, _d;
|
|
12
12
|
var buildConfig = context.build.config;
|
|
13
13
|
var defaultImage = "aquasec/trivy:0.38.3";
|
|
14
|
-
var defaultScript = ["trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(context.
|
|
14
|
+
var defaultScript = ["trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(context.packageManagerInfo.componentIsInWorkspace ? "." : context.build.dir)];
|
|
15
15
|
var image = buildConfig.type === "custom" && buildConfig.sbom !== false ? (_b = (_a = buildConfig.sbom) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : defaultImage : defaultImage;
|
|
16
16
|
var script = buildConfig.type === "custom" && buildConfig.sbom !== false ? (_d = (0, utils_1.ensureArray)((_c = buildConfig.sbom) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : defaultScript : defaultScript;
|
|
17
17
|
return {
|
|
@@ -23268,7 +23268,7 @@ var createAppBuildJob = function (context, _a) {
|
|
|
23268
23268
|
cache: [],
|
|
23269
23269
|
variables: __assign(__assign(__assign(__assign({}, variables !== null && variables !== void 0 ? variables : {}), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), (_b = context.build.config.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
23270
23270
|
runnerVariables: __assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), runnerVariables !== null && runnerVariables !== void 0 ? runnerVariables : {}), (_c = context.build.config.runnerVariables) !== null && _c !== void 0 ? _c : {}),
|
|
23271
|
-
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(context) ? (0, writeDotEnv_1.writeDotEnv)(context) : []), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context
|
|
23271
|
+
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(context) ? (0, writeDotEnv_1.writeDotEnv)(context) : []), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read((_d = (0, utils_1.ensureArray)(script)) !== null && _d !== void 0 ? _d : []), false),
|
|
23272
23272
|
artifacts: {
|
|
23273
23273
|
paths: [(0, path_1.join)(context.build.dir, "__build_info.json")],
|
|
23274
23274
|
reports: {
|
|
@@ -24076,15 +24076,15 @@ var createNodeBuildJobs = function (context) {
|
|
|
24076
24076
|
throw new Error("deploy config is not node, node-static or storybook");
|
|
24077
24077
|
}
|
|
24078
24078
|
var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
|
|
24079
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context
|
|
24079
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
24080
24080
|
return (0, base_1.createBuildJobs)(context, {
|
|
24081
24081
|
appBuild: buildConfig.buildCommand !== null ? {
|
|
24082
24082
|
image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
|
|
24083
24083
|
runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
24084
|
-
cache: __spreadArray(__spreadArray(__spreadArray([], __read((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : []), false), __read((0, cache_1.getNodeCache)(context
|
|
24084
|
+
cache: __spreadArray(__spreadArray(__spreadArray([], __read((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : []), false), __read((0, cache_1.getNodeCache)(context)), false), __read((0, cache_1.getNextCache)(context)), false),
|
|
24085
24085
|
script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : []), false),
|
|
24086
24086
|
artifacts: {
|
|
24087
|
-
paths: __spreadArray([context.build.dir], __read((_d = context.
|
|
24087
|
+
paths: __spreadArray([context.build.dir], __read((_d = context.packageManagerInfo.currentWorkspaceDependencies) !== null && _d !== void 0 ? _d : []), false).flatMap(function (dir) {
|
|
24088
24088
|
var _a, _b;
|
|
24089
24089
|
return __spreadArray([(0, path_1.join)(dir, "__build_info.json"), (0, path_1.join)(dir, "dist"), (0, path_1.join)(dir, ".next")], __read((_b = (_a = buildConfig.artifactsPaths) === null || _a === void 0 ? void 0 : _a.map(function (path) {
|
|
24090
24090
|
return (0, path_1.join)(dir, path);
|
|
@@ -24097,11 +24097,11 @@ var createNodeBuildJobs = function (context) {
|
|
|
24097
24097
|
} : undefined,
|
|
24098
24098
|
dockerBuild: {
|
|
24099
24099
|
script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook" ? "nginx" : "node"),
|
|
24100
|
-
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context
|
|
24100
|
+
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
|
|
24101
24101
|
variables: {
|
|
24102
24102
|
// only required for non static
|
|
24103
|
-
DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context
|
|
24104
|
-
DOCKER_COPY_WORKSPACE_FILES: (_e = context.
|
|
24103
|
+
DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context),
|
|
24104
|
+
DOCKER_COPY_WORKSPACE_FILES: (_e = context.packageManagerInfo.pathsToCopyInDocker.map(function (dir) {
|
|
24105
24105
|
return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir);
|
|
24106
24106
|
})) === null || _e === void 0 ? void 0 : _e.join("\n")
|
|
24107
24107
|
}
|
|
@@ -24158,9 +24158,9 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
24158
24158
|
value: true
|
|
24159
24159
|
}));
|
|
24160
24160
|
exports.getNextCache = exports.getNodeCache = exports.getNodeModulesCache = exports.getYarnCache = void 0;
|
|
24161
|
+
var lodash_1 = __nccwpck_require__(3255);
|
|
24161
24162
|
var path_1 = __nccwpck_require__(1017);
|
|
24162
24163
|
var slugify_1 = __importDefault(__nccwpck_require__(4035));
|
|
24163
|
-
var lodash_1 = __nccwpck_require__(3255);
|
|
24164
24164
|
var getYarnCache = function (context, policy) {
|
|
24165
24165
|
if (policy === void 0) {
|
|
24166
24166
|
policy = "pull-push";
|
|
@@ -24171,9 +24171,9 @@ var getYarnCache = function (context, policy) {
|
|
|
24171
24171
|
policy: policy,
|
|
24172
24172
|
paths: [".yarn"]
|
|
24173
24173
|
} : {
|
|
24174
|
-
key: (0, slugify_1.default)(context.dir) + "-yarn",
|
|
24174
|
+
key: (0, slugify_1.default)(context.build.dir) + "-yarn",
|
|
24175
24175
|
policy: policy,
|
|
24176
|
-
paths: [(0, path_1.join)(context.dir, ".yarn")]
|
|
24176
|
+
paths: [(0, path_1.join)(context.build.dir, ".yarn")]
|
|
24177
24177
|
}];
|
|
24178
24178
|
};
|
|
24179
24179
|
exports.getYarnCache = getYarnCache;
|
|
@@ -24187,12 +24187,12 @@ var getNodeModulesCache = function (context, policy) {
|
|
|
24187
24187
|
// It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
|
|
24188
24188
|
return [{
|
|
24189
24189
|
// if component is in a shared workspace, use workspace cache. use individual cache else
|
|
24190
|
-
key: componentIsInWorkspace ? "node-modules-workspace" : (0, slugify_1.default)(context.dir) + "-node-modules",
|
|
24190
|
+
key: componentIsInWorkspace ? "node-modules-workspace" : (0, slugify_1.default)(context.build.dir) + "-node-modules",
|
|
24191
24191
|
// 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
|
|
24192
24192
|
policy: policy,
|
|
24193
24193
|
paths: __spreadArray([], __read(componentIsInWorkspace ? (0, lodash_1.uniq)(__spreadArray(["node_modules"], __read((_a = context.packageManagerInfo.workspaces.map(function (w) {
|
|
24194
24194
|
return (0, path_1.join)(w.location, "node_modules");
|
|
24195
|
-
})) !== null && _a !== void 0 ? _a : []), false)) : [(0, path_1.join)(context.dir, "node_modules")]), false)
|
|
24195
|
+
})) !== null && _a !== void 0 ? _a : []), false)) : [(0, path_1.join)(context.build.dir, "node_modules")]), false)
|
|
24196
24196
|
}];
|
|
24197
24197
|
};
|
|
24198
24198
|
exports.getNodeModulesCache = getNodeModulesCache;
|
|
@@ -24351,10 +24351,10 @@ var createMeteorBuildJobs = function (context) {
|
|
|
24351
24351
|
if (!(0, types_1.isOfBuildType)(buildConfig, "meteor")) {
|
|
24352
24352
|
throw new Error("deploy config is not meteor");
|
|
24353
24353
|
}
|
|
24354
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context
|
|
24354
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
24355
24355
|
return (0, base_1.createBuildJobs)(context, {
|
|
24356
24356
|
appBuild: buildConfig.buildCommand !== null ? {
|
|
24357
|
-
cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context
|
|
24357
|
+
cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context)), false), __read(getMeteorCache(context)), false),
|
|
24358
24358
|
image: (0, runner_1.getRunnerImage)("jobs-meteor"),
|
|
24359
24359
|
variables: {
|
|
24360
24360
|
METEOR_DISABLE_OPTIMISTIC_CACHING: "1" // see https://forums.meteor.com/t/veeery-long-building-time-inside-docker-container/58673/17?u=macrozone
|
|
@@ -24452,13 +24452,13 @@ var createNodeTestJobs = function (context) {
|
|
|
24452
24452
|
needs: [],
|
|
24453
24453
|
envMode: "none"
|
|
24454
24454
|
};
|
|
24455
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context
|
|
24455
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
24456
24456
|
var auditJob = buildConfig.audit !== false ? __assign(__assign(__assign({
|
|
24457
24457
|
name: "🛡 audit"
|
|
24458
24458
|
}, base), {
|
|
24459
24459
|
image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage,
|
|
24460
24460
|
cache: undefined,
|
|
24461
|
-
script: __spreadArray(["cd ".concat(context.build.dir)], __read((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [context.
|
|
24461
|
+
script: __spreadArray(["cd ".concat(context.build.dir)], __read((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [context.packageManagerInfo.isClassic ? "yarn audit" : "yarn npm audit --environment production" // yarn 2
|
|
24462
24462
|
]), false),
|
|
24463
24463
|
allow_failure: true
|
|
24464
24464
|
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifactsReports, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifacts)) : null;
|
|
@@ -24466,15 +24466,15 @@ var createNodeTestJobs = function (context) {
|
|
|
24466
24466
|
name: "👮 lint"
|
|
24467
24467
|
}, base), {
|
|
24468
24468
|
image: (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.jobImage) !== null && _j !== void 0 ? _j : defaultImage,
|
|
24469
|
-
cache: (0, cache_1.getNodeCache)(context
|
|
24470
|
-
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context
|
|
24469
|
+
cache: (0, cache_1.getNodeCache)(context),
|
|
24470
|
+
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : ["yarn lint"]), false)
|
|
24471
24471
|
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.artifactsReports, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifacts)) : null;
|
|
24472
24472
|
var testJob = buildConfig.test !== false ? __assign(__assign(__assign({
|
|
24473
24473
|
name: "🧪 test"
|
|
24474
24474
|
}, base), {
|
|
24475
24475
|
image: (_q = (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
|
|
24476
|
-
cache: (0, cache_1.getNodeCache)(context
|
|
24477
|
-
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context
|
|
24476
|
+
cache: (0, cache_1.getNodeCache)(context),
|
|
24477
|
+
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_s = (0, utils_1.ensureArray)((_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : ["yarn test"]), false)
|
|
24478
24478
|
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.artifactsReports, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifacts)) : null;
|
|
24479
24479
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
24480
24480
|
};
|
|
@@ -24541,7 +24541,7 @@ var ensureNodeVersion = function (context) {
|
|
|
24541
24541
|
exports.ensureNodeVersion = ensureNodeVersion;
|
|
24542
24542
|
var getYarnInstall = function (context, options) {
|
|
24543
24543
|
var _a;
|
|
24544
|
-
var postInstall = "postInstall" in context.config ? context.config.postInstall : null;
|
|
24544
|
+
var postInstall = "postInstall" in context.build.config ? context.build.config.postInstall : null;
|
|
24545
24545
|
return __spreadArray(__spreadArray(__spreadArray([], __read((0, exports.ensureNodeVersion)(context)), false), __read((0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([getYarnInstallCommand(context)])), false), __read(postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall) ? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((_a = (0, utils_1.ensureArray)(postInstall)) !== null && _a !== void 0 ? _a : []) : []), false);
|
|
24546
24546
|
};
|
|
24547
24547
|
exports.getYarnInstall = getYarnInstall;
|
|
@@ -24828,7 +24828,7 @@ var createSbomBuildJob = function (context) {
|
|
|
24828
24828
|
var _a, _b, _c, _d;
|
|
24829
24829
|
var buildConfig = context.build.config;
|
|
24830
24830
|
var defaultImage = "aquasec/trivy:0.38.3";
|
|
24831
|
-
var defaultScript = ["trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(context.
|
|
24831
|
+
var defaultScript = ["trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(context.packageManagerInfo.componentIsInWorkspace ? "." : context.build.dir)];
|
|
24832
24832
|
var image = buildConfig.type === "custom" && buildConfig.sbom !== false ? (_b = (_a = buildConfig.sbom) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : defaultImage : defaultImage;
|
|
24833
24833
|
var script = buildConfig.type === "custom" && buildConfig.sbom !== false ? (_d = (0, utils_1.ensureArray)((_c = buildConfig.sbom) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : defaultScript : defaultScript;
|
|
24834
24834
|
return {
|
|
@@ -25052,7 +25052,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
25052
25052
|
value: true
|
|
25053
25053
|
}));
|
|
25054
25054
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
25055
|
-
exports.PIPELINE_IMAGE_TAG = "main-
|
|
25055
|
+
exports.PIPELINE_IMAGE_TAG = "main-8a8ce056" || 0;
|
|
25056
25056
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
25057
25057
|
|
|
25058
25058
|
/***/ }),
|
|
@@ -25208,7 +25208,7 @@ var createComponentContext = function (ctx) {
|
|
|
25208
25208
|
if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
|
|
25209
25209
|
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
25210
25210
|
}
|
|
25211
|
-
return [4 /*yield*/, (0, packageManager_1.
|
|
25211
|
+
return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfoForComponent)(ctx.config, ctx.componentName)];
|
|
25212
25212
|
case 1:
|
|
25213
25213
|
packageManagerInfo = _a.sent();
|
|
25214
25214
|
envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
|
|
@@ -25230,7 +25230,6 @@ var createComponentContext = function (ctx) {
|
|
|
25230
25230
|
componentConfig: componentConfig,
|
|
25231
25231
|
build: {
|
|
25232
25232
|
dir: dir,
|
|
25233
|
-
packageManagerInfo: packageManagerInfo,
|
|
25234
25233
|
config: build
|
|
25235
25234
|
},
|
|
25236
25235
|
deploy: deploy ? {
|
|
@@ -28157,7 +28156,7 @@ var createCustomDeployJobs = function (context) {
|
|
|
28157
28156
|
throw new Error("deploy config is not custom");
|
|
28158
28157
|
}
|
|
28159
28158
|
// FIXME: custom deploy currently assumes yarn-based project
|
|
28160
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context
|
|
28159
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context, {
|
|
28161
28160
|
noCustomPostInstall: true
|
|
28162
28161
|
});
|
|
28163
28162
|
return (0, base_1.createDeployementJobs)(context, {
|
|
@@ -30950,12 +30949,12 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
30950
30949
|
Object.defineProperty(exports, "__esModule", ({
|
|
30951
30950
|
value: true
|
|
30952
30951
|
}));
|
|
30953
|
-
exports.
|
|
30952
|
+
exports.getPackageManagerInfoForComponent = void 0;
|
|
30954
30953
|
var fs_1 = __nccwpck_require__(7147);
|
|
30955
30954
|
var path_1 = __nccwpck_require__(1017);
|
|
30956
30955
|
var path_equal_1 = __nccwpck_require__(4843);
|
|
30957
30956
|
var yarnUtils_1 = __nccwpck_require__(9181);
|
|
30958
|
-
var
|
|
30957
|
+
var getPackageManagerInfoForComponent = function (config, componentName) {
|
|
30959
30958
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
30960
30959
|
var version, isClassic, component, workspaces, currentWorkspace, componentIsInWorkspace, workspaceRoot, packageJson, workspacePackageJson, lockFile, configFiles, configFilePaths, currentWorkspaceDependencies, pathsToCopyInDocker;
|
|
30961
30960
|
return __generator(this, function (_a) {
|
|
@@ -31000,7 +30999,7 @@ var getPackageManagerInfo = function (config, componentName) {
|
|
|
31000
30999
|
});
|
|
31001
31000
|
});
|
|
31002
31001
|
};
|
|
31003
|
-
exports.
|
|
31002
|
+
exports.getPackageManagerInfoForComponent = getPackageManagerInfoForComponent;
|
|
31004
31003
|
|
|
31005
31004
|
/***/ }),
|
|
31006
31005
|
|
package/dist/constants.js
CHANGED
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
7
|
-
exports.PIPELINE_IMAGE_TAG = "main-
|
|
7
|
+
exports.PIPELINE_IMAGE_TAG = "main-8a8ce056" || "latest";
|
|
8
8
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "git.panter.ch:5001/catladder/catladder";
|
|
@@ -145,7 +145,7 @@ var createComponentContext = function (ctx) {
|
|
|
145
145
|
if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
|
|
146
146
|
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
147
147
|
}
|
|
148
|
-
return [4 /*yield*/, (0, packageManager_1.
|
|
148
|
+
return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfoForComponent)(ctx.config, ctx.componentName)];
|
|
149
149
|
case 1:
|
|
150
150
|
packageManagerInfo = _a.sent();
|
|
151
151
|
envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
|
|
@@ -167,7 +167,6 @@ var createComponentContext = function (ctx) {
|
|
|
167
167
|
componentConfig: componentConfig,
|
|
168
168
|
build: {
|
|
169
169
|
dir: dir,
|
|
170
|
-
packageManagerInfo: packageManagerInfo,
|
|
171
170
|
config: build
|
|
172
171
|
},
|
|
173
172
|
deploy: deploy ? {
|
|
@@ -48,7 +48,7 @@ var createCustomDeployJobs = function (context) {
|
|
|
48
48
|
throw new Error("deploy config is not custom");
|
|
49
49
|
}
|
|
50
50
|
// FIXME: custom deploy currently assumes yarn-based project
|
|
51
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context
|
|
51
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context, {
|
|
52
52
|
noCustomPostInstall: true
|
|
53
53
|
});
|
|
54
54
|
return (0, base_1.createDeployementJobs)(context, {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Config,
|
|
2
|
-
export declare const
|
|
1
|
+
import type { Config, PackageManagerInfoComponent } from "../types";
|
|
2
|
+
export declare const getPackageManagerInfoForComponent: (config: Config, componentName: string) => Promise<PackageManagerInfoComponent>;
|
|
@@ -149,12 +149,12 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
149
149
|
Object.defineProperty(exports, "__esModule", {
|
|
150
150
|
value: true
|
|
151
151
|
});
|
|
152
|
-
exports.
|
|
152
|
+
exports.getPackageManagerInfoForComponent = void 0;
|
|
153
153
|
var fs_1 = require("fs");
|
|
154
154
|
var path_1 = require("path");
|
|
155
155
|
var path_equal_1 = require("path-equal");
|
|
156
156
|
var yarnUtils_1 = require("./yarn/yarnUtils");
|
|
157
|
-
var
|
|
157
|
+
var getPackageManagerInfoForComponent = function (config, componentName) {
|
|
158
158
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
159
159
|
var version, isClassic, component, workspaces, currentWorkspace, componentIsInWorkspace, workspaceRoot, packageJson, workspacePackageJson, lockFile, configFiles, configFilePaths, currentWorkspaceDependencies, pathsToCopyInDocker;
|
|
160
160
|
return __generator(this, function (_a) {
|
|
@@ -199,4 +199,4 @@ var getPackageManagerInfo = function (config, componentName) {
|
|
|
199
199
|
});
|
|
200
200
|
});
|
|
201
201
|
};
|
|
202
|
-
exports.
|
|
202
|
+
exports.getPackageManagerInfoForComponent = getPackageManagerInfoForComponent;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import memoizee from "memoizee";
|
|
2
|
-
import type {
|
|
2
|
+
import type { YarnWorkspace } from "../../types";
|
|
3
3
|
export declare const getYarnVersion: (() => Promise<string>) & memoizee.Memoized<() => Promise<string>>;
|
|
4
|
-
export declare const getWorkspaces: ((isClassic: boolean) => Promise<
|
|
4
|
+
export declare const getWorkspaces: ((isClassic: boolean) => Promise<Array<YarnWorkspace>>) & memoizee.Memoized<(isClassic: boolean) => Promise<Array<YarnWorkspace>>>;
|
|
5
5
|
export declare const getWorkspaceDependencies: (ws: YarnWorkspace, allWorkspaces: YarnWorkspace[]) => string[];
|