codingpixel-expo-app 0.1.4 → 0.1.6

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/index.js CHANGED
@@ -22,6 +22,7 @@ import { buildLayoutReplacements } from "./fonts.js";
22
22
  import { ensureLockfile, installNativeDeps } from "./install.js";
23
23
  import { log } from "./util.js";
24
24
  import { readSDKNotes } from "./sdkNotes.js";
25
+ import { SDK_PROBE_RESULTS } from "./sdkProbeResults.js";
25
26
  const __filename = fileURLToPath(import.meta.url);
26
27
  const __dirname = path.dirname(__filename);
27
28
  /**
@@ -33,7 +34,9 @@ function resolveTemplatesRoot() {
33
34
  return path.resolve(__dirname, "..", "templates");
34
35
  }
35
36
  /**
36
- * Locate `docs/SDK_NOTES.md`. Same layout assumption as `resolveTemplatesRoot`.
37
+ * Locate `docs/SDK_NOTES.md` for OPTIONAL out-of-tree dev runs (when the CLI
38
+ * is invoked from its own source tree with fresh probe results). Production
39
+ * runs from a published tarball read from `SDK_PROBE_RESULTS` instead.
37
40
  */
38
41
  function resolveSdkNotesPath() {
39
42
  return path.resolve(__dirname, "..", "docs", "SDK_NOTES.md");
@@ -69,15 +72,21 @@ async function main() {
69
72
  log.step("Splicing constants + layout sentinels …");
70
73
  patchConstants(target.dir, templatesRoot, answers);
71
74
  patchLayout(target.dir, buildLayoutReplacements(answers));
72
- // ---- Read SDK_NOTES.md probe outcomes ----
75
+ // ---- Resolve probe outcomes ----
76
+ // Primary: baked-in `SDK_PROBE_RESULTS` (always available; ships in dist/).
77
+ // Override: `docs/SDK_NOTES.md` if present in the CLI source tree (out-of-tree
78
+ // development scenarios where probe was just re-run against a newer SDK).
73
79
  const sdk = readSDKNotes(resolveSdkNotesPath());
74
- const flagsOk = sdk.get("FLAGS_OK") === "1";
75
- const probePass = sdk.get("PROBE_PASS") === "1";
76
- const workletsAutoIncluded = sdk.get("BABEL_PRESET_AUTO_INCLUDES_WORKLETS") === "1";
77
- const workletsPkg = sdk.get("WORKLETS_PKG") === "react-native-worklets-core"
80
+ const get = (key, fallback) => sdk.get(key) ?? fallback;
81
+ const flagsOk = get("FLAGS_OK", SDK_PROBE_RESULTS.FLAGS_OK ? "1" : "0") === "1";
82
+ const probePass = get("PROBE_PASS", SDK_PROBE_RESULTS.PROBE_PASS ? "1" : "0") === "1";
83
+ const workletsAutoIncluded = get("BABEL_PRESET_AUTO_INCLUDES_WORKLETS", SDK_PROBE_RESULTS.BABEL_PRESET_AUTO_INCLUDES_WORKLETS ? "1" : "0") === "1";
84
+ const workletsPkg = get("WORKLETS_PKG", SDK_PROBE_RESULTS.WORKLETS_PKG) ===
85
+ "react-native-worklets-core"
78
86
  ? "react-native-worklets-core"
79
87
  : "react-native-worklets";
80
- const expoBaseUrlInherited = sdk.get("EXPO_TSCONFIG_BASEURL") !== "null";
88
+ const baseUrlNoteRaw = get("EXPO_TSCONFIG_BASEURL", SDK_PROBE_RESULTS.EXPO_TSCONFIG_BASEURL_INHERITED ? "." : "null");
89
+ const expoBaseUrlInherited = baseUrlNoteRaw !== "null";
81
90
  log.step("Patching package.json scripts + tsconfig + babel.config.js …");
82
91
  patchPackageJsonScripts(target.dir);
83
92
  patchTsconfig(target.dir, { expoBaseUrlInherited });
package/dist/scaffold.js CHANGED
@@ -31,13 +31,25 @@ export async function runCreateExpoApp(dir, _name) {
31
31
  ], { stdio: "inherit" });
32
32
  }
