create-disposabl-app 0.20.11 → 0.20.13
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/dist/disposabl.js +1 -1
- package/dist/index.js +22 -13
- package/dist/templates/default/.github/scripts/mobile.sh +4 -1
- package/dist/templates/default/apps/mobile/scripts/production-analytics.mjs +21 -0
- package/dist/templates/default/packages/tests/ios-ota.test.ts +10 -1
- package/package.json +1 -1
package/dist/disposabl.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1563,7 +1563,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
1563
1563
|
import { Command, CommanderError } from "commander";
|
|
1564
1564
|
import * as p2 from "@clack/prompts";
|
|
1565
1565
|
// package.json
|
|
1566
|
-
var version = "0.20.
|
|
1566
|
+
var version = "0.20.13";
|
|
1567
1567
|
|
|
1568
1568
|
// ../cli/telemetry.ts
|
|
1569
1569
|
var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
|
|
@@ -9226,6 +9226,23 @@ function validateAndroidArchitectures(values = defaultAndroidArchitectures) {
|
|
|
9226
9226
|
}
|
|
9227
9227
|
|
|
9228
9228
|
// scaffold.ts
|
|
9229
|
+
function formatGenerated(directory, files = []) {
|
|
9230
|
+
if (spawnSync("bun", ["fmt", "--no-script", "--help"], {
|
|
9231
|
+
cwd: directory,
|
|
9232
|
+
stdio: "ignore"
|
|
9233
|
+
}).status !== 0)
|
|
9234
|
+
return;
|
|
9235
|
+
try {
|
|
9236
|
+
execFileSync("bun", ["fmt", "--no-script", ...files], {
|
|
9237
|
+
cwd: directory,
|
|
9238
|
+
stdio: "pipe"
|
|
9239
|
+
});
|
|
9240
|
+
} catch (cause) {
|
|
9241
|
+
if (!files.length)
|
|
9242
|
+
throw cause;
|
|
9243
|
+
throw new Error("Configuration changes were saved, but formatting failed. " + "In the app directory, run bun fmt --no-script disposabl.json, " + "then retry the original generator command to continue.", { cause });
|
|
9244
|
+
}
|
|
9245
|
+
}
|
|
9229
9246
|
var authStarterPaths = [
|
|
9230
9247
|
"packages/disposabl-kit/client/routes/_auth-pages",
|
|
9231
9248
|
"packages/disposabl-kit/client/routes/consent.tsx",
|
|
@@ -9456,14 +9473,7 @@ main().catch((error) => {
|
|
|
9456
9473
|
}
|
|
9457
9474
|
await writeFile4(join4(destination, "disposabl.json"), JSON.stringify(config, null, 2) + `
|
|
9458
9475
|
`);
|
|
9459
|
-
|
|
9460
|
-
cwd: destination,
|
|
9461
|
-
stdio: "ignore"
|
|
9462
|
-
}).status === 0)
|
|
9463
|
-
execFileSync("bun", ["fmt", "--no-script"], {
|
|
9464
|
-
cwd: destination,
|
|
9465
|
-
stdio: "pipe"
|
|
9466
|
-
});
|
|
9476
|
+
formatGenerated(destination);
|
|
9467
9477
|
} catch (error) {
|
|
9468
9478
|
await rm4(destination, { recursive: true, force: true });
|
|
9469
9479
|
throw error;
|
|
@@ -9669,6 +9679,7 @@ async function reconfigureApp(template, directory, version, options) {
|
|
|
9669
9679
|
}
|
|
9670
9680
|
await writeFile5(join5(directory, configPath), JSON.stringify(config, null, 2) + `
|
|
9671
9681
|
`);
|
|
9682
|
+
formatGenerated(directory, [configPath]);
|
|
9672
9683
|
return config;
|
|
9673
9684
|
} finally {
|
|
9674
9685
|
await rm5(temp, { recursive: true, force: true });
|
|
@@ -9738,6 +9749,7 @@ async function setupApp(directory, name, run = runDisposabl) {
|
|
|
9738
9749
|
config.androidArchitectures = validateAndroidArchitectures(config.androidArchitectures);
|
|
9739
9750
|
await writeFile6(path, JSON.stringify(config, null, 2) + `
|
|
9740
9751
|
`);
|
|
9752
|
+
formatGenerated(directory, ["disposabl.json"]);
|
|
9741
9753
|
const status = await run(["login", "status"]);
|
|
9742
9754
|
if (!status.currentUser) {
|
|
9743
9755
|
await run(["login"], true);
|
|
@@ -9772,10 +9784,7 @@ async function setupApp(directory, name, run = runDisposabl) {
|
|
|
9772
9784
|
config.appId = app.appId;
|
|
9773
9785
|
await writeFile6(path, JSON.stringify(config, null, 2) + `
|
|
9774
9786
|
`);
|
|
9775
|
-
|
|
9776
|
-
cwd: directory,
|
|
9777
|
-
stdio: "pipe"
|
|
9778
|
-
});
|
|
9787
|
+
formatGenerated(directory, ["disposabl.json"]);
|
|
9779
9788
|
}
|
|
9780
9789
|
const configured = await run([
|
|
9781
9790
|
"previews",
|
|
@@ -68,6 +68,8 @@ bun x "$EAS_CLI" env:pull --environment "$EAS_ENVIRONMENT" --path "$RUNNER_TEMP/
|
|
|
68
68
|
bun -e '
|
|
69
69
|
import {parseEnv} from "node:util";
|
|
70
70
|
import {appendFileSync, readFileSync} from "node:fs";
|
|
71
|
+
import {productionAnalyticsEnabled} from "./scripts/production-analytics.mjs";
|
|
72
|
+
const effectiveEnv = {...process.env};
|
|
71
73
|
for (const [key, value] of Object.entries(parseEnv(readFileSync(`${process.env.RUNNER_TEMP}/expo.env`, "utf8")))) {
|
|
72
74
|
// Web and mobile use the same backend from this deployment.
|
|
73
75
|
const backend = /^(?:EXPO_PUBLIC_|VITE_)?(CONVEX_(?:URL|SITE_URL))$/.exec(key);
|
|
@@ -77,12 +79,13 @@ bun -e '
|
|
|
77
79
|
}
|
|
78
80
|
if (/^(GITHUB_|RUNNER_|GH_|DISPOSABL_|ANDROID_|UPDATE_POLICY$|BUN_|CI$|NODE_OPTIONS$|PATH$|HOME$|SOURCE(_PATH)?$|CHANNEL$|PLATFORM$|RELEASE_PREFIX$|MACOS_|EAS_(ENVIRONMENT|CLI)$|EXPO_(TOKEN|PROJECT_ID|OWNER|SLUG|NO_DOTENV)$)/.test(key)) throw new Error(`Reserved EAS variable: ${key}`);
|
|
79
81
|
if (key === "EXPO_PUBLIC_DISPOSABL_ANALYTICS_ENABLED") continue;
|
|
82
|
+
effectiveEnv[key] = value;
|
|
80
83
|
const delimiter = crypto.randomUUID();
|
|
81
84
|
appendFileSync(process.env.GITHUB_ENV, `${key}<<${delimiter}\n${value}\n${delimiter}\n`);
|
|
82
85
|
}
|
|
83
86
|
const site = JSON.parse(readFileSync("../web/site.json", "utf8"));
|
|
84
87
|
const app = JSON.parse(readFileSync("../../disposabl.json", "utf8"));
|
|
85
|
-
const enabled = process.env
|
|
88
|
+
const enabled = productionAnalyticsEnabled(process.env, app, site) && productionAnalyticsEnabled(effectiveEnv, app, site);
|
|
86
89
|
appendFileSync(process.env.GITHUB_ENV, `EXPO_PUBLIC_DISPOSABL_ANALYTICS_ENABLED=${enabled}\n`);
|
|
87
90
|
'
|
|
88
91
|
;;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// The product serves its Convex HTTP routes on the canonical site domain.
|
|
2
|
+
export function productionAnalyticsEnabled(env, app, site) {
|
|
3
|
+
const product = env.GH_REPO === "disposabl-dev/create-disposabl-app";
|
|
4
|
+
const backend = app.productionConvexSiteUrl || site.backendOrigin;
|
|
5
|
+
const matchesBackend = !!backend && backend === env.CONVEX_SITE_URL;
|
|
6
|
+
const matchesProductDomain =
|
|
7
|
+
product &&
|
|
8
|
+
!app.productionConvexSiteUrl &&
|
|
9
|
+
!!site.origin &&
|
|
10
|
+
site.origin === env.CONVEX_SITE_URL;
|
|
11
|
+
return (
|
|
12
|
+
env.GITHUB_ACTIONS === "true" &&
|
|
13
|
+
env.GITHUB_EVENT_NAME === "push" &&
|
|
14
|
+
env.GITHUB_REF === "refs/heads/main" &&
|
|
15
|
+
env.CHANNEL === "production" &&
|
|
16
|
+
env.E2E_TELEMETRY_DISABLED !== "1" &&
|
|
17
|
+
env.EXPO_PUBLIC_E2E !== "true" &&
|
|
18
|
+
app.features.includes("analytics") &&
|
|
19
|
+
(matchesBackend || matchesProductDomain)
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -27,7 +27,16 @@ async function run(
|
|
|
27
27
|
const dir = await mkdtemp(join(tmpdir(), "ios-ota-"));
|
|
28
28
|
try {
|
|
29
29
|
await mkdir(join(dir, "bin"));
|
|
30
|
-
await mkdir(join(dir, "apps/mobile"), { recursive: true });
|
|
30
|
+
await mkdir(join(dir, "apps/mobile/scripts"), { recursive: true });
|
|
31
|
+
await writeFile(
|
|
32
|
+
join(dir, "apps/mobile/scripts/production-analytics.mjs"),
|
|
33
|
+
await readFile(
|
|
34
|
+
resolve(
|
|
35
|
+
import.meta.dirname,
|
|
36
|
+
"../../apps/mobile/scripts/production-analytics.mjs",
|
|
37
|
+
),
|
|
38
|
+
),
|
|
39
|
+
);
|
|
31
40
|
await mkdir(join(dir, "apps/web"), { recursive: true });
|
|
32
41
|
await writeFile(
|
|
33
42
|
join(dir, "apps/mobile/eas.json"),
|