From 581be814052475f92b879c428a409ffb66aec517 Mon Sep 17 00:00:00 2001 From: Makisuo Date: Tue, 3 Nov 2026 00:26:05 +0100 Subject: [PATCH] fix: report the installed version from changeset --version The CLI hardcoded 0.1.0, so the 0.1.1 release still printed v0.1.0. The version is now imported from package.json and inlined at build time. --- .changeset/cli-version-from-package.md | 5 +++++ src/cli.ts | 4 ++-- tsconfig.json | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/cli-version-from-package.md diff --git a/.changeset/cli-version-from-package.md b/.changeset/cli-version-from-package.md new file mode 100644 index 0000000..94fbe2e --- /dev/null +++ b/.changeset/cli-version-from-package.md @@ -0,0 +1,5 @@ +--- +"@maple-dev/changesets": patch +--- + +`changeset --version` reports the installed version instead of a hardcoded 0.1.0. diff --git a/src/cli.ts b/src/cli.ts index a429d24..6dedd27 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -10,8 +10,8 @@ import { shouldSkipPackage, skipOptions } from "./config.ts" import { CommandExit, UnsupportedFeatureError } from "./errors.ts" import { lessThan, type BumpType } from "./semver.ts" import type { ComprehensiveRelease, Package, Release } from "./types.ts" - -const version = "0.1.0" +// Inlined at build time, so `--version` always matches the published version. +import { version } from "../package.json" with { type: "json" } const listFlag = (name: string, description: string) => Flag.String(name).pipe( diff --git a/tsconfig.json b/tsconfig.json index 9d7eebd..7f67ddb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,6 +6,7 @@ "lib": ["ES2023"], "types": ["node"], "moduleResolution": "bundler", + "resolveJsonModule": true, "allowImportingTsExtensions": true, "verbatimModuleSyntax": true, "erasableSyntaxOnly": true,