33
33
  /**
34
- * Delete `App.tsx` shipped by blank-typescript collides with expo-router's
35
- * auto-detection of `src/app/`. Idempotent (no-op if already absent).
34
+ * Delete blank-typescript leftovers that conflict with our expo-router setup:
35
+ *
36
+ * - `App.tsx` — root component for non-expo-router apps; collides with
37
+ * expo-router's auto-detection of `src/app/`.
38
+ * - `index.ts` — root entry shipped by blank-typescript: imports `./App`
39
+ * and calls `registerRootComponent`. We set `package.json#main` to
40
+ * `expo-router/entry` so this file is unused at runtime, but TypeScript
41
+ * still type-checks it and errors with `Cannot find module './App'`
42
+ * after we delete the file above.
43
+ *
44
+ * Idempotent (no-op if already absent).
36
45
  */
37
46
  export function cleanupBlankTemplate(target) {
38
- const appTsx = path.join(target, "App.tsx");
39
- if (fileExists(appTsx)) {
40
- fs.rmSync(appTsx);
41
- log.step("Removed blank-typescript App.tsx (replaced by expo-router src/app/).");
47
+ const removable = ["App.tsx", "index.ts"];
48
+ for (const rel of removable) {
49
+ const p = path.join(target, rel);
50
+ if (fileExists(p)) {
51
+ fs.rmSync(p);
52
+ log.step(`Removed blank-typescript ${rel} (replaced by expo-router src/app/).`);
53
+ }
42
54
  }
43
55
  }
@@ -0,0 +1,28 @@
1
+ // Probe values captured during template authoring (run `scripts/run-probes.sh`
2
+ // to regenerate when bumping target SDK; then update this file by hand).
3
+ //
4
+ // These values are compiled into `dist/` so the CLI has them at runtime without
5
+ // depending on `docs/SDK_NOTES.md` being shipped in the npm tarball. Shipping
6
+ // the docs file was tried earlier and left two real bugs:
7
+ // 1. `BABEL_PRESET_AUTO_INCLUDES_WORKLETS` defaulted false → patchBabel
8
+ // added `react-native-worklets/plugin` even though babel-preset-expo
9
+ // already auto-includes it (double-load risk + duplicate-plugin warnings).
10
+ // 2. `EXPO_TSCONFIG_BASEURL` defaulted "inherited" → `baseUrl` never set
11
+ // → TS path resolution fragile.
12
+ //
13
+ // Constants here override `readSDKNotes` (which is now a fallback for
14
+ // out-of-tree development scenarios).
15
+ export const SDK_PROBE_RESULTS = {
16
+ /** Pinned by template-authoring date — bump alongside Expo SDK upgrades. */
17
+ EXPO_SDK_VERSION: "~54.0.33",
18
+ /** SDK 54+ `babel-preset-expo` auto-includes worklets/reanimated plugin. */
19
+ BABEL_PRESET_AUTO_INCLUDES_WORKLETS: true,
20
+ /** Canonical name per SDK 54 (vs the legacy `-core` variant). */
21
+ WORKLETS_PKG: "react-native-worklets",
22
+ /** SDK 54 `expo/tsconfig.base` does NOT provide `baseUrl` → patcher sets ".". */
23
+ EXPO_TSCONFIG_BASEURL_INHERITED: false,
24
+ /** SDK 54 `npx expo install --yarn`/`--npm` flags supported (Branch A). */
25
+ FLAGS_OK: true,
26
+ /** SDK 54 `expo install` materializes lockfile → no explicit PM install needed. */
27
+ PROBE_PASS: true,
28
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codingpixel-expo-app",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Opinionated Expo app scaffolder mirroring MyRoster conventions.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,8 +1,8 @@
1
- // react-native-mmkv 3.x+ exports `MMKV` as a class (was `createMMKV()` factory
2
- // in older versions). MyRoster's source predates the API change.
3
- import { MMKV } from "react-native-mmkv";
1
+ // react-native-mmkv 4.x exports `createMMKV()` factory + `MMKV` as a TYPE only.
2
+ // (Earlier 3.x exported `MMKV` as a class; the API was reverted in 4.x.)
3
+ import { createMMKV } from "react-native-mmkv";
4
4
 
5
- const storage = new MMKV();
5
+ const storage = createMMKV();
6
6
 
7
7
  export const reduxStorage = {
8
8
  setItem: (key: string, value: string) => {
@@ -14,7 +14,7 @@ export const reduxStorage = {
14
14
  return Promise.resolve(value);
15
15
  },
16
16
  removeItem: (key: string) => {
17
- storage.delete(key);
17
+ storage.remove(key);
18
18
  return Promise.resolve();
19
19
  },
20
20
  };