@vvedantb/config 0.14.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.14.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#337](https://github.com/vvedantb/packages/pull/337) [`8bb6944`](https://github.com/vvedantb/packages/commit/8bb69441de755f833033b02fb2a65d72d692dd24) Thanks [@vvedantb](https://github.com/vvedantb)! - `vvedantb-android-release` can request ABIs for `reactNativeArchitectures` through the `REACT_NATIVE_ARCHITECTURES` env var or the `reactNativeArchitectures` config field, in that order. The default stays `arm64-v8a`. New helpers: `resolveReactNativeArchitectures` and `buildGradlePropertyEdits`.
8
+
3
9
  ## 0.14.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -569,7 +569,7 @@ Paths and filters are as read from each app's current script. Check them against
569
569
 
570
570
  ### Gradle settings
571
571
 
572
- The bin edits `android/gradle.properties` (`DEFAULT_GRADLE_PROPERTY_EDITS`): `reactNativeArchitectures=arm64-v8a` (published APKs run on phones; emulator builds in `apps/native-gallery` set `x86_64` themselves), `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`.
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`.
573
573
 
574
574
  ### Version pick
575
575
 
@@ -577,7 +577,7 @@ The bin edits `android/gradle.properties` (`DEFAULT_GRADLE_PROPERTY_EDITS`): `re
577
577
 
578
578
  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
579
 
580
- Pure helpers (`pickAndroidReleaseVersion`, `readExpoVersion`, `syncExpoVersion`, `syncPackageJsonVersion`, `gradleVersionNameOk`, `validateVersionName`, `validateVersionCode`, `publicEnvDefault`, `easProfileEntries`, `gradlePropertiesEdits`, `parseBadging`, `releaseJson`, `formatReleaseJson`, `formatGithubOutput`, `apkFileName`, `parseAndroidReleaseConfig`) are exported from the root and unit-tested. The full Android build was not exercised on Windows.
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.
581
581
 
582
582
  ## Versions
583
583
 
@@ -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, gradlePropertiesEdits, gradleVersionNameOk, parseAndroidReleaseConfig, parseBadging, publicEnvDefault, readExpoVersion, releaseJson, syncExpoVersion, syncPackageJsonVersion, validateVersionCode, validateVersionName, } from "./android-release.js";
20
+ import { apkFileName, easProfileEntries, formatGithubOutput, formatReleaseJson, buildGradlePropertyEdits, gradlePropertiesEdits, resolveReactNativeArchitectures, 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);
@@ -222,7 +222,8 @@ if (config.gradleWrapperPin !== undefined) {
222
222
  }
223
223
  const propsPath = join(appDir, "android", "gradle.properties");
224
224
  const propsText = existsSync(propsPath) ? readFileSync(propsPath, "utf8") : "";
225
- writeFileSync(propsPath, gradlePropertiesEdits(propsText));
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))));
226
227
  writeFileSync(join(appDir, "android", "local.properties"), `sdk.dir=${sdkRoot}\n`);
227
228
  const outDir = join(appDir, "android", "app", "build", "outputs", "apk", "release");
228
229
  const apk = join(outDir, "app-release.apk");
@@ -53,7 +53,19 @@ 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. */
57
+ export declare const DEFAULT_REACT_NATIVE_ARCHITECTURES = "arm64-v8a";
58
+ /**
59
+ * Resolves the `reactNativeArchitectures` value. Precedence: explicit `option`
60
+ * (for example the `REACT_NATIVE_ARCHITECTURES` env var), then `fallback` (the
61
+ * config field), then `arm64-v8a`. Empty or blank values are skipped. The
62
+ * existing `gradle.properties` value is not preserved: Expo's prebuild default
63
+ * is fat, so keeping it would widen every app that relies on the arm64 force.
64
+ */
65
+ export declare function resolveReactNativeArchitectures(option?: string, fallback?: string): string;
56
66
  /** The edits the release build makes to `gradle.properties`, in order. */
67
+ export declare function buildGradlePropertyEdits(reactNativeArchitectures?: string): readonly GradlePropertyEdit[];
68
+ /** The default edits (arm64-v8a only), in order. */
57
69
  export declare const DEFAULT_GRADLE_PROPERTY_EDITS: readonly GradlePropertyEdit[];
58
70
  /**
59
71
  * Applies the release edits to `gradle.properties` contents and returns the new
@@ -124,6 +136,12 @@ export interface AndroidReleaseConfig {
124
136
  ifContains: string;
125
137
  distributionUrl: string;
126
138
  };
139
+ /**
140
+ * ABIs for `reactNativeArchitectures` in `gradle.properties`, such as
141
+ * `"arm64-v8a,x86_64"`. The `REACT_NATIVE_ARCHITECTURES` env var wins over it.
142
+ * Default `"arm64-v8a"`.
143
+ */
144
+ reactNativeArchitectures?: string;
127
145
  /** Label and env var for the final summary line, such as `{ label: "Convex", envVar: "EXPO_PUBLIC_CONVEX_URL" }`. */
128
146
  summary?: {
129
147
  label: string;
@@ -97,10 +97,24 @@ export function publicEnvDefault(name, options) {
97
97
  }
98
98
  return "";
99
99
  }
