@marktiderman/genesis-cli 1.11.0 → 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 +2 -2
- package/dist/cli.js +35 -7
- package/dist/cli.js.map +1 -1
- package/dist/doctor.js +33 -5
- package/dist/doctor.js.map +1 -1
- package/dist/genesis-catalog.json +10 -10
- package/dist/index.js +33 -5
- 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 +33 -5
- package/dist/vite.js.map +1 -1
- package/package.json +2 -2
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Add your types here, then send them from your server with `notify()` from
|
|
9
9
|
* `@marktiderman/genesis-notifications/server` (never from the app).
|
|
10
10
|
*/
|
|
11
|
-
import { GENESIS_TEST_CATEGORY, GENESIS_TEST_TYPE,
|
|
11
|
+
import { GENESIS_TEST_CATEGORY, GENESIS_TEST_TYPE, defineNotifications } from "@marktiderman/genesis-notifications";
|
|
12
12
|
import { copy } from "@/copy";
|
|
13
13
|
|
|
14
14
|
export const notifications = defineNotifications({
|
|
@@ -16,7 +16,7 @@ export const notifications = defineNotifications({
|
|
|
16
16
|
activity: { label: copy.push.activityTitle, description: copy.push.activityDescription },
|
|
17
17
|
...GENESIS_TEST_CATEGORY,
|
|
18
18
|
},
|
|
19
|
-
|
|
19
|
+
// No message actions here: chat registers its own `messages` category (Reply, Mark as read) in push.ts.
|
|
20
20
|
types: {
|
|
21
21
|
// An example: something in the app needs the person. Rename or replace it.
|
|
22
22
|
"starter.activity": {
|
|
@@ -45,6 +45,8 @@ export function createStarterPush() {
|
|
|
45
45
|
platform: Platform.OS,
|
|
46
46
|
projectId: (Constants.expoConfig?.extra?.eas?.projectId as string | undefined) ?? Constants.easConfig?.projectId ?? null,
|
|
47
47
|
appVersion: Application.nativeApplicationVersion,
|
|
48
|
+
// Devices and preferences on the notifier's tables. An app that registers devices its own way
|
|
49
|
+
// spreads in only the preferences: `{ register, forget, ...notificationsPushPreferences(supabase) }`.
|
|
48
50
|
backend: notificationsPushBackend(supabase),
|
|
49
51
|
...pushOptions,
|
|
50
52
|
onResponse: onChatPushResponse,
|
package/dist/vite.js
CHANGED
|
@@ -1127,7 +1127,7 @@ function unusedComponents(ctx) {
|
|
|
1127
1127
|
// ../../scripts/lib/native-primitives.mjs
|
|
1128
1128
|
var NATIVE_WRAPPED_PRIMITIVES = Object.freeze({
|
|
1129
1129
|
Modal: Object.freeze(["NativeDialog", "NativeSheet", "NativeDrawer"]),
|
|
1130
|
-
ActivityIndicator: Object.freeze(["NativeSkeleton", "NativeProgress"])
|
|
1130
|
+
ActivityIndicator: Object.freeze(["NativeLoadingState", "NativeSkeleton", "NativeProgress"])
|
|
1131
1131
|
});
|
|
1132
1132
|
function wrappedPrimitivesIn(namedImports) {
|
|
1133
1133
|
return namedImports.split(",").map((n) => n.trim()).filter((n) => n && !/^type\s/.test(n)).map((n) => n.split(/\s+as\s+/)[0].trim()).filter((n) => n && Object.hasOwn(NATIVE_WRAPPED_PRIMITIVES, n));
|
|
@@ -1395,6 +1395,13 @@ function checkCustomHeaders(ctx, pkg) {
|
|
|
1395
1395
|
});
|
|
1396
1396
|
}
|
|
1397
1397
|
}
|
|
1398
|
+
var LOADING_ROUTE_COMPANIONS = /* @__PURE__ */ new Set(["NativeLoadingState", "Stack.Screen", "Fragment", "React.Fragment"]);
|
|
1399
|
+
function isLoadingOnlyRoute(code) {
|
|
1400
|
+
const loading = [...code.matchAll(/<NativeLoadingState\b([^>]*)>/g)];
|
|
1401
|
+
if (loading.length === 0 || loading.some((m) => /\bfullScreen\s*=\s*\{\s*false\s*\}/.test(m[1] ?? ""))) return false;
|
|
1402
|
+
const tags = [...code.matchAll(/<([A-Z][\w.]*)/g)].map((m) => m[1] ?? "");
|
|
1403
|
+
return tags.every((t) => LOADING_ROUTE_COMPANIONS.has(t));
|
|
1404
|
+
}
|
|
1398
1405
|
function routerRoot(ctx) {
|
|
1399
1406
|
if (ctx.config.native?.routerRoot) return ctx.config.native.routerRoot.replace(/\/+$/, "");
|
|
1400
1407
|
return existsSync(path14.join(ctx.root, "src", "app")) ? "src/app" : "app";
|
|
@@ -1417,12 +1424,13 @@ function checkScreenLayouts(ctx, pkg) {
|
|
|
1417
1424
|
});
|
|
1418
1425
|
return;
|
|
1419
1426
|
}
|
|
1420
|
-
const renders2 = new RegExp(`<(?:${layouts.join("|")}
|
|
1427
|
+
const renders2 = new RegExp(`<(?:${[...layouts, "Redirect"].join("|")})\\b`);
|
|
1428
|
+
const loadingOnly = pkg.values.has("NativeLoadingState") ? isLoadingOnlyRoute : () => false;
|
|
1421
1429
|
const byPath = new Map(ctx.files.map((f) => [f.absolutePath, f]));
|
|
1422
1430
|
for (const file of routes) {
|
|
1423
1431
|
if (!JSX_EXTS3.has(file.ext) || NON_SCREEN_ROUTE.test(file.path)) continue;
|
|
1424
1432
|
if (!/\bexport\s+default\b/.test(file.code) || !/<[A-Za-z]/.test(file.code)) continue;
|
|
1425
|
-
if (renders2.test(file.code)) continue;
|
|
1433
|
+
if (renders2.test(file.code) || loadingOnly(file.code)) continue;
|
|
1426
1434
|
const viaImport = localImports(ctx.root, file).some((abs) => {
|
|
1427
1435
|
const target = byPath.get(abs) ?? readSource(abs);
|
|
1428
1436
|
return target !== null && renders2.test(target.code);
|
|
@@ -2192,6 +2200,11 @@ var real = (p) => {
|
|
|
2192
2200
|
return p;
|
|
2193
2201
|
}
|
|
2194
2202
|
};
|
|
2203
|
+
var LOCKFILES = ["bun.lock", "bun.lockb", "package-lock.json", "npm-shrinkwrap.json", "yarn.lock", "pnpm-lock.yaml"];
|
|
2204
|
+
function nodeModulesOf(dir) {
|
|
2205
|
+
const parent = path14.dirname(dir);
|
|
2206
|
+
return path14.basename(parent).startsWith("@") ? path14.dirname(parent) : parent;
|
|
2207
|
+
}
|
|
2195
2208
|
function packagesIn(nodeModules) {
|
|
2196
2209
|
if (!existsSync(nodeModules)) return [];
|
|
2197
2210
|
const out = [];
|
|
@@ -2240,18 +2253,33 @@ function genesisInstalls(root) {
|
|
|
2240
2253
|
for (const r of roots) visit(r.dir, r.by, r.range);
|
|
2241
2254
|
while (queue.length) {
|
|
2242
2255
|
const { real: from, manifest, label } = queue.shift();
|
|
2243
|
-
const deps = { ...manifest.
|
|
2256
|
+
const deps = { ...manifest.optionalDependencies, ...manifest.dependencies };
|
|
2244
2257
|
for (const [name, range] of Object.entries(deps)) {
|
|
2245
2258
|
const dir = findPackageDir(from, name);
|
|
2246
2259
|
if (dir) visit(dir, label, range);
|
|
2247
2260
|
}
|
|
2261
|
+
for (const [name, range] of Object.entries(manifest.peerDependencies ?? {})) {
|
|
2262
|
+
if (name in deps) continue;
|
|
2263
|
+
const dir = peerOf(from, name);
|
|
2264
|
+
if (dir) visit(dir, label, range);
|
|
2265
|
+
}
|
|
2248
2266
|
}
|
|
2249
2267
|
};
|
|
2268
|
+
const peerOf = (from, name) => {
|
|
2269
|
+
const dir = findPackageDir(from, name);
|
|
2270
|
+
if (!dir) return null;
|
|
2271
|
+
if (!ownInstall || name in declared) return dir;
|
|
2272
|
+
const realDir = real(dir);
|
|
2273
|
+
if (realDir.startsWith(realRoot + path14.sep)) return dir;
|
|
2274
|
+
return nodeModulesOf(realDir) === nodeModulesOf(from) ? dir : null;
|
|
2275
|
+
};
|
|
2250
2276
|
const rootsOf = (deps, by) => Object.entries(deps).flatMap(([name, range]) => {
|
|
2251
2277
|
const dir = findPackageDir(root, name);
|
|
2252
2278
|
return dir ? [{ dir, by, ...range ? { range } : {} }] : [];
|
|
2253
2279
|
});
|
|
2254
2280
|
const app = readManifest(root);
|
|
2281
|
+
const ownInstall = LOCKFILES.some((f) => existsSync(path14.join(root, f)));
|
|
2282
|
+
const declared = { ...app?.devDependencies, ...app?.peerDependencies, ...app?.optionalDependencies, ...app?.dependencies };
|
|
2255
2283
|
const declaredDev = Object.entries(app?.devDependencies ?? {});
|
|
2256
2284
|
const runtimeDeps = {
|
|
2257
2285
|
...Object.fromEntries(declaredDev.filter(([n]) => !NON_SHIPPING.test(n))),
|
|
@@ -2270,7 +2298,7 @@ function genesisInstalls(root) {
|
|
|
2270
2298
|
}).map((dir) => ({ dir, by: "hoisted, not a direct dependency" }))
|
|
2271
2299
|
);
|
|
2272
2300
|
const devRoots = { ...devDeps };
|
|
2273
|
-
for (const tool of DEV_TOOLS) if (!(tool in devRoots)) devRoots[tool] = runtimeDeps[tool];
|
|
2301
|
+
for (const tool of DEV_TOOLS) if (!(tool in devRoots) && tool in runtimeDeps) devRoots[tool] = runtimeDeps[tool];
|
|
2274
2302
|
walk("dev", rootsOf(devRoots, "the app (dev)"));
|
|
2275
2303
|
for (const [key2, copy] of copies) {
|
|
2276
2304
|
const kinds = via.get(key2);
|