瀏覽代碼

improve the build script

tags/2.3.1
Caven Chen 4 年之前
父節點
當前提交
d90ad237e2
共有 3 個文件被更改,包括 1120 次插入1130 次删除
  1. 3
    2
      package.json
  2. 13
    11
      scripts/build.js
  3. 1104
    1117
      yarn.lock

+ 3
- 2
package.json 查看文件

@@ -34,11 +34,12 @@
"build:chart": "yarn run clean:chart && webpack --config build/webpack.chart.conf --mode production --env.production",
"dev:mapv": "yarn run clean:mapv && webpack --config build/webpack.mapv.conf --mode development",
"build:mapv": "yarn run clean:mapv && webpack --config build/webpack.mapv.conf --mode production --env.production",
"clean": "yarn run clean:base && yarn run clean:core && yarn run clean:chart && yarn run clean:mapv",
"clean": "yarn run clean:base && yarn run clean:core && yarn run clean:chart && yarn run clean:mapv && yarn run clean:sdk",
"clean:base": "rimraf packages/base/dist",
"clean:core": "rimraf packages/core/dist",
"clean:chart": "rimraf packages/chart/dist",
"clean:mapv": "rimraf packages/mapv/dist"
"clean:mapv": "rimraf packages/mapv/dist",
"clean:sdk": "rimraf packages/sdk/dist"
},
"devDependencies": {
"@babel/core": "^7.4.0",

+ 13
- 11
scripts/build.js 查看文件

@@ -11,31 +11,33 @@ const chalk = require('chalk')

shell.echo(chalk.green('build sdk start'))

shell.rm('-rf', path.resolve(__dirname, '..', 'packages/sdk/dist/*'))
let outoutDir = path.resolve(__dirname, '..', 'packages/sdk/dist')

fse.ensureDirSync(outoutDir)

fse.emptyDirSync(outoutDir)

const pkgs = ['base', 'core', 'chart', 'mapv']

const count = pkgs.length

pkgs.forEach(async (item, index) => {
await fse.exists(
pkgs.forEach((item, index) => {
fse.exists(
path.resolve(__dirname, '..', `packages/${item}/dist`),
exists => {
async exists => {
if (exists) {
shell.cp(
'-R',
path.resolve(__dirname, '..', `packages/${item}/dist/*`),
path.resolve(__dirname, '..', 'packages/sdk/dist')
fse.copySync(
path.resolve(__dirname, '..', `packages/${item}/dist`),
outoutDir
)
shell.echo(chalk.yellow(`copy ${item} success`))
if (index === count - 1) {
shell.echo(chalk.green('build sdk end'))
shell.exit(0)
await shell.echo(chalk.green('build sdk end'))
}
} else {
shell.echo(chalk.red(`no ${item} dist`))
if (index === count - 1) {
shell.echo(chalk.green('build sdk end'))
shell.exit(0)
}
}
}

+ 1104
- 1117
yarn.lock
文件差異過大導致無法顯示
查看文件


Loading…
取消
儲存