From 5b4f47e1449cd0e908746700e90431f80c703f2d Mon Sep 17 00:00:00 2001 From: Seth G Date: Thu, 20 Jun 2024 11:20:13 +0200 Subject: [PATCH] fix: create a version.ts file and use this for CLI version numbers (#390) --- .github/workflows/release.yml | 3 --- .releaserc | 8 +++++++- package.json | 1 + src/logHelper.ts | 2 +- src/version.ts | 1 + 5 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 src/version.ts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2c08893..98c14ed 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,9 +19,6 @@ jobs: - name: Install dependencies ⏬ run: npm ci - - name: Build 🏗️ - run: npm run build - - name: Release 🚀 uses: cycjimmy/semantic-release-action@v4.1.0 id: semantic diff --git a/.releaserc b/.releaserc index e74ac0c..80c2cda 100644 --- a/.releaserc +++ b/.releaserc @@ -16,13 +16,19 @@ } } ], + [ + "@semantic-release/exec", + { + "prepareCmd": "echo \"export default '${nextRelease.version}';\" > ./src/version.ts" + } + ], "@semantic-release/changelog", "@semantic-release/npm", [ "@semantic-release/git", { "assets": [ - "CHANGELOG.md", "package.json", "package-lock.json" + "CHANGELOG.md", "package.json", "package-lock.json", "./src/version.ts" ], "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" } diff --git a/package.json b/package.json index d0a7838..9a9007f 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "test": "node test.js", "build-binaries": "npm run build && pkg package.json", "package-binaries": "npm run build-binaries && node package-binaries.js", + "prepublishOnly": "npm run build", "postpublish": "npm run package-binaries" }, "pkg": { diff --git a/src/logHelper.ts b/src/logHelper.ts index 4ef5bf5..1657400 100644 --- a/src/logHelper.ts +++ b/src/logHelper.ts @@ -1,5 +1,5 @@ import gradient from 'gradient-string'; -import { version } from '../package.json'; +import version from './version'; export const logTitle = () :void => { console.log(gradient('#611E82', '#272C82', '#00943D', '#FFED00', '#F48E00', '#E7000E').multiline(` diff --git a/src/version.ts b/src/version.ts new file mode 100644 index 0000000..8fdf836 --- /dev/null +++ b/src/version.ts @@ -0,0 +1 @@ +export default "3.1.4"; \ No newline at end of file