@catladder/cli 0.0.0-main-74b7952c → 0.0.0-main-ab1c788d
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 +166 -141
- package/dist/bundles/cli/index.js +164 -141
- package/dist/cli/src/catenv.js +2 -0
- package/dist/cli/src/catenv.js.map +1 -1
- package/dist/cli/src/config/getProjectConfig.js +3 -0
- package/dist/cli/src/config/getProjectConfig.js.map +1 -1
- package/dist/cli/src/utils/projects/index.d.ts +1 -1
- package/dist/cli/src/utils/projects/index.js +9 -1
- package/dist/cli/src/utils/projects/index.js.map +1 -1
- package/dist/pipeline/src/build/node/buildJob.js +5 -3
- package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
- package/dist/pipeline/src/build/node/cache.js +5 -6
- package/dist/pipeline/src/build/node/cache.js.map +1 -1
- package/dist/pipeline/src/build/node/testJob.js +7 -7
- package/dist/pipeline/src/build/node/testJob.js.map +1 -1
- package/dist/pipeline/src/build/node/yarn.js +5 -5
- package/dist/pipeline/src/build/node/yarn.js.map +1 -1
- package/dist/pipeline/src/build/sbom.js +4 -4
- package/dist/pipeline/src/build/sbom.js.map +1 -1
- package/dist/pipeline/src/context/createComponentContext.d.ts +15 -0
- package/dist/pipeline/src/context/createComponentContext.js +116 -0
- package/dist/pipeline/src/context/createComponentContext.js.map +1 -0
- package/dist/pipeline/src/context/index.d.ts +1 -16
- package/dist/pipeline/src/context/index.js +1 -109
- package/dist/pipeline/src/context/index.js.map +1 -1
- package/dist/pipeline/src/pipeline/createJobsForComponent.d.ts +1 -1
- package/dist/pipeline/src/pipeline/createJobsForComponent.js +2 -6
- package/dist/pipeline/src/pipeline/createJobsForComponent.js.map +1 -1
- package/dist/pipeline/src/types/context.d.ts +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/catenv.ts +2 -0
- package/src/config/getProjectConfig.ts +3 -0
- package/src/utils/projects/index.ts +7 -2
|
@@ -666,7 +666,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
666
666
|
var catenv_1 = __importDefault(__nccwpck_require__(6965));
|
|
667
667
|
var parseChoice_1 = __nccwpck_require__(3941);
|
|
668
668
|
var choice = process.argv[2] ? (0, parseChoice_1.parseChoice)(process.argv[2]) : null;
|
|
669
|
+
var now = performance.now();
|
|
669
670
|
(0, catenv_1.default)(choice).then(function () {
|
|
671
|
+
console.log("catenv", performance.now() - now);
|
|
670
672
|
// we have to exit manually, because we have some file watches
|
|
671
673
|
process.exit();
|
|
672
674
|
});
|
|
@@ -759,6 +761,9 @@ var reloadConfigAndObserve = function () { return __awaiter(void 0, void 0, void
|
|
|
759
761
|
case 0: return [4 /*yield*/, (0, projects_1.getGitRoot)()];
|
|
760
762
|
case 1:
|
|
761
763
|
gitRoot = _a.sent();
|
|
764
|
+
if (!gitRoot) {
|
|
765
|
+
return [2 /*return*/];
|
|
766
|
+
}
|
|
762
767
|
result = (0, pipeline_1.readConfigSync)(gitRoot);
|
|
763
768
|
if (!result) {
|
|
764
769
|
// can't do anything, there is no config
|
|
@@ -1793,10 +1798,18 @@ var getProjectConfig_1 = __nccwpck_require__(5264);
|
|
|
1793
1798
|
var files_1 = __nccwpck_require__(9863);
|
|
1794
1799
|
var child_process_promise_1 = __nccwpck_require__(5763);
|
|
1795
1800
|
var getGitRoot = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1801
|
+
var e_1;
|
|
1796
1802
|
return __generator(this, function (_a) {
|
|
1797
1803
|
switch (_a.label) {
|
|
1798
|
-
case 0:
|
|
1804
|
+
case 0:
|
|
1805
|
+
_a.trys.push([0, 2, , 3]);
|
|
1806
|
+
return [4 /*yield*/, (0, child_process_promise_1.exec)("git rev-parse --show-toplevel")];
|
|
1799
1807
|
case 1: return [2 /*return*/, (_a.sent()).stdout.trim()];
|
|
1808
|
+
case 2:
|
|
1809
|
+
e_1 = _a.sent();
|
|
1810
|
+
// not a git repo
|
|
1811
|
+
return [2 /*return*/, null];
|
|
1812
|
+
case 3: return [2 /*return*/];
|
|
1800
1813
|
}
|
|
1801
1814
|
});
|
|
1802
1815
|
}); };
|
|
@@ -2997,7 +3010,7 @@ var cache_1 = __nccwpck_require__(2026);
|
|
|
2997
3010
|
var constants_1 = __nccwpck_require__(1765);
|
|
2998
3011
|
var yarn_1 = __nccwpck_require__(5043);
|
|
2999
3012
|
var createNodeBuildJobs = function (context) {
|
|
3000
|
-
var _a, _b, _c, _d, _e
|
|
3013
|
+
var _a, _b, _c, _d, _e;
|
|
3001
3014
|
var buildConfig = context.build.config;
|
|
3002
3015
|
if (!(0, types_1.isOfBuildType)(buildConfig, "node", "node-static", "storybook")) {
|
|
3003
3016
|
throw new Error("deploy config is not node, node-static or storybook");
|
|
@@ -3014,7 +3027,8 @@ var createNodeBuildJobs = function (context) {
|
|
|
3014
3027
|
artifacts: {
|
|
3015
3028
|
paths: __spreadArray([
|
|
3016
3029
|
context.build.dir
|
|
3017
|
-
], __read(((
|
|
3030
|
+
], __read(((_d = context.build.packageManagerInfo
|
|
3031
|
+
.currentWorkspaceDependencies) !== null && _d !== void 0 ? _d : [])), false).flatMap(function (dir) {
|
|
3018
3032
|
var _a, _b;
|
|
3019
3033
|
return __spreadArray([
|
|
3020
3034
|
(0, path_1.join)(dir, "__build_info.json"),
|
|
@@ -3038,7 +3052,8 @@ var createNodeBuildJobs = function (context) {
|
|
|
3038
3052
|
variables: {
|
|
3039
3053
|
// only required for non static
|
|
3040
3054
|
DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context.build),
|
|
3041
|
-
DOCKER_COPY_WORKSPACE_FILES: (
|
|
3055
|
+
DOCKER_COPY_WORKSPACE_FILES: (_e = context.build.packageManagerInfo.pathsToCopyInDocker
|
|
3056
|
+
.map(function (dir) { return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir); })) === null || _e === void 0 ? void 0 : _e.join("\n"),
|
|
3042
3057
|
},
|
|
3043
3058
|
},
|
|
3044
3059
|
});
|
|
@@ -3087,9 +3102,8 @@ var path_1 = __nccwpck_require__(1017);
|
|
|
3087
3102
|
var slugify_1 = __importDefault(__nccwpck_require__(4035));
|
|
3088
3103
|
var lodash_1 = __nccwpck_require__(3255);
|
|
3089
3104
|
var getYarnCache = function (context, policy) {
|
|
3090
|
-
var _a;
|
|
3091
3105
|
if (policy === void 0) { policy = "pull-push"; }
|
|
3092
|
-
var componentIsInWorkspace =
|
|
3106
|
+
var componentIsInWorkspace = context.packageManagerInfo.componentIsInWorkspace;
|
|
3093
3107
|
return [
|
|
3094
3108
|
componentIsInWorkspace
|
|
3095
3109
|
? {
|
|
@@ -3106,9 +3120,9 @@ var getYarnCache = function (context, policy) {
|
|
|
3106
3120
|
};
|
|
3107
3121
|
exports.getYarnCache = getYarnCache;
|
|
3108
3122
|
var getNodeModulesCache = function (context, policy) {
|
|
3109
|
-
var _a
|
|
3123
|
+
var _a;
|
|
3110
3124
|
if (policy === void 0) { policy = "pull-push"; }
|
|
3111
|
-
var componentIsInWorkspace =
|
|
3125
|
+
var componentIsInWorkspace = context.packageManagerInfo.componentIsInWorkspace;
|
|
3112
3126
|
// 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.
|
|
3113
3127
|
// It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
|
|
3114
3128
|
return [
|
|
@@ -3121,9 +3135,9 @@ var getNodeModulesCache = function (context, policy) {
|
|
|
3121
3135
|
paths: __spreadArray([], __read((componentIsInWorkspace
|
|
3122
3136
|
? (0, lodash_1.uniq)(__spreadArray([
|
|
3123
3137
|
"node_modules"
|
|
3124
|
-
], __read(((
|
|
3138
|
+
], __read(((_a = context.packageManagerInfo.workspaces.map(function (w) {
|
|
3125
3139
|
return (0, path_1.join)(w.location, "node_modules");
|
|
3126
|
-
})) !== null &&
|
|
3140
|
+
})) !== null && _a !== void 0 ? _a : [])), false))
|
|
3127
3141
|
: [(0, path_1.join)(context.dir, "node_modules")])), false),
|
|
3128
3142
|
},
|
|
3129
3143
|
];
|
|
@@ -3356,7 +3370,7 @@ var constants_1 = __nccwpck_require__(1765);
|
|
|
3356
3370
|
var yarn_1 = __nccwpck_require__(5043);
|
|
3357
3371
|
var createArtifactsConfig_1 = __nccwpck_require__(2820);
|
|
3358
3372
|
var createNodeTestJobs = function (context) {
|
|
3359
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u
|
|
3373
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
3360
3374
|
// don't run tests after release
|
|
3361
3375
|
// TODO: this will be replaced by using rules
|
|
3362
3376
|
if (context.trigger === "taggedRelease") {
|
|
@@ -3376,18 +3390,18 @@ var createNodeTestJobs = function (context) {
|
|
|
3376
3390
|
? __assign(__assign(__assign({ name: "🛡 audit" }, base), { image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage, cache: undefined, script: __spreadArray([
|
|
3377
3391
|
"cd ".concat(context.build.dir)
|
|
3378
3392
|
], __read(((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [
|
|
3379
|
-
|
|
3393
|
+
context.build.packageManagerInfo.isClassic
|
|
3380
3394
|
? "yarn audit"
|
|
3381
3395
|
: "yarn npm audit --environment production", // yarn 2
|
|
3382
|
-
])), false), allow_failure: true }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (
|
|
3396
|
+
])), false), allow_failure: true }), (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;
|
|
3383
3397
|
var lintJob = buildConfig.lint !== false
|
|
3384
|
-
? __assign(__assign(__assign({ name: "👮 lint" }, base), { image: (
|
|
3398
|
+
? __assign(__assign(__assign({ name: "👮 lint" }, base), { image: (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.jobImage) !== null && _j !== void 0 ? _j : defaultImage, cache: (0, cache_1.getNodeCache)(context.build), script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context.build)), false), [
|
|
3385
3399
|
"cd ".concat(context.build.dir)
|
|
3386
|
-
], false), __read(yarnInstall), false), __read(((
|
|
3400
|
+
], 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) }), (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;
|
|
3387
3401
|
var testJob = buildConfig.test !== false
|
|
3388
|
-
? __assign(__assign(__assign({ name: "🧪 test" }, base), { image: (
|
|
3402
|
+
? __assign(__assign(__assign({ name: "🧪 test" }, base), { 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"), cache: (0, cache_1.getNodeCache)(context.build), script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context.build)), false), [
|
|
3389
3403
|
"cd ".concat(context.build.dir)
|
|
3390
|
-
], false), __read(yarnInstall), false), __read(((
|
|
3404
|
+
], 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) }), (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;
|
|
3391
3405
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
3392
3406
|
};
|
|
3393
3407
|
exports.createNodeTestJobs = createNodeTestJobs;
|
|
@@ -3434,8 +3448,7 @@ var YARN_INSTALL_CLASSIC = "yarn install --frozen-lockfile";
|
|
|
3434
3448
|
// FIXME: check why and when rebuild is needed
|
|
3435
3449
|
var YARN_BERRY_PROD_REBUILD = "yarn workspaces focus --production && yarn rebuild";
|
|
3436
3450
|
var getYarnInstallCommand = function (context) {
|
|
3437
|
-
|
|
3438
|
-
if ((_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.isClassic) {
|
|
3451
|
+
if (context.packageManagerInfo.isClassic) {
|
|
3439
3452
|
return YARN_INSTALL_CLASSIC;
|
|
3440
3453
|
}
|
|
3441
3454
|
return "yarn install --immutable";
|
|
@@ -3457,13 +3470,14 @@ var getYarnInstall = function (context, options) {
|
|
|
3457
3470
|
exports.getYarnInstall = getYarnInstall;
|
|
3458
3471
|
var DOCKER_COPY_FILES = "COPY --chown=node:node $APP_DIR .";
|
|
3459
3472
|
var getDockerAppCopyAndBuildScript = function (context) {
|
|
3460
|
-
|
|
3461
|
-
if ((_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.isClassic) {
|
|
3473
|
+
if (context.packageManagerInfo.isClassic) {
|
|
3462
3474
|
return new BashExpression_1.BashExpression("\nRUN ".concat(YARN_INSTALL_CLASSIC, " --production --ignore-scripts\n").concat(DOCKER_COPY_FILES, "\nRUN ").concat(YARN_INSTALL_CLASSIC, " --production \n ").trim());
|
|
3463
3475
|
}
|
|
3464
3476
|
// yarn >= 4 ships with build in plugins, see https://github.com/yarnpkg/berry/pull/4253
|
|
3465
3477
|
// trying to import those fail on this version
|
|
3466
|
-
var doesNotShipWithBuiltInPlugins = ["2", "3"].some(function (v) {
|
|
3478
|
+
var doesNotShipWithBuiltInPlugins = ["2", "3"].some(function (v) {
|
|
3479
|
+
return context.packageManagerInfo.version.startsWith(v);
|
|
3480
|
+
});
|
|
3467
3481
|
var maybeAddWorkspaceToolsCommand = doesNotShipWithBuiltInPlugins
|
|
3468
3482
|
? "RUN yarn plugin import workspace-tools"
|
|
3469
3483
|
: "";
|
|
@@ -3717,19 +3731,19 @@ var utils_1 = __nccwpck_require__(2497);
|
|
|
3717
3731
|
exports.SBOM_BUILD_JOB_NAME = "🧾 sbom";
|
|
3718
3732
|
exports.SBOM_FILE = "__sbom.json";
|
|
3719
3733
|
var createSbomBuildJob = function (context) {
|
|
3720
|
-
var _a, _b, _c, _d
|
|
3734
|
+
var _a, _b, _c, _d;
|
|
3721
3735
|
var buildConfig = context.build.config;
|
|
3722
3736
|
var defaultImage = "aquasec/trivy:0.38.3";
|
|
3723
3737
|
var defaultScript = [
|
|
3724
|
-
"trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(
|
|
3738
|
+
"trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(context.build.packageManagerInfo.componentIsInWorkspace
|
|
3725
3739
|
? "."
|
|
3726
3740
|
: context.build.dir),
|
|
3727
3741
|
];
|
|
3728
3742
|
var image = buildConfig.type === "custom" && buildConfig.sbom !== false
|
|
3729
|
-
? (
|
|
3743
|
+
? (_b = (_a = buildConfig.sbom) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : defaultImage
|
|
3730
3744
|
: defaultImage;
|
|
3731
3745
|
var script = buildConfig.type === "custom" && buildConfig.sbom !== false
|
|
3732
|
-
? (
|
|
3746
|
+
? (_d = (0, utils_1.ensureArray)((_c = buildConfig.sbom) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : defaultScript
|
|
3733
3747
|
: defaultScript;
|
|
3734
3748
|
return {
|
|
3735
3749
|
name: exports.SBOM_BUILD_JOB_NAME,
|
|
@@ -3934,6 +3948,129 @@ exports.DOCKER_REGISTRY = process.env.INLINE_DOCKER_REGISTRY ||
|
|
|
3934
3948
|
|
|
3935
3949
|
/***/ }),
|
|
3936
3950
|
|
|
3951
|
+
/***/ 2775:
|
|
3952
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
3953
|
+
|
|
3954
|
+
"use strict";
|
|
3955
|
+
|
|
3956
|
+
var __assign = (this && this.__assign) || function () {
|
|
3957
|
+
__assign = Object.assign || function(t) {
|
|
3958
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
3959
|
+
s = arguments[i];
|
|
3960
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
3961
|
+
t[p] = s[p];
|
|
3962
|
+
}
|
|
3963
|
+
return t;
|
|
3964
|
+
};
|
|
3965
|
+
return __assign.apply(this, arguments);
|
|
3966
|
+
};
|
|
3967
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3968
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3969
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3970
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
3971
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
3972
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
3973
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
3974
|
+
});
|
|
3975
|
+
};
|
|
3976
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
3977
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
3978
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
3979
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
3980
|
+
function step(op) {
|
|
3981
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
3982
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
3983
|
+
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;
|
|
3984
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
3985
|
+
switch (op[0]) {
|
|
3986
|
+
case 0: case 1: t = op; break;
|
|
3987
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
3988
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
3989
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
3990
|
+
default:
|
|
3991
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
3992
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
3993
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
3994
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
3995
|
+
if (t[2]) _.ops.pop();
|
|
3996
|
+
_.trys.pop(); continue;
|
|
3997
|
+
}
|
|
3998
|
+
op = body.call(thisArg, _);
|
|
3999
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
4000
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
4001
|
+
}
|
|
4002
|
+
};
|
|
4003
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4004
|
+
exports.createContext = exports.createComponentContext = void 0;
|
|
4005
|
+
var lodash_1 = __nccwpck_require__(3255);
|
|
4006
|
+
var build_1 = __nccwpck_require__(7862);
|
|
4007
|
+
var deploy_1 = __nccwpck_require__(8483);
|
|
4008
|
+
var utils_1 = __nccwpck_require__(2497);
|
|
4009
|
+
var getEnvironment_1 = __nccwpck_require__(5699);
|
|
4010
|
+
var getEnvironmentContext_1 = __nccwpck_require__(3663);
|
|
4011
|
+
var packageManager_1 = __nccwpck_require__(6451);
|
|
4012
|
+
var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4013
|
+
var packageManagerInfo, envContext, componentConfigWithoutDefaults, defaults, componentConfig, environment, deploy, build, customJobs, dir, context, resolvedCustomJobs;
|
|
4014
|
+
return __generator(this, function (_a) {
|
|
4015
|
+
switch (_a.label) {
|
|
4016
|
+
case 0:
|
|
4017
|
+
if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
|
|
4018
|
+
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
4019
|
+
}
|
|
4020
|
+
return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfo)(ctx.config, ctx.componentName)];
|
|
4021
|
+
case 1:
|
|
4022
|
+
packageManagerInfo = _a.sent();
|
|
4023
|
+
envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
|
|
4024
|
+
componentConfigWithoutDefaults = envContext.envConfigRaw;
|
|
4025
|
+
defaults = componentConfigWithoutDefaults.deploy
|
|
4026
|
+
? {
|
|
4027
|
+
build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(envContext),
|
|
4028
|
+
deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults(envContext),
|
|
4029
|
+
}
|
|
4030
|
+
: {
|
|
4031
|
+
build: {},
|
|
4032
|
+
deploy: {},
|
|
4033
|
+
};
|
|
4034
|
+
componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
4035
|
+
return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(ctx)];
|
|
4036
|
+
case 2:
|
|
4037
|
+
environment = _a.sent();
|
|
4038
|
+
deploy = componentConfig.deploy, build = componentConfig.build, customJobs = componentConfig.customJobs, dir = componentConfig.dir;
|
|
4039
|
+
context = {
|
|
4040
|
+
fullConfig: ctx.config,
|
|
4041
|
+
componentConfig: componentConfig,
|
|
4042
|
+
build: {
|
|
4043
|
+
dir: dir,
|
|
4044
|
+
packageManagerInfo: packageManagerInfo,
|
|
4045
|
+
config: build,
|
|
4046
|
+
},
|
|
4047
|
+
deploy: deploy
|
|
4048
|
+
? {
|
|
4049
|
+
config: deploy,
|
|
4050
|
+
}
|
|
4051
|
+
: null,
|
|
4052
|
+
componentName: ctx.componentName,
|
|
4053
|
+
environment: environment,
|
|
4054
|
+
packageManagerInfo: packageManagerInfo,
|
|
4055
|
+
pipelineType: ctx.pipelineType,
|
|
4056
|
+
trigger: ctx.trigger,
|
|
4057
|
+
};
|
|
4058
|
+
resolvedCustomJobs = (0, lodash_1.isFunction)(customJobs)
|
|
4059
|
+
? customJobs(context)
|
|
4060
|
+
: customJobs;
|
|
4061
|
+
return [2 /*return*/, __assign(__assign({}, context), { customJobs: resolvedCustomJobs })];
|
|
4062
|
+
}
|
|
4063
|
+
});
|
|
4064
|
+
}); };
|
|
4065
|
+
exports.createComponentContext = createComponentContext;
|
|
4066
|
+
/**
|
|
4067
|
+
* @deprecated use createComponentContext instead
|
|
4068
|
+
*/
|
|
4069
|
+
exports.createContext = exports.createComponentContext;
|
|
4070
|
+
//# sourceMappingURL=createComponentContext.js.map
|
|
4071
|
+
|
|
4072
|
+
/***/ }),
|
|
4073
|
+
|
|
3937
4074
|
/***/ 7827:
|
|
3938
4075
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
3939
4076
|
|
|
@@ -4388,17 +4525,6 @@ exports.getReviewSlug = getReviewSlug;
|
|
|
4388
4525
|
|
|
4389
4526
|
"use strict";
|
|
4390
4527
|
|
|
4391
|
-
var __assign = (this && this.__assign) || function () {
|
|
4392
|
-
__assign = Object.assign || function(t) {
|
|
4393
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4394
|
-
s = arguments[i];
|
|
4395
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
4396
|
-
t[p] = s[p];
|
|
4397
|
-
}
|
|
4398
|
-
return t;
|
|
4399
|
-
};
|
|
4400
|
-
return __assign.apply(this, arguments);
|
|
4401
|
-
};
|
|
4402
4528
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4403
4529
|
if (k2 === undefined) k2 = k;
|
|
4404
4530
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -4413,107 +4539,10 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
4413
4539
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
4414
4540
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
4415
4541
|
};
|
|
4416
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4417
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4418
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4419
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
4420
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
4421
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
4422
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
4423
|
-
});
|
|
4424
|
-
};
|
|
4425
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
4426
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
4427
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
4428
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
4429
|
-
function step(op) {
|
|
4430
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
4431
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
4432
|
-
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;
|
|
4433
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
4434
|
-
switch (op[0]) {
|
|
4435
|
-
case 0: case 1: t = op; break;
|
|
4436
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
4437
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
4438
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
4439
|
-
default:
|
|
4440
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
4441
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
4442
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
4443
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
4444
|
-
if (t[2]) _.ops.pop();
|
|
4445
|
-
_.trys.pop(); continue;
|
|
4446
|
-
}
|
|
4447
|
-
op = body.call(thisArg, _);
|
|
4448
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
4449
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
4450
|
-
}
|
|
4451
|
-
};
|
|
4452
4542
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4453
|
-
|
|
4454
|
-
var lodash_1 = __nccwpck_require__(3255);
|
|
4455
|
-
var build_1 = __nccwpck_require__(7862);
|
|
4456
|
-
var deploy_1 = __nccwpck_require__(8483);
|
|
4457
|
-
var utils_1 = __nccwpck_require__(2497);
|
|
4458
|
-
var getEnvironment_1 = __nccwpck_require__(5699);
|
|
4459
|
-
var getEnvironmentContext_1 = __nccwpck_require__(3663);
|
|
4543
|
+
__exportStar(__nccwpck_require__(2775), exports);
|
|
4460
4544
|
__exportStar(__nccwpck_require__(5699), exports);
|
|
4461
4545
|
__exportStar(__nccwpck_require__(5133), exports);
|
|
4462
|
-
var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4463
|
-
var envContext, componentConfigWithoutDefaults, defaults, componentConfig, environment, deploy, build, customJobs, dir, context, resolvedCustomJobs;
|
|
4464
|
-
return __generator(this, function (_a) {
|
|
4465
|
-
switch (_a.label) {
|
|
4466
|
-
case 0:
|
|
4467
|
-
if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
|
|
4468
|
-
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
4469
|
-
}
|
|
4470
|
-
envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
|
|
4471
|
-
componentConfigWithoutDefaults = envContext.envConfigRaw;
|
|
4472
|
-
defaults = componentConfigWithoutDefaults.deploy
|
|
4473
|
-
? {
|
|
4474
|
-
build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(envContext),
|
|
4475
|
-
deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults(envContext),
|
|
4476
|
-
}
|
|
4477
|
-
: {
|
|
4478
|
-
build: {},
|
|
4479
|
-
deploy: {},
|
|
4480
|
-
};
|
|
4481
|
-
componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
4482
|
-
return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(ctx)];
|
|
4483
|
-
case 1:
|
|
4484
|
-
environment = _a.sent();
|
|
4485
|
-
deploy = componentConfig.deploy, build = componentConfig.build, customJobs = componentConfig.customJobs, dir = componentConfig.dir;
|
|
4486
|
-
context = {
|
|
4487
|
-
fullConfig: ctx.config,
|
|
4488
|
-
componentConfig: componentConfig,
|
|
4489
|
-
build: {
|
|
4490
|
-
dir: dir,
|
|
4491
|
-
packageManagerInfo: ctx.packageManagerInfo,
|
|
4492
|
-
config: build,
|
|
4493
|
-
},
|
|
4494
|
-
deploy: deploy
|
|
4495
|
-
? {
|
|
4496
|
-
config: deploy,
|
|
4497
|
-
}
|
|
4498
|
-
: null,
|
|
4499
|
-
componentName: ctx.componentName,
|
|
4500
|
-
environment: environment,
|
|
4501
|
-
packageManagerInfo: ctx.packageManagerInfo,
|
|
4502
|
-
pipelineType: ctx.pipelineType,
|
|
4503
|
-
trigger: ctx.trigger,
|
|
4504
|
-
};
|
|
4505
|
-
resolvedCustomJobs = (0, lodash_1.isFunction)(customJobs)
|
|
4506
|
-
? customJobs(context)
|
|
4507
|
-
: customJobs;
|
|
4508
|
-
return [2 /*return*/, __assign(__assign({}, context), { customJobs: resolvedCustomJobs })];
|
|
4509
|
-
}
|
|
4510
|
-
});
|
|
4511
|
-
}); };
|
|
4512
|
-
exports.createComponentContext = createComponentContext;
|
|
4513
|
-
/**
|
|
4514
|
-
* @deprecated use createComponentContext instead
|
|
4515
|
-
*/
|
|
4516
|
-
exports.createContext = exports.createComponentContext;
|
|
4517
4546
|
//# sourceMappingURL=index.js.map
|
|
4518
4547
|
|
|
4519
4548
|
/***/ }),
|
|
@@ -7660,7 +7689,6 @@ exports.createJobsForComponent = void 0;
|
|
|
7660
7689
|
var build_1 = __nccwpck_require__(7862);
|
|
7661
7690
|
var context_1 = __nccwpck_require__(5875);
|
|
7662
7691
|
var deploy_1 = __nccwpck_require__(8483);
|
|
7663
|
-
var packageManager_1 = __nccwpck_require__(6451);
|
|
7664
7692
|
var injectDefaultVarsInCustomJobs = function (context, jobs) {
|
|
7665
7693
|
return jobs.map(function (_a) {
|
|
7666
7694
|
var _b;
|
|
@@ -7685,14 +7713,11 @@ var createRawJobs = function (context) {
|
|
|
7685
7713
|
return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
|
|
7686
7714
|
};
|
|
7687
7715
|
var createJobsForComponent = function (contextContext) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7688
|
-
var
|
|
7716
|
+
var context;
|
|
7689
7717
|
return __generator(this, function (_a) {
|
|
7690
7718
|
switch (_a.label) {
|
|
7691
|
-
case 0: return [4 /*yield*/, (0,
|
|
7719
|
+
case 0: return [4 /*yield*/, (0, context_1.createComponentContext)(contextContext)];
|
|
7692
7720
|
case 1:
|
|
7693
|
-
packageManagerInfo = _a.sent();
|
|
7694
|
-
return [4 /*yield*/, (0, context_1.createComponentContext)(__assign(__assign({}, contextContext), { packageManagerInfo: packageManagerInfo }))];
|
|
7695
|
-
case 2:
|
|
7696
7721
|
context = _a.sent();
|
|
7697
7722
|
return [2 /*return*/, createRawJobs(context).map(function (job) { return (__assign(__assign({}, job), { context: context })); })];
|
|
7698
7723
|
}
|