create-disposabl-app 0.3.1 → 0.3.3

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 (42) hide show
  1. package/dist/index.js +36 -8
  2. package/dist/templates/default/.github/README.md +99 -57
  3. package/dist/templates/default/.github/actionlint.yaml +6 -0
  4. package/dist/templates/default/.github/workflows/pipeline.yml.example +492 -0
  5. package/dist/templates/default/apps/desktop/README.md +44 -14
  6. package/dist/templates/default/apps/desktop/build-ci.mjs +56 -0
  7. package/dist/templates/default/apps/desktop/forge.config.mts +36 -17
  8. package/dist/templates/default/apps/desktop/package.json +5 -5
  9. package/dist/templates/default/apps/mobile/README.md +127 -0
  10. package/dist/templates/default/apps/mobile/app.config.js +78 -0
  11. package/dist/templates/default/apps/mobile/assets/expo.icon/icon.json +21 -26
  12. package/dist/templates/default/apps/mobile/eas.json +22 -0
  13. package/dist/templates/default/apps/mobile/eslint.config.js +3 -3
  14. package/dist/templates/default/apps/mobile/package.json +5 -3
  15. package/dist/templates/default/apps/mobile/plugins/with-android-signing.js +29 -0
  16. package/dist/templates/default/apps/mobile/scripts/android-config.test.mjs +128 -0
  17. package/dist/templates/default/apps/mobile/tsconfig.json +3 -12
  18. package/dist/templates/default/apps/web/src/index.css +124 -73
  19. package/dist/templates/default/apps/web/src/routeTree.gen.ts +0 -9
  20. package/dist/templates/default/bun.lock +121 -11
  21. package/dist/templates/default/bunfig.toml +8 -1
  22. package/dist/templates/default/disposabl.json +9 -4
  23. package/dist/templates/default/gitignore +2 -0
  24. package/dist/templates/default/package.json +1 -0
  25. package/dist/templates/default/packages/backend/convex/todos/internal.ts +3 -3
  26. package/dist/templates/default/packages/backend/generate.ts +114 -0
  27. package/dist/templates/default/packages/backend/generated/openapi.json +190 -0
  28. package/dist/templates/default/packages/backend/generated/platforms.ts +3 -0
  29. package/dist/templates/default/packages/backend/package.json +4 -3
  30. package/dist/templates/default/packages/disposabl-kit/client/styles/globals.css +43 -43
  31. package/dist/templates/default/packages/disposabl-kit/eslint.config.js +2 -2
  32. package/dist/templates/default/packages/disposabl-kit/package.json +2 -1
  33. package/dist/templates/default/packages/disposabl-kit/platforms.ts +87 -0
  34. package/dist/templates/default/packages/disposabl-kit/server/http.ts +37 -7
  35. package/dist/templates/default/packages/disposabl-kit/server/lib/functions.ts +1 -10
  36. package/dist/templates/default/packages/disposabl-kit/server/lib/platform-spec.ts +226 -0
  37. package/dist/templates/default/turbo.json +25 -5
  38. package/package.json +1 -1
  39. package/dist/templates/default/.github/workflows/pipeline.yml +0 -141
  40. package/dist/templates/default/packages/disposabl-kit/server/dev-setup.mjs +0 -39
  41. package/dist/templates/default/packages/disposabl-kit/server/lib/mcp-tools.ts +0 -47
  42. package/dist/templates/default/packages/disposabl-kit/server/lib/platforms.ts +0 -20
@@ -1,19 +1,49 @@
1
1
  import type { ForgeConfig } from '@electron-forge/shared-types';
2
2
  import { MakerSquirrel } from '@electron-forge/maker-squirrel';
3
- import { MakerZIP } from '@electron-forge/maker-zip';
3
+ import { MakerDMG } from '@electron-forge/maker-dmg';
4
4
  import { MakerDeb } from '@electron-forge/maker-deb';
5
5
  import { MakerRpm } from '@electron-forge/maker-rpm';
6
6
  import { VitePlugin } from '@electron-forge/plugin-vite';
