polyci 0.0.22 → 0.0.23
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/main.js +14 -23
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -97,13 +97,6 @@ function parseArgs() {
|
|
|
97
97
|
function toPosixPath(p) {
|
|
98
98
|
return p.split(path.sep).join("/");
|
|
99
99
|
}
|
|
100
|
-
function toJobId(value) {
|
|
101
|
-
return value
|
|
102
|
-
.replace(/[^a-zA-Z0-9_]/g, "_")
|
|
103
|
-
.replace(/_+/g, "_")
|
|
104
|
-
.replace(/^_+|_+$/g, "")
|
|
105
|
-
.toLowerCase();
|
|
106
|
-
}
|
|
107
100
|
function detectModuleType(directory) {
|
|
108
101
|
const baseName = path.basename(directory);
|
|
109
102
|
if (baseName === "node_modules" || baseName === ".git" || baseName === "dist") {
|
|
@@ -142,7 +135,6 @@ function discoverModulesRecursively(repoRoot, modulesRoot, scanDir, modules) {
|
|
|
142
135
|
moduleName,
|
|
143
136
|
modulePath: relativeModulePath,
|
|
144
137
|
moduleType,
|
|
145
|
-
jobId: toJobId(relativeModulePath),
|
|
146
138
|
});
|
|
147
139
|
return;
|
|
148
140
|
}
|
|
@@ -182,7 +174,7 @@ function appendGlobalVariables(lines) {
|
|
|
182
174
|
lines.push(``);
|
|
183
175
|
}
|
|
184
176
|
function appendModuleBuildJob(lines, module) {
|
|
185
|
-
lines.push(`${module.
|
|
177
|
+
lines.push(`${module.moduleName}-build:`);
|
|
186
178
|
lines.push(` stage: build`);
|
|
187
179
|
lines.push(` rules:`);
|
|
188
180
|
lines.push(` - changes:`);
|
|
@@ -203,13 +195,13 @@ function appendModuleBuildJob(lines, module) {
|
|
|
203
195
|
lines.push(``);
|
|
204
196
|
}
|
|
205
197
|
function appendModuleTestJob(lines, module) {
|
|
206
|
-
lines.push(`${module.
|
|
198
|
+
lines.push(`${module.moduleName}-test:`);
|
|
207
199
|
lines.push(` stage: test`);
|
|
208
200
|
lines.push(` rules:`);
|
|
209
201
|
lines.push(` - changes:`);
|
|
210
202
|
lines.push(` - ${module.modulePath}/**/*`);
|
|
211
203
|
lines.push(` needs:`);
|
|
212
|
-
lines.push(` - job: ${module.
|
|
204
|
+
lines.push(` - job: ${module.moduleName}-build`);
|
|
213
205
|
lines.push(` image: $IMAGE_LINUX`);
|
|
214
206
|
lines.push(` variables:`);
|
|
215
207
|
lines.push(` MODULE_NAME: ${module.moduleName}`);
|
|
@@ -221,14 +213,14 @@ function appendModuleTestJob(lines, module) {
|
|
|
221
213
|
lines.push(``);
|
|
222
214
|
}
|
|
223
215
|
function appendModuleReleaseJob(lines, module, tagPattern) {
|
|
224
|
-
lines.push(`${module.
|
|
216
|
+
lines.push(`${module.moduleName}-release:`);
|
|
225
217
|
lines.push(` stage: release`);
|
|
226
218
|
lines.push(` rules:`);
|
|
227
219
|
lines.push(` - changes:`);
|
|
228
220
|
lines.push(` - ${module.modulePath}/**/*`);
|
|
229
221
|
lines.push(` needs:`);
|
|
230
|
-
lines.push(` - job: ${module.
|
|
231
|
-
lines.push(` - job: ${module.
|
|
222
|
+
lines.push(` - job: ${module.moduleName}-build`);
|
|
223
|
+
lines.push(` - job: ${module.moduleName}-test`);
|
|
232
224
|
lines.push(` image: $IMAGE_NODE`);
|
|
233
225
|
lines.push(` variables:`);
|
|
234
226
|
lines.push(` MODULE_NAME: ${module.moduleName}`);
|
|
@@ -247,11 +239,11 @@ function appendModuleReleaseJob(lines, module, tagPattern) {
|
|
|
247
239
|
lines.push(``);
|
|
248
240
|
}
|
|
249
241
|
function appendGlobalReleaseJob(lines, modules, mainBranch, versionTemplate, branchVersionTemplate, tagTemplate) {
|
|
250
|
-
lines.push(`
|
|
242
|
+
lines.push(`release:`);
|
|
251
243
|
lines.push(` stage: release`);
|
|
252
244
|
lines.push(` needs:`);
|
|
253
245
|
for (const module of modules) {
|
|
254
|
-
lines.push(` - job: ${module.
|
|
246
|
+
lines.push(` - job: ${module.moduleName}-release`);
|
|
255
247
|
lines.push(` optional: true`);
|
|
256
248
|
}
|
|
257
249
|
lines.push(` image: $IMAGE_NODE`);
|
|
@@ -267,7 +259,6 @@ function appendGlobalReleaseJob(lines, modules, mainBranch, versionTemplate, bra
|
|
|
267
259
|
lines.push(` - TAG_NAMES=""`);
|
|
268
260
|
lines.push(``);
|
|
269
261
|
for (const module of modules) {
|
|
270
|
-
lines.push(` - echo "Tagging release for ${module.moduleName} (${module.modulePath})"`);
|
|
271
262
|
lines.push(` - |`);
|
|
272
263
|
lines.push(` if [ -f "${module.modulePath}/semalease.env" ]; then`);
|
|
273
264
|
lines.push(` . "${module.modulePath}/semalease.env"`);
|
|
@@ -291,7 +282,7 @@ function appendGlobalReleaseJob(lines, modules, mainBranch, versionTemplate, bra
|
|
|
291
282
|
lines.push(` cp -r ci "${module.modulePath}/ci"`);
|
|
292
283
|
lines.push(` cd "${module.modulePath}"`);
|
|
293
284
|
lines.push(` source "ci/${module.moduleType}/release.sh"`);
|
|
294
|
-
lines.push(` cd
|
|
285
|
+
lines.push(` cd -`);
|
|
295
286
|
lines.push(` TAG_NAMES="\${TAG_NAMES} \${MODULE_TAG}"`);
|
|
296
287
|
lines.push(` fi`);
|
|
297
288
|
lines.push(` else`);
|
|
@@ -320,14 +311,14 @@ function appendGlobalReleaseJob(lines, modules, mainBranch, versionTemplate, bra
|
|
|
320
311
|
lines.push(``);
|
|
321
312
|
}
|
|
322
313
|
function appendModulePublishJob(lines, module) {
|
|
323
|
-
lines.push(`${module.
|
|
314
|
+
lines.push(`${module.moduleName}-publish:`);
|
|
324
315
|
lines.push(` stage: publish`);
|
|
325
316
|
lines.push(` rules:`);
|
|
326
317
|
lines.push(` - changes:`);
|
|
327
318
|
lines.push(` - ${module.modulePath}/**/*`);
|
|
328
319
|
lines.push(` needs:`);
|
|
329
|
-
lines.push(` - job: ${module.
|
|
330
|
-
lines.push(` - job:
|
|
320
|
+
lines.push(` - job: ${module.moduleName}-test`);
|
|
321
|
+
lines.push(` - job: release`);
|
|
331
322
|
lines.push(` image: $IMAGE_DOCKER`);
|
|
332
323
|
lines.push(` variables:`);
|
|
333
324
|
lines.push(` MODULE_NAME: ${module.moduleName}`);
|
|
@@ -347,13 +338,13 @@ function appendModulePublishJob(lines, module) {
|
|
|
347
338
|
lines.push(``);
|
|
348
339
|
}
|
|
349
340
|
function appendModuleDeployJob(lines, module) {
|
|
350
|
-
lines.push(`${module.
|
|
341
|
+
lines.push(`${module.moduleName}-deploy:`);
|
|
351
342
|
lines.push(` stage: deploy`);
|
|
352
343
|
lines.push(` rules:`);
|
|
353
344
|
lines.push(` - changes:`);
|
|
354
345
|
lines.push(` - ${module.modulePath}/**/*`);
|
|
355
346
|
lines.push(` needs:`);
|
|
356
|
-
lines.push(` - job: ${module.
|
|
347
|
+
lines.push(` - job: ${module.moduleName}-publish`);
|
|
357
348
|
lines.push(` image: $IMAGE_COMPOSE`);
|
|
358
349
|
lines.push(` variables:`);
|
|
359
350
|
lines.push(` MODULE_NAME: ${module.moduleName}`);
|