@catladder/pipeline 1.158.1 → 1.159.1

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.
@@ -1,14 +1,139 @@
1
1
  "use strict";
2
2
 
3
- var _a;
3
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) {
5
+ return value instanceof P ? value : new P(function (resolve) {
6
+ resolve(value);
7
+ });
8
+ }
9
+ return new (P || (P = Promise))(function (resolve, reject) {
10
+ function fulfilled(value) {
11
+ try {
12
+ step(generator.next(value));
13
+ } catch (e) {
14
+ reject(e);
15
+ }
16
+ }
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+ function step(result) {
25
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
26
+ }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ var __generator = this && this.__generator || function (thisArg, body) {
31
+ var _ = {
32
+ label: 0,
33
+ sent: function () {
34
+ if (t[0] & 1) throw t[1];
35
+ return t[1];
36
+ },
37
+ trys: [],
38
+ ops: []
39
+ },
40
+ f,
41
+ y,
42
+ t,
43
+ g;
44
+ return g = {
45
+ next: verb(0),
46
+ "throw": verb(1),
47
+ "return": verb(2)
48
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
49
+ return this;
50
+ }), g;
51
+ function verb(n) {
52
+ return function (v) {
53
+ return step([n, v]);
54
+ };
55
+ }
56
+ function step(op) {
57
+ if (f) throw new TypeError("Generator is already executing.");
58
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
59
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
60
+ if (y = 0, t) op = [op[0] & 2, t.value];
61
+ switch (op[0]) {
62
+ case 0:
63
+ case 1:
64
+ t = op;
65
+ break;
66
+ case 4:
67
+ _.label++;
68
+ return {
69
+ value: op[1],
70
+ done: false
71
+ };
72
+ case 5:
73
+ _.label++;
74
+ y = op[1];
75
+ op = [0];
76
+ continue;
77
+ case 7:
78
+ op = _.ops.pop();
79
+ _.trys.pop();
80
+ continue;
81
+ default:
82
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
83
+ _ = 0;
84
+ continue;
85
+ }
86
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
87
+ _.label = op[1];
88
+ break;
89
+ }
90
+ if (op[0] === 6 && _.label < t[1]) {
91
+ _.label = t[1];
92
+ t = op;
93
+ break;
94
+ }
95
+ if (t && _.label < t[2]) {
96
+ _.label = t[2];
97
+ _.ops.push(op);
98
+ break;
99
+ }
100
+ if (t[2]) _.ops.pop();
101
+ _.trys.pop();
102
+ continue;
103
+ }
104
+ op = body.call(thisArg, _);
105
+ } catch (e) {
106
+ op = [6, e];
107
+ y = 0;
108
+ } finally {
109
+ f = t = 0;
110
+ }
111
+ if (op[0] & 5) throw op[1];
112
+ return {
113
+ value: op[0] ? op[1] : void 0,
114
+ done: true
115
+ };
116
+ }
117
+ };
4
118
  Object.defineProperty(exports, "__esModule", {
5
119
  value: true
6
120
  });
7
121
  var config_1 = require("./config");
8
122
  var generatePipelineFiles_1 = require("./pipeline/generatePipelineFiles");
9
123
  var mode = process.argv[2] || "local";
10
- var config = (_a = (0, config_1.readConfigSync)()) === null || _a === void 0 ? void 0 : _a.config;
11
- if (!config) {
12
- throw new Error("no catladder config found");
13
- }
14
- (0, generatePipelineFiles_1.generatePipelineFiles)(config, "gitlab", mode);
124
+ var config = (0, config_1.readConfig)().then(function (result) {
125
+ return __awaiter(void 0, void 0, void 0, function () {
126
+ return __generator(this, function (_a) {
127
+ switch (_a.label) {
128
+ case 0:
129
+ if (!(result === null || result === void 0 ? void 0 : result.config)) {
130
+ throw new Error("no catladder config found");
131
+ }
132
+ return [4 /*yield*/, (0, generatePipelineFiles_1.generatePipelineFiles)(result.config, "gitlab", mode)];
133
+ case 1:
134
+ _a.sent();
135
+ return [2 /*return*/];
136
+ }
137
+ });
138
+ });
139
+ });
@@ -1,6 +1,6 @@
1
1
  import type { Config } from "../types";
