@vvedantb/config 0.16.0 → 0.17.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +5 -1
  3. package/dist/android-release-cli.js +0 -40
  4. package/dist/android-release-version.d.ts +0 -20
  5. package/dist/android-release-version.js +0 -15
  6. package/dist/android-release.d.ts +0 -54
  7. package/dist/android-release.js +0 -20
  8. package/dist/check-asar-cli.js +0 -1
  9. package/dist/check-asar.d.ts +0 -2
  10. package/dist/check-asar.js +0 -7
  11. package/dist/check-no-comments.js +2 -3
  12. package/dist/check-no-source-text.js +0 -1
  13. package/dist/check-shared-ui.d.ts +0 -12
  14. package/dist/check-shared-ui.js +0 -1
  15. package/dist/clerk-allow.js +0 -6
  16. package/dist/doctor.d.ts +0 -7
  17. package/dist/doctor.js +0 -14
  18. package/dist/expo.d.ts +0 -14
  19. package/dist/expo.js +0 -5
  20. package/dist/extension.d.ts +0 -18
  21. package/dist/extension.js +0 -2
  22. package/dist/oxlint-anti-slop/define.js +0 -2
  23. package/dist/oxlint-anti-slop/index.d.ts +0 -1
  24. package/dist/oxlint-anti-slop/index.js +0 -1
  25. package/dist/release-signing.d.ts +0 -36
  26. package/dist/release-signing.js +0 -7
  27. package/dist/sync.d.ts +0 -3
  28. package/dist/versions.d.ts +0 -2
  29. package/dist/versions.js +0 -2
  30. package/dist/vite.d.ts +0 -16
  31. package/dist/vitest-shared-setup.js +0 -8
  32. package/dist/vitest-shared.d.ts +0 -9
  33. package/dist/vitest-shared.js +0 -15
  34. package/oxlint/base.json +28 -0
  35. package/oxlint/plugin.mjs +8 -20
  36. package/oxlint/rules/convex-no-collect-in-query.mjs +26 -0
  37. package/oxlint/rules/convex-no-filter-in-query.mjs +38 -0
  38. package/oxlint/rules/convex-no-time-or-random-in-queries.mjs +81 -0
  39. package/oxlint/rules/no-comments.mjs +9 -2
  40. package/oxlint/rules/no-conditional-tests.mjs +0 -2
  41. package/oxlint/rules/no-double-cast.mjs +0 -1
  42. package/oxlint/rules/no-inline-zod-schema.mjs +0 -3
  43. package/oxlint/rules/no-is-record.mjs +0 -5
  44. package/oxlint/rules/no-json-parse.mjs +0 -6
  45. package/oxlint/rules/no-settings-description.mjs +0 -5
  46. package/oxlint/rules/no-source-text-in-tests.mjs +0 -7
  47. package/oxlint/rules/no-tab-search-param.mjs +63 -0
  48. package/oxlint/rules/no-unknown-shape-probing.mjs +0 -6
  49. package/oxlint/rules/no-value-block-in-try.mjs +0 -23
  50. package/oxlint/rules/prefer-schema-inferred-types.mjs +0 -5
  51. package/oxlint/utils.mjs +46 -2
  52. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#128](https://github.com/vvedantb/v/pull/128) [`17ace90`](https://github.com/vvedantb/v/commit/17ace9043b578d2fb39cd821e2fe3e35c4e9d37a) Thanks [@vvedantb](https://github.com/vvedantb)! - Add oxlint rules `convex-no-collect-in-query`, `convex-no-filter-in-query`, `convex-no-time-or-random-in-queries` and `no-tab-search-param`. The base config enables the Convex rules as warnings in `convex` and `backend` folders, enables the tab rule everywhere, and bans `self.localStorage` and `self.sessionStorage`.
