src/index.ts exports a version constant that nothing updates:
/** Package version, replaced at publish time. */exportconstVERSION='26.8.0-beta.0';
package.json and deno.json both say 26.9.0-beta.1. The comment describes a
publish step that does not exist: tsup.config.ts lists src/index.ts as an
entry with no define or replacement, and release.yml only ever reads require('./package.json').version — to pick the dist-tag and to check whether
npm and JSR already hold the version. Nothing writes the constant back, so it
holds whatever the last hand-edit left there.
This is not only a repo-state drift; it shipped. From the published tarball:
$ npm view @green-tea/core@26.9.0-beta.1 dist.tarball -s | xargs curl -s \
| tar -xzO package/dist/index.js | grep 'var VERSION'
var VERSION = "26.8.0-beta.0";
So an application that installs 26.9.0-beta.1 and reads VERSION is told it
is on 26.8.0-beta.0. Both are betas of a framework whose surface changed
between them — the request budget, sse(data, { id }), the reserved token
names — so the one value a consumer would reach for to branch on, or to put in a
bug report, is the one that is wrong. It also breaks the CLI direction: a matcha doctor that reports which core a project is running cannot use this
export and has to read the installed package.json instead.
Why the test suite is green
test/smoke.test.ts is the only thing that looks at it:
That asserts the shape, not the value. 26.8.0-beta.0 satisfies the CalVer
regex exactly as well as the correct string does, and would keep satisfying it
for as many releases as the constant sits still. The check that exists is the
reason nobody noticed the check that was missing.
Two ways out
Assert the value. Have the smoke test — or test/package-metadata.test.ts,
which is already the home for this kind of claim — compare VERSION against package.json's version. Then a bump that forgets the constant fails in CI,
before the tag, rather than in a published artifact.
Make the comment true. Have the release rewrite the constant from package.json before npm run build.
(1) is smaller, needs no new release machinery, and fails at the moment the
mistake is made rather than one step later. It also keeps the constant a plain
literal that JSR can serve as source, which (2) would have to be careful about —
JSR publishes src/, so a substitution applied only to the tsup build would fix
npm and leave JSR reporting the stale value.
Found while auditing what the matcha
CLI had fallen behind on; unrelated to that fix, and filed here because the
constant is core's to correct.
`src/index.ts` exports a version constant that nothing updates:
```ts
/** Package version, replaced at publish time. */
export const VERSION = '26.8.0-beta.0';
```
`package.json` and `deno.json` both say `26.9.0-beta.1`. The comment describes a
publish step that does not exist: `tsup.config.ts` lists `src/index.ts` as an
entry with no `define` or replacement, and `release.yml` only ever *reads*
`require('./package.json').version` — to pick the dist-tag and to check whether
npm and JSR already hold the version. Nothing writes the constant back, so it
holds whatever the last hand-edit left there.
This is not only a repo-state drift; it shipped. From the published tarball:
```
$ npm view @green-tea/core@26.9.0-beta.1 dist.tarball -s | xargs curl -s \
| tar -xzO package/dist/index.js | grep 'var VERSION'
var VERSION = "26.8.0-beta.0";
```
So an application that installs `26.9.0-beta.1` and reads `VERSION` is told it
is on `26.8.0-beta.0`. Both are betas of a framework whose surface changed
between them — the request budget, `sse(data, { id })`, the reserved token
names — so the one value a consumer would reach for to branch on, or to put in a
bug report, is the one that is wrong. It also breaks the CLI direction: a
`matcha doctor` that reports which core a project is running cannot use this
export and has to read the installed `package.json` instead.
## Why the test suite is green
`test/smoke.test.ts` is the only thing that looks at it:
```ts
expect(VERSION).toMatch(/^\d{2}\.\d{1,2}\.\d+(-beta\.\d+)?$/);
```
That asserts the *shape*, not the *value*. `26.8.0-beta.0` satisfies the CalVer
regex exactly as well as the correct string does, and would keep satisfying it
for as many releases as the constant sits still. The check that exists is the
reason nobody noticed the check that was missing.
## Two ways out
1. **Assert the value.** Have the smoke test — or `test/package-metadata.test.ts`,
which is already the home for this kind of claim — compare `VERSION` against
`package.json`'s `version`. Then a bump that forgets the constant fails in CI,
before the tag, rather than in a published artifact.
2. **Make the comment true.** Have the release rewrite the constant from
`package.json` before `npm run build`.
(1) is smaller, needs no new release machinery, and fails at the moment the
mistake is made rather than one step later. It also keeps the constant a plain
literal that JSR can serve as source, which (2) would have to be careful about —
JSR publishes `src/`, so a substitution applied only to the tsup build would fix
npm and leave JSR reporting the stale value.
Found while auditing what the [matcha](https://github.com/Expressive-Tea/matcha)
CLI had fallen behind on; unrelated to that fix, and filed here because the
constant is core's to correct.
Fixed in 26.9.0-beta.2 (a30c2ce). Nothing replaces the constant at publish time, so the code no longer pretends it does: the comment on VERSION in src/index.ts now says it is kept in step with package.json and deno.json by hand, and test/package-metadata.test.ts asserts that VERSION equals package.json's version. A release that bumps one and not the other now fails CI instead of shipping a stale constant. 26.11.0-rc.1 ships VERSION = '26.11.0-rc.1'.
Fixed in **26.9.0-beta.2** (`a30c2ce`). Nothing replaces the constant at publish time, so the code no longer pretends it does: the comment on `VERSION` in `src/index.ts` now says it is kept in step with `package.json` and `deno.json` by hand, and `test/package-metadata.test.ts` asserts that `VERSION` equals `package.json`'s version. A release that bumps one and not the other now fails CI instead of shipping a stale constant. 26.11.0-rc.1 ships `VERSION = '26.11.0-rc.1'`.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
src/index.tsexports a version constant that nothing updates:package.jsonanddeno.jsonboth say26.9.0-beta.1. The comment describes apublish step that does not exist:
tsup.config.tslistssrc/index.tsas anentry with no
defineor replacement, andrelease.ymlonly ever readsrequire('./package.json').version— to pick the dist-tag and to check whethernpm and JSR already hold the version. Nothing writes the constant back, so it
holds whatever the last hand-edit left there.
This is not only a repo-state drift; it shipped. From the published tarball:
So an application that installs
26.9.0-beta.1and readsVERSIONis told itis on
26.8.0-beta.0. Both are betas of a framework whose surface changedbetween them — the request budget,
sse(data, { id }), the reserved tokennames — so the one value a consumer would reach for to branch on, or to put in a
bug report, is the one that is wrong. It also breaks the CLI direction: a
matcha doctorthat reports which core a project is running cannot use thisexport and has to read the installed
package.jsoninstead.Why the test suite is green
test/smoke.test.tsis the only thing that looks at it:That asserts the shape, not the value.
26.8.0-beta.0satisfies the CalVerregex exactly as well as the correct string does, and would keep satisfying it
for as many releases as the constant sits still. The check that exists is the
reason nobody noticed the check that was missing.
Two ways out
test/package-metadata.test.ts,which is already the home for this kind of claim — compare
VERSIONagainstpackage.json'sversion. Then a bump that forgets the constant fails in CI,before the tag, rather than in a published artifact.
package.jsonbeforenpm run build.(1) is smaller, needs no new release machinery, and fails at the moment the
mistake is made rather than one step later. It also keeps the constant a plain
literal that JSR can serve as source, which (2) would have to be careful about —
JSR publishes
src/, so a substitution applied only to the tsup build would fixnpm and leave JSR reporting the stale value.
Found while auditing what the matcha
CLI had fallen behind on; unrelated to that fix, and filed here because the
constant is core's to correct.
Fixed in 26.9.0-beta.2 (
a30c2ce). Nothing replaces the constant at publish time, so the code no longer pretends it does: the comment onVERSIONinsrc/index.tsnow says it is kept in step withpackage.jsonanddeno.jsonby hand, andtest/package-metadata.test.tsasserts thatVERSIONequalspackage.json's version. A release that bumps one and not the other now fails CI instead of shipping a stale constant. 26.11.0-rc.1 shipsVERSION = '26.11.0-rc.1'.