@vvedantb/config 0.14.1 → 0.15.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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#73](https://github.com/vvedantb/v/pull/73) [`7be3472`](https://github.com/vvedantb/v/commit/7be3472fe9c7ef434aad0d59929a3e7c27bb08ce) Thanks [@vvedantb](https://github.com/vvedantb)! - Raise peer ranges to the versions the repository tests against. `@vvedantb/ui` needs `motion` 13, `tailwind-merge` 3, `@streamdown/code` 2 and `@tanstack/react-hotkeys` 0.27. `@vvedantb/config` needs `@expo/config-plugins` 58. `@vvedantb/native-ui` needs `tailwind-merge` 3 or later. `tailwind-merge` 3 keeps `leading-*` and `outline` classes that version 2 dropped when merged with `text-*` and `outline-1`.
8
+
9
+ - [#105](https://github.com/vvedantb/v/pull/105) [`b6e1467`](https://github.com/vvedantb/v/commit/b6e1467ec68058d23593caa2e755cd912bbb1ca1) Thanks [@vvedantb](https://github.com/vvedantb)! - Add `vvedantb-check-no-comments`, a comment ban with a ratchet baseline. It fails on a comment that is not in `comments-baseline.json`. `update` rewrites the baseline and `prune` only removes stale entries. Tool directives, licence headers, JSDoc before an `export` and generated files are never flagged.
10
+
11
+ - [`278dff8`](https://github.com/vvedantb/v/commit/278dff8cd58de75669773eef601a7f202bd72852) Thanks [@vvedantb](https://github.com/vvedantb)! - The shared oxlint base config now errors on direct `localStorage` and `sessionStorage` use (also through `window` and `globalThis`). Use `useLocalStorage` or `useSessionStorage` from `usehooks-ts`. Test, e2e, testing and internal files are exempt.
12
+
13
+ ### Patch Changes
14
+
15
+ - [#101](https://github.com/vvedantb/v/pull/101) [`9291905`](https://github.com/vvedantb/v/commit/92919054016ddb3a8a5d5ca25c858a8cff35ceb1) Thanks [@vvedantb](https://github.com/vvedantb)! - `vvedantb-android-release` now sets `org.gradle.caching=true`, so Gradle reuses cached task outputs. It also routes CMake compiles (Reanimated, Hermes, other native modules) through ccache when CI sets `CCACHE_DIR` or `ANDROID_CCACHE` and ccache is available. The Android release workflow uses a per-app `setup-gradle` cache key, caches the NDK, and keeps a per-app ccache.
16
+
17
+ - [#98](https://github.com/vvedantb/v/pull/98) [`39c54bf`](https://github.com/vvedantb/v/commit/39c54bf753a1c20a12f92d127c12a06bfbf9f167) Thanks [@vvedantb](https://github.com/vvedantb)! - `vvedantb-android-release` now builds ABI splits by default (publish `arm64-v8a`, build `x86_64` for the start-up test; set `abiSplits: false` to opt out). It also turns on R8 minify, resource shrinking and bundle compression, and appends keep rules for Reanimated, Hermes, Clerk and Convex to `proguard-rules.pro` (markers use `#`, because R8 rejects `//`). It also sets `expo.useLegacyPackaging=true` by default, so JNI libs stay zip-compressed and sideload APK downloads are smaller.
18
+
19
+ - [`1076f25`](https://github.com/vvedantb/v/commit/1076f25663e717bdd0265318f5d920d980810e5e) Thanks [@cursoragent](https://github.com/cursoragent)! - `withReleaseSigning` accepts `gradleBlock`, `requireGroovy` and `trimContentsBeforeAppend`. An app can now keep its own Groovy signing block and still use the shared plugin. The generated template and its defaults do not change.
20
+
21
+ ## 0.14.2
22
+
23
+ ### Patch Changes
24
+
25
+ - [#338](https://github.com/vvedantb/packages/pull/338) [`5352f85`](https://github.com/vvedantb/packages/commit/5352f852ed51e4807e04fce84be83fbf522f7fe5) Thanks [@vvedantb](https://github.com/vvedantb)! - `vvedantb-android-release` supports opt-in Gradle ABI splits through the `abiSplits` and `publishArchitectures` config fields. One `assembleRelease` writes one APK per ABI; only the publish ABI APK is renamed, hashed into `release.json` and published, with an unchanged versionCode. The `startup_apk` GitHub output names the x86_64 split for the start-up test. Default behaviour is unchanged. New helpers: `withAbiSplits`, `abiSplitsGradle`, `resolveReleaseApkNames`, `splitApkFileName` and `splitArchitectures`.
26
+
3
27
  ## 0.14.1
4
28
 
5
29
  ### Patch Changes
package/README.md CHANGED
@@ -179,6 +179,18 @@ pnpm exec vvedantb-check-no-source-text apps/web --skip landing --skip-file no-s
179
179
 
180
180
  Put `allow-source-read: <reason>` in a comment on the same or the previous line to allow one read that feeds code under test. The directories `node_modules`, `dist`, `build`, `.git`, `.expo`, `.next`, `android`, `ios`, `out` and `release` are skipped; `--skip <dir>` adds more and `--skip-file <name>` skips one test file by name. Exit code: 0 clean, 1 findings, 2 bad usage.
181
181
 
182
+ ## vvedantb-check-no-comments
183
+
184
+ `vvedantb-check-no-comments` bans comments in product source with a ratchet baseline. It scans `.ts`, `.tsx`, `.js`, `.jsx`, `.mjs`, `.cjs`, `.mts` and `.cts` files under `apps/verve`, `apps/velth`, `apps/vhub`, `apps/vmem`, `apps/vibot`, `apps/v-store` and `apps/project-v` (or the paths you pass), and compares each comment with `comments-baseline.json` in the current directory.
185
+
186
+ ```sh
187
+ pnpm exec vvedantb-check-no-comments # check: fail on a comment that is not in the baseline
188
+ pnpm exec vvedantb-check-no-comments prune # remove baseline entries whose comment is gone; never adds
189
+ pnpm exec vvedantb-check-no-comments update # set the baseline to the current comments; the only way to add
190
+ ```
191
+
192
+ The baseline holds a hash of the file path and the whitespace-normalised comment text, with a 40-character snippet for debugging. A comment that moves inside its file stays allowed. Never flagged: tool directives (`eslint-*`, `oxlint-*`, `@ts-expect-error`, `@ts-ignore`, `@ts-nocheck`, `biome-ignore`, `prettier-ignore`, triple-slash references, a `#!` line), a licence header before any code, JSDoc directly before an `export`, `*.d.ts` and `*.gen.*` files, and the folders `node_modules`, `dist`, `build`, `_generated`, `generated`, `.expo`, `.next`, `android`, `ios`, `.turbo` and `coverage`. `"use client"` and `"use server"` are strings, so the check ignores them. Exit code: 0 clean, 1 new comments, 2 bad usage.
193
+
182
194
  ## vvedantb-doctor
183
195
 
184
196
  `vvedantb-doctor` inspects a repo for drift from the shared CI and tooling house rules and exits non-zero with a list of what to fix. It reads the root `package.json`, walks the workspace packages (from `pnpm-workspace.yaml` and npm `workspaces`), and reads `.github/workflows/*`. It makes no network requests.
@@ -257,7 +269,7 @@ export default defineConfig({
257
269
  | `plugins` | App plugins, last. Falsy entries are dropped, so `flag && plugin()` works. |
258
270
  | `tsconfigPaths` | `resolve.tsconfigPaths: true`. |
259
271
  | `alias` | `resolve.alias` as given (object or `{ find, replacement }` list). `srcAlias(dir)` is `{ "@": "<dir>/src" }`. |
260
- | `dedupe` | `resolve.dedupe` as given. `REACT_DEDUPE` is `react`, `react-dom`, `convex`, `@tanstack/react-router`, `@clerk/clerk-react`. |
272
+ | `dedupe` | `resolve.dedupe` as given. `REACT_DEDUPE` is `react`, `react-dom`, `convex`, `@tanstack/react-router`, `@clerk/react`. |
261
273
  | `vendorChunks` | `build`: `outDir: "dist"`, `chunkSizeWarningLimit: 1000` and rolldown chunk groups `vendor-radix`, `vendor-convex`, `vendor-clerk`, `vendor-motion` (priority 15). An object keyed by group (`radix`, `convex`, `clerk`, `motion`) replaces that group's `test` RegExp. |
262
274
 
263
275
  Keys that are not asked for are left out, so `resolve` and `build` appear only when set. `reactPlugins(setup)` and `vendorChunkBuild(tests?)` are exported on their own.
@@ -462,6 +474,9 @@ Options and defaults:
462
474
  | `storeType` | _(omitted)_ | Emitted as a `storeType "…"` line only when set. |
463
475
  | `skipOnEasBuild` | `false` | Skip the append when `EAS_BUILD` is set (EAS handles its own signing). |
464
476
  | `releaseTaskCondition` | any task of this project whose name contains `"release"` | Groovy boolean deciding whether a build must sign `release`. |
477
+ | `gradleBlock` | _(unset)_ | An exact Groovy block appended instead of the template, so an app keeps its Gradle text byte for byte. `marker` is then required and must appear in the block. The template options above are ignored. |
478
+ | `requireGroovy` | `false` | Throw when `app/build.gradle` is not Groovy. |
479
+ | `trimContentsBeforeAppend` | `false` | With `gradleBlock`: append after `contents.trimEnd()` and a blank line. |
465
480
 
466
481
  Exact marker each app expects:
467
482
 
@@ -569,7 +584,7 @@ Paths and filters are as read from each app's current script. Check them against
569
584
 
570
585
  ### Gradle settings
571
586
 
572
- The bin edits `android/gradle.properties` (`DEFAULT_GRADLE_PROPERTY_EDITS`): `reactNativeArchitectures=arm64-v8a` by default (published APKs run on phones; emulator builds in `apps/native-gallery` set `x86_64` themselves). The `REACT_NATIVE_ARCHITECTURES` env var, then the config field `reactNativeArchitectures`, override it, such as `arm64-v8a,x86_64` for an app whose start-up test runs on an x86_64 emulator. It also sets `org.gradle.workers.max=8` and `org.gradle.parallel=true` (boat-large has 8 cores; both override Expo's defaults). `org.gradle.configuration-cache` stays off: ephemeral CI runners never reuse the cache, so a cold `assembleRelease` only pays the store cost, and Expo and third-party native modules can still be incompatible on release tasks. After prebuild the bin checks `versionCode`, `versionName` and signing in `android/app/build.gradle`.
587
+ The bin edits `android/gradle.properties` (`DEFAULT_GRADLE_PROPERTY_EDITS`): `reactNativeArchitectures=arm64-v8a,x86_64` by default (the config default; the bare `buildGradlePropertyEdits()` helper still gives `arm64-v8a`). The `REACT_NATIVE_ARCHITECTURES` env var, then the config field `reactNativeArchitectures`, override it, `org.gradle.workers.max=8` and `org.gradle.parallel=true` (boat-large has 8 cores; both override Expo's defaults) and `org.gradle.caching=true` (Gradle build cache on). When `CCACHE_DIR` or `ANDROID_CCACHE` is set and a `ccache` binary resolves (`CCACHE_EXEC`, else PATH), the bin writes `android/ccache.init.gradle` and runs Gradle with `-I`, so CMake uses ccache as its C and C++ compiler launcher. It skips this silently when ccache is missing. `abiSplits` is on by default with `publishArchitectures: ["arm64-v8a"]`: Gradle builds one APK per ABI in a single `assembleRelease`, and only the publish ABI APK is published (versionCode unchanged), and the other ABI APK (such as `x86_64`) is written to the `startup_apk` GitHub output for the start-up test. Set `abiSplits: false` to opt out: one APK, phone-only (`arm64-v8a`) unless `reactNativeArchitectures` says otherwise, and no `publishArchitectures` needed. The bin also sets `android.enableMinifyInReleaseBuilds=true`, `android.enableShrinkResourcesInReleaseBuilds=true` and `android.enableBundleCompression=true` (smaller APK, slightly slower cold start), and `expo.useLegacyPackaging=true` (JNI libs stay zip-compressed, so the sideload download is smaller; install extracts them), and appends R8 keep rules (Reanimated and Worklets, Hermes and JNI, Clerk, Convex) to `android/app/proguard-rules.pro` after a `// vvedantb-android-release: keep rules` marker. Existing rules stay, and a second run replaces the block. `org.gradle.configuration-cache` stays off: ephemeral CI runners never reuse the cache, so a cold `assembleRelease` only pays the store cost, and Expo and third-party native modules can still be incompatible on release tasks. After prebuild the bin checks `versionCode`, `versionName` and signing in `android/app/build.gradle`.
573
588
 
574
589
  ### Version pick
575
590
 
@@ -577,7 +592,7 @@ The bin edits `android/gradle.properties` (`DEFAULT_GRADLE_PROPERTY_EDITS`): `re
577
592
 
578
593
  Not covered, so it stays local: the keystore location (a `withReleaseSigning` plugin option), velth's own signing-completeness pre-check (the Gradle plugin enforces it), and eva's Clerk native-API check (use the workflow's `pre_build_command`).
579
594
 
580
- Pure helpers (`pickAndroidReleaseVersion`, `readExpoVersion`, `syncExpoVersion`, `syncPackageJsonVersion`, `gradleVersionNameOk`, `validateVersionName`, `validateVersionCode`, `publicEnvDefault`, `easProfileEntries`, `gradlePropertiesEdits`, `buildGradlePropertyEdits`, `resolveReactNativeArchitectures`, `parseBadging`, `releaseJson`, `formatReleaseJson`, `formatGithubOutput`, `apkFileName`, `parseAndroidReleaseConfig`) are exported from the root and unit-tested. The full Android build was not exercised on Windows.
595
+ Pure helpers (`pickAndroidReleaseVersion`, `readExpoVersion`, `syncExpoVersion`, `syncPackageJsonVersion`, `gradleVersionNameOk`, `validateVersionName`, `validateVersionCode`, `publicEnvDefault`, `easProfileEntries`, `gradlePropertiesEdits`, `buildGradlePropertyEdits`, `resolveReactNativeArchitectures`, `withAbiSplits`, `abiSplitsGradle`, `withKeepRules`, `keepRulesBlock`, `resolveReleaseApkNames`, `splitApkFileName`, `splitArchitectures`, `parseBadging`, `releaseJson`, `formatReleaseJson`, `formatGithubOutput`, `apkFileName`, `parseAndroidReleaseConfig`) are exported from the root and unit-tested. The full Android build was not exercised on Windows.
581
596
 
582
597
  ## Versions
583
598
 
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import "../dist/check-no-comments-cli.js";
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  // `vvedantb-android-release`: build a signed, sideloadable Android release APK
3
- // (arm64-v8a, embedded JS) with Gradle, then write release.json next to
3
+ // (arm64-v8a published, x86_64 start-up APK, embedded JS) with Gradle, then write release.json next to
4
4
  // it. No EAS. One bin for every app; per-app differences come from a JSON config:
5
5
  //
6
6
  // VERSION_NAME=1.0.1 VERSION_CODE=1000 \
@@ -17,7 +17,7 @@ import { spawnSync } from "node:child_process";
17
17
  import { createHash } from "node:crypto";
18
18
  import { appendFileSync, chmodSync, copyFileSync, existsSync, readdirSync, readFileSync, rmSync, writeFileSync, } from "node:fs";
19
19
  import { dirname, join, resolve } from "node:path";
20
- import { apkFileName, easProfileEntries, formatGithubOutput, formatReleaseJson, buildGradlePropertyEdits, gradlePropertiesEdits, resolveReactNativeArchitectures, gradleVersionNameOk, parseAndroidReleaseConfig, parseBadging, publicEnvDefault, readExpoVersion, releaseJson, syncExpoVersion, syncPackageJsonVersion, validateVersionCode, validateVersionName, } from "./android-release.js";
20
+ import { apkFileName, easProfileEntries, formatGithubOutput, formatReleaseJson, buildGradlePropertyEdits, ccacheInitScript, gradlePropertiesEdits, resolveReactNativeArchitectures, resolveReleaseApkNames, splitArchitectures, withAbiSplits, withKeepRules, gradleVersionNameOk, parseAndroidReleaseConfig, parseBadging, publicEnvDefault, readExpoVersion, releaseJson, syncExpoVersion, syncPackageJsonVersion, validateVersionCode, validateVersionName, } from "./android-release.js";
21
21
  function fail(message) {
22
22
  console.error(message);
23
23
  process.exit(1);
@@ -220,13 +220,31 @@ if (config.gradleWrapperPin !== undefined) {
220
220
  }
221
221
  }
222
222
  }
223
+ // Architectures precedence: REACT_NATIVE_ARCHITECTURES env, config field (default arm64-v8a,x86_64).
224
+ const architectures = resolveReactNativeArchitectures(process.env.REACT_NATIVE_ARCHITECTURES, config.reactNativeArchitectures);
225
+ const apkNames = resolveReleaseApkNames({
226
+ abiSplits: config.abiSplits,
227
+ architectures,
228
+ publishArchitectures: config.publishArchitectures,
229
+ });
230
+ if (config.abiSplits === true) {
231
+ const publishAbi = config.publishArchitectures?.[0] ?? "";
232
+ if (!splitArchitectures(architectures).includes(publishAbi)) {
233
+ fail(`Publish ABI ${publishAbi} is not in reactNativeArchitectures (${architectures}).`);
234
+ }
235
+ writeFileSync(appGradle, withAbiSplits(appGradleText, splitArchitectures(architectures)));
236
+ }
223
237
  const propsPath = join(appDir, "android", "gradle.properties");
224
238
  const propsText = existsSync(propsPath) ? readFileSync(propsPath, "utf8") : "";
225
- // Architectures precedence: REACT_NATIVE_ARCHITECTURES env, config field, arm64-v8a.
226
- writeFileSync(propsPath, gradlePropertiesEdits(propsText, buildGradlePropertyEdits(resolveReactNativeArchitectures(process.env.REACT_NATIVE_ARCHITECTURES, config.reactNativeArchitectures))));
239
+ writeFileSync(propsPath, gradlePropertiesEdits(propsText, buildGradlePropertyEdits(architectures)));
240
+ // R8 keep rules for the minified release build. Existing rules stay.
241
+ const proguardPath = join(appDir, "android", "app", "proguard-rules.pro");
242
+ const proguardText = existsSync(proguardPath) ? readFileSync(proguardPath, "utf8") : "";
243
+ writeFileSync(proguardPath, withKeepRules(proguardText));
227
244
  writeFileSync(join(appDir, "android", "local.properties"), `sdk.dir=${sdkRoot}\n`);
228
245
  const outDir = join(appDir, "android", "app", "build", "outputs", "apk", "release");
229
- const apk = join(outDir, "app-release.apk");
246
+ const apk = join(outDir, apkNames.publish);
247
+ const startupApk = apkNames.startup === undefined ? undefined : join(outDir, apkNames.startup);
230
248
  // A failed run must not leave an older APK or release.json to publish.
231
249
  for (const stale of [apk, join(outDir, "release.json")]) {
232
250
  if (existsSync(stale))
@@ -234,7 +252,8 @@ for (const stale of [apk, join(outDir, "release.json")]) {
234
252
  }
235
253
  if (existsSync(outDir)) {
236
254
  for (const name of readdirSync(outDir)) {
237
- if (new RegExp(`^${config.apkPrefix}-.*-android\\.apk$`).test(name)) {
255
+ if (new RegExp(`^${config.apkPrefix}-.*-android\\.apk$`).test(name) ||
256
+ (config.abiSplits === true && /^app-.*release\.apk$/.test(name))) {
238
257
  rmSync(join(outDir, name));
239
258
  }
240
259
  }
@@ -243,8 +262,29 @@ const androidDir = join(appDir, "android");
243
262
  const gradlew = join(androidDir, "gradlew");
244
263
  if (existsSync(gradlew))
245
264
  chmodSync(gradlew, 0o755);
265
+ // ccache for CMake (Reanimated, Hermes and other native modules). Only when CI
266
+ // set CCACHE_DIR or ANDROID_CCACHE and a ccache binary resolves; else skip.
267
+ function resolveCcache() {
268
+ if (!env.CCACHE_DIR && !env.ANDROID_CCACHE)
269
+ return undefined;
270
+ if (env.CCACHE_EXEC && existsSync(env.CCACHE_EXEC))
271
+ return env.CCACHE_EXEC;
272
+ for (const dir of (env.PATH ?? "").split(":")) {
273
+ if (dir !== "" && existsSync(join(dir, "ccache")))
274
+ return join(dir, "ccache");
275
+ }
276
+ return undefined;
277
+ }
246
278
  // Vital lint is not needed for a sideload APK and can run out of Metaspace.
247
- run("./gradlew", ["assembleRelease", "--no-daemon", "-x", "lint", "-x", "lintVitalAnalyzeRelease", "-x", "lintVitalRelease"], { cwd: androidDir, env });
279
+ const gradleArgs = ["assembleRelease", "--no-daemon", "-x", "lint", "-x", "lintVitalAnalyzeRelease", "-x", "lintVitalRelease"];
280
+ const ccache = resolveCcache();
281
+ if (ccache !== undefined) {
282
+ const initScript = join(androidDir, "ccache.init.gradle");
283
+ writeFileSync(initScript, ccacheInitScript(ccache));
284
+ gradleArgs.push("-I", initScript);
285
+ console.info(`Using ccache at ${ccache} for CMake builds.`);
286
+ }
287
+ run("./gradlew", gradleArgs, { cwd: androidDir, env });
248
288
  // Check the APK itself before describing it: package, versionCode, versionName,
249
289
  // and a release signature rather than the debug key.
250
290
  const buildTools = findBuildTools(sdkRoot);
@@ -258,6 +298,14 @@ if (badging.name !== config.packageId ||
258
298
  fail(`Built ${badging.name} ${badging.versionCode} ${badging.versionName} (package, versionCode, versionName); ` +
259
299
  `expected ${config.packageId} ${versionCode} ${versionName}.`);
260
300
  }
301
+ if (startupApk !== undefined) {
302
+ if (!existsSync(startupApk))
303
+ fail(`Gradle did not write the start-up APK ${startupApk}.`);
304
+ const other = parseBadging(capture(join(buildTools, "aapt2"), ["dump", "badging", startupApk], androidDir));
305
+ if (other.versionCode !== badging.versionCode || other.versionName !== badging.versionName) {
306
+ fail(`The start-up APK is ${other.versionCode} ${other.versionName}; the published APK is ${badging.versionCode} ${badging.versionName}.`);
307
+ }
308
+ }
261
309
  const certs = capture(join(buildTools, "apksigner"), ["verify", "--print-certs", apk], androidDir);
262
310
  if (certs.includes("CN=Android Debug")) {
263
311
  fail("The APK is signed with the debug key. Not writing release.json.");
@@ -277,6 +325,7 @@ console.info(`Wrote ${manifest}`);
277
325
  if (env.GITHUB_OUTPUT !== undefined && env.GITHUB_OUTPUT !== "") {
278
326
  appendFileSync(env.GITHUB_OUTPUT, formatGithubOutput({
279
327
  apk: named,
328
+ ...(startupApk === undefined ? {} : { startup_apk: startupApk }),
280
329
  release_json: manifest,
281
330
  version_name: versionName,
282
331
  version_code: String(versionCode),
@@ -53,7 +53,11 @@ export interface GradlePropertyEdit {
53
53
  /** Replace an existing line (true) or only append when absent (false). */
54
54
  replace: boolean;
55
55
  }
56
- /** Default `reactNativeArchitectures`: published APKs target phones. */
56
+ /**
57
+ * Default `reactNativeArchitectures` for the bare helper (no env, no config):
58
+ * phone-only. The CLI reads the config defaults, which add `x86_64` for the
59
+ * start-up test (see `DEFAULT_CONFIG`).
60
+ */
57
61
  export declare const DEFAULT_REACT_NATIVE_ARCHITECTURES = "arm64-v8a";
58
62
  /**
59
63
  * Resolves the `reactNativeArchitectures` value. Precedence: explicit `option`
@@ -63,9 +67,18 @@ export declare const DEFAULT_REACT_NATIVE_ARCHITECTURES = "arm64-v8a";
63
67
  * is fat, so keeping it would widen every app that relies on the arm64 force.
64
68
  */
65
69
  export declare function resolveReactNativeArchitectures(option?: string, fallback?: string): string;
70
+ /**
71
+ * Gradle init script that passes ccache to CMake as the C and C++ compiler
72
+ * launcher for every Android module. It runs in `project.afterEvaluate`, when
73
+ * the android extension is ready, and appends to any existing
74
+ * `cmake.arguments`. A module without CMake is unaffected:
75
+ * the arguments only apply when the module sets `externalNativeBuild.cmake.path`.
76
+ * A failure to configure one module is logged and skipped, never fatal.
77
+ */
78
+ export declare function ccacheInitScript(ccachePath: string): string;
66
79
  /** The edits the release build makes to `gradle.properties`, in order. */
67
80
  export declare function buildGradlePropertyEdits(reactNativeArchitectures?: string): readonly GradlePropertyEdit[];
68
- /** The default edits (arm64-v8a only), in order. */
81
+ /** The default edits (arm64-v8a only, minify on), in order. */
69
82
  export declare const DEFAULT_GRADLE_PROPERTY_EDITS: readonly GradlePropertyEdit[];
70
83
  /**
71
84
  * Applies the release edits to `gradle.properties` contents and returns the new
@@ -139,9 +152,19 @@ export interface AndroidReleaseConfig {
139
152
  /**
140
153
  * ABIs for `reactNativeArchitectures` in `gradle.properties`, such as
141
154
  * `"arm64-v8a,x86_64"`. The `REACT_NATIVE_ARCHITECTURES` env var wins over it.
142
- * Default `"arm64-v8a"`.
155
+ * Default `"arm64-v8a,x86_64"`, or `"arm64-v8a"` when `abiSplits` is `false`.
143
156
  */
144
157
  reactNativeArchitectures?: string;
158
+ /**
159
+ * Build one APK per ABI with Gradle ABI splits (no universal APK). Only the
160
+ * single `publishArchitectures` APK is renamed, hashed and published; another
161
+ * ABI in `reactNativeArchitectures` (such as `x86_64`) is the start-up test
162
+ * APK. versionCode is not changed per ABI. Default `true`; set `false` to
163
+ * opt out (one APK for every ABI in `reactNativeArchitectures`).
164
+ */
165
+ abiSplits?: boolean;
166
+ /** With `abiSplits`: the one ABI to publish. Default `["arm64-v8a"]`. */
167
+ publishArchitectures?: readonly string[];
145
168
  /** Label and env var for the final summary line, such as `{ label: "Convex", envVar: "EXPO_PUBLIC_CONVEX_URL" }`. */
146
169
  summary?: {
147
170
  label: string;
@@ -164,3 +187,48 @@ export declare function syncExpoVersion(appJsonContents: string, versionName: st
164
187
  export declare function syncPackageJsonVersion(packageJsonContents: string, versionName: string): string;
165
188
  /** True when the generated `android/app/build.gradle` sets `versionName "<versionName>"`. */
166
189
  export declare function gradleVersionNameOk(gradleText: string, versionName: string): boolean;
190
+ /** Splits a `reactNativeArchitectures` value such as `"arm64-v8a,x86_64"` into ABIs. */
191
+ export declare function splitArchitectures(value: string): string[];
192
+ /** Marker line that makes the ABI splits block idempotent. */
193
+ export declare const ABI_SPLITS_MARKER = "// vvedantb-android-release: abi splits";
194
+ /**
195
+ * The `android { splits { abi { ... } } }` block for `abis`. No universal APK,
196
+ * and no `versionCodeOverride`, so every ABI APK keeps the same versionCode.
197
+ */
198
+ export declare function abiSplitsGradle(abis: readonly string[]): string;
199
+ /** Adds the ABI splits block to `build.gradle` text, or replaces an earlier one. */
200
+ export declare function withAbiSplits(gradleText: string, abis: readonly string[]): string;
201
+ /** The Gradle output name of an ABI split APK, such as `app-arm64-v8a-release.apk`. */
202
+ export declare function splitApkFileName(abi: string): string;
203
+ /** Which Gradle output APKs the release publishes and the start-up test installs. */
204
+ export interface ReleaseApkNames {
205
+ /** The APK renamed, hashed and published. */
206
+ publish: string;
207
+ /** The APK the start-up test installs, when it differs from `publish`. */
208
+ startup?: string;
209
+ }
210
+ /**
211
+ * Resolves the Gradle output file names. Without `abiSplits` it is
212
+ * `app-release.apk` and no start-up APK. With it, `publish` is the split for the
213
+ * publish ABI and `startup` the first other ABI in `architectures`, if any.
214
+ */
215
+ export declare function resolveReleaseApkNames(options: {
216
+ abiSplits?: boolean;
217
+ architectures: string;
218
+ publishArchitectures?: readonly string[];
219
+ }): ReleaseApkNames;
220
+ /** Marker line that makes the keep rules block idempotent. */
221
+ export declare const KEEP_RULES_MARKER = "# vvedantb-android-release: keep rules";
222
+ /**
223
+ * R8 keep rules for reflection and JNI heavy libraries that V apps share:
224
+ * Reanimated and Worklets, Hermes and React Native JNI, Clerk and Convex.
225
+ */
226
+ export declare const KEEP_RULES: readonly string[];
227
+ /** The keep rules block, between start and end markers. */
228
+ export declare function keepRulesBlock(): string;
229
+ /**
230
+ * Appends the keep rules to `proguard-rules.pro` contents, or replaces an
231
+ * earlier block. Existing rules (such as okhttp keeps) stay. Pass `""` when the
232
+ * file is absent.
233
+ */
234
+ export declare function withKeepRules(proguardText: string): string;
@@ -97,7 +97,11 @@ export function publicEnvDefault(name, options) {
97
97
  }
98
98
  return "";
99
99
  }
100
- /** Default `reactNativeArchitectures`: published APKs target phones. */
100
+ /**
101
+ * Default `reactNativeArchitectures` for the bare helper (no env, no config):
102
+ * phone-only. The CLI reads the config defaults, which add `x86_64` for the
103
+ * start-up test (see `DEFAULT_CONFIG`).
104
+ */
101
105
  export const DEFAULT_REACT_NATIVE_ARCHITECTURES = "arm64-v8a";
102
106
  /**
103
107
  * Resolves the `reactNativeArchitectures` value. Precedence: explicit `option`
@@ -119,10 +123,60 @@ const BASE_GRADLE_PROPERTY_EDITS = [
119
123
  // boat-large has 8 cores. Replace Expo's lower default.
120
124
  { key: "org.gradle.workers.max", value: "8", replace: true },
121
125
  { key: "org.gradle.parallel", value: "true", replace: true },
126
+ // Reuse task outputs from the restored Gradle User Home (per-app cache key in
127
+ // the release workflow), such as DSL script compilation and dex/R8 steps.
128
+ { key: "org.gradle.caching", value: "true", replace: true },
122
129
  // org.gradle.configuration-cache stays off: ephemeral CI runners never reuse
123
130
  // the cache, and native modules may still be incompatible on release tasks.
124
131
  { key: "android.lint.checkReleaseBuilds", value: "false", replace: false },
132
+ // Size wins. Same keys expo-build-properties writes. R8 needs the keep rules
133
+ // appended by `withKeepRules`. Bundle compression trims the APK at the cost
134
+ // of a slower cold start.
135
+ { key: "android.enableMinifyInReleaseBuilds", value: "true", replace: true },
136
+ { key: "android.enableShrinkResourcesInReleaseBuilds", value: "true", replace: true },
137
+ { key: "android.enableBundleCompression", value: "true", replace: true },
138
+ // V Store distributes sideload APKs. Legacy packaging keeps JNI libs
139
+ // zip-compressed, so the download is smaller (install extracts them).
140
+ // Expo defaults to false (uncompressed, aligned libs).
141
+ { key: "expo.useLegacyPackaging", value: "true", replace: true },
125
142
  ];
143
+ /**
144
+ * Gradle init script that passes ccache to CMake as the C and C++ compiler
145
+ * launcher for every Android module. It runs in `project.afterEvaluate`, when
146
+ * the android extension is ready, and appends to any existing
147
+ * `cmake.arguments`. A module without CMake is unaffected:
148
+ * the arguments only apply when the module sets `externalNativeBuild.cmake.path`.
149
+ * A failure to configure one module is logged and skipped, never fatal.
150
+ */
151
+ export function ccacheInitScript(ccachePath) {
152
+ const quoted = ccachePath.replaceAll("\\", "\\\\").replaceAll("'", "\\'");
153
+ return [
154
+ "// Written by vvedantb-android-release. Routes CMake compiles through ccache.",
155
+ "allprojects { project ->",
156
+ " ['com.android.application', 'com.android.library'].each { pluginId ->",
157
+ " project.plugins.withId(pluginId) {",
158
+ " def configureLauncher = {",
159
+ " try {",
160
+ " // arguments(...) appends to the existing list, so earlier cmake.arguments stay.",
161
+ " project.android.defaultConfig.externalNativeBuild.cmake.arguments(",
162
+ ` '-DCMAKE_C_COMPILER_LAUNCHER=${quoted}',`,
163
+ ` '-DCMAKE_CXX_COMPILER_LAUNCHER=${quoted}'`,
164
+ " )",
165
+ " } catch (Exception e) {",
166
+ ' project.logger.info("ccache launcher skipped for ${project.path}: ${e.message}")',
167
+ " }",
168
+ " }",
169
+ " if (project.state.executed) {",
170
+ " configureLauncher()",
171
+ " } else {",
172
+ " project.afterEvaluate(configureLauncher)",
173
+ " }",
174
+ " }",
175
+ " }",
176
+ "}",
177
+ "",
178
+ ].join("\n");
179
+ }
126
180
  /** The edits the release build makes to `gradle.properties`, in order. */
127
181
  export function buildGradlePropertyEdits(reactNativeArchitectures) {
128
182
  return [
@@ -134,7 +188,7 @@ export function buildGradlePropertyEdits(reactNativeArchitectures) {
134
188
  ...BASE_GRADLE_PROPERTY_EDITS,
135
189
  ];
136
190
  }
137
- /** The default edits (arm64-v8a only), in order. */
191
+ /** The default edits (arm64-v8a only, minify on), in order. */
138
192
  export const DEFAULT_GRADLE_PROPERTY_EDITS = buildGradlePropertyEdits();
139
193
  function withTrailingNewline(contents) {
140
194
  if (contents.length === 0)
@@ -189,6 +243,9 @@ export function formatGithubOutput(outputs) {
189
243
  }
190
244
  const DEFAULT_CONFIG = {
191
245
  appDir: "apps/mobile",
246
+ reactNativeArchitectures: "arm64-v8a,x86_64",
247
+ abiSplits: true,
248
+ publishArchitectures: ["arm64-v8a"],
192
249
  publicEnvSources: [],
193
250
  pnpmFilters: ["{.}"],
194
251
  prebuildNoInstall: true,
@@ -276,6 +333,29 @@ export function parseAndroidReleaseConfig(input) {
276
333
  }
277
334
  config.reactNativeArchitectures = raw.reactNativeArchitectures;
278
335
  }
336
+ if (raw.abiSplits !== undefined) {
337
+ if (typeof raw.abiSplits !== "boolean")
338
+ throw new Error('android-release config: "abiSplits" must be a boolean.');
339
+ config.abiSplits = raw.abiSplits;
340
+ }
341
+ if (raw.publishArchitectures !== undefined) {
342
+ config.publishArchitectures = asStringArray(raw.publishArchitectures, "publishArchitectures");
343
+ }
344
+ // Opting out of splits without naming ABIs means one phone-only APK, not a
345
+ // fat APK of the start-up ABI too.
346
+ if (config.abiSplits === false && raw.reactNativeArchitectures === undefined) {
347
+ config.reactNativeArchitectures = DEFAULT_REACT_NATIVE_ARCHITECTURES;
348
+ }
349
+ if (config.abiSplits === true) {
350
+ const publish = config.publishArchitectures ?? [];
351
+ if (publish.length !== 1) {
352
+ throw new Error('android-release config: "abiSplits" needs "publishArchitectures" with exactly one ABI.');
353
+ }
354
+ const all = splitArchitectures(resolveReactNativeArchitectures(undefined, config.reactNativeArchitectures));
355
+ if (!all.includes(publish[0])) {
356
+ throw new Error('android-release config: "publishArchitectures" must be in "reactNativeArchitectures".');
357
+ }
358
+ }
279
359
  if (raw.summary !== undefined)
280
360
  config.summary = parseSummary(raw.summary);
281
361
  return config;
@@ -387,3 +467,104 @@ export function syncPackageJsonVersion(packageJsonContents, versionName) {
387
467
  export function gradleVersionNameOk(gradleText, versionName) {
388
468
  return new RegExp(`^[\\t ]*versionName ["']${escapeRegExp(versionName)}["'][\\t ]*$`, "m").test(gradleText);
389
469
  }
470
+ /** Splits a `reactNativeArchitectures` value such as `"arm64-v8a,x86_64"` into ABIs. */
471
+ export function splitArchitectures(value) {
472
+ return value
473
+ .split(",")
474
+ .map((abi) => abi.trim())
475
+ .filter((abi) => abi !== "");
476
+ }
477
+ /** Marker line that makes the ABI splits block idempotent. */
478
+ export const ABI_SPLITS_MARKER = "// vvedantb-android-release: abi splits";
479
+ /**
480
+ * The `android { splits { abi { ... } } }` block for `abis`. No universal APK,
481
+ * and no `versionCodeOverride`, so every ABI APK keeps the same versionCode.
482
+ */
483
+ export function abiSplitsGradle(abis) {
484
+ const include = abis.map((abi) => `'${abi}'`).join(", ");
485
+ return [
486
+ ABI_SPLITS_MARKER,
487
+ "android {",
488
+ " splits {",
489
+ " abi {",
490
+ " enable true",
491
+ " reset()",
492
+ ` include ${include}`,
493
+ " universalApk false",
494
+ " }",
495
+ " }",
496
+ "}",
497
+ ABI_SPLITS_MARKER + " (end)",
498
+ "",
499
+ ].join("\n");
500
+ }
501
+ /** Adds the ABI splits block to `build.gradle` text, or replaces an earlier one. */
502
+ export function withAbiSplits(gradleText, abis) {
503
+ const start = gradleText.indexOf(ABI_SPLITS_MARKER);
504
+ const endMarker = ABI_SPLITS_MARKER + " (end)\n";
505
+ const end = gradleText.indexOf(endMarker);
506
+ const base = start >= 0 && end > start
507
+ ? gradleText.slice(0, start) + gradleText.slice(end + endMarker.length)
508
+ : gradleText;
509
+ return withTrailingNewline(base) + abiSplitsGradle(abis);
510
+ }
511
+ /** The Gradle output name of an ABI split APK, such as `app-arm64-v8a-release.apk`. */
512
+ export function splitApkFileName(abi) {
513
+ return `app-${abi}-release.apk`;
514
+ }
515
+ /**
516
+ * Resolves the Gradle output file names. Without `abiSplits` it is
517
+ * `app-release.apk` and no start-up APK. With it, `publish` is the split for the
518
+ * publish ABI and `startup` the first other ABI in `architectures`, if any.
519
+ */
520
+ export function resolveReleaseApkNames(options) {
521
+ if (options.abiSplits !== true)
522
+ return { publish: "app-release.apk" };
523
+ const publishAbi = options.publishArchitectures?.[0];
524
+ if (publishAbi === undefined)
525
+ throw new Error("abiSplits needs a publish ABI.");
526
+ const startupAbi = splitArchitectures(options.architectures).find((abi) => abi !== publishAbi);
527
+ return {
528
+ publish: splitApkFileName(publishAbi),
529
+ ...(startupAbi === undefined ? {} : { startup: splitApkFileName(startupAbi) }),
530
+ };
531
+ }
532
+ /** Marker line that makes the keep rules block idempotent. */
533
+ export const KEEP_RULES_MARKER = "# vvedantb-android-release: keep rules";
534
+ /**
535
+ * R8 keep rules for reflection and JNI heavy libraries that V apps share:
536
+ * Reanimated and Worklets, Hermes and React Native JNI, Clerk and Convex.
537
+ */
538
+ export const KEEP_RULES = [
539
+ "# Reanimated and Worklets",
540
+ "-keep class com.swmansion.reanimated.** { *; }",
541
+ "-keep class com.swmansion.worklets.** { *; }",
542
+ "# Hermes and React Native JNI",
543
+ "-keep class com.facebook.hermes.unicode.** { *; }",
544
+ "-keep class com.facebook.jni.** { *; }",
545
+ "-keep class com.facebook.react.turbomodule.** { *; }",
546
+ "# Clerk",
547
+ "-keep class com.clerk.** { *; }",
548
+ "-dontwarn com.clerk.**",
549
+ "# Convex",
550
+ "-keep class dev.convex.** { *; }",
551
+ "-dontwarn dev.convex.**",
552
+ ];
553
+ /** The keep rules block, between start and end markers. */
554
+ export function keepRulesBlock() {
555
+ return [KEEP_RULES_MARKER, ...KEEP_RULES, KEEP_RULES_MARKER + " (end)", ""].join("\n");
556
+ }
557
+ /**
558
+ * Appends the keep rules to `proguard-rules.pro` contents, or replaces an
559
+ * earlier block. Existing rules (such as okhttp keeps) stay. Pass `""` when the
560
+ * file is absent.
561
+ */
562
+ export function withKeepRules(proguardText) {
563
+ const start = proguardText.indexOf(KEEP_RULES_MARKER);
564
+ const endMarker = KEEP_RULES_MARKER + " (end)\n";
565
+ const end = proguardText.indexOf(endMarker);
566
+ const base = start >= 0 && end > start
567
+ ? proguardText.slice(0, start) + proguardText.slice(end + endMarker.length)
568
+ : proguardText;
569
+ return withTrailingNewline(base) + keepRulesBlock();
570
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { runCheckNoComments } from "./check-no-comments.js";
3
+ process.exitCode = runCheckNoComments(process.argv.slice(2), {
4
+ log: (message) => console.info(message),
5
+ error: (message) => console.error(message),
6
+ cwd: () => process.cwd(),
7
+ });
@@ -0,0 +1,51 @@
1
+ export type CheckNoCommentsIo = {
2
+ log: (message: string) => void;
3
+ error: (message: string) => void;
4
+ cwd: () => string;
5
+ };
6
+ export type CommentFinding = {
7
+ file: string;
8
+ line: number;
9
+ hash: string;
10
+ text: string;
11
+ };
12
+ export type BaselineEntry = {
13
+ hash: string;
14
+ count?: number;
15
+ text?: string;
16
+ };
17
+ export type Baseline = {
18
+ version: 1;
19
+ files: Record<string, BaselineEntry[]>;
20
+ };
21
+ export declare const DEFAULT_ROOTS: string[];
22
+ export declare const DEFAULT_SKIP_DIRS: string[];
23
+ export declare const DEFAULT_BASELINE = "comments-baseline.json";
24
+ type RawComment = {
25
+ start: number;
26
+ end: number;
27
+ block: boolean;
28
+ beforeCode: boolean;
29
+ };
30
+ /** Every comment in one file's text, in order. Handles strings, template literals and regex literals. */
31
+ export declare function scanComments(text: string): RawComment[];
32
+ export declare const commentHash: (file: string, text: string) => string;
33
+ /** Comments in one file's text that need a baseline entry. `file` is the posix path from the repo root. */
34
+ export declare function findComments(file: string, text: string): CommentFinding[];
35
+ export declare const isSkippedFile: (name: string) => boolean;
36
+ export declare function readBaseline(path: string): Baseline;
37
+ export declare function serialiseBaseline(baseline: Baseline): string;
38
+ export type CommentDiff = {
39
+ added: CommentFinding[];
40
+ stale: number;
41
+ };
42
+ /** New comments (not in the baseline) and the number of baseline entries that no longer match a comment. */
43
+ export declare function diffAgainstBaseline(findings: readonly CommentFinding[], baseline: Baseline, scopedFiles: ReadonlySet<string>): CommentDiff;
44
+ /**
45
+ * The baseline after `update` (current comments, new ones included) or `prune` (baseline entries that
46
+ * still match, nothing added). Entries for files outside `scopedFiles` stay as they are.
47
+ */
48
+ export declare function rebuildBaseline(findings: readonly CommentFinding[], baseline: Baseline, scopedFiles: ReadonlySet<string>, mode: "update" | "prune", scopePrefixes: readonly string[]): Baseline;
49
+ /** Run the CLI. Returns the process exit code. */
50
+ export declare function runCheckNoComments(argv: readonly string[], io: CheckNoCommentsIo): number;
51
+ export {};
@@ -0,0 +1,338 @@
1
+ import { createHash } from "node:crypto";
2
+ import { existsSync, readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
3
+ import { join, relative, resolve, sep } from "node:path";
4
+ export const DEFAULT_ROOTS = ["apps/verve", "apps/velth", "apps/vhub", "apps/vmem", "apps/vibot", "apps/v-store", "apps/project-v"];
5
+ export const DEFAULT_SKIP_DIRS = ["node_modules", "dist", "build", "_generated", ".expo", ".next", "android", "ios", ".git", ".turbo", "coverage", "generated"];
6
+ export const DEFAULT_BASELINE = "comments-baseline.json";
7
+ const SOURCE_FILE = /\.[cm]?[jt]sx?$/;
8
+ const SKIPPED_FILE = /\.d\.[cm]?ts$|\.gen\.[cm]?[jt]sx?$/;
9
+ const DIRECTIVE = /^\s*(?:\/\s*<reference\b|(?:eslint|oxlint)-(?:disable|enable)|@ts-(?:expect-error|ignore|nocheck)\b|biome-ignore\b|prettier-ignore\b)/;
10
+ const LICENCE = /copyright|licen[cs]e|spdx-license-identifier/i;
11
+ const KEYWORDS_BEFORE_REGEX = new Set(["return", "typeof", "case", "do", "else", "in", "of", "void", "delete", "throw", "new", "yield", "await", "instanceof"]);
12
+ const SNIPPET_LENGTH = 40;
13
+ const isIdentChar = (c) => /[\w$]/.test(c);
14
+ /** Every comment in one file's text, in order. Handles strings, template literals and regex literals. */
15
+ export function scanComments(text) {
16
+ const comments = [];
17
+ const templateDepths = [];
18
+ let depth = 0;
19
+ let sawCode = false;
20
+ let prev = ""; // last significant character
21
+ let prevWord = ""; // identifier or number that ended at `prev`, if any
22
+ let i = 0;
23
+ if (text.startsWith("#!"))
24
+ i = text.indexOf("\n") === -1 ? text.length : text.indexOf("\n");
25
+ const skipQuoted = (quote) => {
26
+ i += 1;
27
+ while (i < text.length && text[i] !== quote && text[i] !== "\n")
28
+ i += text[i] === "\\" ? 2 : 1;
29
+ i += 1;
30
+ };
31
+ const skipTemplate = () => {
32
+ // Called with `i` just after a backtick or a closing `}` of a substitution.
33
+ while (i < text.length) {
34
+ const c = text[i];
35
+ if (c === "\\")
36
+ i += 2;
37
+ else if (c === "`") {
38
+ i += 1;
39
+ return;
40
+ }
41
+ else if (c === "$" && text[i + 1] === "{") {
42
+ templateDepths.push(depth);
43
+ i += 2;
44
+ return;
45
+ }
46
+ else
47
+ i += 1;
48
+ }
49
+ };
50
+ const regexAllowed = () => {
51
+ if (prev === "")
52
+ return true;
53
+ if (isIdentChar(prev))
54
+ return KEYWORDS_BEFORE_REGEX.has(prevWord);
55
+ return !")]}".includes(prev);
56
+ };
57
+ const skipRegex = () => {
58
+ i += 1;
59
+ let inClass = false;
60
+ while (i < text.length && text[i] !== "\n") {
61
+ const c = text[i];
62
+ if (c === "\\")
63
+ i += 1;
64
+ else if (c === "[")
65
+ inClass = true;
66
+ else if (c === "]")
67
+ inClass = false;
68
+ else if (c === "/" && !inClass)
69
+ break;
70
+ i += 1;
71
+ }
72
+ i += 1;
73
+ while (i < text.length && isIdentChar(text[i] ?? ""))
74
+ i += 1;
75
+ };
76
+ while (i < text.length) {
77
+ const c = text[i] ?? "";
78
+ const next = text[i + 1];
79
+ if (c === "/" && next === "/") {
80
+ const end = text.indexOf("\n", i);
81
+ const stop = end === -1 ? text.length : end;
82
+ comments.push({ start: i, end: stop, block: false, beforeCode: !sawCode });
83
+ i = stop;
84
+ }
85
+ else if (c === "/" && next === "*") {
86
+ const close = text.indexOf("*/", i + 2);
87
+ const stop = close === -1 ? text.length : close + 2;
88
+ comments.push({ start: i, end: stop, block: true, beforeCode: !sawCode });
89
+ i = stop;
90
+ }
91
+ else if (/\s/.test(c)) {
92
+ i += 1;
93
+ }
94
+ else {
95
+ sawCode = true;
96
+ if (c === '"' || c === "'") {
97
+ skipQuoted(c);
98
+ prev = c;
99
+ prevWord = "";
100
+ }
101
+ else if (c === "`") {
102
+ i += 1;
103
+ skipTemplate();
104
+ prev = "`";
105
+ prevWord = "";
106
+ }
107
+ else if (c === "/" && regexAllowed()) {
108
+ skipRegex();
109
+ prev = "/";
110
+ prevWord = "";
111
+ }
112
+ else if (isIdentChar(c)) {
113
+ const start = i;
114
+ while (i < text.length && isIdentChar(text[i] ?? ""))
115
+ i += 1;
116
+ prevWord = text.slice(start, i);
117
+ prev = c;
118
+ }
119
+ else {
120
+ if (c === "{")
121
+ depth += 1;
122
+ else if (c === "}") {
123
+ if (templateDepths.length > 0 && templateDepths[templateDepths.length - 1] === depth) {
124
+ templateDepths.pop();
125
+ i += 1;
126
+ skipTemplate();
127
+ prev = "`";
128
+ prevWord = "";
129
+ continue;
130
+ }
131
+ depth -= 1;
132
+ }
133
+ prev = c;
134
+ prevWord = "";
135
+ i += 1;
136
+ }
137
+ }
138
+ }
139
+ return comments;
140
+ }
141
+ const normalise = (value) => value.trim().replace(/\s+/g, " ");
142
+ export const commentHash = (file, text) => createHash("sha256").update(`${file}\n${normalise(text)}`).digest("hex").slice(0, 16);
143
+ function commentBody(raw, block) {
144
+ if (!block)
145
+ return raw.slice(2);
146
+ return raw
147
+ .slice(2, raw.endsWith("*/") ? -2 : undefined)
148
+ .split("\n")
149
+ .map((line) => line.replace(/^\s*\*+ ?/, ""))
150
+ .join("\n");
151
+ }
152
+ /** Comments in one file's text that need a baseline entry. `file` is the posix path from the repo root. */
153
+ export function findComments(file, text) {
154
+ const found = [];
155
+ for (const comment of scanComments(text)) {
156
+ const raw = text.slice(comment.start, comment.end);
157
+ const body = commentBody(raw, comment.block);
158
+ if (DIRECTIVE.test(body))
159
+ continue;
160
+ if (comment.block && comment.beforeCode && LICENCE.test(body))
161
+ continue;
162
+ if (raw.startsWith("/**") && /^\s*export\b/.test(text.slice(comment.end)))
163
+ continue;
164
+ const line = text.slice(0, comment.start).split("\n").length;
165
+ const normalised = normalise(body);
166
+ found.push({ file, line, hash: commentHash(file, body), text: normalised.slice(0, SNIPPET_LENGTH) });
167
+ }
168
+ return found;
169
+ }
170
+ export const isSkippedFile = (name) => !SOURCE_FILE.test(name) || SKIPPED_FILE.test(name);
171
+ function sourceFiles(dir, skip) {
172
+ return readdirSync(dir).flatMap((name) => {
173
+ if (skip.has(name))
174
+ return [];
175
+ const path = join(dir, name);
176
+ if (statSync(path).isDirectory())
177
+ return sourceFiles(path, skip);
178
+ return isSkippedFile(name) ? [] : [path];
179
+ });
180
+ }
181
+ const posix = (path) => path.split(sep).join("/");
182
+ function countByFile(findings) {
183
+ const byFile = new Map();
184
+ for (const f of findings) {
185
+ const counts = byFile.get(f.file) ?? new Map();
186
+ const entry = counts.get(f.hash) ?? { count: 0, text: f.text, lines: [] };
187
+ entry.count += 1;
188
+ entry.lines.push(f.line);
189
+ counts.set(f.hash, entry);
190
+ byFile.set(f.file, counts);
191
+ }
192
+ return byFile;
193
+ }
194
+ export function readBaseline(path) {
195
+ if (!existsSync(path))
196
+ return { version: 1, files: {} };
197
+ return JSON.parse(readFileSync(path, "utf8"));
198
+ }
199
+ export function serialiseBaseline(baseline) {
200
+ const files = {};
201
+ for (const file of Object.keys(baseline.files).sort()) {
202
+ const entries = baseline.files[file] ?? [];
203
+ if (entries.length > 0)
204
+ files[file] = [...entries].sort((a, b) => a.hash.localeCompare(b.hash));
205
+ }
206
+ const lines = Object.entries(files).map(([file, entries]) => ` ${JSON.stringify(file)}: [\n${entries.map((e) => ` ${JSON.stringify(e)}`).join(",\n")}\n ]`);
207
+ return `{\n "version": 1,\n "files": {\n${lines.join(",\n")}\n }\n}\n`;
208
+ }
209
+ /** New comments (not in the baseline) and the number of baseline entries that no longer match a comment. */
210
+ export function diffAgainstBaseline(findings, baseline, scopedFiles) {
211
+ const current = countByFile(findings);
212
+ const added = [];
213
+ let stale = 0;
214
+ for (const [file, counts] of current) {
215
+ const allowed = new Map((baseline.files[file] ?? []).map((e) => [e.hash, e.count ?? 1]));
216
+ for (const [hash, { count, lines, text }] of counts) {
217
+ const extra = count - (allowed.get(hash) ?? 0);
218
+ for (const line of lines.slice(lines.length - Math.max(extra, 0)))
219
+ added.push({ file, line, hash, text });
220
+ }
221
+ }
222
+ for (const file of Object.keys(baseline.files)) {
223
+ if (!scopedFiles.has(file))
224
+ continue;
225
+ const counts = current.get(file);
226
+ for (const entry of baseline.files[file] ?? [])
227
+ stale += Math.max((entry.count ?? 1) - (counts?.get(entry.hash)?.count ?? 0), 0);
228
+ }
229
+ return { added, stale };
230
+ }
231
+ function entriesFor(counts, only) {
232
+ const entries = [];
233
+ for (const [hash, { count, text }] of counts ?? []) {
234
+ const n = only ? Math.min(count, only.get(hash) ?? 0) : count;
235
+ if (n > 0)
236
+ entries.push({ hash, ...(n > 1 ? { count: n } : {}), text });
237
+ }
238
+ return entries;
239
+ }
240
+ /**
241
+ * The baseline after `update` (current comments, new ones included) or `prune` (baseline entries that
242
+ * still match, nothing added). Entries for files outside `scopedFiles` stay as they are.
243
+ */
244
+ export function rebuildBaseline(findings, baseline, scopedFiles, mode, scopePrefixes) {
245
+ const current = countByFile(findings);
246
+ const inScope = (file) => scopedFiles.has(file) || scopePrefixes.some((p) => file === p || file.startsWith(`${p}/`));
247
+ const files = {};
248
+ for (const [file, entries] of Object.entries(baseline.files))
249
+ if (!inScope(file))
250
+ files[file] = entries;
251
+ if (mode === "update") {
252
+ for (const [file, counts] of current)
253
+ files[file] = entriesFor(counts);
254
+ }
255
+ else {
256
+ for (const [file, entries] of Object.entries(baseline.files)) {
257
+ if (!inScope(file))
258
+ continue;
259
+ const kept = entriesFor(current.get(file), new Map(entries.map((e) => [e.hash, e.count ?? 1])));
260
+ if (kept.length > 0)
261
+ files[file] = kept;
262
+ }
263
+ }
264
+ return { version: 1, files };
265
+ }
266
+ const USAGE = `Usage: vvedantb-check-no-comments [check|update|prune] [path]... [--baseline <file>] [--skip <name>]...
267
+
268
+ check Default. Fail on a comment that is not in the baseline.
269
+ update Rewrite the baseline to match the current comments. The only way to add entries.
270
+ prune Remove baseline entries whose comment is gone. Never adds an entry.
271
+ path Folder or file to scan, relative to the current directory.
272
+ Default: ${DEFAULT_ROOTS.join(", ")}.
273
+ --baseline <file> Baseline file. Default: ${DEFAULT_BASELINE} in the current directory.
274
+ --skip <name> Extra directory name to skip. Defaults: ${DEFAULT_SKIP_DIRS.join(", ")}.
275
+
276
+ Skipped files: *.d.ts and *.gen.* files. Run from the repository root.
277
+ Exit code: 0 clean, 1 new comments, 2 bad usage.`;
278
+ /** Run the CLI. Returns the process exit code. */
279
+ export function runCheckNoComments(argv, io) {
280
+ const cwd = io.cwd();
281
+ let mode = "check";
282
+ let baselinePath = resolve(cwd, DEFAULT_BASELINE);
283
+ const skipDirs = new Set(DEFAULT_SKIP_DIRS);
284
+ const paths = [];
285
+ for (let i = 0; i < argv.length; i += 1) {
286
+ const arg = argv[i] ?? "";
287
+ if (arg === "--help" || arg === "-h") {
288
+ io.log(USAGE);
289
+ return 0;
290
+ }
291
+ if (arg === "check" || arg === "update" || arg === "prune")
292
+ mode = arg;
293
+ else if (arg === "--update" || arg === "--prune")
294
+ mode = arg.slice(2);
295
+ else if (arg === "--baseline" || arg === "--skip") {
296
+ const value = argv[i + 1];
297
+ if (value === undefined) {
298
+ io.error(`${arg} needs a value\n${USAGE}`);
299
+ return 2;
300
+ }
301
+ if (arg === "--baseline")
302
+ baselinePath = resolve(cwd, value);
303
+ else
304
+ skipDirs.add(value);
305
+ i += 1;
306
+ }
307
+ else if (arg.startsWith("--")) {
308
+ io.error(`Unknown option: ${arg}\n${USAGE}`);
309
+ return 2;
310
+ }
311
+ else
312
+ paths.push(arg);
313
+ }
314
+ const roots = (paths.length > 0 ? paths : DEFAULT_ROOTS).map((p) => resolve(cwd, p)).filter((p) => existsSync(p));
315
+ const files = roots.flatMap((root) => (statSync(root).isDirectory() ? sourceFiles(root, skipDirs) : isSkippedFile(root) ? [] : [root]));
316
+ const findings = files.flatMap((file) => findComments(posix(relative(cwd, file)), readFileSync(file, "utf8")));
317
+ const scopedFiles = new Set(files.map((file) => posix(relative(cwd, file))));
318
+ const scopePrefixes = roots.filter((root) => statSync(root).isDirectory()).map((root) => posix(relative(cwd, root)));
319
+ const baseline = readBaseline(baselinePath);
320
+ if (mode !== "check") {
321
+ const next = rebuildBaseline(findings, baseline, scopedFiles, mode, scopePrefixes);
322
+ writeFileSync(baselinePath, serialiseBaseline(next));
323
+ const total = Object.values(next.files).reduce((sum, entries) => sum + entries.reduce((n, e) => n + (e.count ?? 1), 0), 0);
324
+ io.log(`no-comments: baseline ${mode}d, ${total} comment(s) in ${Object.keys(next.files).length} file(s)`);
325
+ return 0;
326
+ }
327
+ const { added, stale } = diffAgainstBaseline(findings, baseline, scopedFiles);
328
+ if (added.length > 0) {
329
+ for (const f of added)
330
+ io.error(`${f.file}:${f.line}: comment not in the baseline: ${f.text}`);
331
+ io.error(`\n${added.length} new comment(s) in ${files.length} file(s). Delete the comment, or move a real decision record to docs/adr/. Run \`update\` only for an agreed exception.`);
332
+ return 1;
333
+ }
334
+ io.log(`no-comments: ${files.length} files, no new comments`);
335
+ if (stale > 0)
336
+ io.log(`no-comments: ${stale} baseline entr${stale === 1 ? "y is" : "ies are"} stale. Run \`pnpm run comments:prune\` to shrink the baseline.`);
337
+ return 0;
338
+ }
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { CLAUDE_INSTALL_SNIPPET, ENVIRONMENT_INSTALL, parseJsonc, planSync, runS
3
3
  export { runCli, type CliIo } from "./run.js";
4
4
  export { CHECK_ASAR_CHILD_ENV, findBareImports, findSpecifiers, packageName, runCheckAsar, type AsarCheckHook, type AsarCheckHookContext, type CheckAsarIo, } from "./check-asar.js";
5
5
  export { DEFAULT_SKIP_DIRS, findSourceTextReads, runCheckNoSourceText, type CheckNoSourceTextIo, type SourceTextViolation, } from "./check-no-source-text.js";
6
+ export { DEFAULT_BASELINE as COMMENTS_BASELINE_FILE, DEFAULT_ROOTS as COMMENT_CHECK_ROOTS, commentHash, diffAgainstBaseline, findComments, rebuildBaseline, runCheckNoComments, scanComments, serialiseBaseline, type Baseline as CommentsBaseline, type BaselineEntry as CommentsBaselineEntry, type CheckNoCommentsIo, type CommentFinding, } from "./check-no-comments.js";
6
7
  export { checkSharedUi, runCheckSharedUi, type CheckSharedUiIo, type CheckSharedUiOptions, } from "./check-shared-ui.js";
7
8
  export { runClerkAllow, type ClerkAllowFetch, type ClerkAllowIo, type ClerkAllowResponse, } from "./clerk-allow.js";
8
9
  export { SHARED_WORKER_SETUP, sharedWorkerVitestConfig, type SharedWorkerOptions, type SharedWorkerTestConfig, type SharedWorkerVitestConfig, } from "./vitest-shared.js";
@@ -10,5 +11,5 @@ export { CHECK_IDS, checkCiReusableWorkflow, checkConfigVersion, checkNoEslint,
10
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";
11
12
  export { defineExpoMetroConfig, expoBabelConfig, type BabelApi, type ExpoBabelConfig, type ExpoMetroOptions, type MetroConfigLike, type MetroResolveContext, type MetroResolveRequest, type NativeWindMetroOptions, } from "./expo.js";
12
13
  export { DEFAULT_RELEASE_SIGNING_MARKER, appendReleaseSigning, releaseSigningGradle, withReleaseSigning, type AppBuildGradleMod, type ReleaseSigningOptions, type ReleaseSigningPropertyKeys, type WithAppBuildGradle, type WithReleaseSigningOptions, } from "./release-signing.js";
13
- export { DEFAULT_GRADLE_PROPERTY_EDITS, DEFAULT_REACT_NATIVE_ARCHITECTURES, buildGradlePropertyEdits, resolveReactNativeArchitectures, apkFileName, easProfileEntries, formatGithubOutput, formatReleaseJson, gradlePropertiesEdits, parseAndroidReleaseConfig, parseBadging, publicEnvDefault, readExpoVersion, releaseJson, syncPackageJsonVersion, syncExpoVersion, validateVersionCode, validateVersionName, gradleVersionNameOk, type AndroidReleaseConfig, type BadgingFields, type GradlePropertyEdit, type PublicEnvSource, type ReadAppFile, type ReleaseJson, } from "./android-release.js";
14
+ export { ABI_SPLITS_MARKER, KEEP_RULES, KEEP_RULES_MARKER, abiSplitsGradle, keepRulesBlock, withKeepRules, resolveReleaseApkNames, splitApkFileName, splitArchitectures, withAbiSplits, type ReleaseApkNames, DEFAULT_GRADLE_PROPERTY_EDITS, DEFAULT_REACT_NATIVE_ARCHITECTURES, buildGradlePropertyEdits, ccacheInitScript, resolveReactNativeArchitectures, apkFileName, easProfileEntries, formatGithubOutput, formatReleaseJson, gradlePropertiesEdits, parseAndroidReleaseConfig, parseBadging, publicEnvDefault, readExpoVersion, releaseJson, syncPackageJsonVersion, syncExpoVersion, validateVersionCode, validateVersionName, gradleVersionNameOk, type AndroidReleaseConfig, type BadgingFields, type GradlePropertyEdit, type PublicEnvSource, type ReadAppFile, type ReleaseJson, } from "./android-release.js";
14
15
  export { compareSemver, highestSemver, isSemver, pickAndroidReleaseVersion, publishedVersionNames, type AndroidReleaseVersion, type PickAndroidReleaseVersionInput, type PublishedReleases, type VersionNameSource, } from "./android-release-version.js";
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ export { CLAUDE_INSTALL_SNIPPET, ENVIRONMENT_INSTALL, parseJsonc, planSync, runS
3
3
  export { runCli } from "./run.js";
4
4
  export { CHECK_ASAR_CHILD_ENV, findBareImports, findSpecifiers, packageName, runCheckAsar, } from "./check-asar.js";
5
5
  export { DEFAULT_SKIP_DIRS, findSourceTextReads, runCheckNoSourceText, } from "./check-no-source-text.js";
6
+ export { DEFAULT_BASELINE as COMMENTS_BASELINE_FILE, DEFAULT_ROOTS as COMMENT_CHECK_ROOTS, commentHash, diffAgainstBaseline, findComments, rebuildBaseline, runCheckNoComments, scanComments, serialiseBaseline, } from "./check-no-comments.js";
6
7
  export { checkSharedUi, runCheckSharedUi, } from "./check-shared-ui.js";
7
8
  export { runClerkAllow, } from "./clerk-allow.js";
8
9
  export { SHARED_WORKER_SETUP, sharedWorkerVitestConfig, } from "./vitest-shared.js";
@@ -10,5 +11,5 @@ export { CHECK_IDS, checkCiReusableWorkflow, checkConfigVersion, checkNoEslint,
10
11
  export { REACT_DEDUPE, defineWebViteConfig, defineWebVitestConfig, reactPlugins, srcAlias, vendorChunkBuild, } from "./vite.js";
11
12
  export { defineExpoMetroConfig, expoBabelConfig, } from "./expo.js";
12
13
  export { DEFAULT_RELEASE_SIGNING_MARKER, appendReleaseSigning, releaseSigningGradle, withReleaseSigning, } from "./release-signing.js";
13
- export { DEFAULT_GRADLE_PROPERTY_EDITS, DEFAULT_REACT_NATIVE_ARCHITECTURES, buildGradlePropertyEdits, resolveReactNativeArchitectures, apkFileName, easProfileEntries, formatGithubOutput, formatReleaseJson, gradlePropertiesEdits, parseAndroidReleaseConfig, parseBadging, publicEnvDefault, readExpoVersion, releaseJson, syncPackageJsonVersion, syncExpoVersion, validateVersionCode, validateVersionName, gradleVersionNameOk, } from "./android-release.js";
14
+ export { ABI_SPLITS_MARKER, KEEP_RULES, KEEP_RULES_MARKER, abiSplitsGradle, keepRulesBlock, withKeepRules, resolveReleaseApkNames, splitApkFileName, splitArchitectures, withAbiSplits, DEFAULT_GRADLE_PROPERTY_EDITS, DEFAULT_REACT_NATIVE_ARCHITECTURES, buildGradlePropertyEdits, ccacheInitScript, resolveReactNativeArchitectures, apkFileName, easProfileEntries, formatGithubOutput, formatReleaseJson, gradlePropertiesEdits, parseAndroidReleaseConfig, parseBadging, publicEnvDefault, readExpoVersion, releaseJson, syncPackageJsonVersion, syncExpoVersion, validateVersionCode, validateVersionName, gradleVersionNameOk, } from "./android-release.js";
14
15
  export { compareSemver, highestSemver, isSemver, pickAndroidReleaseVersion, publishedVersionNames, } from "./android-release-version.js";
@@ -35,11 +35,27 @@ export interface ReleaseSigningOptions {
35
35
  * `"release"` (case-insensitive).
36
36
  */
37
37
  releaseTaskCondition?: string;
38
+ /**
39
+ * An exact Groovy block to append instead of the generated template. Use it
40
+ * to keep an app's existing Gradle text byte for byte. `marker` is then
41
+ * required and must appear in the block. The template options above
42
+ * (`keystorePropertiesFile`, `propertyKeys`, `storeType`,
43
+ * `releaseTaskCondition`) are ignored.
44
+ */
45
+ gradleBlock?: string;
46
+ /** Throw when `app/build.gradle` is not Groovy. Default `false`. */
47
+ requireGroovy?: boolean;
48
+ /**
49
+ * Append the block after `contents.trimEnd()` and a blank line, instead of
50
+ * directly after `contents`. Only applies with `gradleBlock`. Default `false`.
51
+ */
52
+ trimContentsBeforeAppend?: boolean;
38
53
  }
39
54
  /** The part of an Expo `appBuildGradle` mod this plugin touches. */
40
55
  export interface AppBuildGradleMod {
41
56
  modResults: {
42
57
  contents: string;
58
+ language?: string;
43
59
  };
44
60
  }
45
61
  /** The part of `withAppBuildGradle` from `expo/config-plugins` this plugin uses. */
@@ -73,6 +73,17 @@ gradle.taskGraph.whenReady { graph ->
73
73
  * contents unchanged when the marker is already present (idempotent).
74
74
  */
75
75
  export function appendReleaseSigning(contents, options) {
76
+ if (options?.gradleBlock !== undefined) {
77
+ const { marker, gradleBlock } = options;
78
+ if (!marker || !gradleBlock.includes(marker)) {
79
+ throw new Error("gradleBlock needs a marker that appears in the block.");
80
+ }
81
+ if (contents.includes(marker))
82
+ return contents;
83
+ return options.trimContentsBeforeAppend
84
+ ? contents.trimEnd() + "\n\n" + gradleBlock
85
+ : contents + gradleBlock;
86
+ }
76
87
  const marker = options?.marker ?? DEFAULT_RELEASE_SIGNING_MARKER;
77
88
  if (contents.includes(marker))
78
89
  return contents;
@@ -95,6 +106,9 @@ export function withReleaseSigning(config, options) {
95
106
  return withGradle(config, (mod) => {
96
107
  if (options?.skipOnEasBuild && process.env.EAS_BUILD)
97
108
  return mod;
109
+ if (options?.requireGroovy && mod.modResults.language !== "groovy") {
110
+ throw new Error("withReleaseSigning supports only a Groovy app/build.gradle.");
111
+ }
98
112
  mod.modResults.contents = appendReleaseSigning(mod.modResults.contents, options);
99
113
  return mod;
100
114
  });
package/dist/vite.d.ts CHANGED
@@ -125,7 +125,7 @@ export interface WebVitestConfig {
125
125
  };
126
126
  }
127
127
  /** Packages that hold React context. pnpm can install two copies; dedupe keeps one. */
128
- export declare const REACT_DEDUPE: readonly ["react", "react-dom", "convex", "@tanstack/react-router", "@clerk/clerk-react"];
128
+ export declare const REACT_DEDUPE: readonly ["react", "react-dom", "convex", "@tanstack/react-router", "@clerk/react"];
129
129
  /** `{ "@": "<dirname>/src" }`. Pass `import.meta.dirname`. */
130
130
  export declare function srcAlias(dirname: string): Record<string, string>;
131
131
  /** The plugin-react plugins for a `ReactSetup`, in order. */
package/dist/vite.js CHANGED
@@ -5,7 +5,7 @@ export const REACT_DEDUPE = [
5
5
  "react-dom",
6
6
  "convex",
7
7
  "@tanstack/react-router",
8
- "@clerk/clerk-react",
8
+ "@clerk/react",
9
9
  ];
10
10
  const VENDOR_TESTS = {
11
11
  radix: /node_modules[\\/]@radix-ui/,
package/oxlint/base.json CHANGED
@@ -36,6 +36,40 @@
36
36
  "no-effect/no-external-store-subscription": "error",
37
37
  "no-effect/no-initialize-state": "error",
38
38
  "no-console": ["error", { "allow": ["warn", "error", "info"] }],
39
+ "no-restricted-properties": [
40
+ "error",
41
+ {
42
+ "object": "window",
43
+ "property": "localStorage",
44
+ "message": "Use useLocalStorage from usehooks-ts."
45
+ },
46
+ {
47
+ "object": "window",
48
+ "property": "sessionStorage",
49
+ "message": "Use useSessionStorage from usehooks-ts."
50
+ },
51
+ {
52
+ "object": "globalThis",
53
+ "property": "localStorage",
54
+ "message": "Use useLocalStorage from usehooks-ts."
55
+ },
56
+ {
57
+ "object": "globalThis",
58
+ "property": "sessionStorage",
59
+ "message": "Use useSessionStorage from usehooks-ts."
60
+ }
61
+ ],
62
+ "no-restricted-globals": [
63
+ "error",
64
+ {
65
+ "name": "localStorage",
66
+ "message": "Use useLocalStorage from usehooks-ts."
67
+ },
68
+ {
69
+ "name": "sessionStorage",
70
+ "message": "Use useSessionStorage from usehooks-ts."
71
+ }
72
+ ],
39
73
  "no-unused-vars": [
40
74
  "error",
41
75
  {
@@ -44,5 +78,19 @@
44
78
  "caughtErrorsIgnorePattern": "^_"
45
79
  }
46
80
  ]
47
- }
81
+ },
82
+ "overrides": [
83
+ {
84
+ "files": [
85
+ "**/*.test.{ts,tsx}",
86
+ "**/e2e/**",
87
+ "**/testing/**",
88
+ "**/internal/**"
89
+ ],
90
+ "rules": {
91
+ "no-restricted-globals": "off",
92
+ "no-restricted-properties": "off"
93
+ }
94
+ }
95
+ ]
48
96
  }
package/package.json CHANGED
@@ -1,16 +1,15 @@
1
1
  {
2
2
  "name": "@vvedantb/config",
3
- "version": "0.14.1",
3
+ "version": "0.15.0",
4
4
  "license": "MIT",
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, shared oxlint JS plugins and a CLI that adds an extension to Clerk's allowed origins.",
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",
7
7
  "publishConfig": {
8
- "access": "public",
9
- "provenance": true
8
+ "access": "public"
10
9
  },
11
10
  "repository": {
12
11
  "type": "git",
13
- "url": "git+https://github.com/vvedantb/packages.git",
12
+ "url": "git+https://github.com/vvedantb/v.git",
14
13
  "directory": "packages/config"
15
14
  },
16
15
  "bin": {
@@ -20,6 +19,7 @@
20
19
  "vvedantb-android-release": "./bin/vvedantb-android-release.js",
21
20
  "vvedantb-check-shared-ui": "./bin/vvedantb-check-shared-ui.js",
22
21
  "vvedantb-check-no-source-text": "./bin/vvedantb-check-no-source-text.js",
22
+ "vvedantb-check-no-comments": "./bin/vvedantb-check-no-comments.js",
23
23
  "vvedantb-doctor": "./bin/vvedantb-doctor.js"
24
24
  },
25
25
  "exports": {
@@ -56,7 +56,7 @@
56
56
  ],
57
57
  "peerDependencies": {
58
58
  "@electron/asar": "^3.2.0 || ^4.0.0",
59
- "@expo/config-plugins": ">=9.0.0",
59
+ "@expo/config-plugins": "^58.0.0",
60
60
  "vitest": ">=3.0.0"
61
61
  },
62
62
  "peerDependenciesMeta": {
@@ -73,15 +73,16 @@
73
73
  "devDependencies": {
74
74
  "@electron/asar": "^4.3.1",
75
75
  "@oxlint/plugins": "^1.79.0",
76
- "@types/node": "^22.0.0",
76
+ "@types/node": "22.20.5",
77
+ "@vitejs/plugin-react": "6.3.0",
77
78
  "esbuild": "0.28.2",
78
79
  "eslint-plugin-react-you-might-not-need-an-effect": "1.0.2",
79
- "@vitejs/plugin-react": "^6.1.2",
80
- "happy-dom": "18.0.1",
81
- "oxlint": "^1.80.0",
80
+ "happy-dom": "21.0.4",
81
+ "oxc-transform-react": "0.158.0",
82
+ "oxlint": "1.94.0",
82
83
  "typescript": "7.0.2",
83
- "vite": "^8.3.4",
84
- "vitest": "^3.2.0"
84
+ "vite": "8.3.8",
85
+ "vitest": "5.1.1"
85
86
  },
86
87
  "scripts": {
87
88
  "build": "tsrs -p tsconfig.json",