1 Star 0 Fork 0

晨光飞舞/vue-devtools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
release.js 1.83 KB
一键复制 编辑 原始数据 按行查看 历史
Guillaume Chau 提交于 2019-10-30 11:36 . chore: improve release script
const fs = require('fs')
const inquirer = require('inquirer')
const semver = require('semver')
const pkg = require('./package.json')
const manifest = require('./packages/shell-chrome/manifest.json')
const curVersion = pkg.version
;(async () => {
const { newVersion } = await inquirer.prompt([{
type: 'input',
name: 'newVersion',
message: `Please provide a version (current: ${curVersion}):`
}])
if (!semver.valid(newVersion)) {
console.error(`Invalid version: ${newVersion}`)
process.exit(1)
}
if (semver.lt(newVersion, curVersion)) {
console.error(`New version (${newVersion}) cannot be lower than current version (${curVersion}).`)
process.exit(1)
}
const { yes } = await inquirer.prompt([{
name: 'yes',
message: `Release ${newVersion}?`,
type: 'confirm'
}])
if (yes) {
const isBeta = newVersion.includes('beta')
pkg.version = newVersion
if (isBeta) {
const [, baseVersion, betaVersion] = /(.*)-beta\.(\w+)/.exec(newVersion)
manifest.version = `${baseVersion}.${betaVersion}`
manifest.version_name = `${baseVersion} beta ${betaVersion}`
applyIcons(manifest, '-beta')
} else {
manifest.version = newVersion
manifest.version_name = newVersion
applyIcons(manifest)
}
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2))
{
// Electron package
const pkg = require('./packages/shell-electron/package.json')
pkg.version = newVersion
fs.writeFileSync('./packages/shell-electron/package.json', JSON.stringify(pkg, null, 2))
}
fs.writeFileSync('./packages/shell-chrome/manifest.json', JSON.stringify(manifest, null, 2))
} else {
process.exit(1)
}
})()
function applyIcons (manifest, suffix = '') {
[16, 48, 128].forEach(size => {
manifest.icons[size] = `icons/${size}${suffix}.png`
})
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ryanma/vue-devtools.git
git@gitee.com:ryanma/vue-devtools.git
ryanma
vue-devtools
vue-devtools
dev

搜索帮助

0d507c66 1850385 C8b1a773 1850385