Parcourir la source

improve the build script

tags/2.3.1
Caven Chen il y a 4 ans
Parent
révision
d90ad237e2
3 fichiers modifiés avec 1120 ajouts et 1130 suppressions
  1. 3
    2
      package.json
  2. 13
    11
      scripts/build.js
  3. 1104
    1117
      yarn.lock

+ 3
- 2
package.json Voir le fichier

"build:chart": "yarn run clean:chart && webpack --config build/webpack.chart.conf --mode production --env.production", "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", "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", "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:base": "rimraf packages/base/dist",
"clean:core": "rimraf packages/core/dist", "clean:core": "rimraf packages/core/dist",
"clean:chart": "rimraf packages/chart/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": { "devDependencies": {
"@babel/core": "^7.4.0", "@babel/core": "^7.4.0",

+ 13
- 11
scripts/build.js Voir le fichier



shell.echo(chalk.green('build sdk start')) 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 pkgs = ['base', 'core', 'chart', 'mapv']

const count = pkgs.length const count = pkgs.length


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

+ 1104
- 1117
yarn.lock
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


Chargement…
Annuler
Enregistrer