@catladder/cli 1.142.2 → 1.144.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/apps/cli/cli.js +2 -1
  2. package/dist/apps/cli/cli.js.map +1 -1
  3. package/dist/apps/cli/commands/cloudSQL/index.js +0 -1
  4. package/dist/apps/cli/commands/cloudSQL/index.js.map +1 -1
  5. package/dist/apps/cli/commands/general/index.js +0 -14
  6. package/dist/apps/cli/commands/general/index.js.map +1 -1
  7. package/dist/apps/cli/commands/project/commandListPods.js +2 -2
  8. package/dist/apps/cli/commands/project/commandListPods.js.map +1 -1
  9. package/dist/apps/cli/commands/project/index.js +0 -1
  10. package/dist/apps/cli/commands/project/index.js.map +1 -1
  11. package/dist/apps/cli/verify/index.js +4 -31
  12. package/dist/apps/cli/verify/index.js.map +1 -1
  13. package/dist/bundles/catenv/index.js +3 -3
  14. package/dist/bundles/cli/index.js +20 -282
  15. package/dist/config/getProjectConfig.d.ts +0 -2
  16. package/dist/config/getProjectConfig.js +5 -36
  17. package/dist/config/getProjectConfig.js.map +1 -1
  18. package/dist/tsconfig.tsbuildinfo +1 -1
  19. package/dist/utils/boxWithAscii.d.ts +1 -0
  20. package/dist/utils/boxWithAscii.js +14 -0
  21. package/dist/utils/boxWithAscii.js.map +1 -0
  22. package/dist/utils/editAsFile.js +3 -3
  23. package/dist/utils/editAsFile.js.map +1 -1
  24. package/dist/utils/files.d.ts +0 -1
  25. package/dist/utils/files.js +1 -19
  26. package/dist/utils/files.js.map +1 -1
  27. package/dist/utils/preferences/index.js +3 -3
  28. package/dist/utils/preferences/index.js.map +1 -1
  29. package/package.json +4 -5
  30. package/src/apps/cli/cli.ts +4 -1
  31. package/src/apps/cli/commands/cloudSQL/index.ts +0 -1
  32. package/src/apps/cli/commands/general/index.ts +0 -6
  33. package/src/apps/cli/commands/project/commandListPods.ts +4 -2
  34. package/src/apps/cli/commands/project/index.ts +0 -1
  35. package/src/apps/cli/verify/index.ts +1 -17
  36. package/src/config/getProjectConfig.ts +1 -14
  37. package/src/utils/boxWithAscii.ts +9 -0
  38. package/src/utils/editAsFile.ts +4 -3
  39. package/src/utils/files.ts +0 -9
  40. package/src/utils/preferences/index.ts +4 -6
  41. package/dist/apps/cli/commands/project/commandInitProject.old.d.ts +0 -3
  42. package/dist/apps/cli/commands/project/commandInitProject.old.js +0 -345
  43. package/dist/apps/cli/commands/project/commandInitProject.old.js.map +0 -1
  44. package/dist/apps/cli/config/writeConfig.d.ts +0 -5
  45. package/dist/apps/cli/config/writeConfig.js +0 -106
  46. package/dist/apps/cli/config/writeConfig.js.map +0 -1
  47. package/dist/apps/cli/verify/migration/fromv2.d.ts +0 -4
  48. package/dist/apps/cli/verify/migration/fromv2.js +0 -349
  49. package/dist/apps/cli/verify/migration/fromv2.js.map +0 -1
  50. package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +0 -4
  51. package/dist/apps/cli/verify/migration/migrateSecrets.js +0 -91
  52. package/dist/apps/cli/verify/migration/migrateSecrets.js.map +0 -1
  53. package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +0 -18
  54. package/dist/apps/cli/verify/migration/oldGitlabCi.js +0 -30
  55. package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +0 -1
  56. package/dist/utils/passwordstore/index.d.ts +0 -7
  57. package/dist/utils/passwordstore/index.js +0 -315
  58. package/dist/utils/passwordstore/index.js.map +0 -1
  59. package/src/apps/cli/commands/project/commandInitProject.old.ts +0 -290
  60. package/src/apps/cli/config/writeConfig.ts +0 -71
  61. package/src/apps/cli/verify/migration/fromv2.ts +0 -262
  62. package/src/apps/cli/verify/migration/migrateSecrets.ts +0 -47
  63. package/src/apps/cli/verify/migration/oldGitlabCi.ts +0 -48
  64. package/src/utils/passwordstore/index.ts +0 -162