7
7
  import { FusesPlugin } from '@electron-forge/plugin-fuses';
8
- import { PublisherGitHub } from '@electron-forge/publisher-github';
9
8
  import { FuseV1Options, FuseVersion } from '@electron/fuses';
10
9
 
10
+ const signedRelease =
11
+ process.platform === 'darwin' && process.env.MACOS_NOTARIZE === 'true';
12
+ if (
13
+ signedRelease &&
14
+ (!process.env.APPLE_API_KEY ||
15
+ !process.env.APPLE_API_KEY_ID ||
16
+ !process.env.APPLE_API_ISSUER)
17
+ )
18
+ throw new Error('macOS releases require Apple notarization credentials');
19
+
11
20
  const config: ForgeConfig = {
12
21
  packagerConfig: {
13
22
  asar: true,
14
- // Native bundle metadata needs a numeric version; package.json retains the PR suffix.
15
- appVersion: process.env.DESKTOP_VERSION?.split('-')[0],
16
- buildVersion: process.env.DESKTOP_VERSION?.split('-')[0],
23
+ appBundleId: process.env.MACOS_BUNDLE_ID || 'dev.disposabl.starter.desktop',
24
+ ...(process.platform === 'darwin'
25
+ ? {
26
+ osxSign: signedRelease
27
+ ? {}
28
+ : {
29
+ identity: '-',
30
+ identityValidation: false,
31
+ optionsForFile: () => ({
32
+ hardenedRuntime: false,
33
+ timestamp: 'none',
34
+ }),
35
+ },
36
+ }
37
+ : {}),
38
+ ...(signedRelease
39
+ ? {
40
+ osxNotarize: {
41
+ appleApiKey: process.env.APPLE_API_KEY!,
42
+ appleApiKeyId: process.env.APPLE_API_KEY_ID!,
43
+ appleApiIssuer: process.env.APPLE_API_ISSUER!,
44
+ },
45
+ }
46
+ : {}),
17
47
  download: {
18
48
  cacheRoot: process.env.electron_config_cache,
19
49
  },
@@ -34,21 +64,10 @@ const config: ForgeConfig = {
34
64
  },
35
65
  makers: [
36
66
  new MakerSquirrel({}),
37
- new MakerZIP({}, ['darwin']),
67
+ new MakerDMG({ format: 'ULFO' }),
38
68
  new MakerRpm({}),
39
69
  new MakerDeb({}),
40
70
  ],
41
- publishers: [
42
- new PublisherGitHub({
43
- repository: {
44
- owner: 'disposabl-dev',
45
- name: 'create-disposabl-app',
46
- },
47
- tagPrefix: 'desktop-v',
48
- draft: true,
49
- prerelease: false,
50
- }),
51
- ],
52
71
  plugins: [
53
72
  new VitePlugin({
54
73
  // `build` can specify multiple entry builds, which can be Main process, Preload scripts, Worker process, etc.
@@ -24,11 +24,11 @@
24
24
  "make:windows": "electron-forge make --platform=win32 --arch=x64",
25
25
  "make:linux": "electron-forge make --platform=linux --arch=x64",
26
26
  "make:macos": "electron-forge make --platform=darwin --arch=arm64",
27
- "release": "electron-forge release",
28
27
  "lint": "oxlint && oxfmt --check",
29
28
  "lint:fix": "oxlint --fix && oxfmt --write",
30
29
  "format": "oxfmt --write",
31
- "typecheck": "tsc --noEmit"
30
+ "typecheck": "tsc --noEmit",
31
+ "preview": "bun build-ci.mjs"
32
32
  },
33
33
  "dependencies": {
34
34
  "electron-squirrel-startup": "^1.0.1"
@@ -36,12 +36,11 @@
36
36
  "devDependencies": {
37
37
  "@electron-forge/cli": "8.0.1",
38
38
  "@electron-forge/maker-deb": "8.0.1",
39
+ "@electron-forge/maker-dmg": "8.0.1",
39
40
  "@electron-forge/maker-rpm": "8.0.1",
40
41
  "@electron-forge/maker-squirrel": "8.0.1",
41
- "@electron-forge/maker-zip": "8.0.1",
42
42
  "@electron-forge/plugin-fuses": "8.0.1",
43
43
  "@electron-forge/plugin-vite": "8.0.1",
44
- "@electron-forge/publisher-github": "8.0.1",
45
44
  "@electron-forge/shared-types": "8.0.1",
46
45
  "@electron/fuses": "^2.1.3",
47
46
  "@types/electron-squirrel-startup": "^1.0.2",
@@ -50,6 +49,7 @@
50
49
  "oxfmt": "^0.75.0",
51
50
  "oxlint": "^1.90.0",
52
51
  "typescript": "^6.0.2",
53
- "vite": "^8"
52
+ "vite": "^8",
53
+ "@electron-forge/publisher-github": "8.0.1"
54
54
  }
55
55
  }
@@ -0,0 +1,127 @@
1
+ # Mobile previews and updates
2
+
3
+ Mobile previews are release builds with embedded JavaScript, not development
4
+ clients. Android uses `assembleRelease`; iOS internal profiles explicitly disable
5
+ `developmentClient`. They run without Metro or Expo Go and use EAS Update for
6
+ compatible changes.
7
+
8
+ Select `android` in the root `disposabl.json`. When mobile or shared dependencies
9
+ change, CI computes the Expo fingerprint in the Web job after web/backend
10
+ deployment, reusing its runner and dependency install. The first run builds an
11
+ installable APK in a separate 4-vCPU Android job. Later runs with the same fingerprint
12
+ publish EAS Update from Web. Native jobs install only the mobile workspace using
13
+ the shared dependency cache. Android and iOS native builds run in parallel.
14
+ Linux and Windows start alongside Web.
15
+ All CI jobs run on Blacksmith. See [.github/README.md](../../.github/README.md)
16
+ for the job order and cache behavior.
17
+
18
+ Each PR uses its own `pr-<number>` channel and Android application ID. Production
19
+ uses `production`. A new PR needs its own first APK even when another PR has the
20
+ same native dependencies. Install that APK once; compatible JavaScript and asset
21
+ updates download on launch and normally apply on the following cold launch.
22
+
23
+ The last published APK is the baseline. Failed builds and partial uploads do
24
+ not advance it. A missing APK forces another build. Reverting a native change
25
+ also builds again, so users do not need to downgrade an older APK. An API or
26
+ authentication error fails CI rather than being interpreted as a missing build.
27
+
28
+ ## Link an Expo project
29
+
30
+ Each generated app needs its own Expo project. From `apps/mobile`, run:
31
+
32
+ ```sh
33
+ bunx eas-cli@27.2.0 init
34
+ bunx eas-cli@27.2.0 update:configure --platform android --environment preview
35
+ ```
36
+
37
+ For dynamic app config, the CLI may ask you to add the returned project ID.
38
+ The starter accepts `EXPO_PROJECT_ID`, `EXPO_OWNER`, and `EXPO_SLUG` in local
39
+ `.env.local` and as GitHub repository variables. It also accepts a committed
40
+ `extra.eas.projectId` and `owner` in `app.json`. `app.config.js` supplies the
41
+ fingerprint runtime policy and channel header for local Gradle builds, following
42
+ [Expo's standalone EAS Update setup](https://docs.expo.dev/eas-update/standalone-service/).
43
+ Do not commit local credentials or reuse the generator maintainer's Expo project.
44
+
45
+ Set these GitHub repository variables to the project returned by the CLI:
46
+
47
+ - `EXPO_PROJECT_ID`
48
+ - `EXPO_OWNER`
49
+ - `EXPO_SLUG`
50
+
51
+ Add an Expo access token as the `EXPO_TOKEN` GitHub secret. CI loads the EAS
52
+ `preview` environment for PRs, and `production` for `main`.
53
+ The backend deployment supplies the same URLs to web and mobile:
54
+ `CONVEX_URL` is the client API origin and `CONVEX_SITE_URL` is the HTTP/auth origin.
55
+ CI exports this pair once, generating the `VITE_` and `EXPO_PUBLIC_` aliases
56
+ for web builds, mobile fingerprinting, APK builds and EAS Update exports.
57
+ Turbo includes the web aliases in build cache keys. Saved EAS aliases are ignored;
58
+ conflicting canonical URLs fail the build. Each PR uses its own deployed backend.
59
+ EAS variables with secret visibility are not available to this local build or
60
+ update flow; native secrets must be supplied through GitHub Actions.
61
+
62
+ ## Build locally
63
+
64
+ Install Java 17 and the Android SDK, set `JAVA_HOME` and `ANDROID_HOME`, then:
65
+
66
+ ```sh
67
+ DISPOSABL_MOBILE_CHANNEL=development bunx expo run:android --variant release
68
+ ```
69
+
70
+ This is a release-mode build with its JavaScript bundled, so it runs without
71
+ Metro. Preview APKs use Expo's public debug signing key and a separate application
72
+ ID. CI's prebuild, Gradle build, caching and embedded fingerprint checks live
73
+ directly in `.github/workflows/pipeline.yml`; there is no Android build helper.
74
+
75
+ ## Production
76
+
77
+ Production builds require a persistent keystore. Add these GitHub secrets:
78
+
79
+ - `ANDROID_KEYSTORE_BASE64`: base64-encoded keystore file
80
+ - `ANDROID_KEYSTORE_PASSWORD`
81
+ - `ANDROID_KEY_ALIAS`
82
+ - `ANDROID_KEY_PASSWORD`
83
+
84
+ Keep the same key for later versions. CI writes it to a temporary file and
85
+ removes it after building. The version code comes from the workflow run number;
86
+ preserve increasing numbers if moving this workflow to another repository.
87
+ An OTA update does not require the signing key because it does not build an APK.
88
+
89
+ Native builds publish GitHub prereleases for previews and releases for
90
+ production. Web publishes Android after an update; the Android job publishes after a native build,
91
+ without waiting for desktop. Each PR reuses its Android release, normally
92
+ `app-pr-N-android`, replacing the APK/metadata and moving the tag to the tested
93
+ commit. Only a published APK with matching metadata and digest is reusable.
94
+ The job has `contents: write`; fork PRs never deploy or publish. There is no
95
+ intermediate Actions artifact. This workflow does not submit to Google Play or
96
+ the App Store.
97
+
98
+ The mobile UI is still the starter screen. Backend URLs are available to mobile
99
+ code through `process.env.EXPO_PUBLIC_CONVEX_URL` and
100
+ `process.env.EXPO_PUBLIC_CONVEX_SITE_URL`; mobile authentication is not added by
101
+ the distribution workflow.
102
+
103
+ ## iOS
104
+
105
+ When iOS is enabled and affected, the Web runner checks the latest
106
+ published iOS release for the same channel, project, bundle ID and runtime.
107
+ A matching IPA with a verified GitHub digest and unexpired provisioning profile
108
+ uses EAS Update. Otherwise a Blacksmith macOS runner performs an EAS local release
109
+ build using the remote signing credentials, then publishes its own iOS release.
110
+ That runner starts only when a new IPA is needed, after Web finishes, in parallel with any Android native build.
111
+
112
+ For an existing PR preview, platform selection compares against that platform's
113
+ last published source commit. Unchanged mobile code skips both native builds and
114
+ EAS Update. A successful iOS update advances the release's source commit and tag.
115
+
116
+ Each PR needs its own initial IPA because its channel is embedded in the app.
117
+ CI sets the EAS profile channel from the workflow's `CHANNEL`, verifies the IPA's
118
+ signature, bundle ID, embedded runtime and channel, and records its profile expiry.
119
+ Install the IPA on a registered iPhone; subsequent compatible changes use EAS
120
+ Update. Local builds are tracked by their GitHub release metadata, not EAS cloud
121
+ build history. Native builds take longer than the update-only path.
122
+
123
+ Internal distribution needs Apple signing credentials and registered devices.
124
+ CI uses the project's EAS ad hoc credentials automatically. Missing or invalid
125
+ credentials fail the iOS build instead of silently skipping it.
126
+ It does not require TestFlight or an App Store Connect app record. TestFlight is
127
+ a separate distribution option. The pipeline never submits to the App Store.
@@ -0,0 +1,78 @@
1
+ const { createHash } = require("node:crypto");
2
+ const project = require("../../package.json");
3
+
4
+ module.exports = ({ config }) => {
5
+ const channel =
6
+ process.env.DISPOSABL_MOBILE_CHANNEL ||
7
+ process.env.DISPOSABL_ANDROID_CHANNEL ||
8
+ (process.env.EAS_BUILD_PROFILE &&
9
+ require("./eas.json").build[process.env.EAS_BUILD_PROFILE]?.channel) ||
10
+ "development";
11
+ if (!/^[a-z][a-z0-9-]{0,62}$/.test(channel)) {
12
+ throw new Error("Invalid DISPOSABL_MOBILE_CHANNEL");
13
+ }
14
+ const projectId = process.env.EXPO_PROJECT_ID || config.extra?.eas?.projectId;
15
+ const suffix = createHash("sha256")
16
+ .update(project.name)
17
+ .digest("hex")
18
+ .slice(0, 12);
19
+ const basePackage = config.android?.package || `app.disposabl.a${suffix}`;
20
+ const versionCode = Number(process.env.DISPOSABL_ANDROID_VERSION_CODE || 1);
21
+ if (
22
+ !Number.isSafeInteger(versionCode) ||
23
+ versionCode < 1 ||
24
+ versionCode > 2100000000
25
+ ) {
26
+ throw new Error(
27
+ "DISPOSABL_ANDROID_VERSION_CODE must be a positive Android version code",
28
+ );
29
+ }
30
+ const iosBuildNumber = process.env.DISPOSABL_IOS_BUILD_NUMBER || "1";
31
+ if (!/^[1-9]\d*$/.test(iosBuildNumber))
32
+ throw new Error("Invalid DISPOSABL_IOS_BUILD_NUMBER");
33
+ // Fail instead of exporting an update against another preview's backend.
34
+ for (const name of ["CONVEX_URL", "CONVEX_SITE_URL"]) {
35
+ const deployed = process.env[name];
36
+ const exported = process.env[`EXPO_PUBLIC_${name}`];
37
+ if (deployed && deployed !== exported) {
38
+ throw new Error(
39
+ `EXPO_PUBLIC_${name} conflicts with the web deployment. Remove it from the shared EAS environment.`,
40
+ );
41
+ }
42
+ }
43
+ return {
44
+ ...config,
45
+ owner: process.env.EXPO_OWNER || config.owner,
46
+ slug: process.env.EXPO_SLUG || config.slug,
47
+ ios: {
48
+ ...config.ios,
49
+ ...(projectId ? { runtimeVersion: { policy: "fingerprint" } } : {}),
50
+ bundleIdentifier:
51
+ channel === "production"
52
+ ? config.ios?.bundleIdentifier || `app.disposabl.a${suffix}`
53
+ : `${config.ios?.bundleIdentifier || `app.disposabl.a${suffix}`}.preview`,
54
+ buildNumber: iosBuildNumber,
55
+ },
56
+ android: {
57
+ ...config.android,
58
+ ...(projectId ? { runtimeVersion: { policy: "fingerprint" } } : {}),
59
+ package:
60
+ channel === "production"
61
+ ? basePackage
62
+ : `${basePackage}.${channel.replaceAll("-", "")}`,
63
+ versionCode,
64
+ },
65
+ plugins: [...(config.plugins || []), "./plugins/with-android-signing.js"],
66
+ ...(projectId
67
+ ? {
68
+ runtimeVersion: { policy: "fingerprint" },
69
+ updates: {
70
+ ...config.updates,
71
+ url: `https://u.expo.dev/${projectId}`,
72
+ requestHeaders: { "expo-channel-name": channel },
73
+ },
74
+ extra: { ...config.extra, eas: { ...config.extra?.eas, projectId } },
75
+ }
76
+ : {}),
77
+ };
78
+ };
@@ -1,40 +1,35 @@
1
1
  {
2
- "fill" : {
3
- "automatic-gradient" : "extended-srgb:0.00000,0.47843,1.00000,1.00000"
2
+ "fill": {
3
+ "automatic-gradient": "extended-srgb:0.00000,0.47843,1.00000,1.00000"
4
4
  },
5
- "groups" : [
5
+ "groups": [
6
6
  {
7
- "layers" : [
7
+ "layers": [
8
8
  {
9
- "image-name" : "expo-symbol 2.svg",
10
- "name" : "expo-symbol 2",
11
- "position" : {
12
- "scale" : 1,
13
- "translation-in-points" : [
14
- 1.1008400065293245e-05,
15
- -16.046875
16
- ]
9
+ "image-name": "expo-symbol 2.svg",
10
+ "name": "expo-symbol 2",
11
+ "position": {
12
+ "scale": 1,
13
+ "translation-in-points": [1.1008400065293245e-5, -16.046875]
17
14
  }
18
15
  },
19
16
  {
20
- "image-name" : "grid.png",
21
- "name" : "grid"
17
+ "image-name": "grid.png",
18
+ "name": "grid"
22
19
  }
23
20
  ],
24
- "shadow" : {
25
- "kind" : "neutral",
26
- "opacity" : 0.5
21
+ "shadow": {
22
+ "kind": "neutral",
23
+ "opacity": 0.5
27
24
  },
28
- "translucency" : {
29
- "enabled" : true,
30
- "value" : 0.5
25
+ "translucency": {
26
+ "enabled": true,
27
+ "value": 0.5
31
28
  }
32
29
  }
33
30
  ],
34
- "supported-platforms" : {
35
- "circles" : [
36
- "watchOS"
37
- ],
38
- "squares" : "shared"
31
+ "supported-platforms": {
32
+ "circles": ["watchOS"],
33
+ "squares": "shared"
39
34
  }
40
- }
35
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "cli": {
3
+ "version": ">= 27.2.0",
4
+ "appVersionSource": "local"
5
+ },
6
+ "build": {
7
+ "ios-preview": {
8
+ "developmentClient": false,
9
+ "distribution": "internal",
10
+ "environment": "preview",
11
+ "credentialsSource": "remote",
12
+ "channel": "preview"
13
+ },
14
+ "ios-production": {
15
+ "developmentClient": false,
16
+ "distribution": "internal",
17
+ "environment": "production",
18
+ "credentialsSource": "remote",
19
+ "channel": "production"
20
+ }
21
+ }
22
+ }
@@ -1,10 +1,10 @@
1
1
  // https://docs.expo.dev/guides/using-eslint/
2
- const { defineConfig } = require('eslint/config');
3
- const expoConfig = require('eslint-config-expo/flat');
2
+ const { defineConfig } = require("eslint/config");
3
+ const expoConfig = require("eslint-config-expo/flat");
4
4
 
5
5
  module.exports = defineConfig([
6
6
  expoConfig,
7
7
  {
8
- ignores: ['dist/*'],
8
+ ignores: ["dist/*"],
9
9
  },
10
10
  ]);
@@ -16,6 +16,7 @@
16
16
  "expo-status-bar": "~58.0.4",
17
17
  "expo-symbols": "~58.0.4",
18
18
  "expo-system-ui": "~58.0.6",
19
+ "expo-updates": "~58.0.20",
19
20
  "expo-web-browser": "~58.0.6",
20
21
  "react": "19.3.0",
21
22
  "react-native": "0.88.0",
@@ -33,11 +34,12 @@
33
34
  },
34
35
  "scripts": {
35
36
  "start": "expo start",
36
- "android": "expo start --android",
37
- "ios": "expo start --ios",
37
+ "android": "expo run:android",
38
+ "ios": "expo run:ios",
38
39
  "lint": "expo lint",
39
40
  "dev": "expo start",
40
- "typecheck": "tsc --noEmit"
41
+ "typecheck": "tsc --noEmit",
42
+ "build:ios": "bunx eas-cli@27.2.0 build --platform ios --profile ios-preview --local"
41
43
  },
42
44
  "private": true
43
45
  }
@@ -0,0 +1,29 @@
1
+ const { withAppBuildGradle } = require("expo/config-plugins");
2
+
3
+ // Generated by Expo prebuild; credentials are read by Gradle, never embedded in config.
4
+ module.exports = (config) =>
5
+ withAppBuildGradle(config, (mod) => {
6
+ if (mod.modResults.language !== "groovy")
7
+ throw new Error("Expected a Groovy Android build");
8
+ if (
9
+ mod.modResults.contents.includes("// Disposabl production APK signing.")
10
+ )
11
+ return mod;
12
+ mod.modResults.contents += `
13
+ // Disposabl production APK signing. Preview APKs retain Expo's debug signing.
14
+ if (System.getenv("DISPOSABL_ANDROID_CHANNEL") == "production") {
15
+ android {
16
+ signingConfigs {
17
+ disposablRelease {
18
+ storeFile file(System.getenv("ANDROID_KEYSTORE_PATH"))
19
+ storePassword System.getenv("ANDROID_KEYSTORE_PASSWORD")
20
+ keyAlias System.getenv("ANDROID_KEY_ALIAS")
21
+ keyPassword System.getenv("ANDROID_KEY_PASSWORD")
22
+ }
23
+ }
24
+ buildTypes.release.signingConfig = signingConfigs.disposablRelease
25
+ }
26
+ }
27
+ `;
28
+ return mod;
29
+ });
@@ -0,0 +1,128 @@
1
+ import { test } from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import configure from "../app.config.js";
4
+
5
+ function withEnv(values, action) {
6
+ const previous = { ...process.env };
7
+ for (const key of Object.keys(process.env)) {
8
+ if (/^(EXPO_|DISPOSABL_|CONVEX_)/.test(key)) delete process.env[key];
9
+ }
10
+ Object.assign(process.env, values);
11
+ try {
12
+ return action();
13
+ } finally {
14
+ process.env = previous;
15
+ }
16
+ }
17
+
18
+ test("PR installations and update channels are isolated from production", () => {
19
+ const config = {
20
+ slug: "app",
21
+ name: "App",
22
+ android: {
23
+ package: "app.example.mobile",
24
+ runtimeVersion: { policy: "appVersion" },
25
+ },
26
+ };
27
+ const result = withEnv(
28
+ { EXPO_PROJECT_ID: "test-id", DISPOSABL_ANDROID_CHANNEL: "pr-12" },
29
+ () => configure({ config }),
30
+ );
31
+ assert.equal(result.android.package, "app.example.mobile.pr12");
32
+ assert.equal(result.updates.requestHeaders["expo-channel-name"], "pr-12");
33
+ assert.deepEqual(result.android.runtimeVersion, { policy: "fingerprint" });
34
+ const production = withEnv(
35
+ { EXPO_PROJECT_ID: "test-id", DISPOSABL_ANDROID_CHANNEL: "production" },
36
+ () => configure({ config }),
37
+ );
38
+ assert.equal(production.android.package, "app.example.mobile");
39
+ assert.equal(
40
+ production.updates.requestHeaders["expo-channel-name"],
41
+ "production",
42
+ );
43
+ });
44
+
45
+ test("EAS cannot silently replace a deployed preview backend URL", () => {
46
+ assert.throws(
47
+ () =>
48
+ withEnv(
49
+ {
50
+ CONVEX_URL: "https://correct.convex.cloud",
51
+ EXPO_PUBLIC_CONVEX_URL: "https://wrong.convex.cloud",
52
+ },
53
+ () => configure({ config: {} }),
54
+ ),
55
+ /conflicts with the web deployment/,
56
+ );
57
+ });
58
+
59
+ test("invalid version codes and channel input fail before native compilation", () => {
60
+ for (const version of ["0", "-1", "1.2", "2100000001", "bad"]) {
61
+ assert.throws(
62
+ () =>
63
+ withEnv({ DISPOSABL_ANDROID_VERSION_CODE: version }, () =>
64
+ configure({ config: {} }),
65
+ ),
66
+ /version code/,
67
+ );
68
+ }
69
+ assert.throws(
70
+ () =>
71
+ withEnv({ DISPOSABL_ANDROID_CHANNEL: "pr-12\nother" }, () =>
72
+ configure({ config: {} }),
73
+ ),
74
+ /CHANNEL/,
75
+ );
76
+ });
77
+
78
+ test("iOS previews share a provisionable identity while their channels remain isolated", () => {
79
+ const config = { ios: { bundleIdentifier: "app.example.mobile" } };
80
+ const preview = (channel) =>
81
+ withEnv(
82
+ {
83
+ EXPO_PROJECT_ID: "test",
84
+ DISPOSABL_MOBILE_CHANNEL: channel,
85
+ DISPOSABL_IOS_BUILD_NUMBER: "42",
86
+ },
87
+ () => configure({ config }),
88
+ );
89
+ const first = preview("pr-12");
90
+ const second = preview("pr-13");
91
+ assert.equal(first.ios.bundleIdentifier, "app.example.mobile.preview");
92
+ assert.equal(second.ios.bundleIdentifier, first.ios.bundleIdentifier);
93
+ assert.equal(first.ios.buildNumber, "42");
94
+ assert.equal(first.updates.requestHeaders["expo-channel-name"], "pr-12");
95
+ assert.equal(second.updates.requestHeaders["expo-channel-name"], "pr-13");
96
+ assert.equal(
97
+ preview("production").ios.bundleIdentifier,
98
+ "app.example.mobile",
99
+ );
100
+ assert.throws(
101
+ () =>
102
+ withEnv({ DISPOSABL_IOS_BUILD_NUMBER: "bad" }, () =>
103
+ configure({ config }),
104
+ ),
105
+ /BUILD_NUMBER/,
106
+ );
107
+ });
108
+
109
+ test("preview naming can change without hardcoded PR syntax", () => {
110
+ const config = withEnv(
111
+ { EXPO_PROJECT_ID: "test", DISPOSABL_MOBILE_CHANNEL: "preview-42" },
112
+ () => configure({ config: { ios: { runtimeVersion: "old" } } }),
113
+ );
114
+ assert.equal(
115
+ config.updates.requestHeaders["expo-channel-name"],
116
+ "preview-42",
117
+ );
118
+ assert.deepEqual(config.ios.runtimeVersion, { policy: "fingerprint" });
119
+ assert.ok(config.android.package.endsWith(".preview42"));
120
+ });
121
+
122
+ test("manual EAS iOS builds use their profile channel", () => {
123
+ const config = withEnv(
124
+ { EXPO_PROJECT_ID: "test", EAS_BUILD_PROFILE: "ios-preview" },
125
+ () => configure({ config: {} }),
126
+ );
127
+ assert.equal(config.updates.requestHeaders["expo-channel-name"], "preview");
128
+ });
@@ -3,18 +3,9 @@
3
3
  "compilerOptions": {
4
4
  "strict": true,
5
5
  "paths": {
6
- "@/*": [
7
- "./src/*"
8
- ],
9
- "@/assets/*": [
10
- "./assets/*"
11
- ]
6
+ "@/*": ["./src/*"],
7
+ "@/assets/*": ["./assets/*"]
12
8
  }
13
9
  },
14
- "include": [
15
- "**/*.ts",
16
- "**/*.tsx",
17
- ".expo/types/**/*.ts",
18
- "expo-env.d.ts"
19
- ]
10
+ "include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.ts", "expo-env.d.ts"]
20
11
  }