From 2e61d4d8df112739745677e04f747c416dcf6f85 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Mon, 19 Aug 2019 20:28:27 +0800 Subject: [PATCH] add lerna scripts --- lerna.json | 10 ++++++- package.json | 4 ++- packages/vue-cli-plugin-uni/generator.js | 28 +++++++++++-------- .../vue-cli-plugin-uni/lib/check-update.js | 3 +- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/lerna.json b/lerna.json index ca5132b76..3264995af 100644 --- a/lerna.json +++ b/lerna.json @@ -4,5 +4,13 @@ "packages": [ "packages/*" ], - "version": "0.9.50" + "publishConfig": { + "access": "public" + }, + "command": { + "publish": { + "message": "chore(release): publish %s" + } + }, + "version": "1.0.0-alpha-22120190814001" } diff --git a/package.json b/package.json index 7fb385e34..1aafa3816 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,9 @@ "build:mp-alipay": "cross-env UNI_PLATFORM=mp-alipay rollup -c build/rollup.config.mp.js", "build:mp-toutiao": "cross-env UNI_PLATFORM=mp-toutiao rollup -c build/rollup.config.mp.js", "build:runtime": "npm run lint && npm run build:mp-weixin && npm run build:mp-qq && npm run build:mp-alipay && npm run build:mp-baidu && npm run build:mp-toutiao && npm run build:app-plus", - "test:unit": "cross-env NODE_ENV=test UNI_PLATFORM=h5 mocha-webpack --require tests/unit/setup.js --webpack-config build/webpack.config.test.js tests/unit/**/*.spec.js" + "test:unit": "cross-env NODE_ENV=test UNI_PLATFORM=h5 mocha-webpack --require tests/unit/setup.js --webpack-config build/webpack.config.test.js tests/unit/**/*.spec.js", + "release": "npm run lint:cli && lerna publish --force-publish=*", + "release:alpha": "npm run lint:cli && lerna publish --force-publish=* --npm-tag=alpha" }, "dependencies": { "base64-arraybuffer": "^0.2.0", diff --git a/packages/vue-cli-plugin-uni/generator.js b/packages/vue-cli-plugin-uni/generator.js index cd59dc173..d2a4d24f9 100644 --- a/packages/vue-cli-plugin-uni/generator.js +++ b/packages/vue-cli-plugin-uni/generator.js @@ -1,4 +1,8 @@ module.exports = (api, options, rootOptions) => { + let version = '^1.0.0-22220190816001' + if (require('./package.json').version.indexOf('alpha') !== -1) { + version = '^1.0.0-alpha-22120190814001' + } api.extendPackage(pkg => { delete pkg.postcss delete pkg.browserslist @@ -26,22 +30,22 @@ module.exports = (api, options, rootOptions) => { 'scripts': {} }, dependencies: { - '@dcloudio/uni-app-plus': '*', - '@dcloudio/uni-h5': '*', - '@dcloudio/uni-mp-qq': '*', - '@dcloudio/uni-mp-weixin': '*', - '@dcloudio/uni-mp-baidu': '*', - '@dcloudio/uni-mp-alipay': '*', - '@dcloudio/uni-mp-toutiao': '*', - '@dcloudio/uni-stat': '*', + '@dcloudio/uni-app-plus': version, + '@dcloudio/uni-h5': version, + '@dcloudio/uni-mp-qq': version, + '@dcloudio/uni-mp-weixin': version, + '@dcloudio/uni-mp-baidu': version, + '@dcloudio/uni-mp-alipay': version, + '@dcloudio/uni-mp-toutiao': version, + '@dcloudio/uni-stat': version, 'flyio': '^0.6.2', 'vuex': '^3.0.1' }, devDependencies: { - '@dcloudio/uni-cli-shared': '*', - '@dcloudio/uni-template-compiler': '*', - '@dcloudio/webpack-uni-mp-loader': '*', - '@dcloudio/webpack-uni-pages-loader': '*', + '@dcloudio/uni-cli-shared': version, + '@dcloudio/uni-template-compiler': version, + '@dcloudio/webpack-uni-mp-loader': version, + '@dcloudio/webpack-uni-pages-loader': version, 'babel-plugin-import': '^1.11.0' }, browserslist: [ diff --git a/packages/vue-cli-plugin-uni/lib/check-update.js b/packages/vue-cli-plugin-uni/lib/check-update.js index 8767bf146..90059471c 100644 --- a/packages/vue-cli-plugin-uni/lib/check-update.js +++ b/packages/vue-cli-plugin-uni/lib/check-update.js @@ -25,7 +25,8 @@ module.exports = async function checkUpdate () { if (pkg.version.split('.')[0] !== update.latest.split('.')[0]) { console.log(`发现 uni-app 新版本 ${update.latest}`) console.log(`1.修改 package.json 中 @dcloudio 相关包版本为 ^${update.latest}`) - console.log('2.执行 npm install ') + console.log('2.删除 package-lock.json 或 yarn.lock') + console.log('3.执行 npm install 或 yarn') } else { console.log(`发现 uni-app 新版本 ${update.latest}. 请执行 npm update 升级`) } -- GitLab