@@ -1,345 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- 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) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (_) try {
29
- 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;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
50
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
51
- if (ar || !(i in from)) {
52
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
53
- ar[i] = from[i];
54
- }
55
- }
56
- return to.concat(ar || Array.prototype.slice.call(from));
57
- };
58
- var __importDefault = (this && this.__importDefault) || function (mod) {
59
- return (mod && mod.__esModule) ? mod : { "default": mod };
60
- };
61
- exports.__esModule = true;
62
- var fs_extra_1 = require("fs-extra");
63
- var js_yaml_1 = require("js-yaml");
64
- var lodash_1 = require("lodash");
65
- var path_1 = __importDefault(require("path"));
66
- var projects_1 = require("../../../../utils/projects");
67
- var transformVar = function (key) { return (0, lodash_1.toUpper)((0, lodash_1.snakeCase)(key)); };
68
- var DEFAULT_VARIABLES = {
69
- clusterName: "production"
70
- };
71
- // TODO: we should find a way how to fetch the variables of the inclues directly from gitlab
72
- var DEFAULT_NODE_asdfAPPLICATION = {};
73
- var DEFAULT_FILES_TO_CREATE = [
74
- {
75
- filename: ".envrc",
76
- content: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
77
- return [2 /*return*/, (0, fs_extra_1.readFile)(path_1["default"].resolve(__dirname, "../includes/envrc"), "utf8")];
78
- }); }); }
79
- },
80
- ];
81
- /*
82
-
83
- TODO: reimplement as PRESETS ?
84
- const PLATFORMS: { [platformName: string]: PlatformDefinition } = {
85
- nextJS: {
86
- variables: {},
87
- gitlabCiInclude: {
88
- project: "catladder/gitlab-ci",
89
- ref: "v1",
90
- file: "node-kubernetes.yml",
91
- },
92
- values: {
93
- application: DEFAULT_NODE_APPLICATION,
94
- },
95
- filesToCreate: [
96
- {
97
- content: "v14",
98
- filename: ".nvmrc",
99
- },
100
- ],
101
- },
102
- nestJS: {
103
- variables: {},
104
- gitlabCiInclude: {
105
- project: "catladder/gitlab-ci",
106
- ref: "v1",
107
- file: "node-kubernetes.yml",
108
- },
109
- values: {
110
- application: {
111
- command: "yarn start:prod --port $(PORT)",
112
- },
113
- },
114
- filesToCreate: [
115
- {
116
- content: "v14",
117
- filename: ".nvmrc",
118
- },
119
- ],
120
- },
121
- node: {
122
- variables: {},
123
- gitlabCiInclude: {
124
- project: "catladder/gitlab-ci",
125
- ref: "v1",
126
- file: "node-kubernetes.yml",
127
- },
128
- values: {
129
- application: DEFAULT_NODE_APPLICATION,
130
- },
131
- filesToCreate: [
132
- {
133
- content: "v14",
134
- filename: ".nvmrc",
135
- },
136
- ],
137
- },
138
- staticJs: {
139
- variables: {},
140
- gitlabCiInclude: {
141
- project: "catladder/gitlab-ci",
142
- ref: "v1",
143
- file: "static-js-kubernetes.yml",
144
- },
145
- values: {},
146
- },
147
- meteor: {
148
- variables: {},
149
- gitlabCiInclude: {
150
- project: "gitlab-ci/meteor-kubernetes",
151
- ref: "v1",
152
- file: "meteor-kubernetes.yml",
153
- },
154
- values: {},
155
- },
156
- rails: {
157
- variables: {},
158
- gitlabCiInclude: {
159
- project: "catladder/gitlab-ci",
160
- ref: "v1",
161
- file: "rails-kubernetes.yml",
162
- },
163
- values: {
164
- env: {
165
- public: {
166
- RAILS_ENV: "production",
167
- PORT: 8080,
168
- },
169
- secret: {
170
- POSTGRESQL_PASSWORD: "app-secrets",
171
- },
172
- },
173
- application: {
174
- command: ["/cnb/process/web"],
175
- livenessProbe: {
176
- httpGet: {
177
- path: "/robots.txt",
178
- httpHeaders: null,
179
- },
180
- },
181
- readinessProbe: {
182
- httpGet: {
183
- path: "/robots.txt",
184
- httpHeaders: null,
185
- },
186
- },
187
- },
188
- cloudsql: { enabled: true },
189
- jobs: {
190
- "db-prepare": {
191
- hook: "post-install,post-upgrade",
192
- command: "/cnb/lifecycle/launcher bundle exec rake db:prepare",
193
- },
194
- },
195
- },
196
- filesToCreate: [
197
- {
198
- filename: "values-review.yml",
199
- content: async () =>
200
- dump({
201
- jobs: {
202
- "db-prepare-seed": {
203
- hook: "post-install",
204
- command:
205
- "/cnb/lifecycle/launcher bundle exec rake db:prepare db:seed",
206
- },
207
- "db-prepare": {
208
- hook: "post-upgrade",
209
- command: "/cnb/lifecycle/launcher bundle exec rake db:prepare",
210
- },
211
- },
212
- }),
213
- },
214
- ],
215
- },
216
- other: {
217
- variables: {},
218
- gitlabCiInclude: {
219
- project: "catladder/gitlab-ci",
220
- ref: "v1",
221
- file: "panter-kubernetes-base.yml",
222
- },
223
- values: {},
224
- },
225
- };
226
-
227
- */
228
- var PLATFORMS = {};
229
- exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
230
- return __generator(this, function (_a) {
231
- return [2 /*return*/, vorpal
232
- .command("project-init", "Inits a new project")
233
- .action(function () {
234
- return __awaiter(this, void 0, void 0, function () {
235
- var hasGitlabFile, questions, _a, customerName, appName, componentName, platform, _b, gitlabCiInclude, platformVariables, values, filesToCreate, allVariables, allFilesToCreate, transformedVariables, gitlabCiContentObj, gitlabCiContent, shouldContinue;
236
- var _this = this;
237
- return __generator(this, function (_c) {
238
- switch (_c.label) {
239
- case 0: throw new Error("needs reimplementation");
240
- case 1:
241
- hasGitlabFile = _c.sent();
242
- if (!hasGitlabFile) return [3 /*break*/, 2];
243
- this.log("there is already a gitlab-ci.yml file. Skipping");
244
- return [3 /*break*/, 6];
245
- case 2:
246
- this.log("Alright. Let's do this! 😼");
247
- this.log("");
248
- questions = [
249
- {
250
- type: "input",
251
- name: "customerName",
252
- "default": "pan",
253
- message: "Which customer?"
254
- },
255
- {
256
- type: "input",
257
- name: "appName",
258
- message: "What is the app's name?"
259
- },
260
- {
261
- type: "input",
262
- name: "componentName",
263
- "default": "web",
264
- message: "And the componentName?\n(in multi-app projects, you have to chose a different componentName for each app, e.g. frontend and backend)\n\n"
265
- },
266
- {
267
- type: "list",
268
- name: "platform",
269
- choices: Object.keys(PLATFORMS),
270
- message: "What is your app platform?"
271
- },
272
- ].map(function (q) { return (__assign(__assign({}, q), { validate: Boolean, message: "".concat(q.message, " ") })); });
273
- return [4 /*yield*/, this.prompt(questions)];
274
- case 3:
275
- _a = _c.sent(), customerName = _a.customerName, appName = _a.appName, componentName = _a.componentName, platform = _a.platform;
276
- _b = PLATFORMS[platform], gitlabCiInclude = _b.gitlabCiInclude, platformVariables = _b.variables, values = _b.values, filesToCreate = _b.filesToCreate;
277
- allVariables = __assign(__assign({ customerName: customerName, appName: appName, componentName: componentName }, DEFAULT_VARIABLES), platformVariables);
278
- allFilesToCreate = __spreadArray(__spreadArray([], DEFAULT_FILES_TO_CREATE, true), (filesToCreate !== null && filesToCreate !== void 0 ? filesToCreate : []), true);
279
- transformedVariables = (0, lodash_1.mapKeys)(allVariables, function (value, key) {
280
- return transformVar(key);
281
- });
282
- gitlabCiContentObj = {
283
- include: [gitlabCiInclude],
284
- variables: transformedVariables
285
- };
286
- gitlabCiContent = (0, js_yaml_1.dump)(gitlabCiContentObj);
287
- return [4 /*yield*/, (0, fs_extra_1.writeFile)(".gitlab-ci.yml", gitlabCiContent)];
288
- case 4:
289
- _c.sent();
290
- allFilesToCreate.forEach(function (_a) {
291
- var filename = _a.filename, content = _a.content;
292
- return __awaiter(_this, void 0, void 0, function () {
293
- var theContent, _b;
294
- return __generator(this, function (_c) {
295
- switch (_c.label) {
296
- case 0:
297
- if (!(typeof content === "function")) return [3 /*break*/, 2];
298
- return [4 /*yield*/, content()];
299
- case 1:
300
- _b = _c.sent();
301
- return [3 /*break*/, 3];
302
- case 2:
303
- _b = content;
304
- _c.label = 3;
305
- case 3:
306
- theContent = _b;
307
- return [4 /*yield*/, (0, fs_extra_1.writeFile)(filename, theContent)];
308
- case 4:
309
- _c.sent();
310
- return [2 /*return*/];
311
- }
312
- });
313
- });
314
- });
315
- return [4 /*yield*/, (0, fs_extra_1.writeFile)("values.yml", (0, js_yaml_1.dump)(values))];
316
- case 5:
317
- _c.sent();
318
- this.log("");
319
- this.log("gitlab-ci created! 💪😻");
320
- this.log("feel free to adjust it to your needs!");
321
- this.log("");
322
- this.log("we also create an .envrc for you which works with direnv");
323
- this.log("");
324
- _c.label = 6;
325
- case 6: return [4 /*yield*/, this.prompt({
326
- "default": true,
327
- message: "should we continue with setting up your gitlab? 🤔 (connecting cluster and stuff)",
328
- name: "shouldContinue",
329
- type: "confirm"
330
- })];
331
- case 7:
332
- shouldContinue = (_c.sent()).shouldContinue;
333
- if (!shouldContinue) return [3 /*break*/, 9];
334
- return [4 /*yield*/, vorpal.execSync("project-init-gitlab")];
335
- case 8:
336
- _c.sent();
337
- _c.label = 9;
338
- case 9: return [2 /*return*/];
339
- }
340
- });
341
- });
342
- })];
343
- });
344
- }); });
345
- //# sourceMappingURL=commandInitProject.old.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commandInitProject.old.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/project/commandInitProject.old.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAA+C;AAC/C,mCAA+B;AAC/B,iCAAqD;AACrD,8CAAwB;AAExB,uDAA6D;AAE7D,IAAM,YAAY,GAAG,UAAC,GAAW,IAAK,OAAA,IAAA,gBAAO,EAAC,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,EAAvB,CAAuB,CAAC;AAoB9D,IAAM,iBAAiB,GAAG;IACxB,WAAW,EAAE,YAAY;CAC1B,CAAC;AACF,4FAA4F;AAC5F,IAAM,4BAA4B,GAAG,EAAE,CAAC;AAExC,IAAM,uBAAuB,GAAmB;IAC9C;QACE,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE;YACP,sBAAA,IAAA,mBAAQ,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CAAA;;;oDADrD,UAAU,KAC2C;oDAC3D,qBAAM,IAAA,oBAAS,EAAC,QAAQ,EAAE,UAAU,CAAC,EAAA;;oDAArC,SAAqC,CAAC;;;;;iCACvC,CAAC,CAAC;gCAEH,qBAAM,IAAA,oBAAS,EAAC,YAAY,EAAE,IAAA,cAAI,EAAC,MAAM,CAAC,CAAC,EAAA;;gCAA3C,SAA2C,CAAC;gCAE5C,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gCACb,IAAI,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;gCACpC,IAAI,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;gCAClD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gCACb,IAAI,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;gCACrE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;;oCAEY,qBAAM,IAAI,CAAC,MAAM,CAAC;oCAC3C,SAAO,EAAE,IAAI;oCACb,OAAO,EACL,mFAAmF;oCACrF,IAAI,EAAE,gBAAgB;oCACtB,IAAI,EAAE,SAAS;iCAChB,CAAC,EAAA;;gCANM,cAAc,GAAK,CAAA,SAMzB,CAAA,eANoB;qCAOlB,cAAc,EAAd,wBAAc;gCAChB,qBAAM,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EAAA;;gCAA5C,SAA4C,CAAC;;;;;;aAEhD,CAAC,EAAA;;KAAA,EAAC"}
@@ -1,5 +0,0 @@
1
- import type { Config } from "@catladder/pipeline";
2
- import type { CommandInstance } from "vorpal";
3
- export declare const writeConfig: (vorpal: CommandInstance, config: Config, options?: {
4
- endComment?: string;
5
- }) => Promise<void>;
@@ -1,106 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- 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;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- exports.__esModule = true;
39
- exports.writeConfig = void 0;
40
- var child_process_promise_1 = require("child-process-promise");
41
- var fs_extra_1 = require("fs-extra");
42
- var js_yaml_1 = require("js-yaml");
43
- var prettier_1 = require("prettier");
44
- var projects_1 = require("../../../utils/projects");
45
- var writeConfig = function (vorpal, config, options) { return __awaiter(void 0, void 0, void 0, function () {
46
- var gitRoot, TS, configType, file, content, file, content;
47
- return __generator(this, function (_a) {
48
- switch (_a.label) {
49
- case 0: return [4 /*yield*/, (0, projects_1.getGitRoot)()];
50
- case 1:
51
- gitRoot = _a.sent();
52
- TS = "typescript (recommended)";
53
- return [4 /*yield*/, vorpal.prompt({
54
- type: "list",
55
- name: "configType",
56
- choices: [TS, "yaml"],
57
- message: "In which format do you want the config? 🤔"
58
- })];
59
- case 2:
60
- configType = (_a.sent()).configType;
61
- vorpal.log("");
62
- if (!(configType === TS)) return [3 /*break*/, 6];
63
- file = gitRoot + "/catladder.ts";
64
- content = (0, prettier_1.format)("\n import type { Config } from \"@catladder/pipeline\";\n \n const config: Config = ".concat(JSON.stringify(config), ";\n\n export default config;\n\n \n ").concat((options === null || options === void 0 ? void 0 : options.endComment) ? "/*".concat(options.endComment, "*/") : "", "\n \n "), {
65
- parser: "babel"
66
- });
67
- return [4 /*yield*/, (0, fs_extra_1.writeFile)(file, content, {
68
- encoding: "utf-8"
69
- })];
70
- case 3:
71
- _a.sent();
72
- vorpal.log("adding type @catladder/pipeline....");
73
- return [4 /*yield*/, (0, child_process_promise_1.spawn)("yarn add --non-interactive @catladder/pipeline -DW", {
74
- shell: true
75
- })];
76
- case 4:
77
- _a.sent();
78
- return [4 /*yield*/, (0, child_process_promise_1.exec)("git add " + file)];
79
- case 5:
80
- _a.sent();
81
- return [3 /*break*/, 9];
82
- case 6:
83
- file = gitRoot + "/catladder.yml";
84
- content = (0, js_yaml_1.dump)(config);
85
- return [4 /*yield*/, (0, fs_extra_1.writeFile)(file, content +
86
- "\n\n" +
87
- (options.endComment
88
- ? "# " + options.endComment.split("\n").join("\n# ")
89
- : ""), {
90
- encoding: "utf-8"
91
- })];
92
- case 7:
93
- _a.sent();
94
- return [4 /*yield*/, (0, child_process_promise_1.exec)("git add " + file)];
95
- case 8:
96
- _a.sent();
97
- _a.label = 9;
98
- case 9:
99
- vorpal.log("done!");
100
- vorpal.log("");
101
- return [2 /*return*/];
102
- }
103
- });
104
- }); };
105
- exports.writeConfig = writeConfig;
106
- //# sourceMappingURL=writeConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"writeConfig.js","sourceRoot":"","sources":["../../../../src/apps/cli/config/writeConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+DAAoD;AACpD,qCAAqC;AACrC,mCAA+B;AAC/B,qCAAkC;AAElC,oDAAqD;AAE9C,IAAM,WAAW,GAAG,UACzB,MAAuB,EACvB,MAAc,EACd,OAEC;;;;oBAEe,qBAAM,IAAA,qBAAU,GAAE,EAAA;;gBAA5B,OAAO,GAAG,SAAkB;gBAC5B,EAAE,GAAG,0BAA0B,CAAC;gBACf,qBAAM,MAAM,CAAC,MAAM,CAAC;wBACzC,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,YAAY;wBAClB,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC;wBACrB,OAAO,EAAE,4CAA4C;qBACtD,CAAC,EAAA;;gBALM,UAAU,GAAK,CAAA,SAKrB,CAAA,WALgB;gBAMlB,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;qBACX,CAAA,UAAU,KAAK,EAAE,CAAA,EAAjB,wBAAiB;gBACb,IAAI,GAAG,OAAO,GAAG,eAAe,CAAC;gBACjC,OAAO,GAAG,IAAA,iBAAM,EACpB,6GAGyB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,+DAK7C,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,EAAC,CAAC,CAAC,YAAK,OAAO,CAAC,UAAU,OAAI,CAAC,CAAC,CAAC,EAAE,qBAEvD,EACD;oBACE,MAAM,EAAE,OAAO;iBAChB,CACF,CAAC;gBAEF,qBAAM,IAAA,oBAAS,EAAC,IAAI,EAAE,OAAO,EAAE;wBAC7B,QAAQ,EAAE,OAAO;qBAClB,CAAC,EAAA;;gBAFF,SAEE,CAAC;gBACH,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;gBAClD,qBAAM,IAAA,6BAAK,EAAC,oDAAoD,EAAE;wBAChE,KAAK,EAAE,IAAI;qBACZ,CAAC,EAAA;;gBAFF,SAEE,CAAC;gBACH,qBAAM,IAAA,4BAAI,EAAC,UAAU,GAAG,IAAI,CAAC,EAAA;;gBAA7B,SAA6B,CAAC;;;gBAExB,IAAI,GAAG,OAAO,GAAG,gBAAgB,CAAC;gBAClC,OAAO,GAAG,IAAA,cAAI,EAAC,MAAM,CAAC,CAAC;gBAE7B,qBAAM,IAAA,oBAAS,EACb,IAAI,EACJ,OAAO;wBACL,MAAM;wBACN,CAAC,OAAO,CAAC,UAAU;4BACjB,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;4BACpD,CAAC,CAAC,EAAE,CAAC,EACT;wBACE,QAAQ,EAAE,OAAO;qBAClB,CACF,EAAA;;gBAVD,SAUC,CAAC;gBACF,qBAAM,IAAA,4BAAI,EAAC,UAAU,GAAG,IAAI,CAAC,EAAA;;gBAA7B,SAA6B,CAAC;;;gBAEhC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACpB,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;;;;KAChB,CAAC;AA9DW,QAAA,WAAW,eA8DtB"}
@@ -1,4 +0,0 @@
1
- import type Vorpal from "vorpal";
2
- export declare const LEGACY_ENVS: readonly ["dev-local", "dev", "review", "stage", "prod"];
3
- export declare const isV2: () => Promise<boolean>;
4
- export declare const migrateV2: (vorpal: Vorpal) => Promise<void>;