From a84b72e8f163c21d460e726998485da28a7610e7 Mon Sep 17 00:00:00 2001 From: zazzaz Date: Sun, 22 Nov 2020 21:34:02 +0800 Subject: [PATCH] build: update build version --- .gitignore | 1 + build/gen-version.js | 6 ++++++ package.json | 3 ++- packages/element-plus/index.ts | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 build/gen-version.js diff --git a/.gitignore b/.gitignore index 4b1dbd80cc..547975efe9 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ coverage/ website-dist lib website/play/index.vue +ep-version.js diff --git a/build/gen-version.js b/build/gen-version.js new file mode 100644 index 0000000000..8b7d5d47b2 --- /dev/null +++ b/build/gen-version.js @@ -0,0 +1,6 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ +const fs = require('fs') +const path = require('path') +const { version } = require('../package.json') +fs.writeFileSync(path.resolve(__dirname, '../ep-version.js'), `export const version = '${version}' +`) diff --git a/package.json b/package.json index 97e09bf225..7da1c8d8f1 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "test": "jest", "gen": "bash ./scripts/gc.sh", "bootstrap": "yarn && npx lerna bootstrap", - "build": "yarn bootstrap && yarn build:lib && yarn build:theme && yarn build:esm-bundle && yarn build:esm && yarn build:utils && yarn build:locale && yarn build:locale-umd", + "gen:version": "node build/gen-version.js", + "build": "yarn bootstrap && yarn gen:version && yarn build:lib && yarn build:theme && yarn build:esm-bundle && yarn build:esm && yarn build:utils && yarn build:locale && yarn build:locale-umd", "build:lib": "rimraf lib && webpack --config ./build/webpack.config.js", "build:esm-bundle": "rollup --config ./build/rollup.config.bundle.js", "build:esm": "node ./build/bincomp.js", diff --git a/packages/element-plus/index.ts b/packages/element-plus/index.ts index 422fa71d20..77bba6f5fd 100644 --- a/packages/element-plus/index.ts +++ b/packages/element-plus/index.ts @@ -83,7 +83,7 @@ import ElTransfer from '@element-plus/transfer' import ElTree from '@element-plus/tree' import ElUpload from '@element-plus/upload' import { use } from '@element-plus/locale' -import { version } from '../../package.json' +import { version } from '../../ep-version' interface InstallOptions { size: ComponentSize