@marktiderman/genesis-cli 1.11.1 → 1.11.2
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/README.md +1 -1
- package/dist/cli.js +12 -4
- package/dist/cli.js.map +1 -1
- package/dist/doctor.js +11 -3
- package/dist/doctor.js.map +1 -1
- package/dist/genesis-catalog.json +7 -7
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/starter/src/lib/notifications.ts +2 -2
- package/dist/starter/src/lib/push.ts +2 -0
- package/dist/vite.js +11 -3
- package/dist/vite.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -448,7 +448,7 @@ keep `raw-color`).
|
|
|
448
448
|
|
|
449
449
|
| Rule | Level | What it flags |
|
|
450
450
|
| --- | --- | --- |
|
|
451
|
-
| `native-raw-primitive` | error | A React Native primitive Genesis wraps, used from `react-native` (`Modal`, `ActivityIndicator`; the list in the repo's `scripts/lib/native-primitives.mjs`, shared with `check:forbidden-imports`): named and aliased imports (multi-line too), `import * as RN` then `RN.Modal`, `require("react-native").Modal`, destructured `require`, and `export { Modal } from "react-native"`. Type-only imports are fine. The message names the replacements the installed package exports. |
|
|
451
|
+
| `native-raw-primitive` | error | A React Native primitive Genesis wraps, used from `react-native` (`Modal`, `ActivityIndicator`, which points to `NativeLoadingState`; the list in the repo's `scripts/lib/native-primitives.mjs`, shared with `check:forbidden-imports`): named and aliased imports (multi-line too), `import * as RN` then `RN.Modal`, `require("react-native").Modal`, destructured `require`, and `export { Modal } from "react-native"`. Type-only imports are fine. The message names the replacements the installed package exports. |
|
|
452
452
|
| `native-literal-color` | error | Hex and `rgb()/hsl()` literals in native code (the same lexer as `raw-color`, which it replaces for script files). Use a theme role (`useThemeRoles()`), a token className or `PlatformColor(...)`. |
|
|
453
453
|
| `native-custom-header` | warn | A file that sets `headerShown: false` and draws its own header (a `<…Header>` of the app's own, or `style={styles.header}`); a screen that draws one when the `_layout` beside it hides the navigator's; a hand-built tab bar (`tabBar={…}` in a file with `<Tabs>`, or a `<…TabBar>` of the app's own). Section headers (`SectionHeader`, `ListHeader`, `CardHeader`, …) and Genesis components don't count. Only the `_layout` in the screen's own folder is followed, not ancestors. |
|
|
454
454
|
| `native-screen-layout` | warn | A route screen under the router root (`native.routerRoot`, default `src/app`, else `app`) that renders no Genesis screen layout, directly or through one local import (`./`, `../`, `@/`, `~/`). `_layout`, `+html`, `+native-intent`, `+middleware`, `+api` files, re-export-only routes and `<Redirect>` routes are skipped. Also a warning when the router root is missing, or when `src` leaves it unscanned. |
|
package/dist/cli.js
CHANGED
|
@@ -2525,7 +2525,7 @@ var init_native_primitives = __esm({
|
|
|
2525
2525
|
"../../scripts/lib/native-primitives.mjs"() {
|
|
2526
2526
|
NATIVE_WRAPPED_PRIMITIVES = Object.freeze({
|
|
2527
2527
|
Modal: Object.freeze(["NativeDialog", "NativeSheet", "NativeDrawer"]),
|
|
2528
|
-
ActivityIndicator: Object.freeze(["NativeSkeleton", "NativeProgress"])
|
|
2528
|
+
ActivityIndicator: Object.freeze(["NativeLoadingState", "NativeSkeleton", "NativeProgress"])
|
|
2529
2529
|
});
|
|
2530
2530
|
}
|
|
2531
2531
|
});
|
|
@@ -2799,6 +2799,12 @@ function checkCustomHeaders(ctx, pkg) {
|
|
|
2799
2799
|
});
|
|
2800
2800
|
}
|
|
2801
2801
|
}
|
|
2802
|
+
function isLoadingOnlyRoute(code) {
|
|
2803
|
+
const loading = [...code.matchAll(/<NativeLoadingState\b([^>]*)>/g)];
|
|
2804
|
+
if (loading.length === 0 || loading.some((m) => /\bfullScreen\s*=\s*\{\s*false\s*\}/.test(m[1] ?? ""))) return false;
|
|
2805
|
+
const tags = [...code.matchAll(/<([A-Z][\w.]*)/g)].map((m) => m[1] ?? "");
|
|
2806
|
+
return tags.every((t) => LOADING_ROUTE_COMPANIONS.has(t));
|
|
2807
|
+
}
|
|
2802
2808
|
function routerRoot(ctx) {
|
|
2803
2809
|
if (ctx.config.native?.routerRoot) return ctx.config.native.routerRoot.replace(/\/+$/, "");
|
|
2804
2810
|
return existsSync(path32.join(ctx.root, "src", "app")) ? "src/app" : "app";
|
|
@@ -2821,12 +2827,13 @@ function checkScreenLayouts(ctx, pkg) {
|
|
|
2821
2827
|
});
|
|
2822
2828
|
return;
|
|
2823
2829
|
}
|
|
2824
|
-
const renders2 = new RegExp(`<(?:${layouts.join("|")}
|
|
2830
|
+
const renders2 = new RegExp(`<(?:${[...layouts, "Redirect"].join("|")})\\b`);
|
|
2831
|
+
const loadingOnly = pkg.values.has("NativeLoadingState") ? isLoadingOnlyRoute : () => false;
|
|
2825
2832
|
const byPath = new Map(ctx.files.map((f) => [f.absolutePath, f]));
|
|
2826
2833
|
for (const file of routes) {
|
|
2827
2834
|
if (!JSX_EXTS3.has(file.ext) || NON_SCREEN_ROUTE.test(file.path)) continue;
|
|
2828
2835
|
if (!/\bexport\s+default\b/.test(file.code) || !/<[A-Za-z]/.test(file.code)) continue;
|
|
2829
|
-
if (renders2.test(file.code)) continue;
|
|
2836
|
+
if (renders2.test(file.code) || loadingOnly(file.code)) continue;
|
|
2830
2837
|
const viaImport = localImports(ctx.root, file).some((abs) => {
|
|
2831
2838
|
const target = byPath.get(abs) ?? readSource(abs);
|
|
2832
2839
|
return target !== null && renders2.test(target.code);
|
|
@@ -2964,7 +2971,7 @@ function checkStoreReadiness(ctx) {
|
|
|
2964
2971
|
});
|
|
2965
2972
|
}
|
|
2966
2973
|
}
|
|
2967
|
-
var SCRIPT_EXTS3, JSX_EXTS3, LAYOUT_NAME, NON_SCREEN_ROUTE, PART_HEADER, HIDES_HEADER, RN, PERMISSIONS, SOCIAL_SIGN_IN, WEAK_SOCIAL_SIGN_IN, APPLE_SIGN_IN, EXPO_CONFIGS, SUPABASE_SIGN_IN, GENESIS_PLUGIN, GENESIS_PLUGIN_TEXT, GENESIS_PLUGIN_IMPORT;
|
|
2974
|
+
var SCRIPT_EXTS3, JSX_EXTS3, LAYOUT_NAME, NON_SCREEN_ROUTE, PART_HEADER, HIDES_HEADER, RN, LOADING_ROUTE_COMPANIONS, PERMISSIONS, SOCIAL_SIGN_IN, WEAK_SOCIAL_SIGN_IN, APPLE_SIGN_IN, EXPO_CONFIGS, SUPABASE_SIGN_IN, GENESIS_PLUGIN, GENESIS_PLUGIN_TEXT, GENESIS_PLUGIN_IMPORT;
|
|
2968
2975
|
var init_native = __esm({
|
|
2969
2976
|
"src/doctor/native.ts"() {
|
|
2970
2977
|
init_native_primitives();
|
|
@@ -2980,6 +2987,7 @@ var init_native = __esm({
|
|
|
2980
2987
|
PART_HEADER = /(?:Section|List|Card|Dialog|Table|Group|Column|Row|Cell|Accordion|Sheet|Drawer|Modal|Popover|Menu|Panel|Form)Header$/;
|
|
2981
2988
|
HIDES_HEADER = /\bheaderShown\s*(?::|=\s*\{)\s*false\b/;
|
|
2982
2989
|
RN = String.raw`["']react-native["']`;
|
|
2990
|
+
LOADING_ROUTE_COMPANIONS = /* @__PURE__ */ new Set(["NativeLoadingState", "Stack.Screen", "Fragment", "React.Fragment"]);
|
|
2983
2991
|
PERMISSIONS = [
|
|
2984
2992
|
{ module: "expo-camera", key: "NSCameraUsageDescription", option: "cameraPermission" },
|
|
2985
2993
|
{ module: "expo-image-picker", key: "NSPhotoLibraryUsageDescription", option: "photosPermission" },
|