2
- export declare const readConfigSync: (directory?: string) => {
2
+ export declare const readConfig: (directory?: string) => Promise<{
3
3
  config: Config;
4
4
  path: string;
5
5
  ext: string;
6
- } | null;
6
+ } | null>;
@@ -1,52 +1,203 @@
1
1
  "use strict";
2
2
 
3
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) {
5
+ return value instanceof P ? value : new P(function (resolve) {
6
+ resolve(value);
7
+ });
8
+ }
9
+ return new (P || (P = Promise))(function (resolve, reject) {
10
+ function fulfilled(value) {
11
+ try {
12
+ step(generator.next(value));
13
+ } catch (e) {
14
+ reject(e);
15
+ }
16
+ }
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+ function step(result) {
25
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
26
+ }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ var __generator = this && this.__generator || function (thisArg, body) {
31
+ var _ = {
32
+ label: 0,
33
+ sent: function () {
34
+ if (t[0] & 1) throw t[1];
35
+ return t[1];
36
+ },
37
+ trys: [],
38
+ ops: []
39
+ },
40
+ f,
41
+ y,
42
+ t,
43
+ g;
44
+ return g = {
45
+ next: verb(0),
46
+ "throw": verb(1),
47
+ "return": verb(2)
48
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
49
+ return this;
50
+ }), g;
51
+ function verb(n) {
52
+ return function (v) {
53
+ return step([n, v]);
54
+ };
55
+ }
56
+ function step(op) {
57
+ if (f) throw new TypeError("Generator is already executing.");
58
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
59
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
60
+ if (y = 0, t) op = [op[0] & 2, t.value];
61
+ switch (op[0]) {
62
+ case 0:
63
+ case 1:
64
+ t = op;
65
+ break;
66
+ case 4:
67
+ _.label++;
68
+ return {
69
+ value: op[1],
70
+ done: false
71
+ };
72
+ case 5:
73
+ _.label++;
74
+ y = op[1];
75
+ op = [0];
76
+ continue;
77
+ case 7:
78
+ op = _.ops.pop();
79
+ _.trys.pop();
80
+ continue;
81
+ default:
82
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
83
+ _ = 0;
84
+ continue;
85
+ }
86
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
87
+ _.label = op[1];
88
+ break;
89
+ }
90
+ if (op[0] === 6 && _.label < t[1]) {
91
+ _.label = t[1];
92
+ t = op;
93
+ break;
94
+ }
95
+ if (t && _.label < t[2]) {
96
+ _.label = t[2];
97
+ _.ops.push(op);
98
+ break;
99
+ }
100
+ if (t[2]) _.ops.pop();
101
+ _.trys.pop();
102
+ continue;
103
+ }
104
+ op = body.call(thisArg, _);
105
+ } catch (e) {
106
+ op = [6, e];
107
+ y = 0;
108
+ } finally {
109
+ f = t = 0;
110
+ }
111
+ if (op[0] & 5) throw op[1];
112
+ return {
113
+ value: op[0] ? op[1] : void 0,
114
+ done: true
115
+ };
116
+ }
117
+ };
118
+ var __read = this && this.__read || function (o, n) {
119
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
120
+ if (!m) return o;
121
+ var i = m.call(o),
122
+ r,
123
+ ar = [],
124
+ e;
125
+ try {
126
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
127
+ } catch (error) {
128
+ e = {
129
+ error: error
130
+ };
131
+ } finally {
132
+ try {
133
+ if (r && !r.done && (m = i["return"])) m.call(i);
134
+ } finally {
135
+ if (e) throw e.error;
136
+ }
137
+ }
138
+ return ar;
139
+ };
140
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
141
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
142
+ if (ar || !(i in from)) {
143
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
144
+ ar[i] = from[i];
145
+ }
146
+ }
147
+ return to.concat(ar || Array.prototype.slice.call(from));
148
+ };
3
149
  Object.defineProperty(exports, "__esModule", {
4
150
  value: true
5
151
  });
6
- exports.readConfigSync = void 0;
152
+ exports.readConfig = void 0;
7
153
  var fs_1 = require("fs");
8
- var ts_node_1 = require("ts-node");
154
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
155
+ var tsx = require("tsx/cjs/api");
9
156
  var yaml_1 = require("yaml");
10
157
  // allows us to load ts files
11
158
  var fullPath = function (directory, ext) {
12
159
  return directory + "/catladder." + ext;
13
160
  };
