@nocode-factory/sanity-kit 2.12.0 → 2.13.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocode-factory/sanity-kit",
3
- "version": "2.12.0",
3
+ "version": "2.13.1",
4
4
  "description": "Outils Studio de NoCode Factory : Pages (liste + board), Composants, Historique",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -47,7 +47,8 @@
47
47
  "dev": "pkg-utils watch",
48
48
  "typecheck": "tsc --noEmit",
49
49
  "test": "vitest run",
50
- "test:watch": "vitest"
50
+ "test:watch": "vitest",
51
+ "version": "node scripts/sync-version.mjs && git add src/version.ts"
51
52
  },
52
53
  "dependencies": {
53
54
  "@sanity/client": "^7.27.0",
@@ -0,0 +1,11 @@
1
+ // Recopie la version de package.json dans src/version.ts. Lancé par `npm version`
2
+ // (script "version") : la version affichée dans le Studio ne peut plus dériver.
3
+ import {readFileSync, writeFileSync} from 'node:fs'
4
+
5
+ const {version} = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'))
6
+ const file = new URL('../src/version.ts', import.meta.url)
7
+ const source = readFileSync(file, 'utf8')
8
+ const next = source.replace(/export const KIT_VERSION = '[^']*'/, `export const KIT_VERSION = '${version}'`)
9
+ if (!next.includes(`'${version}'`)) throw new Error('KIT_VERSION introuvable dans src/version.ts')
10
+ writeFileSync(file, next)
11
+ console.log(`KIT_VERSION = ${version}`)
package/src/version.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Version du kit, rapportée au service pour savoir quels projets tournent sur
3
- * quelle version. Tenue à jour avec `package.json`.
3
+ * quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
4
+ * le vérifie.
4
5
  */
5
- export const KIT_VERSION = '2.11.0'
6
+ export const KIT_VERSION = '2.13.1'