diff --git a/.versionrc.js b/.versionrc.cjs similarity index 100% rename from .versionrc.js rename to .versionrc.cjs diff --git a/package.json b/package.json index b3024bb..afdcc75 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "___ Miscellaneous ___": "", "man:dev:update": "keep-updated update --audit-fix", "man:nx:migrate": "npx nx migrate latest && npx nx migrate --run-migrations && npm run man:dev:update && rm -f migrations.json", + "postinstall": "node ./tools/patch-std-ver.mjs", "prepare": "is-ci || husky install" }, "private": true, diff --git a/tools/patch-std-ver.mjs b/tools/patch-std-ver.mjs new file mode 100644 index 0000000..3a3a73f --- /dev/null +++ b/tools/patch-std-ver.mjs @@ -0,0 +1,14 @@ +import { existsSync, readFileSync, writeFileSync } from 'node:fs'; +import { normalize } from 'node:path'; + +const filePath = normalize('node_modules/standard-version/lib/configuration.js'); + +if (existsSync(filePath)) { + const content = readFileSync(filePath, { encoding: 'utf8' }) + .replace(`'.versionrc',`, `'.versionrc',\n '.versionrc.cjs',`) + .replace( + `if (path.extname(configPath) === '.js') {`, + `const ext = path.extname(configPath)\n if (ext === '.js' || ext === '.cjs') {`, + ); + writeFileSync(filePath, content, { encoding: 'utf8' }); +}