diff --git a/babel.config.js b/babel.config.js index a042e6d3c..27fec6e80 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,38 +1,3 @@ -module.exports = function (api) { - const { BABEL_MODULE, NODE_ENV } = process.env; - const useESModules = BABEL_MODULE !== 'commonjs' && NODE_ENV !== 'test'; - - api && api.cache(false); - - return { - presets: [ - [ - '@babel/preset-env', - { - loose: true, - modules: useESModules ? false : 'commonjs' - } - ], - [ - '@vue/babel-preset-jsx', - { - functional: false - } - ], - '@babel/preset-typescript' - ], - plugins: [ - [ - '@babel/plugin-transform-runtime', - { - corejs: false, - helpers: true, - regenerator: NODE_ENV === 'test', - useESModules - } - ], - '@babel/plugin-transform-object-assign', - '@babel/plugin-proposal-optional-chaining' - ] - }; +module.exports = { + presets: ['@vant/cli/preset'] }; diff --git a/package.json b/package.json index 948cedc15..3c6882780 100644 --- a/package.json +++ b/package.json @@ -15,13 +15,12 @@ "scripts": { "bootstrap": "yarn || npm i", "dev": "npm run build:entry && webpack-dev-server --config build/webpack.site.dev.js", - "lint": "eslint ./src --ext .js,.vue,.ts,.tsx && stylelint \"src/**/*.less\" --fix", + "lint": "vant-cli lint", "build:entry": "node build/build-entry.js", - "build:changelog": "vant changelog ./docs/markdown/changelog.generated.md --tag v2.1.0", + "build:changelog": "vant-cli changelog ./docs/markdown/changelog.generated.md --tag v2.2.0", "build:lib": "node build/build-lib.js", - "test": "jest", - "test:watch": "jest --watch", - "test:clear-cache": "jest --clearCache", + "test": "vant-cli test", + "test:watch": "vant-cli test --watch", "test:coverage": "open test/coverage/index.html", "release": "sh build/release.sh", "release:site": "sh build/release-site.sh" diff --git a/test/transformer.js b/test/transformer.js index a1b580d9c..d49d40348 100644 --- a/test/transformer.js +++ b/test/transformer.js @@ -1,3 +1,3 @@ const babelConfig = require('../babel.config'); -module.exports = require('babel-jest').createTransformer(babelConfig()); +module.exports = require('babel-jest').createTransformer(babelConfig);