From 1bd2aa497047e36cd5b538961e4178c345107aa0 Mon Sep 17 00:00:00 2001 From: David Nalchevanidze Date: Wed, 12 Jun 2024 12:32:50 +0200 Subject: [PATCH] 0.12.0 --- package-lock.json | 14 +++++++------- package.json | 2 +- scripts/release.ts | 33 ++++++++------------------------- 3 files changed, 16 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1edeb8ea7..50d260835 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "commander": "^9.1.0", - "gh-rel-easy": "^0.8.0", + "gh-rel-easy": "^0.12.0", "ts-node": "^10.7.0", "typescript": "^4.6.2" }, @@ -1158,9 +1158,9 @@ } }, "node_modules/gh-rel-easy": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/gh-rel-easy/-/gh-rel-easy-0.8.0.tgz", - "integrity": "sha512-JFSnB4ZOY1zmNgMP/iwotoux4mbz0fenD1Su7BFGi6q3N4fL8fUFz+lVGkpLo1iutNjUdQo4mSp8NnWQ3CSFWA==", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/gh-rel-easy/-/gh-rel-easy-0.12.0.tgz", + "integrity": "sha512-JkplKWk41LCwRaC9EtlVdVLfDTHqIwHXQ7Um3jpMRZ7DMe/PW0dz5KjArHKsnh8f5g1Ot8se3Sgp+P1qoHwT3A==", "dependencies": { "axios": "^0.26.1", "js-yaml": "^4.1.0", @@ -2894,9 +2894,9 @@ "dev": true }, "gh-rel-easy": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/gh-rel-easy/-/gh-rel-easy-0.8.0.tgz", - "integrity": "sha512-JFSnB4ZOY1zmNgMP/iwotoux4mbz0fenD1Su7BFGi6q3N4fL8fUFz+lVGkpLo1iutNjUdQo4mSp8NnWQ3CSFWA==", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/gh-rel-easy/-/gh-rel-easy-0.12.0.tgz", + "integrity": "sha512-JkplKWk41LCwRaC9EtlVdVLfDTHqIwHXQ7Um3jpMRZ7DMe/PW0dz5KjArHKsnh8f5g1Ot8se3Sgp+P1qoHwT3A==", "requires": { "axios": "^0.26.1", "js-yaml": "^4.1.0", diff --git a/package.json b/package.json index 852b999e7..128518f9a 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ }, "dependencies": { "commander": "^9.1.0", - "gh-rel-easy": "^0.8.0", + "gh-rel-easy": "^0.12.0", "ts-node": "^10.7.0", "typescript": "^4.6.2" } diff --git a/scripts/release.ts b/scripts/release.ts index c27156718..cadf0a246 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -1,17 +1,11 @@ -import { writeFile } from "fs/promises"; import { GHRelEasy, runCli } from "gh-rel-easy"; import { Command } from "commander"; -export const exit = (error: Error) => { - console.log(error.message); - process.exit(1); -}; - // HConf const hconf = runCli("hconf"); // GHRelEasy -const release = new GHRelEasy({ +const gh = new GHRelEasy({ gh: "morpheusgraphql/morpheus-graphql", scope: { server: "morpheus-graphql", @@ -23,7 +17,8 @@ const release = new GHRelEasy({ }, pkg: (p) => `https://hackage.haskell.org/package/${p}`, version: () => hconf("version"), - next: (b) => hconf("next", ...(b ? ["-b"] : [])).then(console.log), + next: (b) => hconf("next", b && "-b").then(console.log), + setup: () => hconf("setup").then(console.log), }); // CLI @@ -33,23 +28,11 @@ cli.name("release-cli").description("Automated Releases").version("1.0"); cli .command("open") - .option("-p, --preview", "preview", false) - .action(({ preview }: { preview: boolean }) => - release - .changelog() - .then((body) => - hconf("setup") - .then(console.log) - .then(() => (preview ? undefined : release.open(body))) - ) - .catch(exit) - ); + .option("-d, --dry", "only changelog and setup", false) + .action(({ dry }: { dry: boolean }) => gh.release(dry)); -cli.command("changelog").action(() => - release - .changelog() - .then((body: string) => writeFile("./changelog.md", body, "utf8")) - .catch(exit) -); +cli.command("changelog").action(async () => { + await gh.changelog("changelog"); +}); cli.parse();