@catladder/pipeline 0.0.0-main-049e2ce6 → 0.0.0-main-e8632d85
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/catladder-gitlab/index.js +199 -186
- package/dist/constants.js +1 -1
- package/dist/context/createComponentContext.d.ts +16 -0
- package/dist/context/createComponentContext.js +190 -0
- package/dist/context/index.d.ts +2 -17
- package/dist/context/index.js +2 -186
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/context/createComponentContext.ts +91 -0
- package/src/context/index.ts +1 -92
|
@@ -25052,11 +25052,208 @@ 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-e8632d85" || 0;
|
|
25056
25056
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
25057
25057
|
|
|
25058
25058
|
/***/ }),
|
|
25059
25059
|
|
|
25060
|
+
/***/ 2234:
|
|
25061
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
25062
|
+
|
|
25063
|
+
"use strict";
|
|
25064
|
+
|
|
25065
|
+
|
|
25066
|
+
var __assign = this && this.__assign || function () {
|
|
25067
|
+
__assign = Object.assign || function (t) {
|
|
25068
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
25069
|
+
s = arguments[i];
|
|
25070
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
25071
|
+
}
|
|
25072
|
+
return t;
|
|
25073
|
+
};
|
|
25074
|
+
return __assign.apply(this, arguments);
|
|
25075
|
+
};
|
|
25076
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
25077
|
+
function adopt(value) {
|
|
25078
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
25079
|
+
resolve(value);
|
|
25080
|
+
});
|
|
25081
|
+
}
|
|
25082
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
25083
|
+
function fulfilled(value) {
|
|
25084
|
+
try {
|
|
25085
|
+
step(generator.next(value));
|
|
25086
|
+
} catch (e) {
|
|
25087
|
+
reject(e);
|
|
25088
|
+
}
|
|
25089
|
+
}
|
|
25090
|
+
function rejected(value) {
|
|
25091
|
+
try {
|
|
25092
|
+
step(generator["throw"](value));
|
|
25093
|
+
} catch (e) {
|
|
25094
|
+
reject(e);
|
|
25095
|
+
}
|
|
25096
|
+
}
|
|
25097
|
+
function step(result) {
|
|
25098
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
25099
|
+
}
|
|
25100
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
25101
|
+
});
|
|
25102
|
+
};
|
|
25103
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
25104
|
+
var _ = {
|
|
25105
|
+
label: 0,
|
|
25106
|
+
sent: function () {
|
|
25107
|
+
if (t[0] & 1) throw t[1];
|
|
25108
|
+
return t[1];
|
|
25109
|
+
},
|
|
25110
|
+
trys: [],
|
|
25111
|
+
ops: []
|
|
25112
|
+
},
|
|
25113
|
+
f,
|
|
25114
|
+
y,
|
|
25115
|
+
t,
|
|
25116
|
+
g;
|
|
25117
|
+
return g = {
|
|
25118
|
+
next: verb(0),
|
|
25119
|
+
"throw": verb(1),
|
|
25120
|
+
"return": verb(2)
|
|
25121
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
25122
|
+
return this;
|
|
25123
|
+
}), g;
|
|
25124
|
+
function verb(n) {
|
|
25125
|
+
return function (v) {
|
|
25126
|
+
return step([n, v]);
|
|
25127
|
+
};
|
|
25128
|
+
}
|
|
25129
|
+
function step(op) {
|
|
25130
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
25131
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
25132
|
+
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;
|
|
25133
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
25134
|
+
switch (op[0]) {
|
|
25135
|
+
case 0:
|
|
25136
|
+
case 1:
|
|
25137
|
+
t = op;
|
|
25138
|
+
break;
|
|
25139
|
+
case 4:
|
|
25140
|
+
_.label++;
|
|
25141
|
+
return {
|
|
25142
|
+
value: op[1],
|
|
25143
|
+
done: false
|
|
25144
|
+
};
|
|
25145
|
+
case 5:
|
|
25146
|
+
_.label++;
|
|
25147
|
+
y = op[1];
|
|
25148
|
+
op = [0];
|
|
25149
|
+
continue;
|
|
25150
|
+
case 7:
|
|
25151
|
+
op = _.ops.pop();
|
|
25152
|
+
_.trys.pop();
|
|
25153
|
+
continue;
|
|
25154
|
+
default:
|
|
25155
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
25156
|
+
_ = 0;
|
|
25157
|
+
continue;
|
|
25158
|
+
}
|
|
25159
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
25160
|
+
_.label = op[1];
|
|
25161
|
+
break;
|
|
25162
|
+
}
|
|
25163
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
25164
|
+
_.label = t[1];
|
|
25165
|
+
t = op;
|
|
25166
|
+
break;
|
|
25167
|
+
}
|
|
25168
|
+
if (t && _.label < t[2]) {
|
|
25169
|
+
_.label = t[2];
|
|
25170
|
+
_.ops.push(op);
|
|
25171
|
+
break;
|
|
25172
|
+
}
|
|
25173
|
+
if (t[2]) _.ops.pop();
|
|
25174
|
+
_.trys.pop();
|
|
25175
|
+
continue;
|
|
25176
|
+
}
|
|
25177
|
+
op = body.call(thisArg, _);
|
|
25178
|
+
} catch (e) {
|
|
25179
|
+
op = [6, e];
|
|
25180
|
+
y = 0;
|
|
25181
|
+
} finally {
|
|
25182
|
+
f = t = 0;
|
|
25183
|
+
}
|
|
25184
|
+
if (op[0] & 5) throw op[1];
|
|
25185
|
+
return {
|
|
25186
|
+
value: op[0] ? op[1] : void 0,
|
|
25187
|
+
done: true
|
|
25188
|
+
};
|
|
25189
|
+
}
|
|
25190
|
+
};
|
|
25191
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
25192
|
+
value: true
|
|
25193
|
+
}));
|
|
25194
|
+
exports.createContext = exports.createComponentContext = void 0;
|
|
25195
|
+
var lodash_1 = __nccwpck_require__(3255);
|
|
25196
|
+
var build_1 = __nccwpck_require__(2004);
|
|
25197
|
+
var deploy_1 = __nccwpck_require__(1264);
|
|
25198
|
+
var utils_1 = __nccwpck_require__(1815);
|
|
25199
|
+
var getEnvironment_1 = __nccwpck_require__(4029);
|
|
25200
|
+
var getEnvironmentContext_1 = __nccwpck_require__(3817);
|
|
25201
|
+
var createComponentContext = function (ctx) {
|
|
25202
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
25203
|
+
var envContext, componentConfigWithoutDefaults, defaults, componentConfig, environment, deploy, build, customJobs, dir, context, resolvedCustomJobs;
|
|
25204
|
+
return __generator(this, function (_a) {
|
|
25205
|
+
switch (_a.label) {
|
|
25206
|
+
case 0:
|
|
25207
|
+
if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
|
|
25208
|
+
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
25209
|
+
}
|
|
25210
|
+
envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
|
|
25211
|
+
componentConfigWithoutDefaults = envContext.envConfigRaw;
|
|
25212
|
+
defaults = componentConfigWithoutDefaults.deploy ? {
|
|
25213
|
+
build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(envContext),
|
|
25214
|
+
deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults(envContext)
|
|
25215
|
+
} : {
|
|
25216
|
+
build: {},
|
|
25217
|
+
deploy: {}
|
|
25218
|
+
};
|
|
25219
|
+
componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
25220
|
+
return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(ctx)];
|
|
25221
|
+
case 1:
|
|
25222
|
+
environment = _a.sent();
|
|
25223
|
+
deploy = componentConfig.deploy, build = componentConfig.build, customJobs = componentConfig.customJobs, dir = componentConfig.dir;
|
|
25224
|
+
context = {
|
|
25225
|
+
fullConfig: ctx.config,
|
|
25226
|
+
componentConfig: componentConfig,
|
|
25227
|
+
build: {
|
|
25228
|
+
dir: dir,
|
|
25229
|
+
packageManagerInfo: ctx.packageManagerInfo,
|
|
25230
|
+
config: build
|
|
25231
|
+
},
|
|
25232
|
+
deploy: deploy ? {
|
|
25233
|
+
config: deploy
|
|
25234
|
+
} : null,
|
|
25235
|
+
componentName: ctx.componentName,
|
|
25236
|
+
environment: environment,
|
|
25237
|
+
packageManagerInfo: ctx.packageManagerInfo,
|
|
25238
|
+
pipelineType: ctx.pipelineType,
|
|
25239
|
+
trigger: ctx.trigger
|
|
25240
|
+
};
|
|
25241
|
+
resolvedCustomJobs = (0, lodash_1.isFunction)(customJobs) ? customJobs(context) : customJobs;
|
|
25242
|
+
return [2 /*return*/, __assign(__assign({}, context), {
|
|
25243
|
+
customJobs: resolvedCustomJobs
|
|
25244
|
+
})];
|
|
25245
|
+
}
|
|
25246
|
+
});
|
|
25247
|
+
});
|
|
25248
|
+
};
|
|
25249
|
+
exports.createComponentContext = createComponentContext;
|
|
25250
|
+
/**
|
|
25251
|
+
* @deprecated use createComponentContext instead
|
|
25252
|
+
*/
|
|
25253
|
+
exports.createContext = exports.createComponentContext;
|
|
25254
|
+
|
|
25255
|
+
/***/ }),
|
|
25256
|
+
|
|
25060
25257
|
/***/ 4906:
|
|
25061
25258
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
25062
25259
|
|
|
@@ -25731,16 +25928,6 @@ exports.getReviewSlug = getReviewSlug;
|
|
|
25731
25928
|
"use strict";
|
|
25732
25929
|
|
|
25733
25930
|
|
|
25734
|
-
var __assign = this && this.__assign || function () {
|
|
25735
|
-
__assign = Object.assign || function (t) {
|
|
25736
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
25737
|
-
s = arguments[i];
|
|
25738
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
25739
|
-
}
|
|
25740
|
-
return t;
|
|
25741
|
-
};
|
|
25742
|
-
return __assign.apply(this, arguments);
|
|
25743
|
-
};
|
|
25744
25931
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
25745
25932
|
if (k2 === undefined) k2 = k;
|
|
25746
25933
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -25760,186 +25947,12 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
|
|
|
25760
25947
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
25761
25948
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
25762
25949
|
};
|
|
25763
|
-
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
25764
|
-
function adopt(value) {
|
|
25765
|
-
return value instanceof P ? value : new P(function (resolve) {
|
|
25766
|
-
resolve(value);
|
|
25767
|
-
});
|
|
25768
|
-
}
|
|
25769
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
25770
|
-
function fulfilled(value) {
|
|
25771
|
-
try {
|
|
25772
|
-
step(generator.next(value));
|
|
25773
|
-
} catch (e) {
|
|
25774
|
-
reject(e);
|
|
25775
|
-
}
|
|
25776
|
-
}
|
|
25777
|
-
function rejected(value) {
|
|
25778
|
-
try {
|
|
25779
|
-
step(generator["throw"](value));
|
|
25780
|
-
} catch (e) {
|
|
25781
|
-
reject(e);
|
|
25782
|
-
}
|
|
25783
|
-
}
|
|
25784
|
-
function step(result) {
|
|
25785
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
25786
|
-
}
|
|
25787
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
25788
|
-
});
|
|
25789
|
-
};
|
|
25790
|
-
var __generator = this && this.__generator || function (thisArg, body) {
|
|
25791
|
-
var _ = {
|
|
25792
|
-
label: 0,
|
|
25793
|
-
sent: function () {
|
|
25794
|
-
if (t[0] & 1) throw t[1];
|
|
25795
|
-
return t[1];
|
|
25796
|
-
},
|
|
25797
|
-
trys: [],
|
|
25798
|
-
ops: []
|
|
25799
|
-
},
|
|
25800
|
-
f,
|
|
25801
|
-
y,
|
|
25802
|
-
t,
|
|
25803
|
-
g;
|
|
25804
|
-
return g = {
|
|
25805
|
-
next: verb(0),
|
|
25806
|
-
"throw": verb(1),
|
|
25807
|
-
"return": verb(2)
|
|
25808
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
25809
|
-
return this;
|
|
25810
|
-
}), g;
|
|
25811
|
-
function verb(n) {
|
|
25812
|
-
return function (v) {
|
|
25813
|
-
return step([n, v]);
|
|
25814
|
-
};
|
|
25815
|
-
}
|
|
25816
|
-
function step(op) {
|
|
25817
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
25818
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
25819
|
-
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;
|
|
25820
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
25821
|
-
switch (op[0]) {
|
|
25822
|
-
case 0:
|
|
25823
|
-
case 1:
|
|
25824
|
-
t = op;
|
|
25825
|
-
break;
|
|
25826
|
-
case 4:
|
|
25827
|
-
_.label++;
|
|
25828
|
-
return {
|
|
25829
|
-
value: op[1],
|
|
25830
|
-
done: false
|
|
25831
|
-
};
|
|
25832
|
-
case 5:
|
|
25833
|
-
_.label++;
|
|
25834
|
-
y = op[1];
|
|
25835
|
-
op = [0];
|
|
25836
|
-
continue;
|
|
25837
|
-
case 7:
|
|
25838
|
-
op = _.ops.pop();
|
|
25839
|
-
_.trys.pop();
|
|
25840
|
-
continue;
|
|
25841
|
-
default:
|
|
25842
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
25843
|
-
_ = 0;
|
|
25844
|
-
continue;
|
|
25845
|
-
}
|
|
25846
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
25847
|
-
_.label = op[1];
|
|
25848
|
-
break;
|
|
25849
|
-
}
|
|
25850
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
25851
|
-
_.label = t[1];
|
|
25852
|
-
t = op;
|
|
25853
|
-
break;
|
|
25854
|
-
}
|
|
25855
|
-
if (t && _.label < t[2]) {
|
|
25856
|
-
_.label = t[2];
|
|
25857
|
-
_.ops.push(op);
|
|
25858
|
-
break;
|
|
25859
|
-
}
|
|
25860
|
-
if (t[2]) _.ops.pop();
|
|
25861
|
-
_.trys.pop();
|
|
25862
|
-
continue;
|
|
25863
|
-
}
|
|
25864
|
-
op = body.call(thisArg, _);
|
|
25865
|
-
} catch (e) {
|
|
25866
|
-
op = [6, e];
|
|
25867
|
-
y = 0;
|
|
25868
|
-
} finally {
|
|
25869
|
-
f = t = 0;
|
|
25870
|
-
}
|
|
25871
|
-
if (op[0] & 5) throw op[1];
|
|
25872
|
-
return {
|
|
25873
|
-
value: op[0] ? op[1] : void 0,
|
|
25874
|
-
done: true
|
|
25875
|
-
};
|
|
25876
|
-
}
|
|
25877
|
-
};
|
|
25878
25950
|
Object.defineProperty(exports, "__esModule", ({
|
|
25879
25951
|
value: true
|
|
25880
25952
|
}));
|
|
25881
|
-
|
|
25882
|
-
var lodash_1 = __nccwpck_require__(3255);
|
|
25883
|
-
var build_1 = __nccwpck_require__(2004);
|
|
25884
|
-
var deploy_1 = __nccwpck_require__(1264);
|
|
25885
|
-
var utils_1 = __nccwpck_require__(1815);
|
|
25886
|
-
var getEnvironment_1 = __nccwpck_require__(4029);
|
|
25887
|
-
var getEnvironmentContext_1 = __nccwpck_require__(3817);
|
|
25953
|
+
__exportStar(__nccwpck_require__(2234), exports);
|
|
25888
25954
|
__exportStar(__nccwpck_require__(4029), exports);
|
|
25889
25955
|
__exportStar(__nccwpck_require__(2292), exports);
|
|
25890
|
-
var createComponentContext = function (ctx) {
|
|
25891
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
25892
|
-
var envContext, componentConfigWithoutDefaults, defaults, componentConfig, environment, deploy, build, customJobs, dir, context, resolvedCustomJobs;
|
|
25893
|
-
return __generator(this, function (_a) {
|
|
25894
|
-
switch (_a.label) {
|
|
25895
|
-
case 0:
|
|
25896
|
-
if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
|
|
25897
|
-
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
25898
|
-
}
|
|
25899
|
-
envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
|
|
25900
|
-
componentConfigWithoutDefaults = envContext.envConfigRaw;
|
|
25901
|
-
defaults = componentConfigWithoutDefaults.deploy ? {
|
|
25902
|
-
build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(envContext),
|
|
25903
|
-
deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults(envContext)
|
|
25904
|
-
} : {
|
|
25905
|
-
build: {},
|
|
25906
|
-
deploy: {}
|
|
25907
|
-
};
|
|
25908
|
-
componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
25909
|
-
return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(ctx)];
|
|
25910
|
-
case 1:
|
|
25911
|
-
environment = _a.sent();
|
|
25912
|
-
deploy = componentConfig.deploy, build = componentConfig.build, customJobs = componentConfig.customJobs, dir = componentConfig.dir;
|
|
25913
|
-
context = {
|
|
25914
|
-
fullConfig: ctx.config,
|
|
25915
|
-
componentConfig: componentConfig,
|
|
25916
|
-
build: {
|
|
25917
|
-
dir: dir,
|
|
25918
|
-
packageManagerInfo: ctx.packageManagerInfo,
|
|
25919
|
-
config: build
|
|
25920
|
-
},
|
|
25921
|
-
deploy: deploy ? {
|
|
25922
|
-
config: deploy
|
|
25923
|
-
} : null,
|
|
25924
|
-
componentName: ctx.componentName,
|
|
25925
|
-
environment: environment,
|
|
25926
|
-
packageManagerInfo: ctx.packageManagerInfo,
|
|
25927
|
-
pipelineType: ctx.pipelineType,
|
|
25928
|
-
trigger: ctx.trigger
|
|
25929
|
-
};
|
|
25930
|
-
resolvedCustomJobs = (0, lodash_1.isFunction)(customJobs) ? customJobs(context) : customJobs;
|
|
25931
|
-
return [2 /*return*/, __assign(__assign({}, context), {
|
|
25932
|
-
customJobs: resolvedCustomJobs
|
|
25933
|
-
})];
|
|
25934
|
-
}
|
|
25935
|
-
});
|
|
25936
|
-
});
|
|
25937
|
-
};
|
|
25938
|
-
exports.createComponentContext = createComponentContext;
|
|
25939
|
-
/**
|
|
25940
|
-
* @deprecated use createComponentContext instead
|
|
25941
|
-
*/
|
|
25942
|
-
exports.createContext = exports.createComponentContext;
|
|
25943
25956
|
|
|
25944
25957
|
/***/ }),
|
|
25945
25958
|
|
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-e8632d85" || "latest";
|
|
8
8
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "git.panter.ch:5001/catladder/catladder";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PipelineType } from "../types";
|
|
2
|
+
import type { Config, PipelineTrigger } from "../types/config";
|
|
3
|
+
import type { ComponentContext, PackageManagerInfo } from "../types/context";
|
|
4
|
+
export type CreateComponentContextContext = {
|
|
5
|
+
config: Config;
|
|
6
|
+
componentName: string;
|
|
7
|
+
env: string;
|
|
8
|
+
pipelineType?: PipelineType;
|
|
9
|
+
trigger?: PipelineTrigger;
|
|
10
|
+
packageManagerInfo?: PackageManagerInfo;
|
|
11
|
+
};
|
|
12
|
+
export declare const createComponentContext: (ctx: CreateComponentContextContext) => Promise<ComponentContext>;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated use createComponentContext instead
|
|
15
|
+
*/
|
|
16
|
+
export declare const createContext: (ctx: CreateComponentContextContext) => Promise<ComponentContext>;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __assign = this && this.__assign || function () {
|
|
4
|
+
__assign = Object.assign || function (t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) {
|
|
15
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
16
|
+
resolve(value);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) {
|
|
21
|
+
try {
|
|
22
|
+
step(generator.next(value));
|
|
23
|
+
} catch (e) {
|
|
24
|
+
reject(e);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function rejected(value) {
|
|
28
|
+
try {
|
|
29
|
+
step(generator["throw"](value));
|
|
30
|
+
} catch (e) {
|
|
31
|
+
reject(e);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function step(result) {
|
|
35
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
36
|
+
}
|
|
37
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
41
|
+
var _ = {
|
|
42
|
+
label: 0,
|
|
43
|
+
sent: function () {
|
|
44
|
+
if (t[0] & 1) throw t[1];
|
|
45
|
+
return t[1];
|
|
46
|
+
},
|
|
47
|
+
trys: [],
|
|
48
|
+
ops: []
|
|
49
|
+
},
|
|
50
|
+
f,
|
|
51
|
+
y,
|
|
52
|
+
t,
|
|
53
|
+
g;
|
|
54
|
+
return g = {
|
|
55
|
+
next: verb(0),
|
|
56
|
+
"throw": verb(1),
|
|
57
|
+
"return": verb(2)
|
|
58
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
59
|
+
return this;
|
|
60
|
+
}), g;
|
|
61
|
+
function verb(n) {
|
|
62
|
+
return function (v) {
|
|
63
|
+
return step([n, v]);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function step(op) {
|
|
67
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
68
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
69
|
+
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;
|
|
70
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
71
|
+
switch (op[0]) {
|
|
72
|
+
case 0:
|
|
73
|
+
case 1:
|
|
74
|
+
t = op;
|
|
75
|
+
break;
|
|
76
|
+
case 4:
|
|
77
|
+
_.label++;
|
|
78
|
+
return {
|
|
79
|
+
value: op[1],
|
|
80
|
+
done: false
|
|
81
|
+
};
|
|
82
|
+
case 5:
|
|
83
|
+
_.label++;
|
|
84
|
+
y = op[1];
|
|
85
|
+
op = [0];
|
|
86
|
+
continue;
|
|
87
|
+
case 7:
|
|
88
|
+
op = _.ops.pop();
|
|
89
|
+
_.trys.pop();
|
|
90
|
+
continue;
|
|
91
|
+
default:
|
|
92
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
93
|
+
_ = 0;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
97
|
+
_.label = op[1];
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
101
|
+
_.label = t[1];
|
|
102
|
+
t = op;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
if (t && _.label < t[2]) {
|
|
106
|
+
_.label = t[2];
|
|
107
|
+
_.ops.push(op);
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
if (t[2]) _.ops.pop();
|
|
111
|
+
_.trys.pop();
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
op = body.call(thisArg, _);
|
|
115
|
+
} catch (e) {
|
|
116
|
+
op = [6, e];
|
|
117
|
+
y = 0;
|
|
118
|
+
} finally {
|
|
119
|
+
f = t = 0;
|
|
120
|
+
}
|
|
121
|
+
if (op[0] & 5) throw op[1];
|
|
122
|
+
return {
|
|
123
|
+
value: op[0] ? op[1] : void 0,
|
|
124
|
+
done: true
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
Object.defineProperty(exports, "__esModule", {
|
|
129
|
+
value: true
|
|
130
|
+
});
|
|
131
|
+
exports.createContext = exports.createComponentContext = void 0;
|
|
132
|
+
var lodash_1 = require("lodash");
|
|
133
|
+
var build_1 = require("../build");
|
|
134
|
+
var deploy_1 = require("../deploy");
|
|
135
|
+
var utils_1 = require("../utils");
|
|
136
|
+
var getEnvironment_1 = require("./getEnvironment");
|
|
137
|
+
var getEnvironmentContext_1 = require("./getEnvironmentContext");
|
|
138
|
+
var createComponentContext = function (ctx) {
|
|
139
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
140
|
+
var envContext, componentConfigWithoutDefaults, defaults, componentConfig, environment, deploy, build, customJobs, dir, context, resolvedCustomJobs;
|
|
141
|
+
return __generator(this, function (_a) {
|
|
142
|
+
switch (_a.label) {
|
|
143
|
+
case 0:
|
|
144
|
+
if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
|
|
145
|
+
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
146
|
+
}
|
|
147
|
+
envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
|
|
148
|
+
componentConfigWithoutDefaults = envContext.envConfigRaw;
|
|
149
|
+
defaults = componentConfigWithoutDefaults.deploy ? {
|
|
150
|
+
build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(envContext),
|
|
151
|
+
deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults(envContext)
|
|
152
|
+
} : {
|
|
153
|
+
build: {},
|
|
154
|
+
deploy: {}
|
|
155
|
+
};
|
|
156
|
+
componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
157
|
+
return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(ctx)];
|
|
158
|
+
case 1:
|
|
159
|
+
environment = _a.sent();
|
|
160
|
+
deploy = componentConfig.deploy, build = componentConfig.build, customJobs = componentConfig.customJobs, dir = componentConfig.dir;
|
|
161
|
+
context = {
|
|
162
|
+
fullConfig: ctx.config,
|
|
163
|
+
componentConfig: componentConfig,
|
|
164
|
+
build: {
|
|
165
|
+
dir: dir,
|
|
166
|
+
packageManagerInfo: ctx.packageManagerInfo,
|
|
167
|
+
config: build
|
|
168
|
+
},
|
|
169
|
+
deploy: deploy ? {
|
|
170
|
+
config: deploy
|
|
171
|
+
} : null,
|
|
172
|
+
componentName: ctx.componentName,
|
|
173
|
+
environment: environment,
|
|
174
|
+
packageManagerInfo: ctx.packageManagerInfo,
|
|
175
|
+
pipelineType: ctx.pipelineType,
|
|
176
|
+
trigger: ctx.trigger
|
|
177
|
+
};
|
|
178
|
+
resolvedCustomJobs = (0, lodash_1.isFunction)(customJobs) ? customJobs(context) : customJobs;
|
|
179
|
+
return [2 /*return*/, __assign(__assign({}, context), {
|
|
180
|
+
customJobs: resolvedCustomJobs
|
|
181
|
+
})];
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
exports.createComponentContext = createComponentContext;
|
|
187
|
+
/**
|
|
188
|
+
* @deprecated use createComponentContext instead
|
|
189
|
+
*/
|
|
190
|
+
exports.createContext = exports.createComponentContext;
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Config, PipelineTrigger } from "../types/config";
|
|
3
|
-
import type { ComponentContext, PackageManagerInfo } from "../types/context";
|
|
1
|
+
export * from "./createComponentContext";
|
|
4
2
|
export * from "./getEnvironment";
|
|
5
|
-
export * from "./getEnvironmentVariables";
|
|
6
|
-
export type CreateComponentContextContext = {
|
|
7
|
-
config: Config;
|
|
8
|
-
componentName: string;
|
|
9
|
-
env: string;
|
|
10
|
-
pipelineType?: PipelineType;
|
|
11
|
-
trigger?: PipelineTrigger;
|
|
12
|
-
packageManagerInfo?: PackageManagerInfo;
|
|
13
|
-
};
|
|
14
|
-
export declare const createComponentContext: (ctx: CreateComponentContextContext) => Promise<ComponentContext>;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated use createComponentContext instead
|
|
17
|
-
*/
|
|
18
|
-
export declare const createContext: (ctx: CreateComponentContextContext) => Promise<ComponentContext>;
|
|
3
|
+
export * from "./getEnvironmentVariables";
|