1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-12 06:41:40 +03:00
Files
svgo/scripts/sync-version.js
2025-05-04 17:39:44 +01:00

13 lines
449 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',
`/**\n * Version of SVGO.\n *\n * @type {string}\n * @since 4.0.0\n */\nexport const VERSION = '${version}';\n`,
);