提交 35448122 编写于 作者: fxy060608's avatar fxy060608

chore(cli): add check-version.js dist-tag-latest.js

上级 d6451be2
const fs = require('fs')
const path = require('path')
const request = require('request')
const registry = 'https://registry.npmjs.org/@dcloudio/'
const pkgs = fs.readdirSync(path.resolve(__dirname, 'packages'))
const tag = process.argv[2] || 'alpha'
pkgs.forEach(pkg => {
request(registry + pkg, function(error, response, body) {
if (error) {
console.log(pkg, error)
} else {
const version = JSON.parse(body)['dist-tags'][tag]
console.log(pkg + ':' + (' '.repeat(80 - (pkg + ':' + version).length)) + version)
}
})
})
const fs = require('fs')
const path = require('path')
const shellExec = require('shell-exec')
const pkgs = fs.readdirSync(path.resolve(__dirname, 'packages'))
const version = process.argv[2]
if (!version) {
throw new Error('必须传入 version')
}
(async function() {
for (let i = 0; i < pkgs.length; i++) {
console.log(`npm dist-tag add @dcloudio/${pkgs[i]}@${version} latest`);
await shellExec(`npm dist-tag add @dcloudio/${pkgs[i]}@${version} latest`)
}
})();
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册