diff options
Diffstat (limited to 'scripts/cmd/build.js')
-rw-r--r-- | scripts/cmd/build.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/cmd/build.js b/scripts/cmd/build.js index b5eb91195..02c0f5798 100644 --- a/scripts/cmd/build.js +++ b/scripts/cmd/build.js @@ -28,7 +28,9 @@ export default async function build(...args) { .map((f) => f.replace(/^'/, '').replace(/'$/, '')); // Needed for Windows: glob strings contain surrounding string chars??? remove these let entryPoints = [].concat(...(await Promise.all(patterns.map((pattern) => glob(pattern, { filesOnly: true, absolute: true }))))); - const { type = 'module', dependencies = {} } = await fs.readFile('./package.json').then((res) => JSON.parse(res.toString())); + const { type = 'module', version, dependencies = {} } = await fs.readFile('./package.json').then((res) => JSON.parse(res.toString())); + // expose PACKAGE_VERSION on process.env for CLI utils + config.define = { 'process.env.PACKAGE_VERSION': JSON.stringify(version) }; const format = type === 'module' ? 'esm' : 'cjs'; const outdir = 'dist'; await clean(outdir); |