create-disposabl-app 0.20.11 → 0.20.12

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 CHANGED
@@ -3,7 +3,7 @@
3
3
  // ../cli/auth.ts
4
4
  import { lock } from "proper-lockfile";
5
5
  // ../cli/package.json
6
- var version = "0.20.11";
6
+ var version = "0.20.12";
7
7
  var package_default = {
8
8
  name: "@disposabl/cli",
9
9
  version,
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.11";
1566
+ var version = "0.20.12";
1567
1567
 
1568
1568
  // ../cli/telemetry.ts
1569
1569
  var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
@@ -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.CHANNEL === "production" && process.env.E2E_TELEMETRY_DISABLED !== "1" && app.features.includes("analytics") && !!(app.productionConvexSiteUrl || site.backendOrigin) && (app.productionConvexSiteUrl || site.backendOrigin) === process.env.CONVEX_SITE_URL;
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"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-disposabl-app",
3
- "version": "0.20.11",
3
+ "version": "0.20.12",
4
4
  "description": "Create a Disposabl app",
5
5
  "type": "module",
6
6
  "license": "MIT",