Ai
1 Star 0 Fork 0

乾男呼呼/arduino-ide

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
update-version.js 1.96 KB
一键复制 编辑 原始数据 按行查看 历史
Akos Kitta 提交于 2020-12-14 21:13 +08:00 . Added a script to update the versions.
//@ts-check
const fs = require('fs');
const path = require('path');
const semver = require('semver');
const targetVersion = process.argv.slice(2).shift();
const repoRootPath = path.join(__dirname, '..');
const { version: currentVersion } = require(path.join(repoRootPath, 'package.json'));
if (!targetVersion) {
console.error('Target version was not specified. Target version must be a valid semver. Use: `yarn update:version x.y.z` to update the versions.');
process.exit(1);
}
if (!semver.valid(targetVersion)) {
console.error(`Target version '${targetVersion}' is not a valid semver. Use: \`yarn update:version x.y.z\` to update the versions.`);
process.exit(1);
}
if (!semver.gt(targetVersion, currentVersion)) {
console.error(`Target version '${targetVersion}' must be greater than the current version '${currentVersion}.'`);
process.exit(1);
}
console.log(`🛠️ Updating current version from '${currentVersion}' to '${targetVersion}':`);
for (const toUpdate of [
path.join(repoRootPath, 'package.json'),
path.join(repoRootPath, 'electron-app', 'package.json'),
path.join(repoRootPath, 'browser-app', 'package.json'),
path.join(repoRootPath, 'arduino-ide-extension', 'package.json'),
path.join(repoRootPath, 'arduino-debugger-extension', 'package.json') // Currently unused. The debugger functionality comes from the `cortex.debug` VS Code extension.
]) {
process.stdout.write(` Updating ${toUpdate}'...`);
const pkg = require(toUpdate);
pkg.version = targetVersion;
if ('dependencies' in pkg) {
for (const dep of Object.keys(pkg['dependencies'])) {
if (dep.startsWith('arduino-')) {
pkg['dependencies'][dep] = targetVersion;
}
}
}
fs.writeFileSync(toUpdate, JSON.stringify(pkg, null, 2) + '\n');
process.stdout.write(` ✅ Done.\n`);
}
console.log(`Done. The new version is '${targetVersion}' now. Commit your changes and tag the code for the release. 🚢`);
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/hqnhqh/arduino-ide.git
git@gitee.com:hqnhqh/arduino-ide.git
hqnhqh
arduino-ide
arduino-ide
atl--sprint-16

搜索帮助