@oddessentials/repo-standards 5.3.0 → 6.0.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/README.md +10 -1
- package/dist/config/standards.csharp-dotnet.azure-devops.json +1 -1
- package/dist/config/standards.csharp-dotnet.github-actions.json +1 -1
- package/dist/config/standards.csharp-dotnet.json +1 -1
- package/dist/config/standards.go.azure-devops.json +1 -1
- package/dist/config/standards.go.github-actions.json +1 -1
- package/dist/config/standards.go.json +1 -1
- package/dist/config/standards.json +2 -2
- package/dist/config/standards.python.azure-devops.json +1 -1
- package/dist/config/standards.python.github-actions.json +1 -1
- package/dist/config/standards.python.json +1 -1
- package/dist/config/standards.rust.azure-devops.json +1 -1
- package/dist/config/standards.rust.github-actions.json +1 -1
- package/dist/config/standards.rust.json +1 -1
- package/dist/config/standards.typescript-js.azure-devops.json +2 -2
- package/dist/config/standards.typescript-js.github-actions.json +2 -2
- package/dist/config/standards.typescript-js.json +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/scripts/sync-schema-version-pretest.cjs +43 -0
package/README.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
[](https://www.npmjs.com/package/@oddessentials/repo-standards)
|
|
2
|
+
[](https://www.npmjs.com/package/@oddessentials/repo-standards)
|
|
2
3
|
[](https://github.com/oddessentials/repo-standards/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/oddessentials/repo-standards/actions/workflows/release.yml)
|
|
5
|
+
[](https://renovatebot.com)
|
|
6
|
+
[](https://github.com/semantic-release/semantic-release)
|
|
7
|
+
[](https://github.com/semantic-release/semantic-release)
|
|
8
|
+
[](https://conventionalcommits.org)
|
|
3
9
|
[](LICENSE)
|
|
10
|
+
[](https://nodejs.org)
|
|
11
|
+
[](https://www.typescriptlang.org/)
|
|
4
12
|
|
|
5
13
|
# 🐝 Repository Standards & CI Checklist
|
|
6
14
|
|
|
@@ -68,7 +76,7 @@ The master spec includes a `meta` block that defines system-wide expectations:
|
|
|
68
76
|
|
|
69
77
|
## Structure of `config/standards.json`
|
|
70
78
|
|
|
71
|
-
- `version` — schema version (currently `
|
|
79
|
+
- `version` — schema version (currently `6`)
|
|
72
80
|
- `meta` — global rules and migration policy
|
|
73
81
|
- `ciSystems` — supported CI platforms
|
|
74
82
|
_(currently `github-actions`, `azure-devops`)_
|
|
@@ -105,6 +113,7 @@ The `version` field indicates schema compatibility:
|
|
|
105
113
|
- `3` — Expands release, build determinism, and provenance/CI automation requirements; adds unified release workflow and template automation guidance.
|
|
106
114
|
- `4` — Stable API contract with `getStandards()`, `getSchema()`, `STANDARDS_VERSION` exports; Node 22 LTS alignment.
|
|
107
115
|
- `5` — Adds automated version-guard guidance for repositories using semantic-release; schema aligned to package major version 5.
|
|
116
|
+
- `6` — Schema version aligned to package major version 6; introduces automated pre-test version sync.
|
|
108
117
|
|
|
109
118
|
To keep `config/standards.json` in sync with semantic-release major bumps, use
|
|
110
119
|
`scripts/sync-standards-version.cjs` during the semantic-release prepare step
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"description": "Verify no CRLF in shell/script files",
|
|
130
130
|
"expectExitCode": 0
|
|
131
131
|
},
|
|
132
|
-
"notes": "Use .gitattributes as the authority for EOL; .editorconfig is supplementary for editor display. Mark *.sh, *.bash as eol=lf. After adding .gitattributes, run 'git add --renormalize .' to fix existing files. Windows contributors should set core.autocrlf=false.",
|
|
132
|
+
"notes": "Use .gitattributes as the authority for EOL; .editorconfig is supplementary for editor display. Mark *.sh, *.bash as eol=lf. After adding .gitattributes, run 'git add --renormalize .' to fix existing files. Windows contributors should set core.autocrlf=false and core.safecrlf=warn (safecrlf=true blocks normalization with fatal errors).",
|
|
133
133
|
"optionalFiles": [
|
|
134
134
|
".editorconfig"
|
|
135
135
|
],
|
|
@@ -4706,5 +4706,5 @@
|
|
|
4706
4706
|
"languageFamily": "js"
|
|
4707
4707
|
}
|
|
4708
4708
|
},
|
|
4709
|
-
"version":
|
|
4709
|
+
"version": 6
|
|
4710
4710
|
}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"description": "Verify no CRLF in shell/script files",
|
|
25
25
|
"expectExitCode": 0
|
|
26
26
|
},
|
|
27
|
-
"notes": "Use .gitattributes as the authority for EOL; .editorconfig is supplementary for editor display. Mark *.sh, *.bash as eol=lf. After adding .gitattributes, run 'git add --renormalize .' to fix existing files. Windows contributors should set core.autocrlf=false.",
|
|
27
|
+
"notes": "Use .gitattributes as the authority for EOL; .editorconfig is supplementary for editor display. Mark *.sh, *.bash as eol=lf. After adding .gitattributes, run 'git add --renormalize .' to fix existing files. Windows contributors should set core.autocrlf=false and core.safecrlf=warn (safecrlf=true blocks normalization with fatal errors).",
|
|
28
28
|
"optionalFiles": [
|
|
29
29
|
".editorconfig"
|
|
30
30
|
],
|
|
@@ -1306,5 +1306,5 @@
|
|
|
1306
1306
|
},
|
|
1307
1307
|
"stack": "typescript-js",
|
|
1308
1308
|
"stackLabel": "TypeScript / JavaScript",
|
|
1309
|
-
"version":
|
|
1309
|
+
"version": 6
|
|
1310
1310
|
}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"description": "Verify no CRLF in shell/script files",
|
|
25
25
|
"expectExitCode": 0
|
|
26
26
|
},
|
|
27
|
-
"notes": "Use .gitattributes as the authority for EOL; .editorconfig is supplementary for editor display. Mark *.sh, *.bash as eol=lf. After adding .gitattributes, run 'git add --renormalize .' to fix existing files. Windows contributors should set core.autocrlf=false.",
|
|
27
|
+
"notes": "Use .gitattributes as the authority for EOL; .editorconfig is supplementary for editor display. Mark *.sh, *.bash as eol=lf. After adding .gitattributes, run 'git add --renormalize .' to fix existing files. Windows contributors should set core.autocrlf=false and core.safecrlf=warn (safecrlf=true blocks normalization with fatal errors).",
|
|
28
28
|
"optionalFiles": [
|
|
29
29
|
".editorconfig"
|
|
30
30
|
],
|
|
@@ -1306,5 +1306,5 @@
|
|
|
1306
1306
|
},
|
|
1307
1307
|
"stack": "typescript-js",
|
|
1308
1308
|
"stackLabel": "TypeScript / JavaScript",
|
|
1309
|
-
"version":
|
|
1309
|
+
"version": 6
|
|
1310
1310
|
}
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"description": "Verify no CRLF in shell/script files",
|
|
29
29
|
"expectExitCode": 0
|
|
30
30
|
},
|
|
31
|
-
"notes": "Use .gitattributes as the authority for EOL; .editorconfig is supplementary for editor display. Mark *.sh, *.bash as eol=lf. After adding .gitattributes, run 'git add --renormalize .' to fix existing files. Windows contributors should set core.autocrlf=false.",
|
|
31
|
+
"notes": "Use .gitattributes as the authority for EOL; .editorconfig is supplementary for editor display. Mark *.sh, *.bash as eol=lf. After adding .gitattributes, run 'git add --renormalize .' to fix existing files. Windows contributors should set core.autocrlf=false and core.safecrlf=warn (safecrlf=true blocks normalization with fatal errors).",
|
|
32
32
|
"optionalFiles": [
|
|
33
33
|
".editorconfig"
|
|
34
34
|
],
|
|
@@ -1458,5 +1458,5 @@
|
|
|
1458
1458
|
},
|
|
1459
1459
|
"stack": "typescript-js",
|
|
1460
1460
|
"stackLabel": "TypeScript / JavaScript",
|
|
1461
|
-
"version":
|
|
1461
|
+
"version": 6
|
|
1462
1462
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -41,8 +41,8 @@ var import_node_fs = require("fs");
|
|
|
41
41
|
var import_node_path = require("path");
|
|
42
42
|
|
|
43
43
|
// src/version.ts
|
|
44
|
-
var STANDARDS_VERSION = "
|
|
45
|
-
var STANDARDS_SCHEMA_VERSION =
|
|
44
|
+
var STANDARDS_VERSION = "6.0.0";
|
|
45
|
+
var STANDARDS_SCHEMA_VERSION = 6;
|
|
46
46
|
|
|
47
47
|
// src/index.ts
|
|
48
48
|
var __filename2 = (0, import_node_url.fileURLToPath)(importMetaUrl);
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../node_modules/tsup/assets/cjs_shims.js","../src/version.ts"],"sourcesContent":["import { fileURLToPath } from \"node:url\";\nimport { readFileSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\nimport type {\n MasterJson,\n StackChecklistJson,\n StackId,\n CiSystem,\n} from \"./types.js\";\nimport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION } from \"./version.js\";\n\n// Re-export types for consumers\nexport type { MasterJson, StackChecklistJson, StackId, CiSystem };\n\n// Re-export version info (stable API contract)\nexport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION };\n\n// ESM equivalent of __dirname\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n// Path to config directory:\n// - When running from src/ (dev/test): use repo root config/\n// - When running from dist/ (installed): use dist/config/\nconst isDevMode = __dirname.includes(\"src\");\nconst configDir = isDevMode\n ? join(__dirname, \"..\", \"config\")\n : join(__dirname, \"config\");\n\n/** Load the master spec JSON from the packaged dist directory */\nexport function loadMasterSpec(): MasterJson {\n const filePath = join(configDir, \"standards.json\");\n return JSON.parse(readFileSync(filePath, \"utf8\"));\n}\n\n/** Load a stack-specific checklist (optionally filtered by CI system) */\nexport function loadBaseline(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n const suffix = ci ? `.${ci}` : \"\";\n const file = `standards.${stack}${suffix}.json`;\n const filePath = join(configDir, file);\n return JSON.parse(readFileSync(filePath, \"utf8\"));\n}\n\n/** List all supported stacks (derived from the master spec) */\nexport function listSupportedStacks(): readonly StackId[] {\n const spec = loadMasterSpec();\n return Object.keys(spec.stacks) as StackId[];\n}\n\n/** List all supported CI systems (derived from the master spec) */\nexport function listSupportedCiSystems(): readonly CiSystem[] {\n const spec = loadMasterSpec();\n return spec.ciSystems as CiSystem[];\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadBaseline - loads stack-specific standards checklist.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getStandards(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n return loadBaseline(stack, ci);\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadMasterSpec - loads the master standards schema.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getSchema(): MasterJson {\n return loadMasterSpec();\n}\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","/**\n * AUTO-GENERATED at build time by scripts/build.ts\n * DO NOT EDIT MANUALLY\n *\n * This module provides version information for the repo-standards package.\n * Consumers should import from here instead of package.json to avoid\n * ESM/CJS interop issues.\n */\n\nexport const STANDARDS_VERSION = '
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../node_modules/tsup/assets/cjs_shims.js","../src/version.ts"],"sourcesContent":["import { fileURLToPath } from \"node:url\";\nimport { readFileSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\nimport type {\n MasterJson,\n StackChecklistJson,\n StackId,\n CiSystem,\n} from \"./types.js\";\nimport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION } from \"./version.js\";\n\n// Re-export types for consumers\nexport type { MasterJson, StackChecklistJson, StackId, CiSystem };\n\n// Re-export version info (stable API contract)\nexport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION };\n\n// ESM equivalent of __dirname\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n// Path to config directory:\n// - When running from src/ (dev/test): use repo root config/\n// - When running from dist/ (installed): use dist/config/\nconst isDevMode = __dirname.includes(\"src\");\nconst configDir = isDevMode\n ? join(__dirname, \"..\", \"config\")\n : join(__dirname, \"config\");\n\n/** Load the master spec JSON from the packaged dist directory */\nexport function loadMasterSpec(): MasterJson {\n const filePath = join(configDir, \"standards.json\");\n return JSON.parse(readFileSync(filePath, \"utf8\"));\n}\n\n/** Load a stack-specific checklist (optionally filtered by CI system) */\nexport function loadBaseline(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n const suffix = ci ? `.${ci}` : \"\";\n const file = `standards.${stack}${suffix}.json`;\n const filePath = join(configDir, file);\n return JSON.parse(readFileSync(filePath, \"utf8\"));\n}\n\n/** List all supported stacks (derived from the master spec) */\nexport function listSupportedStacks(): readonly StackId[] {\n const spec = loadMasterSpec();\n return Object.keys(spec.stacks) as StackId[];\n}\n\n/** List all supported CI systems (derived from the master spec) */\nexport function listSupportedCiSystems(): readonly CiSystem[] {\n const spec = loadMasterSpec();\n return spec.ciSystems as CiSystem[];\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadBaseline - loads stack-specific standards checklist.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getStandards(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n return loadBaseline(stack, ci);\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadMasterSpec - loads the master standards schema.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getSchema(): MasterJson {\n return loadMasterSpec();\n}\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","/**\n * AUTO-GENERATED at build time by scripts/build.ts\n * DO NOT EDIT MANUALLY\n *\n * This module provides version information for the repo-standards package.\n * Consumers should import from here instead of package.json to avoid\n * ESM/CJS interop issues.\n */\n\nexport const STANDARDS_VERSION = '6.0.0';\nexport const STANDARDS_SCHEMA_VERSION = 6;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKA,IAAM,mBAAmB,MACvB,OAAO,aAAa,cAChB,IAAI,IAAI,QAAQ,UAAU,EAAE,EAAE,OAC7B,SAAS,iBAAiB,SAAS,cAAc,QAAQ,YAAY,MAAM,WAC1E,SAAS,cAAc,MACvB,IAAI,IAAI,WAAW,SAAS,OAAO,EAAE;AAEtC,IAAM,gBAAgC,iCAAiB;;;ADZ9D,sBAA8B;AAC9B,qBAA6B;AAC7B,uBAA8B;;;AEOvB,IAAM,oBAAoB;AAC1B,IAAM,2BAA2B;;;AFQxC,IAAMA,kBAAa,+BAAc,aAAe;AAChD,IAAM,gBAAY,0BAAQA,WAAU;AAKpC,IAAM,YAAY,UAAU,SAAS,KAAK;AAC1C,IAAM,YAAY,gBACd,uBAAK,WAAW,MAAM,QAAQ,QAC9B,uBAAK,WAAW,QAAQ;AAGrB,SAAS,iBAA6B;AAC3C,QAAM,eAAW,uBAAK,WAAW,gBAAgB;AACjD,SAAO,KAAK,UAAM,6BAAa,UAAU,MAAM,CAAC;AAClD;AAGO,SAAS,aACd,OACA,IACoB;AACpB,QAAM,SAAS,KAAK,IAAI,EAAE,KAAK;AAC/B,QAAM,OAAO,aAAa,KAAK,GAAG,MAAM;AACxC,QAAM,eAAW,uBAAK,WAAW,IAAI;AACrC,SAAO,KAAK,UAAM,6BAAa,UAAU,MAAM,CAAC;AAClD;AAGO,SAAS,sBAA0C;AACxD,QAAM,OAAO,eAAe;AAC5B,SAAO,OAAO,KAAK,KAAK,MAAM;AAChC;AAGO,SAAS,yBAA8C;AAC5D,QAAM,OAAO,eAAe;AAC5B,SAAO,KAAK;AACd;AAOO,SAAS,aACd,OACA,IACoB;AACpB,SAAO,aAAa,OAAO,EAAE;AAC/B;AAOO,SAAS,YAAwB;AACtC,SAAO,eAAe;AACxB;","names":["__filename"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -156,8 +156,8 @@ interface StackChecklistJson {
|
|
|
156
156
|
* Consumers should import from here instead of package.json to avoid
|
|
157
157
|
* ESM/CJS interop issues.
|
|
158
158
|
*/
|
|
159
|
-
declare const STANDARDS_VERSION = "
|
|
160
|
-
declare const STANDARDS_SCHEMA_VERSION =
|
|
159
|
+
declare const STANDARDS_VERSION = "6.0.0";
|
|
160
|
+
declare const STANDARDS_SCHEMA_VERSION = 6;
|
|
161
161
|
|
|
162
162
|
/** Load the master spec JSON from the packaged dist directory */
|
|
163
163
|
declare function loadMasterSpec(): MasterJson;
|
package/dist/index.d.ts
CHANGED
|
@@ -156,8 +156,8 @@ interface StackChecklistJson {
|
|
|
156
156
|
* Consumers should import from here instead of package.json to avoid
|
|
157
157
|
* ESM/CJS interop issues.
|
|
158
158
|
*/
|
|
159
|
-
declare const STANDARDS_VERSION = "
|
|
160
|
-
declare const STANDARDS_SCHEMA_VERSION =
|
|
159
|
+
declare const STANDARDS_VERSION = "6.0.0";
|
|
160
|
+
declare const STANDARDS_SCHEMA_VERSION = 6;
|
|
161
161
|
|
|
162
162
|
/** Load the master spec JSON from the packaged dist directory */
|
|
163
163
|
declare function loadMasterSpec(): MasterJson;
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import { readFileSync } from "fs";
|
|
|
4
4
|
import { join, dirname } from "path";
|
|
5
5
|
|
|
6
6
|
// src/version.ts
|
|
7
|
-
var STANDARDS_VERSION = "
|
|
8
|
-
var STANDARDS_SCHEMA_VERSION =
|
|
7
|
+
var STANDARDS_VERSION = "6.0.0";
|
|
8
|
+
var STANDARDS_SCHEMA_VERSION = 6;
|
|
9
9
|
|
|
10
10
|
// src/index.ts
|
|
11
11
|
var __filename2 = fileURLToPath(import.meta.url);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/version.ts"],"sourcesContent":["import { fileURLToPath } from \"node:url\";\nimport { readFileSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\nimport type {\n MasterJson,\n StackChecklistJson,\n StackId,\n CiSystem,\n} from \"./types.js\";\nimport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION } from \"./version.js\";\n\n// Re-export types for consumers\nexport type { MasterJson, StackChecklistJson, StackId, CiSystem };\n\n// Re-export version info (stable API contract)\nexport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION };\n\n// ESM equivalent of __dirname\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n// Path to config directory:\n// - When running from src/ (dev/test): use repo root config/\n// - When running from dist/ (installed): use dist/config/\nconst isDevMode = __dirname.includes(\"src\");\nconst configDir = isDevMode\n ? join(__dirname, \"..\", \"config\")\n : join(__dirname, \"config\");\n\n/** Load the master spec JSON from the packaged dist directory */\nexport function loadMasterSpec(): MasterJson {\n const filePath = join(configDir, \"standards.json\");\n return JSON.parse(readFileSync(filePath, \"utf8\"));\n}\n\n/** Load a stack-specific checklist (optionally filtered by CI system) */\nexport function loadBaseline(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n const suffix = ci ? `.${ci}` : \"\";\n const file = `standards.${stack}${suffix}.json`;\n const filePath = join(configDir, file);\n return JSON.parse(readFileSync(filePath, \"utf8\"));\n}\n\n/** List all supported stacks (derived from the master spec) */\nexport function listSupportedStacks(): readonly StackId[] {\n const spec = loadMasterSpec();\n return Object.keys(spec.stacks) as StackId[];\n}\n\n/** List all supported CI systems (derived from the master spec) */\nexport function listSupportedCiSystems(): readonly CiSystem[] {\n const spec = loadMasterSpec();\n return spec.ciSystems as CiSystem[];\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadBaseline - loads stack-specific standards checklist.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getStandards(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n return loadBaseline(stack, ci);\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadMasterSpec - loads the master standards schema.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getSchema(): MasterJson {\n return loadMasterSpec();\n}\n","/**\n * AUTO-GENERATED at build time by scripts/build.ts\n * DO NOT EDIT MANUALLY\n *\n * This module provides version information for the repo-standards package.\n * Consumers should import from here instead of package.json to avoid\n * ESM/CJS interop issues.\n */\n\nexport const STANDARDS_VERSION = '
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/version.ts"],"sourcesContent":["import { fileURLToPath } from \"node:url\";\nimport { readFileSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\nimport type {\n MasterJson,\n StackChecklistJson,\n StackId,\n CiSystem,\n} from \"./types.js\";\nimport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION } from \"./version.js\";\n\n// Re-export types for consumers\nexport type { MasterJson, StackChecklistJson, StackId, CiSystem };\n\n// Re-export version info (stable API contract)\nexport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION };\n\n// ESM equivalent of __dirname\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n// Path to config directory:\n// - When running from src/ (dev/test): use repo root config/\n// - When running from dist/ (installed): use dist/config/\nconst isDevMode = __dirname.includes(\"src\");\nconst configDir = isDevMode\n ? join(__dirname, \"..\", \"config\")\n : join(__dirname, \"config\");\n\n/** Load the master spec JSON from the packaged dist directory */\nexport function loadMasterSpec(): MasterJson {\n const filePath = join(configDir, \"standards.json\");\n return JSON.parse(readFileSync(filePath, \"utf8\"));\n}\n\n/** Load a stack-specific checklist (optionally filtered by CI system) */\nexport function loadBaseline(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n const suffix = ci ? `.${ci}` : \"\";\n const file = `standards.${stack}${suffix}.json`;\n const filePath = join(configDir, file);\n return JSON.parse(readFileSync(filePath, \"utf8\"));\n}\n\n/** List all supported stacks (derived from the master spec) */\nexport function listSupportedStacks(): readonly StackId[] {\n const spec = loadMasterSpec();\n return Object.keys(spec.stacks) as StackId[];\n}\n\n/** List all supported CI systems (derived from the master spec) */\nexport function listSupportedCiSystems(): readonly CiSystem[] {\n const spec = loadMasterSpec();\n return spec.ciSystems as CiSystem[];\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadBaseline - loads stack-specific standards checklist.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getStandards(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n return loadBaseline(stack, ci);\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadMasterSpec - loads the master standards schema.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getSchema(): MasterJson {\n return loadMasterSpec();\n}\n","/**\n * AUTO-GENERATED at build time by scripts/build.ts\n * DO NOT EDIT MANUALLY\n *\n * This module provides version information for the repo-standards package.\n * Consumers should import from here instead of package.json to avoid\n * ESM/CJS interop issues.\n */\n\nexport const STANDARDS_VERSION = '6.0.0';\nexport const STANDARDS_SCHEMA_VERSION = 6;\n"],"mappings":";AAAA,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B,SAAS,MAAM,eAAe;;;ACOvB,IAAM,oBAAoB;AAC1B,IAAM,2BAA2B;;;ADQxC,IAAMA,cAAa,cAAc,YAAY,GAAG;AAChD,IAAMC,aAAY,QAAQD,WAAU;AAKpC,IAAM,YAAYC,WAAU,SAAS,KAAK;AAC1C,IAAM,YAAY,YACd,KAAKA,YAAW,MAAM,QAAQ,IAC9B,KAAKA,YAAW,QAAQ;AAGrB,SAAS,iBAA6B;AAC3C,QAAM,WAAW,KAAK,WAAW,gBAAgB;AACjD,SAAO,KAAK,MAAM,aAAa,UAAU,MAAM,CAAC;AAClD;AAGO,SAAS,aACd,OACA,IACoB;AACpB,QAAM,SAAS,KAAK,IAAI,EAAE,KAAK;AAC/B,QAAM,OAAO,aAAa,KAAK,GAAG,MAAM;AACxC,QAAM,WAAW,KAAK,WAAW,IAAI;AACrC,SAAO,KAAK,MAAM,aAAa,UAAU,MAAM,CAAC;AAClD;AAGO,SAAS,sBAA0C;AACxD,QAAM,OAAO,eAAe;AAC5B,SAAO,OAAO,KAAK,KAAK,MAAM;AAChC;AAGO,SAAS,yBAA8C;AAC5D,QAAM,OAAO,eAAe;AAC5B,SAAO,KAAK;AACd;AAOO,SAAS,aACd,OACA,IACoB;AACpB,SAAO,aAAa,OAAO,EAAE;AAC/B;AAOO,SAAS,YAAwB;AACtC,SAAO,eAAe;AACxB;","names":["__filename","__dirname"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oddessentials/repo-standards",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "6.0.1",
|
|
5
5
|
"description": "Standards and CI filtering utilities for multi-stack repository governance.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
"format:check": "prettier . --check",
|
|
17
17
|
"test": "vitest run",
|
|
18
18
|
"typecheck": "tsc --noEmit",
|
|
19
|
+
"sync:version": "node scripts/sync-schema-version-pretest.cjs",
|
|
19
20
|
"prepare": "husky",
|
|
20
21
|
"postinstall": "git config core.hooksPath .husky || true",
|
|
21
|
-
"ci": "npm run lint && npm run format:check && npm run typecheck && npm run test && npm run build",
|
|
22
|
+
"ci": "npm run lint && npm run format:check && npm run typecheck && npm run sync:version && npm run test && npm run build",
|
|
22
23
|
"generate:standards": "tsx scripts/generate-standards.ts",
|
|
23
24
|
"validate:schema": "tsx scripts/validate-schema.ts",
|
|
24
25
|
"verify": "npm run ci"
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-test schema version sync.
|
|
3
|
+
* Ensures config/standards.json version matches package.json major version
|
|
4
|
+
* before tests run. This prevents CI failures when semantic-release has
|
|
5
|
+
* bumped package.json but tests run before build.
|
|
6
|
+
*
|
|
7
|
+
* Usage: node scripts/sync-schema-version-pretest.cjs
|
|
8
|
+
*/
|
|
9
|
+
const fs = require("fs");
|
|
10
|
+
const path = require("path");
|
|
11
|
+
|
|
12
|
+
const rootDir = process.cwd();
|
|
13
|
+
const pkgPath = path.join(rootDir, "package.json");
|
|
14
|
+
const standardsPath = path.join(rootDir, "config", "standards.json");
|
|
15
|
+
|
|
16
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
17
|
+
const standards = JSON.parse(fs.readFileSync(standardsPath, "utf8"));
|
|
18
|
+
|
|
19
|
+
const pkgMajor = parseInt(pkg.version.split(".")[0], 10);
|
|
20
|
+
|
|
21
|
+
if (Number.isNaN(pkgMajor)) {
|
|
22
|
+
console.error(
|
|
23
|
+
`[sync-schema-version] Unable to parse major version from ${pkg.version}`,
|
|
24
|
+
);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (pkgMajor > standards.version) {
|
|
29
|
+
console.log(
|
|
30
|
+
`[sync-schema-version] Upgrading schema version: ${standards.version} -> ${pkgMajor}`,
|
|
31
|
+
);
|
|
32
|
+
standards.version = pkgMajor;
|
|
33
|
+
fs.writeFileSync(standardsPath, JSON.stringify(standards, null, 2) + "\n");
|
|
34
|
+
} else if (standards.version > pkgMajor) {
|
|
35
|
+
console.error(
|
|
36
|
+
`[sync-schema-version] ERROR: Schema version ${standards.version} is ahead of package.json major ${pkgMajor}`,
|
|
37
|
+
);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
} else {
|
|
40
|
+
console.log(
|
|
41
|
+
`[sync-schema-version] Schema version ${standards.version} already matches package.json major`,
|
|
42
|
+
);
|
|
43
|
+
}
|