@homeflare/config 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../src/release.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,KAAK,GAAG,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/D;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAMtF;AAED,yEAAyE;AACzE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAG3D;AAED,MAAM,MAAM,eAAe,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC,CAanF;AAED,mFAAmF;AACnF,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAExF;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAiBzE"}
1
+ {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../src/release.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,KAAK,GAAG,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/D;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAMtF;AAgBD,yEAAyE;AACzE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAG3D;AAED,MAAM,MAAM,eAAe,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC,CAanF;AAED,mFAAmF;AACnF,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAExF;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAiBzE"}
package/dist/release.js CHANGED
@@ -7,8 +7,15 @@ async function changelogHasEntry(cwd, version) {
7
7
  const escaped = version.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
8
8
  return new RegExp(`^## ${escaped}$`, "m").test(await file.text());
9
9
  }
10
+ var gitEnv = () => {
11
+ const env = { ...process.env };
12
+ delete env.GIT_DIR;
13
+ delete env.GIT_WORK_TREE;
14
+ delete env.GIT_INDEX_FILE;
15
+ return env;
16
+ };
10
17
  function tagExists(cwd, tag) {
11
- const result = Bun.spawnSync(["git", "tag", "-l", tag], { cwd });
18
+ const result = Bun.spawnSync(["git", "tag", "-l", tag], { cwd, env: gitEnv() });
12
19
  return result.stdout.toString().trim() === tag;
13
20
  }
14
21
  async function shouldRelease(cwd, pkg) {
@@ -55,5 +62,5 @@ export {
55
62
  tagExists
56
63
  };
57
64
 
58
- //# debugId=BB062728D267ADD364756E2164756E21
65
+ //# debugId=6C6369E02082921C64756E2164756E21
59
66
  //# sourceMappingURL=release.js.map
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/release.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * No npm publish. Tag a GitHub Release — but ONLY when this version genuinely just\n * came out of `changeset version`, never on an arbitrary changeset-less push to main.\n *\n * 🔴 MEASURED 2026-09-16/17 on homeflare-openbao, and documented upstream\n * (changesets/action's own README, changesets/action#9): a custom publish-script runs\n * on EVERY push to `main` that has zero pending changesets — not just the one push\n * right after a Version Packages PR merges. The README says so directly: \"a commit\n * without any new changesets can always land on your base branch after a successful\n * publish... you need to figure out on your own how to skip.\" Unguarded, this would\n * tag `<name>@<version>` on every unrelated push to main once CHANGELOG.md exists.\n *\n * ★ THE CONDITION: proceed only if `CHANGELOG.md` has an entry for the current version\n * (proof `changeset version` really ran and wrote it) AND no git tag `<name>@<version>`\n * exists yet (proof this exact release was not already cut). Both checks are local —\n * no network, no GitHub API — and both work from the checkout `release.yml` already\n * has (`fetch-depth: 0`).\n *\n * ⛔ TELL changesets/action WHAT TO TAG. With a custom publish-script it learns what\n * shipped only from `CHANGESETS_OUTPUT`. Without it, the action warns \"GitHub releases\n * and git tags cannot be created without this output\" and creates neither.\n */\ntype Pkg = { readonly name: string; readonly version: string };\n\n/**\n * Does CHANGELOG.md have a heading for this exact version?\n * @changesets/changelog-github writes `## <version>` for a single, non-monorepo package.\n */\nexport async function changelogHasEntry(cwd: string, version: string): Promise<boolean> {\n const file = Bun.file(`${cwd}/CHANGELOG.md`);\n if (!(await file.exists())) return false;\n\n const escaped = version.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n return new RegExp(`^## ${escaped}$`, 'm').test(await file.text());\n}\n\n/** Does this exact tag already exist? Local `git tag -l`, no network. */\nexport function tagExists(cwd: string, tag: string): boolean {\n const result = Bun.spawnSync(['git', 'tag', '-l', tag], { cwd });\n return result.stdout.toString().trim() === tag;\n}\n\nexport type ReleaseDecision = { readonly ok: boolean; readonly reason: string };\n\nexport async function shouldRelease(cwd: string, pkg: Pkg): Promise<ReleaseDecision> {\n const tag = `${pkg.name}@${pkg.version}`;\n\n if (!(await changelogHasEntry(cwd, pkg.version))) {\n return {\n ok: false,\n reason: `CHANGELOG.md has no \"## ${pkg.version}\" entry — changeset version has not run for this version`,\n };\n }\n if (tagExists(cwd, tag)) {\n return { ok: false, reason: `${tag} already exists — this version was already released` };\n }\n return { ok: true, reason: `CHANGELOG.md has the entry and ${tag} does not exist yet` };\n}\n\n/** One ndjson line changesets/action turns into a git tag and a GitHub Release. */\nexport function tagEvent(pkg: Pkg): { type: 'git-tag'; tag: string; packageName: string } {\n return { type: 'git-tag', tag: `${pkg.name}@${pkg.version}`, packageName: pkg.name };\n}\n\n/**\n * App-repo publish-script. Reads `package.json` at `cwd`, gates on `shouldRelease`,\n * and writes the tag event to `$CHANGESETS_OUTPUT` when this version is new.\n *\n * ⛔ `cwd` is the APP, never this package. Defaulting from `import.meta.url` after\n * publish would inspect `@homeflare/config` itself.\n */\nexport async function runAppRelease(cwd: string): Promise<ReleaseDecision> {\n const pkg = (await Bun.file(`${cwd}/package.json`).json()) as Pkg;\n const decision = await shouldRelease(cwd, pkg);\n\n if (!decision.ok) {\n process.stdout.write(`skip: ${decision.reason}\\n`);\n return decision;\n }\n\n const outputFile = process.env['CHANGESETS_OUTPUT'];\n if (outputFile !== undefined) {\n await Bun.write(outputFile, `${JSON.stringify(tagEvent(pkg))}\\n`);\n }\n process.stdout.write(\n `${pkg.name}@${pkg.version} — no npm publish; tagged (${decision.reason}).\\n`,\n );\n return decision;\n}\n\nif (import.meta.main) {\n await runAppRelease(process.cwd());\n}\n"
5
+ "/**\n * No npm publish. Tag a GitHub Release — but ONLY when this version genuinely just\n * came out of `changeset version`, never on an arbitrary changeset-less push to main.\n *\n * 🔴 MEASURED 2026-09-16/17 on homeflare-openbao, and documented upstream\n * (changesets/action's own README, changesets/action#9): a custom publish-script runs\n * on EVERY push to `main` that has zero pending changesets — not just the one push\n * right after a Version Packages PR merges. The README says so directly: \"a commit\n * without any new changesets can always land on your base branch after a successful\n * publish... you need to figure out on your own how to skip.\" Unguarded, this would\n * tag `<name>@<version>` on every unrelated push to main once CHANGELOG.md exists.\n *\n * ★ THE CONDITION: proceed only if `CHANGELOG.md` has an entry for the current version\n * (proof `changeset version` really ran and wrote it) AND no git tag `<name>@<version>`\n * exists yet (proof this exact release was not already cut). Both checks are local —\n * no network, no GitHub API — and both work from the checkout `release.yml` already\n * has (`fetch-depth: 0`).\n *\n * ⛔ TELL changesets/action WHAT TO TAG. With a custom publish-script it learns what\n * shipped only from `CHANGESETS_OUTPUT`. Without it, the action warns \"GitHub releases\n * and git tags cannot be created without this output\" and creates neither.\n */\ntype Pkg = { readonly name: string; readonly version: string };\n\n/**\n * Does CHANGELOG.md have a heading for this exact version?\n * @changesets/changelog-github writes `## <version>` for a single, non-monorepo package.\n */\nexport async function changelogHasEntry(cwd: string, version: string): Promise<boolean> {\n const file = Bun.file(`${cwd}/CHANGELOG.md`);\n if (!(await file.exists())) return false;\n\n const escaped = version.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n return new RegExp(`^## ${escaped}$`, 'm').test(await file.text());\n}\n\n/**\n * ⛔ DROP HUSKY GIT_DIR. `cwd` is not enough — pre-push exports GIT_DIR\n * and `git tag -l` then reads this checkout, not the throwaway repo.\n * Symptom: shouldRelease is false during verify and a test commits `init`\n * onto the branch being pushed.\n */\nconst gitEnv = (): NodeJS.ProcessEnv => {\n const env = { ...process.env };\n delete env.GIT_DIR;\n delete env.GIT_WORK_TREE;\n delete env.GIT_INDEX_FILE;\n return env;\n};\n\n/** Does this exact tag already exist? Local `git tag -l`, no network. */\nexport function tagExists(cwd: string, tag: string): boolean {\n const result = Bun.spawnSync(['git', 'tag', '-l', tag], { cwd, env: gitEnv() });\n return result.stdout.toString().trim() === tag;\n}\n\nexport type ReleaseDecision = { readonly ok: boolean; readonly reason: string };\n\nexport async function shouldRelease(cwd: string, pkg: Pkg): Promise<ReleaseDecision> {\n const tag = `${pkg.name}@${pkg.version}`;\n\n if (!(await changelogHasEntry(cwd, pkg.version))) {\n return {\n ok: false,\n reason: `CHANGELOG.md has no \"## ${pkg.version}\" entry — changeset version has not run for this version`,\n };\n }\n if (tagExists(cwd, tag)) {\n return { ok: false, reason: `${tag} already exists — this version was already released` };\n }\n return { ok: true, reason: `CHANGELOG.md has the entry and ${tag} does not exist yet` };\n}\n\n/** One ndjson line changesets/action turns into a git tag and a GitHub Release. */\nexport function tagEvent(pkg: Pkg): { type: 'git-tag'; tag: string; packageName: string } {\n return { type: 'git-tag', tag: `${pkg.name}@${pkg.version}`, packageName: pkg.name };\n}\n\n/**\n * App-repo publish-script. Reads `package.json` at `cwd`, gates on `shouldRelease`,\n * and writes the tag event to `$CHANGESETS_OUTPUT` when this version is new.\n *\n * ⛔ `cwd` is the APP, never this package. Defaulting from `import.meta.url` after\n * publish would inspect `@homeflare/config` itself.\n */\nexport async function runAppRelease(cwd: string): Promise<ReleaseDecision> {\n const pkg = (await Bun.file(`${cwd}/package.json`).json()) as Pkg;\n const decision = await shouldRelease(cwd, pkg);\n\n if (!decision.ok) {\n process.stdout.write(`skip: ${decision.reason}\\n`);\n return decision;\n }\n\n const outputFile = process.env['CHANGESETS_OUTPUT'];\n if (outputFile !== undefined) {\n await Bun.write(outputFile, `${JSON.stringify(tagEvent(pkg))}\\n`);\n }\n process.stdout.write(\n `${pkg.name}@${pkg.version} — no npm publish; tagged (${decision.reason}).\\n`,\n );\n return decision;\n}\n\nif (import.meta.main) {\n await runAppRelease(process.cwd());\n}\n"
6
6
  ],
7
- "mappings": ";;AA4BA,eAAsB,iBAAiB,CAAC,KAAa,SAAmC;AAAA,EACtF,MAAM,OAAO,IAAI,K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D,OAAO;AAAA,MACL,IAAI;AAAA,MACJ,QAAQ,2BAA2B,IAAI;AAAA,IACzC;AAAA,EACF;AAAA,EACA,IAAI,UAAU,KAAK,GAAG,GAAG;AAAA,IACvB,OAAO,EAAE,IAAI,OAAO,QAAQ,GAAG,8DAAyD;AAAA,EAC1F;AAAA,EACA,OAAO,EAAE,IAAI,MAAM,QAAQ,kCAAkC,yBAAyB;AAAA;AAIjF,SAAS,QAAQ,CAAC,KAAiE;AAAA,EACxF,OAAO,EAAE,MAAM,WAAW,KAAK,GAAG,IAAI,QAAQ,IAAI,WAAW,aAAa,IAAI,KAAK;AAAA;AAUrF,eAAsB,aAAa,CAAC,KAAuC;AAAA,EACzE,MAAM,MAAO,MAAM,IAAI,KAAK,GAAG,kBAAkB,EAAE,KAAK;AAAA,EACxD,MAAM,WAAW,MAAM,cAAc,KAAK,GAAG;AAAA,EAE7C,IAAI,CAAC,SAAS,IAAI;AAAA,IAChB,QAAQ,OAAO,MAAM,SAAS,SAAS;AAAA,CAAU;AAAA,IACjD,OAAO;AAAA,EACT;AAAA,EAEA,MAAM,aAAa,QAAQ,IAAI;AAAA,EAC/B,IAAI,eAAe,WAAW;AAAA,IAC5B,MAAM,IAAI,MAAM,YAAY,GAAG,KAAK,UAAU,SAAS,GAAG,CAAC;AAAA,CAAK;AAAA,EAClE;AAAA,EACA,QAAQ,OAAO,MACb,GAAG,IAAI,QAAQ,IAAI,0CAAqC,SAAS;AAAA,CACnE;AAAA,EACA,OAAO;AAAA;AAGT,IAAI,kBAAkB;AAAA,EACpB,MAAM,cAAc,QAAQ,IAAI,CAAC;AACnC;",
8
+ "debugId": "6C6369E02082921C64756E2164756E21",
9
9
  "names": []
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homeflare/config",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Shared tsconfig, oxlint, oxfmt, and non-npm release helpers for HomeFlare projects.",
5
5
  "license": "MIT",
6
6
  "author": "Timothy Schneider",
package/src/release.ts CHANGED
@@ -34,9 +34,23 @@ export async function changelogHasEntry(cwd: string, version: string): Promise<b
34
34
  return new RegExp(`^## ${escaped}$`, 'm').test(await file.text());
35
35
  }
36
36
 
37
+ /**
38
+ * ⛔ DROP HUSKY GIT_DIR. `cwd` is not enough — pre-push exports GIT_DIR
39
+ * and `git tag -l` then reads this checkout, not the throwaway repo.
40
+ * Symptom: shouldRelease is false during verify and a test commits `init`
41
+ * onto the branch being pushed.
42
+ */
43
+ const gitEnv = (): NodeJS.ProcessEnv => {
44
+ const env = { ...process.env };
45
+ delete env.GIT_DIR;
46
+ delete env.GIT_WORK_TREE;
47
+ delete env.GIT_INDEX_FILE;
48
+ return env;
49
+ };
50
+
37
51
  /** Does this exact tag already exist? Local `git tag -l`, no network. */
38
52
  export function tagExists(cwd: string, tag: string): boolean {
39
- const result = Bun.spawnSync(['git', 'tag', '-l', tag], { cwd });
53
+ const result = Bun.spawnSync(['git', 'tag', '-l', tag], { cwd, env: gitEnv() });
40
54
  return result.stdout.toString().trim() === tag;
41
55
  }
42
56