@vvedantb/config 0.20.1 → 0.21.0
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.
- package/CHANGELOG.md +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/release-notes.d.ts +43 -0
- package/dist/release-notes.js +59 -0
- package/dist/vite.d.ts +3 -0
- package/dist/vite.js +4 -0
- package/files/claude/commands/changelog.md +5 -5
- package/files/claude/commands/ship.md +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.21.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`41060a0`](https://github.com/vvedantb/v/commit/41060a057d6aaaed7dc5960e231ae46f63d1ebae) Thanks [@vvedantb](https://github.com/vvedantb)! - `defineWebViteConfig` adds `releaseNotes()`, which writes `release-notes.json` from the product's changelog entry files (`internal/changelog/<YYYY-MM-DD>/<slug>.md`) into each build. `releaseNotes: false` turns it off. The synced `/changelog` and `/ship` commands write one entry file per change.
|
|
8
|
+
|
|
3
9
|
## 0.20.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { runClerkAllow, type ClerkAllowFetch, type ClerkAllowIo, type ClerkAllow
|
|
|
9
9
|
export { SHARED_WORKER_SETUP, sharedWorkerVitestConfig, type SharedWorkerOptions, type SharedWorkerTestConfig, type SharedWorkerVitestConfig, } from "./vitest-shared.js";
|
|
10
10
|
export { CHECK_IDS, checkCiReusableWorkflow, checkConfigVersion, checkNoEslint, checkNoPlainTsc, checkNoPrettier, checkOxlintDep, checkOxlintScript, checkTsrsPresent, isOlderMinor, loadRepo, loadWaivers, rangeMinorFloor, runDoctor, runDoctorChecks, type CheckId, type CheckResult, type CheckStatus, type DoctorCheckOptions, type DoctorIo, type LoadedWaivers, type PackageEntry, type RepoModel, } from "./doctor.js";
|
|
11
11
|
export { REACT_DEDUPE, defineWebViteConfig, defineWebVitestConfig, reactPlugins, srcAlias, vendorChunkBuild, type AliasOptions, type BabelReactCompiler, type PathOptions, type ReactSetup, type ResolveConfig, type RouterPluginOptions, type VendorChunk, type VendorChunkGroup, type VitePlugin, type VitePluginOption, type WebBuildConfig, type WebViteConfig, type WebViteOptions, type WebVitestConfig, type WebVitestOptions, } from "./vite.js";
|
|
12
|
+
export { changelogEntryTitle, readReleaseNotes, releaseNotes, type ReleaseNote, type ReleaseNotesOptions, type ReleaseNotesPlugin, } from "./release-notes.js";
|
|
12
13
|
export { clerkScriptTags, clerkScriptsFromReact, originHintTags, originHints, type ClerkScripts, type HeadTag, type OriginHintsOptions, type OriginHintsPlugin, type OriginHintsResolvedConfig, } from "./origin-hints.js";
|
|
13
14
|
export { defineExpoMetroConfig, expoBabelConfig, type BabelApi, type ExpoBabelConfig, type ExpoMetroOptions, type MetroConfigLike, type MetroResolveContext, type MetroResolveRequest, type NativeWindMetroOptions, } from "./expo.js";
|
|
14
15
|
export { DEFAULT_RELEASE_SIGNING_MARKER, appendReleaseSigning, releaseSigningGradle, withReleaseSigning, type AppBuildGradleMod, type ReleaseSigningOptions, type ReleaseSigningPropertyKeys, type WithAppBuildGradle, type WithReleaseSigningOptions, } from "./release-signing.js";
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export { runClerkAllow, } from "./clerk-allow.js";
|
|
|
9
9
|
export { SHARED_WORKER_SETUP, sharedWorkerVitestConfig, } from "./vitest-shared.js";
|
|
10
10
|
export { CHECK_IDS, checkCiReusableWorkflow, checkConfigVersion, checkNoEslint, checkNoPlainTsc, checkNoPrettier, checkOxlintDep, checkOxlintScript, checkTsrsPresent, isOlderMinor, loadRepo, loadWaivers, rangeMinorFloor, runDoctor, runDoctorChecks, } from "./doctor.js";
|
|
11
11
|
export { REACT_DEDUPE, defineWebViteConfig, defineWebVitestConfig, reactPlugins, srcAlias, vendorChunkBuild, } from "./vite.js";
|
|
12
|
+
export { changelogEntryTitle, readReleaseNotes, releaseNotes, } from "./release-notes.js";
|
|
12
13
|
export { clerkScriptTags, clerkScriptsFromReact, originHintTags, originHints, } from "./origin-hints.js";
|
|
13
14
|
export { defineExpoMetroConfig, expoBabelConfig, } from "./expo.js";
|
|
14
15
|
export { DEFAULT_RELEASE_SIGNING_MARKER, appendReleaseSigning, releaseSigningGradle, withReleaseSigning, } from "./release-signing.js";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** One changelog entry file, as `/release-notes.json` lists it. */
|
|
2
|
+
export interface ReleaseNote {
|
|
3
|
+
id: string;
|
|
4
|
+
date: string;
|
|
5
|
+
title: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ReleaseNotesOptions {
|
|
8
|
+
/** The changelog folder. Defaults to `<root>/../../internal/changelog`, the product's folder. */
|
|
9
|
+
dir?: string;
|
|
10
|
+
/** The most entries the file lists, newest first. Defaults to 50. */
|
|
11
|
+
max?: number;
|
|
12
|
+
}
|
|
13
|
+
interface EmittedAsset {
|
|
14
|
+
type: "asset";
|
|
15
|
+
fileName: string;
|
|
16
|
+
source: string;
|
|
17
|
+
}
|
|
18
|
+
/** The Vite plugin that `releaseNotes` returns. */
|
|
19
|
+
export interface ReleaseNotesPlugin {
|
|
20
|
+
name: "vvedantb-release-notes";
|
|
21
|
+
apply: "build";
|
|
22
|
+
configResolved: (config: {
|
|
23
|
+
root: string;
|
|
24
|
+
}) => void;
|
|
25
|
+
generateBundle: (this: {
|
|
26
|
+
emitFile: (file: EmittedAsset) => string;
|
|
27
|
+
}) => Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
/** The `# Title` of an entry file, when it is the first line with text. */
|
|
30
|
+
export declare function changelogEntryTitle(text: string): string | null;
|
|
31
|
+
/**
|
|
32
|
+
* The entry files of a changelog folder (`<YYYY-MM-DD>/<slug>.md`), newest
|
|
33
|
+
* date first. Entries without a `# Title`, and the history files beside the
|
|
34
|
+
* date folders, are left out. A missing folder gives no entries.
|
|
35
|
+
*/
|
|
36
|
+
export declare function readReleaseNotes(dir: string, max?: number): Promise<ReleaseNote[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Writes `release-notes.json` (`{ notes: ReleaseNote[] }`) into the build, so
|
|
39
|
+
* a running page can tell what a newer deploy adds. Nothing is written when
|
|
40
|
+
* the folder has no entries.
|
|
41
|
+
*/
|
|
42
|
+
export declare function releaseNotes(options?: ReleaseNotesOptions): ReleaseNotesPlugin;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { readdir, readFile } from "node:fs/promises";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
const DATE_FOLDER = /^\d{4}-\d{2}-\d{2}$/;
|
|
4
|
+
const DEFAULT_MAX = 50;
|
|
5
|
+
/** The `# Title` of an entry file, when it is the first line with text. */
|
|
6
|
+
export function changelogEntryTitle(text) {
|
|
7
|
+
const first = text.split(/\r?\n/).find((line) => line.trim() !== "");
|
|
8
|
+
const match = first === undefined ? null : /^#\s+(.+?)\s*$/.exec(first);
|
|
9
|
+
return match ? match[1] : null;
|
|
10
|
+
}
|
|
11
|
+
async function listNames(dir) {
|
|
12
|
+
try {
|
|
13
|
+
return await readdir(dir);
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The entry files of a changelog folder (`<YYYY-MM-DD>/<slug>.md`), newest
|
|
21
|
+
* date first. Entries without a `# Title`, and the history files beside the
|
|
22
|
+
* date folders, are left out. A missing folder gives no entries.
|
|
23
|
+
*/
|
|
24
|
+
export async function readReleaseNotes(dir, max = DEFAULT_MAX) {
|
|
25
|
+
const dates = (await listNames(dir)).filter((name) => DATE_FOLDER.test(name)).sort().reverse();
|
|
26
|
+
const notes = [];
|
|
27
|
+
for (const date of dates) {
|
|
28
|
+
const files = (await listNames(join(dir, date))).filter((name) => name.endsWith(".md")).sort();
|
|
29
|
+
for (const file of files) {
|
|
30
|
+
const title = changelogEntryTitle(await readFile(join(dir, date, file), "utf8"));
|
|
31
|
+
if (title)
|
|
32
|
+
notes.push({ id: `${date}/${file.slice(0, -3)}`, date, title });
|
|
33
|
+
if (notes.length >= max)
|
|
34
|
+
return notes;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return notes;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Writes `release-notes.json` (`{ notes: ReleaseNote[] }`) into the build, so
|
|
41
|
+
* a running page can tell what a newer deploy adds. Nothing is written when
|
|
42
|
+
* the folder has no entries.
|
|
43
|
+
*/
|
|
44
|
+
export function releaseNotes(options = {}) {
|
|
45
|
+
let dir = options.dir ?? "";
|
|
46
|
+
return {
|
|
47
|
+
name: "vvedantb-release-notes",
|
|
48
|
+
apply: "build",
|
|
49
|
+
configResolved(config) {
|
|
50
|
+
dir = options.dir ? resolve(config.root, options.dir) : resolve(config.root, "../../internal/changelog");
|
|
51
|
+
},
|
|
52
|
+
async generateBundle() {
|
|
53
|
+
const notes = await readReleaseNotes(dir, options.max);
|
|
54
|
+
if (notes.length === 0)
|
|
55
|
+
return;
|
|
56
|
+
this.emitFile({ type: "asset", fileName: "release-notes.json", source: JSON.stringify({ notes }) });
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type OriginHintsOptions } from "./origin-hints.js";
|
|
2
|
+
import { type ReleaseNotesOptions } from "./release-notes.js";
|
|
2
3
|
/** A Vite plugin: Vite's `Plugin` needs only `name`. */
|
|
3
4
|
export interface VitePlugin {
|
|
4
5
|
name: string;
|
|
@@ -82,6 +83,8 @@ export interface WebViteOptions<Preset> extends PathOptions {
|
|
|
82
83
|
vendorChunks?: boolean | Partial<Record<VendorChunk, RegExp>>;
|
|
83
84
|
/** Convex and Clerk preconnects and early Clerk scripts (see `originHints`). On by default; `false` turns it off. */
|
|
84
85
|
originHints?: boolean | OriginHintsOptions;
|
|
86
|
+
/** `release-notes.json` from the product's changelog entry files (see `releaseNotes`). On by default; `false` turns it off. */
|
|
87
|
+
releaseNotes?: boolean | ReleaseNotesOptions;
|
|
85
88
|
}
|
|
86
89
|
export interface WebViteConfig {
|
|
87
90
|
plugins: VitePluginOption[];
|
package/dist/vite.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
2
|
import { originHints } from "./origin-hints.js";
|
|
3
|
+
import { releaseNotes } from "./release-notes.js";
|
|
3
4
|
/** Packages that hold React context. pnpm can install two copies; dedupe keeps one. */
|
|
4
5
|
export const REACT_DEDUPE = [
|
|
5
6
|
"react",
|
|
@@ -73,6 +74,9 @@ export function defineWebViteConfig(options) {
|
|
|
73
74
|
if (options.originHints !== false) {
|
|
74
75
|
plugins.push(originHints(options.originHints === true ? {} : options.originHints));
|
|
75
76
|
}
|
|
77
|
+
if (options.releaseNotes !== false) {
|
|
78
|
+
plugins.push(releaseNotes(options.releaseNotes === true ? {} : options.releaseNotes));
|
|
79
|
+
}
|
|
76
80
|
const config = { plugins };
|
|
77
81
|
const resolved = resolveConfig(options);
|
|
78
82
|
if (resolved)
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
model: haiku
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
Review all changes made in this conversation and add
|
|
5
|
+
Review all changes made in this conversation and add one new entry file: `internal/changelog/<YYYY-MM-DD>/<slug>.md`, in today's date folder (create the folder if it does not exist). In the V monorepo the folder is `apps/<product>/internal/changelog/`. The slug is the entry's title in short kebab case. One file per entry, so two commits never conflict. Never edit the older files in `internal/changelog/` (`history.md`, `<YYYY-MM>.md`); they are history.
|
|
6
6
|
|
|
7
|
-
Format:
|
|
7
|
+
Format: `# <Title>` followed by bullet points describing each change.
|
|
8
|
+
|
|
9
|
+
The release workflows read these files: each Android release lists the titles of the entry files added since the previous release as its release notes, and the apps show them in the update prompt and V Store. Write the title for a user, not a developer.
|
|
8
10
|
|
|
9
11
|
Rules:
|
|
10
12
|
|
|
11
13
|
- Only add entries for medium-to-large changes/features, not quick fixes or bug fixes
|
|
12
14
|
- Each bullet should describe what changed and why, not implementation details
|
|
13
15
|
- Keep bullets concise (one line each)
|
|
14
|
-
-
|
|
15
|
-
- Use today's date
|
|
16
|
-
- If multiple features were implemented, group them under one entry if related, or create separate entries if unrelated
|
|
16
|
+
- If multiple features were implemented, group them in one file if related, or create separate files if unrelated
|
|
@@ -4,7 +4,7 @@ model: haiku
|
|
|
4
4
|
|
|
5
5
|
Stage relevant files, commit, and push to remote.
|
|
6
6
|
|
|
7
|
-
1. Run the `/changelog` step first: review this session's changes and, only if they amount to a medium-to-large change or feature (skip quick fixes and bug fixes), add
|
|
7
|
+
1. Run the `/changelog` step first: review this session's changes and, only if they amount to a medium-to-large change or feature (skip quick fixes and bug fixes), add one entry file at `internal/changelog/<YYYY-MM-DD>/<slug>.md` (today's date folder) per the `/changelog` rules. Stage this edit with the code in step 4.
|
|
8
8
|
2. Run `git status -u` and `git log --oneline -5` in parallel
|
|
9
9
|
3. Identify session-related files, excluding pre-existing dirty files
|
|
10
10
|
4. Stage with `git add` using specific paths (never `git add -A` or `.`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vvedantb/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Shared tsconfig bases, oxlint base, Vite, Vitest, Babel and Metro presets, a WXT preset and host-permission helper for Chrome extensions, pinned tool versions, a sync CLI for Claude commands, CLAUDE.md, Cursor environment and Convex tsconfig, a packaged Electron app.asar module check, a shared header and footer check, a no-source-text-in-tests check, a no-comments check with a ratchet baseline, shared oxlint JS plugins and a CLI that adds an extension to Clerk's allowed origins.",
|
|
6
6
|
"type": "module",
|