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,