polyci 0.1.4 → 0.1.5

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 (3) hide show
  1. package/dist/main.js +15 -4
  2. package/package.json +34 -34
  3. package/readme.md +54 -54
package/dist/main.js CHANGED
@@ -293,6 +293,7 @@ function appendGlobalReleaseJob(lines, modules) {
293
293
  lines.push(` - git config user.name "polyci"`);
294
294
  lines.push(` - git remote set-url origin "https://oauth2:\${POLYCI_TOKEN}@\${CI_SERVER_HOST}/\${CI_PROJECT_PATH}.git"`);
295
295
  lines.push(` - TAG_NAMES=""`);
296
+ lines.push(` - RELEASE_MESSAGE=""`);
296
297
  lines.push(``);
297
298
  for (const module of modules) {
298
299
  lines.push(` - |`);
@@ -309,13 +310,14 @@ function appendGlobalReleaseJob(lines, modules) {
309
310
  lines.push(` source "ci/${module.moduleType}/release.sh"`);
310
311
  lines.push(` cd "$ROOT_REPO_DIR"`);
311
312
  lines.push(` TAG_NAMES="\${TAG_NAMES} \${PLI_MODULE_TAG}"`);
313
+ lines.push(` RELEASE_MESSAGE="\${RELEASE_MESSAGE}\${RELEASE_MESSAGE:+, }\${PLI_MODULE_NAME} (\${PLI_MODULE_VERSION})"`);
312
314
  lines.push(` fi`);
313
315
  lines.push(` fi`);
314
316
  }
315
317
  lines.push(``);
316
318
  lines.push(` - |`);
317
319
  lines.push(` if [ -n "$TAG_NAMES" ]; then`);
318
- lines.push(` git commit --allow-empty -m "release: ${modules.map((m) => m.moduleName).join(", ")}"`);
320
+ lines.push(` git commit --allow-empty -m "release: \${RELEASE_MESSAGE}"`);
319
321
  lines.push(` for TAG_NAME in \${TAG_NAMES}; do`);
320
322
  lines.push(` git tag "\${TAG_NAME}"`);
321
323
  lines.push(` done`);
@@ -341,7 +343,6 @@ function appendModulePublishJob(lines, module) {
341
343
  lines.push(` - changes:`);
342
344
  lines.push(` - ${module.modulePath}/**/*`);
343
345
  lines.push(` needs:`);
344
- lines.push(` - job: ${module.moduleName}-test`);
345
346
  lines.push(` - job: release`);
346
347
  lines.push(` image: $IMAGE_NODE`);
347
348
  lines.push(` script:`);
@@ -350,7 +351,12 @@ function appendModulePublishJob(lines, module) {
350
351
  lines.push(` - cd ${module.modulePath}`);
351
352
  lines.push(` - cat polyci.env`);
352
353
  lines.push(` - source polyci.env`);
353
- lines.push(` - source "ci/${module.moduleType}/publish.sh"`);
354
+ lines.push(` - |`);
355
+ lines.push(` if [ -n "\${PLI_MODULE_VERSION:-}" ]; then`);
356
+ lines.push(` source "ci/${module.moduleType}/publish.sh"`);
357
+ lines.push(` else`);
358
+ lines.push(` echo "No new version. Skipping publish."`);
359
+ lines.push(` fi`);
354
360
  lines.push(` artifacts:`);
355
361
  lines.push(` paths:`);
356
362
  lines.push(` - ${module.modulePath}/polyci.env`);
@@ -372,7 +378,12 @@ function appendModuleDeployJob(lines, module) {
372
378
  lines.push(` - cd ${module.modulePath}`);
373
379
  lines.push(` - cat polyci.env`);
374
380
  lines.push(` - source polyci.env`);
375
- lines.push(` - source "ci/${module.moduleType}/deploy.sh"`);
381
+ lines.push(` - |`);
382
+ lines.push(` if [ -n "\${PLI_MODULE_VERSION:-}" ]; then`);
383
+ lines.push(` source "ci/${module.moduleType}/deploy.sh"`);
384
+ lines.push(` else`);
385
+ lines.push(` echo "No new version. Skipping deploy."`);
386
+ lines.push(` fi`);
376
387
  lines.push(``);
377
388
  }
378
389
  function buildPipeline(modules, mainBranch, versionTemplate, branchVersionTemplate, tagTemplate, tagPattern, branchTagPattern) {
package/package.json CHANGED
@@ -1,34 +1,34 @@
1
- {
2
- "name": "polyci",
3
- "description": "Monorepo CI/CD utilities.",
4
- "version": "0.1.4",
5
- "type": "module",
6
- "private": false,
7
- "author": "Alexander Tsarev",
8
- "license": "MIT",
9
- "main": "./dist/main.js",
10
- "bin": {
11
- "polyci": "dist/cli.js"
12
- },
13
- "files": [
14
- "dist",
15
- "readme.md"
16
- ],
17
- "publishConfig": {
18
- "access": "public"
19
- },
20
- "scripts": {
21
- "build": "tsc",
22
- "dev": "tsx main.ts"
23
- },
24
- "dependencies": {
25
- "commander": "^14.0.3",
26
- "pino": "^10.3.1",
27
- "pino-pretty": "^13.1.3"
28
- },
29
- "devDependencies": {
30
- "@types/node": "^25.3.3",
31
- "tsx": "^4.21.0",
32
- "typescript": "^5.9.3"
33
- }
34
- }
1
+ {
2
+ "name": "polyci",
3
+ "description": "Monorepo CI/CD utilities.",
4
+ "version": "0.1.5",
5
+ "type": "module",
6
+ "private": false,
7
+ "author": "Alexander Tsarev",
8
+ "license": "MIT",
9
+ "main": "./dist/main.js",
10
+ "bin": {
11
+ "polyci": "dist/cli.js"
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "readme.md"
16
+ ],
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "scripts": {
21
+ "build": "tsc",
22
+ "dev": "tsx main.ts"
23
+ },
24
+ "dependencies": {
25
+ "commander": "^14.0.3",
26
+ "pino": "^10.3.1",
27
+ "pino-pretty": "^13.1.3"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "^25.3.3",
31
+ "tsx": "^4.21.0",
32
+ "typescript": "^5.9.3"
33
+ }
34
+ }
package/readme.md CHANGED
@@ -1,54 +1,54 @@
1
- # polyci
2
-
3
- Generates GitLab CI pipelines for monorepos. Discovers modules under a root directory, creates per-module build, test, release, publish, and deploy jobs, and wires them with conventional-commit-based versioning via semalease.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install
9
- npm run build
10
- ```
11
-
12
- Or use via `npx polyci` when the package is published.
13
-
14
- ## Usage
15
-
16
- ```bash
17
- npx polyci [output] [options]
18
- ```
19
-
20
- **Example** (typical GitLab CI setup):
21
-
22
- ```bash
23
- npx polyci --modules-root modules polyci-pipeline.yml
24
- ```
25
-
26
- **Options:**
27
-
28
- | Option | Description | Default |
29
- |--------|-------------|---------|
30
- | `-o, --output <path>` | Output pipeline file path | — |
31
- | `--modules-root <path>` | Root directory to scan for modules | `./modules` |
32
- | `--main-branch <name>` | Primary branch for release tagging | `main` |
33
- | `--version-template <template>` | Version template for main branch; placeholders: `{version}`, `{branch}`, `{increment}` | `{version}` |
34
- | `--branch-version-template <template>` | Version template for non-main branches | `{version}-{branch}-{increment}` |
35
- | `--tag-template <template>` | Tag template; placeholders: `{module}`, `{version}` | `{module}-v{version}` |
36
- | `--tag-pattern <pattern>` | Tag regex for main branch (passed to semalease) | `^$PLI_MODULE_NAME-v(?<version>...)` |
37
- | `--branch-tag-pattern <pattern>` | Tag regex for non-main branches (with `?<increment>`) | — |
38
- | `--cwd <path>` | Working directory | current directory |
39
-
40
- ## Description
41
-
42
- If there is no new version, publish and deploy finish successfuly doing nothing.
43
-
44
- ## Requirements
45
-
46
- - **POLYCI_TOKEN** — GitLab OAuth token for pushing tags; must be defined in GitLab CI/CD variables and available to jobs that run the release stage.
47
- - **Module build** — Each module must support `npm run build` and produce output in `./dist`.
48
-
49
- For **docker-service** deploy type: a Docker host with Traefik 3.
50
-
51
- ## Recommendations
52
-
53
- - **Do not modify the built-in module types** (`node-vite`, `node-express`, `npm-package`). Copy and customize a new type under `ci/` instead.
54
- - **Avoid heavy setup in `release.sh`** — Module releases run sequentially in a single container; installing extra packages or changing the environment can slow or break the job.
1
+ # polyci
2
+
3
+ Generates GitLab CI pipelines for monorepos. Discovers modules under a root directory, creates per-module build, test, release, publish, and deploy jobs, and wires them with conventional-commit-based versioning via semalease.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install
9
+ npm run build
10
+ ```
11
+
12
+ Or use via `npx polyci` when the package is published.
13
+
14
+ ## Usage
15
+
16
+ ```bash
17
+ npx polyci [output] [options]
18
+ ```
19
+
20
+ **Example** (typical GitLab CI setup):
21
+
22
+ ```bash
23
+ npx polyci --modules-root modules polyci-pipeline.yml
24
+ ```
25
+
26
+ **Options:**
27
+
28
+ | Option | Description | Default |
29
+ |--------|-------------|---------|
30
+ | `-o, --output <path>` | Output pipeline file path | — |
31
+ | `--modules-root <path>` | Root directory to scan for modules | `./modules` |
32
+ | `--main-branch <name>` | Primary branch for release tagging | `main` |
33
+ | `--version-template <template>` | Version template for main branch; placeholders: `{version}`, `{branch}`, `{increment}` | `{version}` |
34
+ | `--branch-version-template <template>` | Version template for non-main branches | `{version}-{branch}-{increment}` |
35
+ | `--tag-template <template>` | Tag template; placeholders: `{module}`, `{version}` | `{module}-v{version}` |
36
+ | `--tag-pattern <pattern>` | Tag regex for main branch (passed to semalease) | `^$PLI_MODULE_NAME-v(?<version>...)` |
37
+ | `--branch-tag-pattern <pattern>` | Tag regex for non-main branches (with `?<increment>`) | — |
38
+ | `--cwd <path>` | Working directory | current directory |
39
+
40
+ ## Description
41
+
42
+ If there is no new version, publish and deploy finish successfuly doing nothing.
43
+
44
+ ## Requirements
45
+
46
+ - **POLYCI_TOKEN** — GitLab OAuth token for pushing tags; must be defined in GitLab CI/CD variables and available to jobs that run the release stage.
47
+ - **Module build** — Each module must support `npm run build` and produce output in `./dist`.
48
+
49
+ For **docker-service** deploy type: a Docker host with Traefik 3.
50
+
51
+ ## Recommendations
52
+
53
+ - **Do not modify the built-in module types** (`node-vite`, `node-express`, `npm-package`). Copy and customize a new type under `ci/` instead.
54
+ - **Avoid heavy setup in `release.sh`** — Module releases run sequentially in a single container; installing extra packages or changing the environment can slow or break the job.