8
+
9
+ ## 0.16.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#127](https://github.com/vvedantb/v/pull/127) [`c879912`](https://github.com/vvedantb/v/commit/c879912f54acec722957ccca585f4fd562ba48aa) Thanks [@vvedantb](https://github.com/vvedantb)! - `vvedantb/no-comments` keeps `allow-source-read:` markers.
14
+
15
+ - [#126](https://github.com/vvedantb/v/pull/126) [`8dbd360`](https://github.com/vvedantb/v/commit/8dbd360e4633fef950f8c5b32f58b42a5ab7819c) Thanks [@vvedantb](https://github.com/vvedantb)! - `vvedantb/no-comments` keeps hashbang lines and keeps `check-*-allow:` markers, and skips the generated `oxlint/no-effect.mjs`.
16
+
3
17
  ## 0.16.0
4
18
 
5
19
  ### Minor Changes
package/README.md CHANGED
@@ -57,7 +57,7 @@ The package ships two oxlint JS plugins. Both load with oxlint 1.79 or later (th
57
57
 
58
58
  #### `vvedantb` plugin: `@vvedantb/config/oxlint/plugin.mjs`
59
59
 
60
- Thirteen rules, with no app prefix:
60
+ Seventeen rules, with no app prefix:
61
61
 
62
62
  | Rule | Flags |
63
63
  | --- | --- |
@@ -68,6 +68,10 @@ Thirteen rules, with no app prefix:
68
68
  | `no-is-record` | Any identifier named `isRecord`. An `unknown` leaked in; type the data at its entry point instead. |
69
69
  | `no-settings-description` | A `description` prop on `SettingsSection`, `SettingsToggleRow` or `LabeledSwitchRow`. Opt in only where an app wants a hard ban; the default guidance is the `## UI copy` section, which allows a description where the user needs one. `{ "components": ["ProfileCard"] }` adds component names. |
70
70
  | `no-comments` | A comment that is not a lint or tool directive, a licence header, JSDoc before an `export`, a JSDoc `@type` annotation or a comment with an `http(s)://` link. `oxlint --fix` removes it. Skips `.d.ts` files and `.claude` and `.agents` folders. |
71
+ | `convex-no-collect-in-query` | `.collect()` on a `db.query(...)` chain. Use `.take(n)` or `.paginate()`. Syntactic port of `@convex-dev/eslint-plugin`, which needs type information. Warning in `convex` and `backend` folders, off in tests. |
72
+ | `convex-no-filter-in-query` | `.filter()` on a `db.query(...)` chain, also through a variable. Use `.withIndex()`. Warning in `convex` and `backend` folders, off in tests. |
73
+ | `convex-no-time-or-random-in-queries` | `new Date()`, `Date.now()`, `performance.now()`, `Math.random()` and `crypto.randomUUID()` inside a Convex query handler. Helpers that the handler calls are not followed. |
74
+ | `no-tab-search-param` | A tab in the query string: `searchParams.get("tab")`, `useQueryState("tab")`, `"?tab=x"` strings. Use a nested route such as `/edit-details/specialisms`. |
71
75
  | `no-ts-nocheck` | `@ts-nocheck` and `@ts-ignore` comments. `@ts-expect-error` with a reason stays allowed. |
72
76
  | `no-conditional-tests` | An `expect(...)` call inside an `if`, `?:`, `&&`/`\|\|` or `switch` case in a test file. |
73
77
  | `no-inline-object-type-assertion` | `x as { … }` and `x as Record<string, unknown>`. |
@@ -1,18 +1,4 @@
1
1
  #!/usr/bin/env node
2
- // `vvedantb-android-release`: build a signed, sideloadable Android release APK
3
- // (arm64-v8a published, x86_64 start-up APK, embedded JS) with Gradle, then write release.json next to
4
- // it. No EAS. One bin for every app; per-app differences come from a JSON config:
5
- //
6
- // VERSION_NAME=1.0.1 VERSION_CODE=1000 \
7
- // vvedantb-android-release --config scripts/android-release.config.json
8
- //
9
- // The release workflow chooses VERSION_NAME and VERSION_CODE. Signing reads
10
- // ANDROID_KEYSTORE_PATH, ANDROID_KEYSTORE_PASSWORD, ANDROID_KEY_ALIAS and
11
- // ANDROID_KEY_PASSWORD from the environment, else from keystore.properties in the
12
- // repo root (see withReleaseSigning). The build stops if any is missing. Linux or
13
- // WSL2 (GNU sed is not needed; edits run in Node). This orchestration needs a
14
- // Linux host with the Android SDK, so it is exercised only on CI, never on the
15
- // package's own test run.
16
2
  import { spawnSync } from "node:child_process";
17
3
  import { createHash } from "node:crypto";
18
4
  import { appendFileSync, chmodSync, copyFileSync, existsSync, readdirSync, readFileSync, rmSync, writeFileSync, } from "node:fs";
@@ -46,7 +32,6 @@ function capture(command, commandArgs, cwd) {
46
32
  }
47
33
  return result.stdout;
48
34
  }
49
- /** Highest versioned subdirectory under `base` whose `bin/sdkmanager` is a file. */
50
35
  function findSdkManager(sdkRoot) {
51
36
  const latest = join(sdkRoot, "cmdline-tools", "latest", "bin", "sdkmanager");
52
37
  if (existsSync(latest))
@@ -64,7 +49,6 @@ function findSdkManager(sdkRoot) {
64
49
  }
65
50
  return undefined;
66
51
  }
67
- /** Newest build-tools directory that has both aapt2 and apksigner. */
68
52
  function findBuildTools(sdkRoot) {
69
53
  const base = join(sdkRoot, "build-tools");
70
54
  if (!existsSync(base))
@@ -108,7 +92,6 @@ catch (error) {
108
92
  }
109
93
  const appDir = join(root, config.appDir);
110
94
  const env = { ...process.env };
111
- // VERSION_NAME is required, unless the config reads expo.version from app.json.
112
95
  let rawVersionName = env.VERSION_NAME;
113
96
  if ((rawVersionName === undefined || rawVersionName === "") && config.versionNameFromAppJson) {
114
97
  const appJsonFile = join(appDir, "app.json");
@@ -118,7 +101,6 @@ const versionName = validateVersionName(rawVersionName);
118
101
  const versionCode = validateVersionCode(env.VERSION_CODE);
119
102
  env.VERSION_NAME = versionName;
120
103
  env.VERSION_CODE = String(versionCode);
121
- // Keep app.json and the root package.json on the released version (v-store).
122
104
  if (config.syncAppVersion) {
123
105
  const appJsonFile = join(appDir, "app.json");
124
106
  if (existsSync(appJsonFile)) {
@@ -129,9 +111,6 @@ if (config.syncAppVersion) {
129
111
  writeFileSync(packageJsonFile, syncPackageJsonVersion(readFileSync(packageJsonFile, "utf8"), versionName));
130
112
  }
131
113
  }
132
- // Bake the production runtime config into the APK. Each value comes from the
133
- // environment, else a baked-in default named in the config. A release never
134
- // ships without them.
135
114
  const readAppFile = (relativePath) => {
136
115
  const full = join(appDir, relativePath);
137
116
  return existsSync(full) ? readFileSync(full, "utf8") : undefined;
@@ -143,7 +122,6 @@ for (const name of config.publicEnv) {
143
122
  }
144
123
  env[name] = value;
145
124
  }
146
- // An eas-profile source with exportAll also exports the profile's other entries.
147
125
  for (const source of config.publicEnvSources) {
148
126
  if (source.kind !== "eas-profile" || source.exportAll !== true)
149
127
  continue;
@@ -152,13 +130,10 @@ for (const source of config.publicEnvSources) {
152
130
  fail(`${config.appDir}/eas.json is missing, so its env cannot be exported.`);
153
131
  Object.assign(env, easProfileEntries(contents, source.profile ?? "production"));
154
132
  }
155
- // optionalEnv names are passed through from the environment when present; the
156
- // copied `env` already carries them, so nothing extra is needed here.
157
133
  for (const name of config.unsetEnv)
158
134
  delete env[name];
159
135
  for (const [key, value] of Object.entries(config.extraEnv))
160
136
  env[key] = value;
161
- // Our own signing (EAS_BUILD would switch it off in Expo tooling).
162
137
  delete env.EAS_BUILD;
163
138
  env.CI = env.CI ?? "1";
164
139
  const sdkRoot = env.ANDROID_SDK_ROOT ?? env.ANDROID_HOME ?? join(env.HOME ?? "", "Android/Sdk");
@@ -177,16 +152,13 @@ if (sdkManager === undefined) {
177
152
  fail(`Android SDK cmdline-tools not found at ${sdkRoot}/cmdline-tools (latest or a version folder).`);
178
153
  }
179
154
  env.PATH = `${dirname(sdkManager)}:${env.PATH}`;
180
- // Repo-root checks the app runs before building (such as a Clerk API check).
181
155
  for (const check of config.preChecks) {
182
156
  run("bash", ["-lc", check], { cwd: root, env });
183
157
  }
184
- // Mobile and its workspace deps, plus the root, whose pnpm settings the install uses.
185
158
  const installArgs = ["install", "--frozen-lockfile"];
186
159
  for (const filter of config.pnpmFilters)
187
160
  installArgs.push("--filter", filter);
188
161
  run("pnpm", installArgs, { cwd: root, env });
189
- // App-folder steps after install, before prebuild (such as a babel smoke test).
190
162
  for (const step of config.preBuildSteps) {
191
163
  run("bash", ["-lc", step], { cwd: appDir, env });
192
164
  }
@@ -196,12 +168,9 @@ if (!skipPrebuild) {
196
168
  prebuildArgs.push("--no-install");
197
169
  run("npx", prebuildArgs, { cwd: appDir, env });
198
170
  }
199
- // App-folder steps after prebuild, before Gradle (such as a check of a generated file).
200
171
  for (const step of config.postPrebuildSteps) {
201
172
  run("bash", ["-lc", step], { cwd: appDir, env });
202
173
  }
203
- // app.config reads VERSION_CODE at prebuild time, so a SKIP_PREBUILD run keeps
204
- // whatever android/ was generated with.
205
174
  const appGradle = join(appDir, "android", "app", "build.gradle");
206
175
  const appGradleText = existsSync(appGradle) ? readFileSync(appGradle, "utf8") : "";
207
176
  const versionCodeOk = new RegExp(`^[\\t ]*versionCode ${versionCode}[\\t ]*$`, "m").test(appGradleText);
@@ -209,7 +178,6 @@ const versionNameOk = gradleVersionNameOk(appGradleText, versionName);
209
178
  if (!versionCodeOk || !versionNameOk || !appGradleText.includes("withReleaseSigning")) {
210
179
  fail("android/ is stale (versionCode, versionName or signing). Run again without SKIP_PREBUILD=1.");
211
180
  }
212
- // Optionally pin the Gradle wrapper (one app ships an incompatible default).
213
181
  if (config.gradleWrapperPin !== undefined) {
214
182
  const wrapperProps = join(appDir, "android", "gradle", "wrapper", "gradle-wrapper.properties");
215
183
  if (existsSync(wrapperProps)) {
@@ -220,7 +188,6 @@ if (config.gradleWrapperPin !== undefined) {
220
188
  }
221
189
  }
222
190
  }
223
- // Architectures precedence: REACT_NATIVE_ARCHITECTURES env, config field (default arm64-v8a,x86_64).
224
191
  const architectures = resolveReactNativeArchitectures(process.env.REACT_NATIVE_ARCHITECTURES, config.reactNativeArchitectures);
225
192
  const apkNames = resolveReleaseApkNames({
226
193
  abiSplits: config.abiSplits,
@@ -237,7 +204,6 @@ if (config.abiSplits === true) {
237
204
  const propsPath = join(appDir, "android", "gradle.properties");
238
205
  const propsText = existsSync(propsPath) ? readFileSync(propsPath, "utf8") : "";
239
206
  writeFileSync(propsPath, gradlePropertiesEdits(propsText, buildGradlePropertyEdits(architectures)));
240
- // R8 keep rules for the minified release build. Existing rules stay.
241
207
  const proguardPath = join(appDir, "android", "app", "proguard-rules.pro");
242
208
  const proguardText = existsSync(proguardPath) ? readFileSync(proguardPath, "utf8") : "";
243
209
  writeFileSync(proguardPath, withKeepRules(proguardText));
@@ -245,7 +211,6 @@ writeFileSync(join(appDir, "android", "local.properties"), `sdk.dir=${sdkRoot}\n
245
211
  const outDir = join(appDir, "android", "app", "build", "outputs", "apk", "release");
246
212
  const apk = join(outDir, apkNames.publish);
247
213
  const startupApk = apkNames.startup === undefined ? undefined : join(outDir, apkNames.startup);
248
- // A failed run must not leave an older APK or release.json to publish.
249
214
  for (const stale of [apk, join(outDir, "release.json")]) {
250
215
  if (existsSync(stale))
251
216
  rmSync(stale);
@@ -262,8 +227,6 @@ const androidDir = join(appDir, "android");
262
227
  const gradlew = join(androidDir, "gradlew");
263
228
  if (existsSync(gradlew))
264
229
  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
230
  function resolveCcache() {
268
231
  if (!env.CCACHE_DIR && !env.ANDROID_CCACHE)
269
232
  return undefined;
@@ -275,7 +238,6 @@ function resolveCcache() {
275
238
  }
276
239
  return undefined;
277
240
  }
278
- // Vital lint is not needed for a sideload APK and can run out of Metaspace.
279
241
  const gradleArgs = ["assembleRelease", "--no-daemon", "-x", "lint", "-x", "lintVitalAnalyzeRelease", "-x", "lintVitalRelease"];
280
242
  const ccache = resolveCcache();
281
243
  if (ccache !== undefined) {
@@ -285,8 +247,6 @@ if (ccache !== undefined) {
285
247
  console.info(`Using ccache at ${ccache} for CMake builds.`);
286
248
  }
287
249
  run("./gradlew", gradleArgs, { cwd: androidDir, env });
288
- // Check the APK itself before describing it: package, versionCode, versionName,
289
- // and a release signature rather than the debug key.
290
250
  const buildTools = findBuildTools(sdkRoot);
291
251
  if (buildTools === undefined) {
292
252
  fail(`No build-tools with aapt2 and apksigner in ${sdkRoot}/build-tools. Install build-tools;36.0.0 with sdkmanager.`);
@@ -2,45 +2,25 @@
2
2
  export type VersionNameSource = "default_version_name" | "app_json";
3
3
  /** What the workflow knows about the published releases for a tag prefix. */
4
4
  export interface PublishedReleases {
5
- /** Tags from `gh release list` that start with the tag prefix. */
6
5
  tags: readonly string[];
7
- /**
8
- * versionCode from the release.json of the highest semver tag. `undefined`
9
- * means that release has no release.json (a release from before this
10
- * workflow), which counts as versionCode 1.
11
- */
12
6
  highestVersionCode?: number | undefined;
13
7
  }
14
8
  /** Inputs to {@link pickAndroidReleaseVersion}. */
15
9
  export interface PickAndroidReleaseVersionInput {
16
- /** Tag prefix, such as `"eva-v"`. */
17
10
  tagPrefix: string;
18
- /** `version_code_floor` input, such as `"1000"`. */
19
11
  versionCodeFloor: string;
20
- /** `version_name_source` input. */
21
12
  versionNameSource: VersionNameSource;
22
- /**
23
- * The versionName floor: the `DEFAULT_VERSION_NAME` literal from
24
- * app.config.ts (`default_version_name`) or `expo.version` from app.json
25
- * (`app_json`). `undefined` when app.json has none.
26
- */
27
13
  appVersion?: string | undefined;
28
- /** `version` input, empty or absent when not set. */
29
14
  inputVersion?: string | undefined;
30
- /** `version_code` input, empty or absent when not set. */
31
15
  inputVersionCode?: string | undefined;
32
- /** The pushed tag (`GITHUB_REF_NAME`) on a tag push, else absent. */
33
16
  tagPush?: string | undefined;
34
- /** Published releases for the tag prefix. */
35
17
  published: PublishedReleases;
36
18
  }
37
19
  /** The decision. */
38
20
  export interface AndroidReleaseVersion {
39
21
  versionName: string;
40
22
  versionCode: number;
41
- /** The tag to release: the pushed tag, else `<tagPrefix><versionName>`. */
42
23
  tag: string;
43
- /** The tag with the highest published semver versionName, or `""`. */
44
24
  previousTag: string;
45
25
  }
46
26
  /** True when `value` is `X.Y.Z`. */
@@ -1,13 +1,3 @@
1
- // Version pick for the shared Android APK release workflow
2
- // (.github/workflows/release-android-apk.yml). This module owns the algorithm and
3
- // its tests. The workflow's "Choose versionName, versionCode and tag" step
4
- // gathers the same inputs with one `gh release list` and one release.json
5
- // download, and implements the same rules in bash. Change both together.
6
- //
7
- // The workflow does not read every release.json. Published versionNames come
8
- // from tag suffixes (`<tagPrefix><semver>`). Only the highest semver tag needs
9
- // its release.json, because the highest versionName carries the highest
10
- // versionCode under the normal monotonic scheme.
11
1
  const SEMVER_RE = /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/;
12
2
  const WHOLE_NUMBER_RE = /^[1-9][0-9]*$/;
13
3
  const VERSION_CODE_FLOOR_RE = /^[1-9][0-9]{0,9}$/;
@@ -84,9 +74,6 @@ export function pickAndroidReleaseVersion(input) {
84
74
  const highestCode = highestPublished === undefined ? 0 : (input.published.highestVersionCode ?? 1);
85
75
  let versionName;
86
76
  if (versionNameSource === "app_json") {
87
- // The version input; else the tag's version; else the highest published
88
- // versionName with the patch bumped, or expo.version if that is higher or
89
- // nothing is published yet.
90
77
  if (inputVersion !== "") {
91
78
  versionName = inputVersion;
92
79
  }
@@ -127,8 +114,6 @@ export function pickAndroidReleaseVersion(input) {
127
114
  throw new Error(`versionName ${versionName} must be higher than ${highestPublished}, the highest published release.json.`);
128
115
  }
129
116
  }
130
- // Sideload versionCodes start at the floor. The version_code input can only
131
- // raise that minimum.
132
117
  const minCode = Math.max(highestCode + 1, floor);
133
118
  const codeText = inputVersionCode === "" ? String(minCode) : inputVersionCode;
134
119
  if (!WHOLE_NUMBER_RE.test(codeText) || Number(codeText) < minCode) {
@@ -4,28 +4,13 @@ export declare function validateVersionName(value: string | undefined): string;
4
4
  export declare function validateVersionCode(value: string | undefined): number;
5
5
  /** Where a baked-in default for an `EXPO_PUBLIC_*` value is read from. */
6
6
  export type PublicEnvSource = {
7
- /** The `build.<profile>.env[name]` value in `eas.json`. */
8
7
  kind: "eas-profile";
9
- /** Profile name. Default `"production"`. */
10
8
  profile?: string;
11
- /**
12
- * The profile wins over the environment, and a name the profile lacks is
13
- * an error (no fallback to the environment or a later source). Use it when
14
- * a release must bake the same values as the EAS profile, whatever the
15
- * shell or a local `.env` says. Default `false`.
16
- */
17
9
  authoritative?: boolean;
18
- /**
19
- * Also export every entry of the profile `env` (not only `publicEnv`
20
- * names) to the build, such as a strict-mode flag. Default `false`.
21
- */
22
10
  exportAll?: boolean;
23
11
  } | {
24
- /** A `process.env.NAME <op> "literal"` default in a config file. */
25
12
  kind: "config-literal";
26
- /** File relative to the app folder, such as `"app.config.ts"` or `"src/config.ts"`. */
27
13
  file: string;
28
- /** Operators that precede the literal. Default `["??", "||"]`. */
29
14
  operators?: readonly ("??" | "||")[];
30
15
  };
31
16
  /** Reads a text file relative to the app folder, or `undefined` when absent. */
@@ -46,11 +31,8 @@ export declare function publicEnvDefault(name: string, options: {
46
31
  }): string;
47
32
  /** One edit to `gradle.properties`. */
48
33
  export interface GradlePropertyEdit {
49
- /** Property key, such as `"org.gradle.jvmargs"`. */
50
34
  key: string;
51
- /** Property value. */
52
35
  value: string;
53
- /** Replace an existing line (true) or only append when absent (false). */
54
36
  replace: boolean;
55
37
  }
56
38
  /**
@@ -110,62 +92,28 @@ export declare function formatReleaseJson(release: ReleaseJson): string;
110
92
  export declare function formatGithubOutput(outputs: Readonly<Record<string, string>>): string;
111
93
  /** Per-app configuration for the Android release build. */
112
94
  export interface AndroidReleaseConfig {
113
- /** Android package id, such as `"com.projectvdotuk.vmem"`. */
114
95
  packageId: string;
115
- /** App folder relative to the repo root. Default `"apps/mobile"`. */
116
96
  appDir: string;
117
- /** Published APK name prefix, such as `"vmem"` (`vmem-1.0.1-android.apk`). */
118
97
  apkPrefix: string;
119
- /** `EXPO_PUBLIC_*` names that must be baked into the APK. */
120
98
  publicEnv: readonly string[];
121
- /** Where to read a default for a missing `EXPO_PUBLIC_*` value. */
122
99
  publicEnvSources: readonly PublicEnvSource[];
123
- /** `pnpm install --filter` values, such as `["@vmem/mobile...", "{.}"]`. */
124
100
  pnpmFilters: readonly string[];
125
- /**
126
- * After versionName resolves, write it to `<appDir>/app.json` (`expo.version`)
127
- * and the root `package.json` (`version`) when those files exist, before
128
- * prebuild. Default `false`.
129
- */
130
101
  syncAppVersion: boolean;
131
- /** Read `expo.version` from `<appDir>/app.json` when `VERSION_NAME` is unset. Default `false`. */
132
102
  versionNameFromAppJson: boolean;
133
- /** Pass `--no-install` to `expo prebuild` (vibot installs during prebuild). */
134
103
  prebuildNoInstall: boolean;
135
- /** Extra environment set for the whole build, such as `{ APP_VARIANT: "production" }`. */
136
104
  extraEnv: Readonly<Record<string, string>>;
137
- /** Names removed from the build environment before `extraEnv` is applied, such as `["APP_VARIANT"]`. */
138
105
  unsetEnv: readonly string[];
139
- /** Optional `EXPO_PUBLIC_*` names (set from env when present, never required). */
140
106
  optionalEnv: readonly string[];
141
- /** Shell commands run in the repo root before the build, such as a Clerk check. */
142
107
  preChecks: readonly string[];
143
- /** Commands run in the app folder after install, before prebuild, such as `pnpm run test:babel`. */
144
108
  preBuildSteps: readonly string[];
145
- /** Commands run in the app folder after prebuild, before Gradle, such as a check of a generated file. */
146
109
  postPrebuildSteps: readonly string[];
147
- /** Pin the Gradle wrapper: replace `distributionUrl` when it contains `ifContains`. */
148
110
  gradleWrapperPin?: {
149
111
  ifContains: string;
150
112
  distributionUrl: string;
151
113
  };
152
- /**
153
- * ABIs for `reactNativeArchitectures` in `gradle.properties`, such as
154
- * `"arm64-v8a,x86_64"`. The `REACT_NATIVE_ARCHITECTURES` env var wins over it.
155
- * Default `"arm64-v8a,x86_64"`, or `"arm64-v8a"` when `abiSplits` is `false`.
156
- */
157
114
  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
115
  abiSplits?: boolean;
166
- /** With `abiSplits`: the one ABI to publish. Default `["arm64-v8a"]`. */
167
116
  publishArchitectures?: readonly string[];
168
- /** Label and env var for the final summary line, such as `{ label: "Convex", envVar: "EXPO_PUBLIC_CONVEX_URL" }`. */
169
117
  summary?: {
170
118
  label: string;
171
119
  envVar: string;
@@ -202,9 +150,7 @@ export declare function withAbiSplits(gradleText: string, abis: readonly string[
202
150
  export declare function splitApkFileName(abi: string): string;
203
151
  /** Which Gradle output APKs the release publishes and the start-up test installs. */
204
152
  export interface ReleaseApkNames {
205
- /** The APK renamed, hashed and published. */
206
153
  publish: string;
207
- /** The APK the start-up test installs, when it differs from `publish`. */
208
154
  startup?: string;
209
155
  }
210
156
  /**
@@ -1,11 +1,4 @@
1
- // Shared logic for the `vvedantb-android-release` bin: build a signed,
2
- // sideloadable Android release APK with Gradle, then write release.json next
3
- // to it. No EAS. The bin (android-release-cli.ts) orchestrates the real tools
4
- // (pnpm, expo prebuild, gradlew, aapt2, apksigner) on Linux CI; this module
5
- // holds the pure, per-app pieces so they can be tested without a build.
6
- /** Semantic version like `1.0.1`. */
7
1
  const VERSION_NAME_RE = /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/;
8
- /** Android caps versionCode at 2_100_000_000. */
9
2
  const VERSION_CODE_RE = /^[1-9][0-9]{0,9}$/;
10
3
  const MAX_VERSION_CODE = 2_100_000_000;
11
4
  /** Returns `value` when it is a version like `1.0.1`, else throws. */
@@ -120,24 +113,13 @@ export function resolveReactNativeArchitectures(option, fallback) {
120
113
  }
121
114
  const BASE_GRADLE_PROPERTY_EDITS = [
122
115
  { key: "org.gradle.jvmargs", value: "-Xmx4096m -XX:MaxMetaspaceSize=1024m", replace: true },
123
- // boat-large has 8 cores. Replace Expo's lower default.
124
116
  { key: "org.gradle.workers.max", value: "8", replace: true },
125
117
  { 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
118
  { key: "org.gradle.caching", value: "true", replace: true },
129
- // org.gradle.configuration-cache stays off: ephemeral CI runners never reuse
130
- // the cache, and native modules may still be incompatible on release tasks.
131
119
  { 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
120
  { key: "android.enableMinifyInReleaseBuilds", value: "true", replace: true },
136
121
  { key: "android.enableShrinkResourcesInReleaseBuilds", value: "true", replace: true },
137
122
  { 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
123
  { key: "expo.useLegacyPackaging", value: "true", replace: true },
142
124
  ];
143
125
  /**
@@ -341,8 +323,6 @@ export function parseAndroidReleaseConfig(input) {
341
323
  if (raw.publishArchitectures !== undefined) {
342
324
  config.publishArchitectures = asStringArray(raw.publishArchitectures, "publishArchitectures");
343
325
  }
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
326
  if (config.abiSplits === false && raw.reactNativeArchitectures === undefined) {
347
327
  config.reactNativeArchitectures = DEFAULT_REACT_NATIVE_ARCHITECTURES;
348
328
  }
@@ -8,6 +8,5 @@ const code = await runCheckAsar(process.argv.slice(2), {
8
8
  env: process.env,
9
9
  selfPath: fileURLToPath(import.meta.url),
10
10
  });
11
- // Exit at once on failure; on success let the process end by itself, as the original scripts did.
12
11
  if (code !== 0)
13
12
  process.exit(code);
@@ -3,11 +3,9 @@ export type CheckAsarIo = {
3
3
  error: (message: string) => void;
4
4
  cwd: () => string;
5
5
  env: Readonly<Record<string, string | undefined>>;
6
- /** This CLI's own file, which `resolve` runs again inside the Electron binary. */
7
6
  selfPath: string;
8
7
  };
9
8
  export type AsarCheckHookContext = {
10
- /** Absolute path of app.asar (readable as a directory inside the Electron binary). */
11
9
  asar: string;
12
10
  };
13
11
  /**
@@ -58,7 +58,6 @@ const PROVIDED = new Set(["electron", ...builtinModules]);
58
58
  /** Finds import and require specifiers in built JavaScript (`list` mode). */
59
59
  export function findSpecifiers(source) {
60
60
  const found = new Set();
61
- // A specifier never holds spaces or commas, so text such as ["the", "from", "will"] in a bundled word list is not an import.
62
61
  const patterns = [/\bfrom\s*["']([^"'\s,]+)["']/g, /\bimport\s*["']([^"'\s,]+)["']/g, /\b(?:require|import)\(\s*["']([^"'\s,]+)["']\s*\)/g];
63
62
  for (const pattern of patterns) {
64
63
  for (const match of source.matchAll(pattern))
@@ -84,7 +83,6 @@ export function findBareImports(source) {
84
83
  return found;
85
84
  }
86
85
  const JS_FILE = /\.(c|m)?js$/;
87
- /** JS files under `dir`, recursively. A missing dir has none. */
88
86
  function listJsFiles(dir) {
89
87
  if (!existsSync(dir))
90
88
  return [];
@@ -92,7 +90,6 @@ function listJsFiles(dir) {
92
90
  .filter((entry) => entry.isFile() && JS_FILE.test(entry.name))
93
91
  .map((entry) => join(entry.parentPath, entry.name));
94
92
  }
95
- /** JS files under `dir`, skipping directories named in `skip` at any depth. Throws if `dir` is missing. */
96
93
  function resolveJsFiles(dir, skip) {
97
94
  return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
98
95
  const path = join(dir, entry.name);
@@ -205,7 +202,6 @@ function runResolveParent(options, io) {
205
202
  return result.status ?? 1;
206
203
  }
207
204
  async function runHook(file, context) {
208
- // The module is the app's; the checks below stand in for its declared type.
209
205
  const mod = await import(pathToFileURL(file).href);
210
206
  const hook = mod.default;
211
207
  if (typeof hook !== "function")
@@ -217,13 +213,11 @@ async function runHook(file, context) {
217
213
  return [`hook ${file} must return a list of problems`];
218
214
  return result.map(String);
219
215
  }
220
- /** The run inside the Electron binary: argv is `[app.asar, ...flags]` with an absolute asar and hook. */
221
216
  async function runResolveChild(options, io) {
222
217
  const asar = options.positional[0] ?? "";
223
218
  const problems = [];
224
219
  const requireFromAsar = createRequire(join(asar, "package.json"));
225
220
  const skip = new Set(options.skipDirs);
226
- // 1. Every unbundled JS import must resolve from inside the asar.
227
221
  const files = options.scans.flatMap((dir) => resolveJsFiles(join(asar, dir), skip));
228
222
  const specs = new Set();
229
223
  for (const file of files) {
@@ -239,7 +233,6 @@ async function runResolveChild(options, io) {
239
233
  }
240
234
  }
241
235
  io.log(`checked ${files.length} JS files, ${specs.size} unbundled imports`);
242
- // 2. The app's own checks (native files, booting a bundled path, ...).
243
236
  if (options.hook !== undefined)
244
237
  problems.push(...(await runHook(options.hook, { asar })));
245
238
  if (problems.length > 0) {
@@ -17,8 +17,8 @@ export function scanComments(text) {
17
17
  const templateDepths = [];
18
18
  let depth = 0;
19
19
  let sawCode = false;
20
- let prev = ""; // last significant character
21
- let prevWord = ""; // identifier or number that ended at `prev`, if any
20
+ let prev = "";
21
+ let prevWord = "";
22
22
  let i = 0;
23
23
  if (text.startsWith("#!"))
24
24
  i = text.indexOf("\n") === -1 ? text.length : text.indexOf("\n");
@@ -29,7 +29,6 @@ export function scanComments(text) {
29
29
  i += 1;
30
30
  };
31
31
  const skipTemplate = () => {
32
- // Called with `i` just after a backtick or a closing `}` of a substitution.
33
32
  while (i < text.length) {
34
33
  const c = text[i];
35
34
  if (c === "\\")
@@ -6,7 +6,6 @@ const READ_CALL = /\b(readFileSync|readFile|readdirSync|readdir|createReadStream
6
6
  const SOURCE_ARG = /(?:^|[^\w])(?:src|source|sources|srcDir|sourceDir)\b|\.(?:css|scss|md|mdx|[cm]?[jt]sx?)\b/i;
7
7
  const RAW_IMPORT = /from\s+["'][^"']*\?raw["']|import\.meta\.glob\([^)]*(?:\?raw|as:\s*["']raw["'])/;
8
8
  const ALLOW = /allow-source-read:/;
9
- /** The text of a call's arguments, up to the matching close bracket. */
10
9
  function callArguments(text, start) {
11
10
  let depth = 1;
12
11
  let i = start;
@@ -5,29 +5,17 @@ export type CheckSharedUiIo = {
5
5
  cwd: () => string;
6
6
  };
7
7
  export type CheckSharedUiOptions = {
8
- /** Repo root. Paths below are relative to it. */
9
8
  root: string;
10
- /** Package that exports the shared components. */
11
9
  packageName: string;
12
- /** Components that count as the shared footer. */
13
10
  footerComponents: readonly string[];
14
- /** Directories whose footer files must render a shared footer. */
15
11
  footerDirs: readonly string[];
16
- /** Directories whose footer files are only checked for banned patterns. */
17
12
  footerScanDirs: readonly string[];
18
- /** Path segments to skip when looking for footer files, such as `sidebar`. */
19
13
  footerExclude: readonly string[];
20
- /** Hosts whose bare root URL is a placeholder social link. */
21
14
  socialHosts: readonly string[];
22
- /** Pages that must render the shared header. */
23
15
  headerPages: readonly string[];
24
- /** The shared header component. */
25
16
  headerComponent: string;
26
- /** Directories searched for local landing navigation files. */
27
17
  navDirs: readonly string[];
28
- /** A file whose name starts with one of these is a local landing nav. */
29
18
  localNavNames: readonly string[];
30
- /** Directory names never entered. */
31
19
  skip: readonly string[];
32
20
  };
33
21
  export declare const DEFAULT_SKIP: string[];
@@ -156,7 +156,6 @@ export function checkSharedUi(options) {
156
156
  }
157
157
  }
158
158
  };
159
- // Required dirs first, so a file in both is held to the stricter rule.
160
159
  collect(options.footerDirs, true);
161
160
  collect(options.footerScanDirs, false);
162
161
  for (const { file, required } of footers) {
@@ -1,8 +1,4 @@
1
- // Adds a Chrome extension's origin to a Clerk instance's allowed origins through the Clerk
2
- // Backend API: GET /v1/instance, add `chrome-extension://<id>` to `allowed_origins`, PATCH
3
- // /v1/instance with the whole list. The secret key is read from the environment and never printed.
4
1
  export const CLERK_INSTANCE_URL = "https://api.clerk.com/v1/instance";
5
- /** Chrome extension IDs are 32 letters from a to p. */
6
2
  const EXTENSION_ID = /^[a-p]{32}$/;
7
3
  const USAGE = `Usage: vvedantb-clerk-allow <extension-id>
8
4
 
@@ -29,7 +25,6 @@ function readInstance(body) {
29
25
  throw new Error("GET /v1/instance did not return JSON. Nothing was changed.");
30
26
  }
31
27
  const origins = data.allowed_origins === null ? [] : data.allowed_origins;
32
- // Without the current list, a PATCH with only the new origin could drop the others.
33
28
  if (!Array.isArray(origins) || !origins.every((o) => typeof o === "string")) {
34
29
  throw new Error("GET /v1/instance returned no allowed_origins list. Nothing was changed.");
35
30
  }
@@ -51,7 +46,6 @@ export async function runClerkAllow(argv, io) {
51
46
  io.error(`${id === undefined ? "Missing the" : "Pass one"} extension ID.\n${USAGE}`);
52
47
  return 2;
53
48
  }
54
- // The argument is not echoed: it could be a key pasted by mistake.
55
49
  if (!EXTENSION_ID.test(id)) {
56
50
  io.error("The extension ID must be 32 letters from a to p, as shown in chrome://extensions.");
57
51
  return 2;
package/dist/doctor.d.ts CHANGED
@@ -5,13 +5,10 @@ export type DoctorIo = {
5
5
  };
6
6
  export type CheckStatus = "pass" | "fail" | "waived";
7
7
  export interface CheckResult {
8
- /** Stable id used for waivers and `--json`. */
9
8
  id: string;
10
9
  title: string;
11
10
  status: CheckStatus;
12
- /** Problem lines (empty when the check passes). */
13
11
  details: string[];
14
- /** The written reason, when the check is waived. */
15
12
  waiver?: string;
16
13
  }
17
14
  /** The ordered ids of every check the doctor runs. */
@@ -34,9 +31,7 @@ interface PackageJson {
34
31
  };
35
32
  }
36
33
  export interface PackageEntry {
37
- /** Absolute directory holding the package.json. */
38
34
  dir: string;
39
- /** Path relative to the repo root, forward slashes. The root is ".". */
40
35
  rel: string;
41
36
  json: PackageJson;
42
37
  }
@@ -93,14 +88,12 @@ export declare function checkCiCommands(repo: RepoModel, reasons: Record<string,
93
88
  export interface DoctorCheckOptions {
94
89
  runningVersion: string;
95
90
  waivers?: Record<string, string>;
96
- /** Written reasons for CI commands beyond the standard three, keyed by the exact command. */
97
91
  ciCommandReasons?: Record<string, string>;
98
92
  }
99
93
  /** Run every check against the repo at `root`, applying waivers. */
100
94
  export declare function runDoctorChecks(root: string, options: DoctorCheckOptions): CheckResult[];
101
95
  export interface LoadedWaivers {
102
96
  waivers: Record<string, string>;
103
- /** Written reasons for extra CI commands, keyed by the exact command. */
104
97
  ciCommands: Record<string, string>;
105
98
  warnings: string[];
106
99
  }