mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-01 04:55:57 +08:00
refactor: add hotfix mode to release package
This commit is contained in:
parent
c6620aba74
commit
c8e964d0f6
4 changed files with 73 additions and 27 deletions
|
|
@ -39,9 +39,10 @@
|
|||
"release-be": "monkeytype-release --be",
|
||||
"release-no-deploy": "monkeytype-release --no-deploy",
|
||||
"release-dry": "monkeytype-release --dry",
|
||||
"hotfix-fe": "npm run build-fe && cd frontend && npm run deploy-live && monkeytype-purge",
|
||||
"hotfix-be": "monkeytype-deploy-be",
|
||||
"hotfix": "npm run hotfix-be && npm run hotfix-fe",
|
||||
"hotfix": "monkeytype-release --hotfix",
|
||||
"hotfix-fe": "monkeytype-release --hotfix --fe",
|
||||
"hotfix-be": "monkeytype-release --hotfix --be",
|
||||
"hotfix-dry": "monkeytype-release --hotfix --dry",
|
||||
"pretty-check": "prettier --check .",
|
||||
"pretty-check-be": "prettier --check ./backend",
|
||||
"pretty-check-fe": "prettier --check ./frontend/src",
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "nodemon --watch src --exec \"node ./src/index.js --dry\"",
|
||||
"dev-hotfix": "nodemon --watch src --exec \"node ./src/index.js --dry --hotfix\"",
|
||||
"dev-changelog": "nodemon ./src/buildChangelog.js",
|
||||
"oxlint": "oxlint .",
|
||||
"lint": "npm run oxlint",
|
||||
|
|
@ -16,9 +17,7 @@
|
|||
"oxlint": "0.16.7"
|
||||
},
|
||||
"bin": {
|
||||
"monkeytype-release": "./src/index.js",
|
||||
"monkeytype-purge": "./bin/purgeCfCache.sh",
|
||||
"monkeytype-deploy-be": "./bin/deployBackend.sh"
|
||||
"monkeytype-release": "./src/index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@octokit/rest": "21.1.1",
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ const noDeploy = args.has("--no-deploy");
|
|||
const isBackend = args.has("--be");
|
||||
const isDryRun = args.has("--dry");
|
||||
const noSyncCheck = args.has("--no-sync-check");
|
||||
const hotfix = args.has("--hotfix");
|
||||
|
||||
const PROJECT_ROOT = path.resolve(__dirname, "../../../");
|
||||
|
||||
|
|
@ -235,27 +236,31 @@ const createGithubRelease = async (version, changelogContent) => {
|
|||
};
|
||||
|
||||
const main = async () => {
|
||||
console.log("Starting release process...");
|
||||
console.log(`Starting ${hotfix ? "hotfix" : "release"} process...`);
|
||||
|
||||
checkBranchSync();
|
||||
if (!hotfix) checkBranchSync();
|
||||
|
||||
checkUncommittedChanges();
|
||||
|
||||
const changelogContent = await generateChangelog();
|
||||
let changelogContent;
|
||||
let newVersion;
|
||||
if (!hotfix) {
|
||||
changelogContent = await generateChangelog();
|
||||
|
||||
console.log(changelogContent);
|
||||
console.log(changelogContent);
|
||||
|
||||
if (!readlineSync.keyInYN("Changelog looks good?")) {
|
||||
console.log("Exiting.");
|
||||
process.exit(1);
|
||||
if (!readlineSync.keyInYN("Changelog looks good?")) {
|
||||
console.log("Exiting.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const currentVersion = getCurrentVersion();
|
||||
newVersion = incrementVersion(currentVersion);
|
||||
console.log(`New version: ${newVersion}`);
|
||||
}
|
||||
|
||||
const currentVersion = getCurrentVersion();
|
||||
const newVersion = incrementVersion(currentVersion);
|
||||
|
||||
buildProject();
|
||||
|
||||
if (!readlineSync.keyInYN(`Ready to release ${newVersion}?`)) {
|
||||
if (!hotfix && !readlineSync.keyInYN(`Ready to release ${newVersion}?`)) {
|
||||
console.log("Exiting.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
|
@ -269,16 +274,22 @@ const main = async () => {
|
|||
}
|
||||
|
||||
if (!noDeploy) purgeCache();
|
||||
updatePackage(newVersion);
|
||||
createCommitAndTag(newVersion);
|
||||
try {
|
||||
await createGithubRelease(newVersion, changelogContent);
|
||||
} catch (e) {
|
||||
console.error(`Failed to create release on GitHub: ${e}`);
|
||||
console.log("Please create the release manually.");
|
||||
if (!hotfix) {
|
||||
updatePackage(newVersion);
|
||||
createCommitAndTag(newVersion);
|
||||
try {
|
||||
await createGithubRelease(newVersion, changelogContent);
|
||||
} catch (e) {
|
||||
console.error(`Failed to create release on GitHub: ${e}`);
|
||||
console.log("Please create the release manually.");
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`Release ${newVersion} completed successfully.`);
|
||||
if (hotfix) {
|
||||
console.log("Hotfix completed successfully.");
|
||||
} else {
|
||||
console.log(`Release ${newVersion} completed successfully.`);
|
||||
}
|
||||
process.exit(0);
|
||||
};
|
||||
|
||||
|
|
|
|||
37
pnpm-lock.yaml
generated
37
pnpm-lock.yaml
generated
|
|
@ -532,7 +532,7 @@ importers:
|
|||
version: 0.16.7
|
||||
tsup:
|
||||
specifier: 8.4.0
|
||||
version: 8.4.0(postcss@8.5.3)(tsx@4.16.2)(typescript@5.5.4)(yaml@2.5.0)
|
||||
version: 8.4.0(postcss@8.5.1)(tsx@4.16.2)(typescript@5.5.4)(yaml@2.5.0)
|
||||
typescript:
|
||||
specifier: 5.5.4
|
||||
version: 5.5.4
|
||||
|
|
@ -18922,6 +18922,14 @@ snapshots:
|
|||
|
||||
possible-typed-array-names@1.1.0: {}
|
||||
|
||||
postcss-load-config@6.0.1(postcss@8.5.1)(tsx@4.16.2)(yaml@2.5.0):
|
||||
dependencies:
|
||||
lilconfig: 3.1.3
|
||||
optionalDependencies:
|
||||
postcss: 8.5.1
|
||||
tsx: 4.16.2
|
||||
yaml: 2.5.0
|
||||
|
||||
postcss-load-config@6.0.1(postcss@8.5.3)(tsx@4.16.2)(yaml@2.5.0):
|
||||
dependencies:
|
||||
lilconfig: 3.1.3
|
||||
|
|
@ -20659,6 +20667,33 @@ snapshots:
|
|||
|
||||
tsscmp@1.0.6: {}
|
||||
|
||||
tsup@8.4.0(postcss@8.5.1)(tsx@4.16.2)(typescript@5.5.4)(yaml@2.5.0):
|
||||
dependencies:
|
||||
bundle-require: 5.1.0(esbuild@0.25.0)
|
||||
cac: 6.7.14
|
||||
chokidar: 4.0.3
|
||||
consola: 3.4.0
|
||||
debug: 4.4.0
|
||||
esbuild: 0.25.0
|
||||
joycon: 3.1.1
|
||||
picocolors: 1.1.1
|
||||
postcss-load-config: 6.0.1(postcss@8.5.1)(tsx@4.16.2)(yaml@2.5.0)
|
||||
resolve-from: 5.0.0
|
||||
rollup: 4.34.8
|
||||
source-map: 0.8.0-beta.0
|
||||
sucrase: 3.35.0
|
||||
tinyexec: 0.3.2
|
||||
tinyglobby: 0.2.12
|
||||
tree-kill: 1.2.2
|
||||
optionalDependencies:
|
||||
postcss: 8.5.1
|
||||
typescript: 5.5.4
|
||||
transitivePeerDependencies:
|
||||
- jiti
|
||||
- supports-color
|
||||
- tsx
|
||||
- yaml
|
||||
|
||||
tsup@8.4.0(postcss@8.5.3)(tsx@4.16.2)(typescript@5.5.4)(yaml@2.5.0):
|
||||
dependencies:
|
||||
bundle-require: 5.1.0(esbuild@0.25.0)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue