@forthtilliath/expo-config-plugins 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +72 -2
- package/dist/transforms.d.ts +60 -0
- package/dist/transforms.d.ts.map +1 -0
- package/dist/transforms.js +89 -0
- package/dist/withAndroidAbis.d.ts +13 -0
- package/dist/withAndroidAbis.d.ts.map +1 -0
- package/dist/withAndroidAbis.js +16 -0
- package/dist/withReleaseSigning.d.ts +15 -0
- package/dist/withReleaseSigning.d.ts.map +1 -0
- package/dist/withReleaseSigning.js +18 -0
- package/dist/withShortCxxPath.d.ts +13 -0
- package/dist/withShortCxxPath.d.ts.map +1 -0
- package/dist/withShortCxxPath.js +21 -0
- package/package.json +46 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Forthtilliath
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,73 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @forthtilliath/expo-config-plugins
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Expo config plugins for sideloaded Android apps (APKs shared directly, not through a store).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install --save-dev @forthtilliath/expo-config-plugins
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
`expo` is a peer dependency. Then list the plugins in `app.json`, and run `npx expo prebuild` again.
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"expo": {
|
|
16
|
+
"plugins": [
|
|
17
|
+
[
|
|
18
|
+
"@forthtilliath/expo-config-plugins/withReleaseSigning",
|
|
19
|
+
{ "propertyPrefix": "MYAPP" }
|
|
20
|
+
],
|
|
21
|
+
"@forthtilliath/expo-config-plugins/withAndroidAbis",
|
|
22
|
+
"@forthtilliath/expo-config-plugins/withShortCxxPath"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## `withReleaseSigning` — sign releases with your own key
|
|
29
|
+
|
|
30
|
+
Out of the box, an Expo release APK is signed with React Native's `debug.keystore` — **the same public key in every React Native project**: anyone could sign an APK that Android accepts as an update of yours. This plugin makes the release build use your upload key instead, read from Gradle properties that stay out of the repository:
|
|
31
|
+
|
|
32
|
+
```properties
|
|
33
|
+
# ~/.gradle/gradle.properties (or ORG_GRADLE_PROJECT_MYAPP_UPLOAD_* variables)
|
|
34
|
+
MYAPP_UPLOAD_STORE_FILE=C:/keys/myapp-upload.jks
|
|
35
|
+
MYAPP_UPLOAD_STORE_PASSWORD=…
|
|
36
|
+
MYAPP_UPLOAD_KEY_ALIAS=upload
|
|
37
|
+
MYAPP_UPLOAD_KEY_PASSWORD=…
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Without these properties the release build **fails** ("Keystore file not set") rather than falling back to the debug key. If Expo's Gradle template changes and the signing block can't be found, the prebuild fails too. The debug build is untouched.
|
|
41
|
+
|
|
42
|
+
| Option | Type | Notes |
|
|
43
|
+
| ---------------- | -------- | ---------------------------------------------------------------------------------- |
|
|
44
|
+
| `propertyPrefix` | `string` | Required, upper case (`MYAPP` → `MYAPP_UPLOAD_*`). One prefix per app and per key. |
|
|
45
|
+
|
|
46
|
+
## `withAndroidAbis` — real phones only
|
|
47
|
+
|
|
48
|
+
Ships native code for 32- and 64-bit ARM only: x86 / x86_64 only serve emulators and nearly double the APK's size. `expo run:android` still builds for the connected device's ABI.
|
|
49
|
+
|
|
50
|
+
| Option | Type | Default |
|
|
51
|
+
| ------ | ---------- | ------------------------------ |
|
|
52
|
+
| `abis` | `string[]` | `["armeabi-v7a", "arm64-v8a"]` |
|
|
53
|
+
|
|
54
|
+
## `withShortCxxPath` — Windows path length
|
|
55
|
+
|
|
56
|
+
On Windows, release builds can overflow the 260-character path limit inside `android/app/.cxx` (react-native-gesture-handler's codegen paths). This plugin moves CMake's staging directory to a short path. It does nothing on other systems unless `stagingDir` is set.
|
|
57
|
+
|
|
58
|
+
| Option | Type | Default |
|
|
59
|
+
| ------------ | -------- | --------------------------------- |
|
|
60
|
+
| `stagingDir` | `string` | `C:/rncxx` on Windows, else unset |
|
|
61
|
+
|
|
62
|
+
## Testing your own setup
|
|
63
|
+
|
|
64
|
+
The transforms behind the plugins are exported as pure functions from `@forthtilliath/expo-config-plugins/transforms` (`applyReleaseSigning`, `applyAndroidAbis`, `applyShortCxxPath`).
|
|
65
|
+
|
|
66
|
+
## Scripts
|
|
67
|
+
|
|
68
|
+
| Script | What it does |
|
|
69
|
+
| ------------- | ------------------------------ |
|
|
70
|
+
| `build` | Compiles `src/` to CommonJS. |
|
|
71
|
+
| `test` | Runs the transform tests. |
|
|
72
|
+
| `lint` | ESLint, zero warnings allowed. |
|
|
73
|
+
| `check-types` | Type-checks without emitting. |
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Makes `android/app/build.gradle` sign release builds with the app's own
|
|
3
|
+
* upload key, read from `<PREFIX>_UPLOAD_*` Gradle properties, instead of
|
|
4
|
+
* React Native's **public** `debug.keystore`. The debug build is untouched;
|
|
5
|
+
* already-patched contents are returned as is.
|
|
6
|
+
*
|
|
7
|
+
* @throws When `prefix` isn't an upper-case identifier, or when the expected
|
|
8
|
+
* signing block isn't there — failing the prebuild beats shipping an APK
|
|
9
|
+
* signed with the debug key.
|
|
10
|
+
*/
|
|
11
|
+
export declare function applyReleaseSigning(contents: string, prefix: string | undefined): string;
|
|
12
|
+
/** One entry of `gradle.properties`, as Expo's `withGradleProperties` exposes it. */
|
|
13
|
+
export type GradlePropertiesItem = {
|
|
14
|
+
type: "property";
|
|
15
|
+
key: string;
|
|
16
|
+
value: string;
|
|
17
|
+
} | {
|
|
18
|
+
type: "comment";
|
|
19
|
+
value: string;
|
|
20
|
+
} | {
|
|
21
|
+
type: "empty";
|
|
22
|
+
};
|
|
23
|
+
/** Real phones only: 32- and 64-bit ARM. */
|
|
24
|
+
export declare const ARM_ABIS: readonly string[];
|
|
25
|
+
/**
|
|
26
|
+
* Sets `reactNativeArchitectures` in `gradle.properties` (in place), so the
|
|
27
|
+
* APK only ships native code for `abis` — x86 / x86_64 only serve emulators
|
|
28
|
+
* and nearly double the APK's size. `expo run:android` still passes the
|
|
29
|
+
* device's own ABI, which wins over this value in development.
|
|
30
|
+
*/
|
|
31
|
+
export declare function applyAndroidAbis(properties: GradlePropertiesItem[], abis?: readonly string[]): GradlePropertiesItem[];
|
|
32
|
+
/**
|
|
33
|
+
* Moves the CMake staging directory (`.cxx`) out of `android/app` to
|
|
34
|
+
* `stagingDir`: nested in the project, release builds overflow Windows'
|
|
35
|
+
* 260-character path limit on react-native-gesture-handler's codegen paths.
|
|
36
|
+
* Already-patched contents are returned as is.
|
|
37
|
+
*
|
|
38
|
+
* @throws When the `namespace` line to anchor on isn't found.
|
|
39
|
+
*/
|
|
40
|
+
export declare function applyShortCxxPath(contents: string, stagingDir: string): string;
|
|
41
|
+
export interface ReleaseSigningOptions {
|
|
42
|
+
/**
|
|
43
|
+
* Prefix of the Gradle properties holding the upload key, e.g. `MYAPP` for
|
|
44
|
+
* `MYAPP_UPLOAD_STORE_FILE`, `MYAPP_UPLOAD_STORE_PASSWORD`,
|
|
45
|
+
* `MYAPP_UPLOAD_KEY_ALIAS`, `MYAPP_UPLOAD_KEY_PASSWORD`.
|
|
46
|
+
*/
|
|
47
|
+
propertyPrefix?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface AndroidAbisOptions {
|
|
50
|
+
/** @defaultValue `["armeabi-v7a", "arm64-v8a"]` — real phones only */
|
|
51
|
+
abis?: string[];
|
|
52
|
+
}
|
|
53
|
+
export interface ShortCxxPathOptions {
|
|
54
|
+
/**
|
|
55
|
+
* Where CMake stages native builds. Given, it always applies; omitted, the
|
|
56
|
+
* plugin only acts on Windows, with `C:/rncxx`.
|
|
57
|
+
*/
|
|
58
|
+
stagingDir?: string;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=transforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transforms.d.ts","sourceRoot":"","sources":["../src/transforms.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,MAAM,CAmBR;AAED,qFAAqF;AACrF,MAAM,MAAM,oBAAoB,GAC5B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtB,4CAA4C;AAC5C,eAAO,MAAM,QAAQ,EAAE,SAAS,MAAM,EAAiC,CAAC;AAExE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,oBAAoB,EAAE,EAClC,IAAI,GAAE,SAAS,MAAM,EAAa,GACjC,oBAAoB,EAAE,CAcxB;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,CAiBR;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// The plugins' actual work, as pure functions over the generated files'
|
|
3
|
+
// contents — testable without running `expo prebuild` — and their options.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.ARM_ABIS = void 0;
|
|
6
|
+
exports.applyReleaseSigning = applyReleaseSigning;
|
|
7
|
+
exports.applyAndroidAbis = applyAndroidAbis;
|
|
8
|
+
exports.applyShortCxxPath = applyShortCxxPath;
|
|
9
|
+
/** The `signingConfig signingConfigs.debug` of the `release` build type (not the `debug` one's). */
|
|
10
|
+
const RELEASE_USES_DEBUG_KEY = /(buildTypes\s*\{[\s\S]*?release\s*\{[^}]*?)signingConfig signingConfigs\.debug/;
|
|
11
|
+
function releaseSigningConfig(prefix) {
|
|
12
|
+
const property = (name) => `findProperty('${prefix}_UPLOAD_${name}')`;
|
|
13
|
+
return `signingConfigs {
|
|
14
|
+
release {
|
|
15
|
+
if (${property("STORE_FILE")}) {
|
|
16
|
+
storeFile file(${property("STORE_FILE")})
|
|
17
|
+
storePassword ${property("STORE_PASSWORD")}
|
|
18
|
+
keyAlias ${property("KEY_ALIAS")}
|
|
19
|
+
keyPassword ${property("KEY_PASSWORD")}
|
|
20
|
+
}
|
|
21
|
+
}`;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Makes `android/app/build.gradle` sign release builds with the app's own
|
|
25
|
+
* upload key, read from `<PREFIX>_UPLOAD_*` Gradle properties, instead of
|
|
26
|
+
* React Native's **public** `debug.keystore`. The debug build is untouched;
|
|
27
|
+
* already-patched contents are returned as is.
|
|
28
|
+
*
|
|
29
|
+
* @throws When `prefix` isn't an upper-case identifier, or when the expected
|
|
30
|
+
* signing block isn't there — failing the prebuild beats shipping an APK
|
|
31
|
+
* signed with the debug key.
|
|
32
|
+
*/
|
|
33
|
+
function applyReleaseSigning(contents, prefix) {
|
|
34
|
+
if (prefix === undefined || !/^[A-Z][A-Z0-9_]*$/.test(prefix)) {
|
|
35
|
+
throw new Error("withReleaseSigning: missing or invalid propertyPrefix option (e.g. MYAPP)");
|
|
36
|
+
}
|
|
37
|
+
if (contents.includes("signingConfig signingConfigs.release"))
|
|
38
|
+
return contents;
|
|
39
|
+
if (!RELEASE_USES_DEBUG_KEY.test(contents) ||
|
|
40
|
+
!contents.includes("signingConfigs {")) {
|
|
41
|
+
throw new Error("withReleaseSigning: signing block not found in android/app/build.gradle");
|
|
42
|
+
}
|
|
43
|
+
return contents
|
|
44
|
+
.replace(RELEASE_USES_DEBUG_KEY, "$1signingConfig signingConfigs.release")
|
|
45
|
+
.replace("signingConfigs {", releaseSigningConfig(prefix));
|
|
46
|
+
}
|
|
47
|
+
/** Real phones only: 32- and 64-bit ARM. */
|
|
48
|
+
exports.ARM_ABIS = ["armeabi-v7a", "arm64-v8a"];
|
|
49
|
+
/**
|
|
50
|
+
* Sets `reactNativeArchitectures` in `gradle.properties` (in place), so the
|
|
51
|
+
* APK only ships native code for `abis` — x86 / x86_64 only serve emulators
|
|
52
|
+
* and nearly double the APK's size. `expo run:android` still passes the
|
|
53
|
+
* device's own ABI, which wins over this value in development.
|
|
54
|
+
*/
|
|
55
|
+
function applyAndroidAbis(properties, abis = exports.ARM_ABIS) {
|
|
56
|
+
const value = abis.join(",");
|
|
57
|
+
const existing = properties.find((item) => item.type === "property" && item.key === "reactNativeArchitectures");
|
|
58
|
+
if (existing)
|
|
59
|
+
existing.value = value;
|
|
60
|
+
else
|
|
61
|
+
properties.push({
|
|
62
|
+
type: "property",
|
|
63
|
+
key: "reactNativeArchitectures",
|
|
64
|
+
value,
|
|
65
|
+
});
|
|
66
|
+
return properties;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Moves the CMake staging directory (`.cxx`) out of `android/app` to
|
|
70
|
+
* `stagingDir`: nested in the project, release builds overflow Windows'
|
|
71
|
+
* 260-character path limit on react-native-gesture-handler's codegen paths.
|
|
72
|
+
* Already-patched contents are returned as is.
|
|
73
|
+
*
|
|
74
|
+
* @throws When the `namespace` line to anchor on isn't found.
|
|
75
|
+
*/
|
|
76
|
+
function applyShortCxxPath(contents, stagingDir) {
|
|
77
|
+
if (contents.includes("buildStagingDirectory"))
|
|
78
|
+
return contents;
|
|
79
|
+
if (!contents.includes(" namespace")) {
|
|
80
|
+
throw new Error("withShortCxxPath: `namespace` line not found in android/app/build.gradle");
|
|
81
|
+
}
|
|
82
|
+
return contents.replace(" namespace", ` externalNativeBuild {
|
|
83
|
+
cmake {
|
|
84
|
+
buildStagingDirectory "${stagingDir.replace(/\\/g, "/")}"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
namespace`);
|
|
89
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ConfigPlugin } from "expo/config-plugins";
|
|
2
|
+
import { type AndroidAbisOptions } from "./transforms.js";
|
|
3
|
+
/**
|
|
4
|
+
* Ships native code for real phones only (32- and 64-bit ARM) by default:
|
|
5
|
+
* x86 / x86_64 only serve emulators and nearly double the APK's size.
|
|
6
|
+
* `expo run:android` still passes the device's own ABI in development.
|
|
7
|
+
*
|
|
8
|
+
* `"@forthtilliath/expo-config-plugins/withAndroidAbis"`, or
|
|
9
|
+
* `["@forthtilliath/expo-config-plugins/withAndroidAbis", { "abis": ["arm64-v8a"] }]`
|
|
10
|
+
*/
|
|
11
|
+
declare const withAndroidAbis: ConfigPlugin<AndroidAbisOptions | undefined>;
|
|
12
|
+
export = withAndroidAbis;
|
|
13
|
+
//# sourceMappingURL=withAndroidAbis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withAndroidAbis.d.ts","sourceRoot":"","sources":["../src/withAndroidAbis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAwB,MAAM,qBAAqB,CAAC;AAE9E,OAAO,EAAE,KAAK,kBAAkB,EAAoB,MAAM,iBAAiB,CAAC;AAE5E;;;;;;;GAOG;AACH,QAAA,MAAM,eAAe,EAAE,YAAY,CAAC,kBAAkB,GAAG,SAAS,CAO9D,CAAC;AAEL,SAAS,eAAe,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
3
|
+
const transforms_js_1 = require("./transforms.js");
|
|
4
|
+
/**
|
|
5
|
+
* Ships native code for real phones only (32- and 64-bit ARM) by default:
|
|
6
|
+
* x86 / x86_64 only serve emulators and nearly double the APK's size.
|
|
7
|
+
* `expo run:android` still passes the device's own ABI in development.
|
|
8
|
+
*
|
|
9
|
+
* `"@forthtilliath/expo-config-plugins/withAndroidAbis"`, or
|
|
10
|
+
* `["@forthtilliath/expo-config-plugins/withAndroidAbis", { "abis": ["arm64-v8a"] }]`
|
|
11
|
+
*/
|
|
12
|
+
const withAndroidAbis = (config, options) => (0, config_plugins_1.withGradleProperties)(config, (mod) => {
|
|
13
|
+
(0, transforms_js_1.applyAndroidAbis)(mod.modResults, options?.abis);
|
|
14
|
+
return mod;
|
|
15
|
+
});
|
|
16
|
+
module.exports = withAndroidAbis;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ConfigPlugin } from "expo/config-plugins";
|
|
2
|
+
import { type ReleaseSigningOptions } from "./transforms.js";
|
|
3
|
+
/**
|
|
4
|
+
* Signs the release APK with the app's own upload key instead of React
|
|
5
|
+
* Native's public `debug.keystore` (the same key in every RN project: anyone
|
|
6
|
+
* could sign a fake update). The key and its passwords stay out of the repo,
|
|
7
|
+
* read as Gradle properties (`~/.gradle/gradle.properties` or
|
|
8
|
+
* `ORG_GRADLE_PROJECT_*` variables). Without them the release build fails
|
|
9
|
+
* ("Keystore file not set") instead of falling back to the debug key.
|
|
10
|
+
*
|
|
11
|
+
* `["@forthtilliath/expo-config-plugins/withReleaseSigning", { "propertyPrefix": "MYAPP" }]`
|
|
12
|
+
*/
|
|
13
|
+
declare const withReleaseSigning: ConfigPlugin<ReleaseSigningOptions | undefined>;
|
|
14
|
+
export = withReleaseSigning;
|
|
15
|
+
//# sourceMappingURL=withReleaseSigning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withReleaseSigning.d.ts","sourceRoot":"","sources":["../src/withReleaseSigning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;GASG;AACH,QAAA,MAAM,kBAAkB,EAAE,YAAY,CAAC,qBAAqB,GAAG,SAAS,CAUpE,CAAC;AAEL,SAAS,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
3
|
+
const transforms_js_1 = require("./transforms.js");
|
|
4
|
+
/**
|
|
5
|
+
* Signs the release APK with the app's own upload key instead of React
|
|
6
|
+
* Native's public `debug.keystore` (the same key in every RN project: anyone
|
|
7
|
+
* could sign a fake update). The key and its passwords stay out of the repo,
|
|
8
|
+
* read as Gradle properties (`~/.gradle/gradle.properties` or
|
|
9
|
+
* `ORG_GRADLE_PROJECT_*` variables). Without them the release build fails
|
|
10
|
+
* ("Keystore file not set") instead of falling back to the debug key.
|
|
11
|
+
*
|
|
12
|
+
* `["@forthtilliath/expo-config-plugins/withReleaseSigning", { "propertyPrefix": "MYAPP" }]`
|
|
13
|
+
*/
|
|
14
|
+
const withReleaseSigning = (config, options) => (0, config_plugins_1.withAppBuildGradle)(config, (mod) => {
|
|
15
|
+
mod.modResults.contents = (0, transforms_js_1.applyReleaseSigning)(mod.modResults.contents, options?.propertyPrefix);
|
|
16
|
+
return mod;
|
|
17
|
+
});
|
|
18
|
+
module.exports = withReleaseSigning;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ConfigPlugin } from "expo/config-plugins";
|
|
2
|
+
import { type ShortCxxPathOptions } from "./transforms.js";
|
|
3
|
+
/**
|
|
4
|
+
* Moves the CMake staging directory (`.cxx`) out of the project: on Windows,
|
|
5
|
+
* release builds overflow the 260-character path limit on
|
|
6
|
+
* react-native-gesture-handler's codegen paths. A no-op on other systems
|
|
7
|
+
* unless `stagingDir` is set.
|
|
8
|
+
*
|
|
9
|
+
* `"@forthtilliath/expo-config-plugins/withShortCxxPath"`
|
|
10
|
+
*/
|
|
11
|
+
declare const withShortCxxPath: ConfigPlugin<ShortCxxPathOptions | undefined>;
|
|
12
|
+
export = withShortCxxPath;
|
|
13
|
+
//# sourceMappingURL=withShortCxxPath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withShortCxxPath.d.ts","sourceRoot":"","sources":["../src/withShortCxxPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAqB,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE9E;;;;;;;GAOG;AACH,QAAA,MAAM,gBAAgB,EAAE,YAAY,CAAC,mBAAmB,GAAG,SAAS,CAcnE,CAAC;AAEF,SAAS,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
3
|
+
const transforms_js_1 = require("./transforms.js");
|
|
4
|
+
/**
|
|
5
|
+
* Moves the CMake staging directory (`.cxx`) out of the project: on Windows,
|
|
6
|
+
* release builds overflow the 260-character path limit on
|
|
7
|
+
* react-native-gesture-handler's codegen paths. A no-op on other systems
|
|
8
|
+
* unless `stagingDir` is set.
|
|
9
|
+
*
|
|
10
|
+
* `"@forthtilliath/expo-config-plugins/withShortCxxPath"`
|
|
11
|
+
*/
|
|
12
|
+
const withShortCxxPath = (config, options) => {
|
|
13
|
+
const stagingDir = options?.stagingDir ?? (process.platform === "win32" ? "C:/rncxx" : null);
|
|
14
|
+
if (!stagingDir)
|
|
15
|
+
return config;
|
|
16
|
+
return (0, config_plugins_1.withAppBuildGradle)(config, (mod) => {
|
|
17
|
+
mod.modResults.contents = (0, transforms_js_1.applyShortCxxPath)(mod.modResults.contents, stagingDir);
|
|
18
|
+
return mod;
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
module.exports = withShortCxxPath;
|
package/package.json
CHANGED
|
@@ -1,6 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forthtilliath/expo-config-plugins",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Expo config plugins for sideloaded Android apps: release signing with your own key, ARM-only native code, short CMake paths on Windows.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/Forthtilliath/forthtilliath-packages.git",
|
|
12
|
+
"directory": "packages/expo-config-plugins"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/Forthtilliath/forthtilliath-packages/tree/main/packages/expo-config-plugins#readme",
|
|
15
|
+
"bugs": "https://github.com/Forthtilliath/forthtilliath-packages/issues",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"exports": {
|
|
20
|
+
"./withReleaseSigning": "./dist/withReleaseSigning.js",
|
|
21
|
+
"./withAndroidAbis": "./dist/withAndroidAbis.js",
|
|
22
|
+
"./withShortCxxPath": "./dist/withShortCxxPath.js",
|
|
23
|
+
"./transforms": "./dist/transforms.js",
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"expo": ">=54.0.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^26.2.0",
|
|
31
|
+
"@vitest/coverage-v8": "5.0.2",
|
|
32
|
+
"eslint": "10.7.0",
|
|
33
|
+
"expo": "~57.0.9",
|
|
34
|
+
"typescript": "^5.9.3",
|
|
35
|
+
"vitest": "^5.0.2",
|
|
36
|
+
"@forthtilliath/eslint-config": "0.9.0",
|
|
37
|
+
"@forthtilliath/typescript-config": "0.1.1"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"lint": "eslint . --max-warnings 0",
|
|
41
|
+
"check-types": "tsc --noEmit",
|
|
42
|
+
"clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
43
|
+
"dev": "tsc --watch -p tsconfig.build.json",
|
|
44
|
+
"build": "pnpm run clean && tsc -p tsconfig.build.json",
|
|
45
|
+
"test": "vitest run",
|
|
46
|
+
"test:watch": "vitest",
|
|
47
|
+
"coverage": "vitest run --coverage"
|
|
48
|
+
}
|
|
6
49
|
}
|