1
0
mirror of https://github.com/svg/svgo.git synced 2025-04-19 10:22:15 +03:00
svgo/scripts/sync-version.js
2024-05-27 20:28:13 +01:00

13 lines
403 B
JavaScript

import fs from 'node:fs/promises';
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const pkgPath = path.join(__dirname, '../package.json');
const { version } = JSON.parse(await fs.readFile(pkgPath, 'utf-8'));
await fs.writeFile(
'./lib/version.js',
`/** Version of SVGO. */\nexport const VERSION = '${version}';\n`,
);