UNPKG

@basetime/a2w-api-ts

Version:

Client library that communicates with the addtowallet API.

21 lines (17 loc) 771 B
#!/usr/bin/env node /** * Reads the version from package.json and writes it to src/version.ts so * runtime code can import the version without forcing tsc's rootDir up to * the project root (which would emit declarations into dist/src/ rather * than dist/). */ import { readFileSync, writeFileSync } from 'node:fs'; import { dirname, resolve } from 'node:path'; import { fileURLToPath } from 'node:url'; const __dirname = dirname(fileURLToPath(import.meta.url)); const root = resolve(__dirname, '..'); const pkg = JSON.parse(readFileSync(resolve(root, 'package.json'), 'utf8')); const out = `// Auto-generated by scripts/sync-version.mjs. Do not edit. export const version = ${JSON.stringify(pkg.version)}; `; writeFileSync(resolve(root, 'src/version.ts'), out);