14
- function requireUncached(module) {
15
- delete require.cache[require.resolve(module)];
16
- return require(module);
17
- }
18
- var readConfigSync = function (directory) {
19
- if (directory === void 0) {
20
- directory = process.cwd();
161
+ var readConfig = function () {
162
+ var args_1 = [];
163
+ for (var _i = 0; _i < arguments.length; _i++) {
164
+ args_1[_i] = arguments[_i];
21
165
  }
22
- (0, ts_node_1.register)({
23
- cwd: directory,
24
- transpileOnly: true,
25
- compilerOptions: {
26
- module: "commonjs"
166
+ return __awaiter(void 0, __spreadArray([], __read(args_1), false), void 0, function (directory) {
167
+ var found, filePath, result, config;
168
+ if (directory === void 0) {
169
+ directory = process.cwd();
27
170
  }
171
+ return __generator(this, function (_a) {
172
+ switch (_a.label) {
173
+ case 0:
174
+ found = ["ts", "js", "yml", "yaml"].find(function (extension) {
175
+ return (0, fs_1.existsSync)(fullPath(directory, extension));
176
+ });
177
+ if (!found) return [3 /*break*/, 3];
178
+ filePath = fullPath(directory, found);
179
+ if (!(found === "ts" || found === "js")) return [3 /*break*/, 2];
180
+ return [4 /*yield*/, tsx.require(filePath, directory)];
181
+ case 1:
182
+ result = _a.sent();
183
+ config = result.default.default || result.default;
184
+ return [2 /*return*/, {
185
+ path: filePath,
186
+ ext: found,
187
+ config: config
188
+ }];
189
+ case 2:
190
+ return [2 /*return*/, {
191
+ path: filePath,
192
+ ext: found,
193
+ config: (0, yaml_1.parse)((0, fs_1.readFileSync)(filePath, {
194
+ encoding: "utf-8"
195
+ }))
196
+ }];
197
+ case 3:
198
+ return [2 /*return*/, null];
199
+ }
200
+ });
28
201
  });
29
- var found = ["ts", "js", "yml", "yaml"].find(function (extension) {
30
- return (0, fs_1.existsSync)(fullPath(directory, extension));
31
- });
32
- if (found) {
33
- var filePath = fullPath(directory, found);
34
- if (found === "ts" || found === "js") {
35
- return {
36
- path: filePath,
37
- ext: found,
38
- config: requireUncached(filePath).default
39
- };
40
- } else {
41
- return {
42
- path: filePath,
43
- ext: found,
44
- config: (0, yaml_1.parse)((0, fs_1.readFileSync)(filePath, {
45
- encoding: "utf-8"
46
- }))
47
- };
48
- }
49
- }
50
- return null;
51
202
  };
52
- exports.readConfigSync = readConfigSync;
203
+ exports.readConfig = readConfig;
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 = "v1-158-1-09e585ab" || "latest";
7
+ exports.PIPELINE_IMAGE_TAG = "v1-159-1-414b31c3" || "latest";
8
8
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "git.panter.ch:5001/catladder/catladder";
@@ -1,2 +1,4 @@
1
- declare const ownPkg: any;
1
+ declare let ownPkg: {
2
+ version: string;
3
+ };
2
4
  export default ownPkg;
@@ -1,14 +1,20 @@
1
1
  "use strict";
2
2
 
3
- // we can't import the package.json directly, because the bundling process will inline it
4
- // but the version is only set during deployement, when its already bundled
5
- // instead we need to use require.main.path to get the path of the main module, which is actually the file in the bin
6
- // this will point to the root package.json
7
3
  var _a;
8
4
  Object.defineProperty(exports, "__esModule", {
9
5
  value: true
10
6
  });
11
- var path = ((_a = require.main) === null || _a === void 0 ? void 0 : _a.path) + "/../package.json";
12
- // eslint-disable-next-line @typescript-eslint/no-var-requires
13
- var ownPkg = require(path);
7
+ // we can't import the package.json directly, because the bundling process will inline it
8
+ // but the version is only set during deployement, when its already bundled
9
+ // instead we need to use require.main.path to get the path of the main module, which is actually the file in the bin
10
+ // this will point to the root package.json
11
+ var ownPkg = {
12
+ version: "0.0.0"
13
+ };
14
+ try {
15
+ var path = ((_a = require.main) === null || _a === void 0 ? void 0 : _a.path) + "/../package.json";
16
+ ownPkg = require(path);
17
+ } catch (e) {
18
+ // ignore, currently in the gitlab-includes, this doesn't work
19
+ }
14
20
  exports.default = ownPkg;