Something went wrong. Try again.
An AT Protocol Personal Data Server written in JavaScript pdsjs.dev
pds atproto
Something went wrong. Try again.
JavaScript
123456789101112131415161718192021222324252627// Rewrites the VERSION constant in @pdsjs/core to match its package.json.//// changeset version bumps manifests but never touches source, and core carries// its version as a literal because it cannot import package.json on Workers or// Deno. Left to a human, the two drift: the constant sat at 0.7.0 across two// releases, then at 1.0.0 through the 1.0.1 release. This runs as part of// `npm run version-packages`; test/version.test.js is the backstop.import { readFileSync, writeFileSync } from 'node:fs';
const pkgUrl = new URL('../packages/core/package.json', import.meta.url);const srcUrl = new URL('../packages/core/src/pds.js', import.meta.url);
const { version } = JSON.parse(readFileSync(pkgUrl, 'utf8'));const source = readFileSync(srcUrl, 'utf8');const pattern = /^const VERSION = '[^']*';$/m;
if (!pattern.test(source)) { console.error( 'sync-version: no VERSION constant in packages/core/src/pds.js — it was ' + 'renamed or reformatted, and the version can no longer be kept in step.', ); process.exit(1);}
writeFileSync(srcUrl, source.replace(pattern, `const VERSION = '${version}';`));console.log(`sync-version: VERSION -> ${version}`);