@zairakai/js-dev-tools 3.7.0 → 3.8.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.
@@ -393,6 +393,9 @@ js:publish:
393
393
  id_tokens:
394
394
  NPM_ID_TOKEN:
395
395
  aud: "npm:registry.npmjs.org"
396
+ # Lets npm sign the provenance: the package page shows it was built on GitLab from this project.
397
+ SIGSTORE_ID_TOKEN:
398
+ aud: sigstore
396
399
  rules:
397
400
  - if: $UPDATE_DEPENDENCIES == "true"
398
401
  when: never
@@ -406,7 +409,7 @@ js:publish:
406
409
  fi
407
410
  echo "Publishing ${NPM_PACKAGE_NAME}@${CI_COMMIT_TAG} to npm (tag ${npm_tag})..."
408
411
  npm version "${CI_COMMIT_TAG}" --no-git-tag-version --allow-same-version
409
- npm publish --access public --tag "${npm_tag}"
412
+ npm publish --provenance --access public --tag "${npm_tag}"
410
413
  environment:
411
414
  name: production
412
415
  url: https://www.npmjs.com/package/${NPM_PACKAGE_NAME}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zairakai/js-dev-tools",
3
- "version": "3.7.0",
3
+ "version": "3.8.0",
4
4
  "description": "The unified and centralized development toolkit for JavaScript/TypeScript projects - ESLint, Prettier, Stylelint, Knip, Vitest, Git Hooks, and GitLab CI pipeline templates",
5
5
  "keywords": [
6
6
  "dev-tools",
@@ -89,14 +89,14 @@
89
89
  },
90
90
  "dependencies": {
91
91
  "@stanislas-poisson/js-dev-tools": "^1.0.0",
92
- "eslint": "^10.12.0",
92
+ "eslint": "^10.13.0",
93
93
  "markdownlint-cli2": "^0.23.3",
94
94
  "prettier": "^3.9.10",
95
95
  "stylelint": "^17.16.0"
96
96
  },
97
97
  "devDependencies": {
98
98
  "@vitest/coverage-v8": "^5.0.5",
99
- "knip": "^6.41.0",
99
+ "knip": "^6.42.0",
100
100
  "sort-package-json": "^4.1.0",
101
101
  "typescript": "^6.0.3",
102
102
  "vitest": "^5.0.5",
@@ -26,6 +26,7 @@ import { existsSync, readFileSync } from 'node:fs'
26
26
  import { pathToFileURL } from 'node:url'
27
27
 
28
28
  const CONFIG_FILE = '.dependency-update.json'
29
+ const PIPELINE_FILE = '.gitlab-ci.yml'
29
30
  const COMMIT_SUBJECT = 'chore(deps): update the dependencies'
30
31
  const BRANCH_PREFIX = 'chore/update-dependencies'
31
32
 
@@ -152,6 +153,16 @@ export function planTag({ config, last, commits, before, after, sections = RUNTI
152
153
  return { version: nextVersion(last, config.tag.level), reason: 'a published range changed' }
153
154
  }
154
155
 
156
+ /**
157
+ * True when a diff changes one `ref:` line and nothing else. The install of the tools moves the `ref:` of the shared
158
+ * pipeline to the installed version: that is the only change of the pipeline file an update may commit.
159
+ */
160
+ export function isRefOnlyChange(diff) {
161
+ const changed = diff.split('\n').filter((line) => /^[+-]/.test(line) && !/^(\+\+\+|---)/.test(line))
162
+
163
+ return 2 === changed.length && changed.every((line) => /^[+-]\s*ref:\s*\S+\s*$/.test(line))
164
+ }
165
+
155
166
  // ---------------------------------------------------------------------------------------------------------------------
156
167
 
157
168
  const log = (message) => console.info(message)
@@ -336,6 +347,11 @@ async function update(config) {
336
347
  // Only the manifest and the lock file: the postinstall of the tools can rewrite other files of the project in CI.
337
348
  const files = [ecosystem.file, ...['package-lock.json', 'composer.lock'].filter((file) => existsSync(file))]
338
349
 
350
+ // The one exception: the `ref:` of the shared pipeline follows the installed version of the tools.
351
+ if (existsSync(PIPELINE_FILE) && isRefOnlyChange(run('git', ['diff', '-U0', '--', PIPELINE_FILE]))) {
352
+ files.push(PIPELINE_FILE)
353
+ }
354
+
339
355
  if ('' === run('git', ['status', '--porcelain', '--', ...files])) {
340
356
  log('Everything is up to date.')
341
357
  return