storybook/lib/api/scripts/generateVersion.js

10 lines
320 B
JavaScript

const fs = require('fs');
const path = require('path');
const output = version => `export default '${version}';\n`;
const text = fs.readFileSync(path.join(__dirname, '../package.json'), 'utf8');
const json = JSON.parse(text);
fs.writeFileSync(path.join(__dirname, '../src/version.ts'), output(json.version), 'utf8');