100
- /** The edits the release build makes to `gradle.properties`, in order. */
101
- export const DEFAULT_GRADLE_PROPERTY_EDITS = [
102
- // arm64-v8a only: published APKs target phones. x86_64 is for emulators.
103
- { key: "reactNativeArchitectures", value: "arm64-v8a", replace: true },
100
+ /** Default `reactNativeArchitectures`: published APKs target phones. */
101
+ export const DEFAULT_REACT_NATIVE_ARCHITECTURES = "arm64-v8a";
102
+ /**
103
+ * Resolves the `reactNativeArchitectures` value. Precedence: explicit `option`
104
+ * (for example the `REACT_NATIVE_ARCHITECTURES` env var), then `fallback` (the
105
+ * config field), then `arm64-v8a`. Empty or blank values are skipped. The
106
+ * existing `gradle.properties` value is not preserved: Expo's prebuild default
107
+ * is fat, so keeping it would widen every app that relies on the arm64 force.
108
+ */
109
+ export function resolveReactNativeArchitectures(option, fallback) {
110
+ for (const candidate of [option, fallback]) {
111
+ const trimmed = candidate?.trim();
112
+ if (trimmed !== undefined && trimmed !== "")
113
+ return trimmed;
114
+ }
115
+ return DEFAULT_REACT_NATIVE_ARCHITECTURES;
116
+ }
117
+ const BASE_GRADLE_PROPERTY_EDITS = [
104
118
  { key: "org.gradle.jvmargs", value: "-Xmx4096m -XX:MaxMetaspaceSize=1024m", replace: true },
105
119
  // boat-large has 8 cores. Replace Expo's lower default.
106
120
  { key: "org.gradle.workers.max", value: "8", replace: true },
@@ -109,6 +123,19 @@ export const DEFAULT_GRADLE_PROPERTY_EDITS = [
109
123
  // the cache, and native modules may still be incompatible on release tasks.
110
124
  { key: "android.lint.checkReleaseBuilds", value: "false", replace: false },
111
125
  ];
126
+ /** The edits the release build makes to `gradle.properties`, in order. */
127
+ export function buildGradlePropertyEdits(reactNativeArchitectures) {
128
+ return [
129
+ {
130
+ key: "reactNativeArchitectures",
131
+ value: resolveReactNativeArchitectures(reactNativeArchitectures),
132
+ replace: true,
133
+ },
134
+ ...BASE_GRADLE_PROPERTY_EDITS,
135
+ ];
136
+ }
137
+ /** The default edits (arm64-v8a only), in order. */
138
+ export const DEFAULT_GRADLE_PROPERTY_EDITS = buildGradlePropertyEdits();
112
139
  function withTrailingNewline(contents) {
113
140
  if (contents.length === 0)
114
141
  return contents;
@@ -243,6 +270,12 @@ export function parseAndroidReleaseConfig(input) {
243
270
  }
244
271
  if (raw.gradleWrapperPin !== undefined)
245
272
  config.gradleWrapperPin = parseWrapperPin(raw.gradleWrapperPin);
273
+ if (raw.reactNativeArchitectures !== undefined) {
274
+ if (typeof raw.reactNativeArchitectures !== "string") {
275
+ throw new Error('android-release config: "reactNativeArchitectures" must be a string.');
276
+ }
277
+ config.reactNativeArchitectures = raw.reactNativeArchitectures;
278
+ }
246
279
  if (raw.summary !== undefined)
247
280
  config.summary = parseSummary(raw.summary);
248
281
  return config;
package/dist/index.d.ts CHANGED
@@ -10,5 +10,5 @@ export { CHECK_IDS, checkCiReusableWorkflow, checkConfigVersion, checkNoEslint,
10
10
  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
11
  export { defineExpoMetroConfig, expoBabelConfig, type BabelApi, type ExpoBabelConfig, type ExpoMetroOptions, type MetroConfigLike, type MetroResolveContext, type MetroResolveRequest, type NativeWindMetroOptions, } from "./expo.js";
12
12
  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, 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";
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
14
  export { compareSemver, highestSemver, isSemver, pickAndroidReleaseVersion, publishedVersionNames, type AndroidReleaseVersion, type PickAndroidReleaseVersionInput, type PublishedReleases, type VersionNameSource, } from "./android-release-version.js";
package/dist/index.js CHANGED
@@ -10,5 +10,5 @@ export { CHECK_IDS, checkCiReusableWorkflow, checkConfigVersion, checkNoEslint,
10
10
  export { REACT_DEDUPE, defineWebViteConfig, defineWebVitestConfig, reactPlugins, srcAlias, vendorChunkBuild, } from "./vite.js";
11
11
  export { defineExpoMetroConfig, expoBabelConfig, } from "./expo.js";
12
12
  export { DEFAULT_RELEASE_SIGNING_MARKER, appendReleaseSigning, releaseSigningGradle, withReleaseSigning, } from "./release-signing.js";
13
- export { DEFAULT_GRADLE_PROPERTY_EDITS, apkFileName, easProfileEntries, formatGithubOutput, formatReleaseJson, gradlePropertiesEdits, parseAndroidReleaseConfig, parseBadging, publicEnvDefault, readExpoVersion, releaseJson, syncPackageJsonVersion, syncExpoVersion, validateVersionCode, validateVersionName, gradleVersionNameOk, } from "./android-release.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
14
  export { compareSemver, highestSemver, isSemver, pickAndroidReleaseVersion, publishedVersionNames, } from "./android-release-version.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vvedantb/config",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "license": "MIT",
5
5
  "description": "Shared tsconfig bases, oxlint base, Vite, Vitest, Babel and Metro presets, a WXT preset and host-permission helper for Chrome extensions, pinned tool versions, a sync CLI for Claude commands, CLAUDE.md, Cursor environment and Convex tsconfig, a packaged Electron app.asar module check, a shared header and footer check, a no-source-text-in-tests check, shared oxlint JS plugins and a CLI that adds an extension to Clerk's allowed origins.",
6
6
  "type": "module",