mirror of
https://github.com/graphql-hive/console
synced 2026-04-21 22:47:17 +00:00
12 lines
439 B
JavaScript
12 lines
439 B
JavaScript
|
|
import { readFileSync, writeFileSync } from 'node:fs';
|
||
|
|
import { join } from 'node:path';
|
||
|
|
|
||
|
|
const packageJsonAt = join(process.cwd(), 'package.json');
|
||
|
|
const pkg = JSON.parse(readFileSync(packageJsonAt, 'utf-8'));
|
||
|
|
const code = `export const version = '${pkg.version}';\n`;
|
||
|
|
const versionFileAt = join(process.cwd(), 'src/version.ts');
|
||
|
|
|
||
|
|
writeFileSync(versionFileAt, code);
|
||
|
|
|
||
|
|
console.log('Generated version file successfully at', versionFileAt);
|