@marktiderman/genesis-cli 1.12.1 → 1.13.1
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 +10 -4
- package/dist/cli.js +65 -29
- package/dist/cli.js.map +1 -1
- package/dist/doctor.js +5 -4
- package/dist/doctor.js.map +1 -1
- package/dist/genesis-catalog.json +327 -15
- package/dist/index.d.ts +11 -1
- package/dist/index.js +63 -28
- package/dist/index.js.map +1 -1
- package/dist/starter/README.md +9 -1
- package/dist/starter/__tests__/components/product-demo.test.tsx +32 -0
- package/dist/starter/__tests__/starter.test.ts +33 -1
- package/dist/starter/metro.config.js +1 -1
- package/dist/starter/package.json +1 -0
- package/dist/starter/src/app/(app)/(home)/_layout.tsx +3 -0
- package/dist/starter/src/app/(app)/messages/_layout.tsx +3 -0
- package/dist/starter/src/app/(app)/notifications/_layout.tsx +3 -0
- package/dist/starter/src/app/(app)/settings/_layout.tsx +3 -0
- package/dist/starter/src/app/(app)/settings/index.tsx +9 -3
- package/dist/starter/src/app/(app)/settings/product.tsx +44 -0
- package/dist/starter/src/copy.ts +18 -0
- package/dist/starter/src/lib/define-starter.ts +7 -0
- package/dist/starter/src/lib/observability.ts +12 -1
- package/dist/starter/src/lib/product-demo.ts +26 -0
- package/dist/starter/starter.config.ts +2 -0
- package/dist/vite.js +5 -4
- package/dist/vite.js.map +1 -1
- package/package.json +3 -3
package/dist/starter/README.md
CHANGED
|
@@ -59,7 +59,7 @@ In this monorepo the root `pnpm-workspace.yaml` pins `react`, `react-dom`, `@typ
|
|
|
59
59
|
## Turning features off
|
|
60
60
|
|
|
61
61
|
Each line of `features` in `starter.config.ts` is one feature, `true` by default except
|
|
62
|
-
`googleSignIn`:
|
|
62
|
+
`googleSignIn` and `productDemo`:
|
|
63
63
|
|
|
64
64
|
| Line | What it is | Off means |
|
|
65
65
|
| --- | --- | --- |
|
|
@@ -79,6 +79,7 @@ Each line of `features` in `starter.config.ts` is one feature, `true` by default
|
|
|
79
79
|
| `updates` | The updates block (`createUpdates`, `src/lib/updates.ts`): force upgrade and maintenance from the `app_release_policy` row, the update banner (never reloads mid sign-in or mid deletion: `useBlockReload`), what's new, and the version signature in Settings > About. | No blocking screens, banner or notes; About shows the version and build from `expo-application`. |
|
|
80
80
|
| `observability` | The observability block (`src/lib/observability.ts`): every error the shell catches, route breadcrumbs and timings, the user's id and the typed events in `events`, to Sentry when `EXPO_PUBLIC_SENTRY_DSN` is set and to the console in development, scrubbed of emails, tokens and query strings on the phone. | Errors only reach `console` (LogBox in development). |
|
|
81
81
|
| `devtools` | The devtools overlay (`src/lib/devtools.ts`) in development and preview builds: a three-finger hold, "Open devtools" in the dev menu or Settings > About > Developer tools open a sheet with the version signature, channel switch, user id, blocks, flags and recent errors. Never in a production bundle. | No overlay and no Settings row. |
|
|
82
|
+
| `productDemo` | **Off by default.** A demo of `@marktiderman/genesis-product/native` (`src/lib/product-demo.ts`): Settings > Product demo opens the idea board (a vote shows at once, with a haptic, and is queued while offline) and the Now / Next / Later roadmap, over sample data in memory. Nothing is sent anywhere. Screen: `src/app/(app)/settings/product.tsx`. | No Settings row; the route sends you back to Settings. |
|
|
82
83
|
|
|
83
84
|
A config with every sign-in method off, or Google without Apple, fails at start-up. Apple's button
|
|
84
85
|
only shows on iOS, so with `emailSignIn` and `googleSignIn` off `app.config.ts` builds for iOS only.
|
|
@@ -290,6 +291,13 @@ it (App Store Review Guideline 4.8): `defineStarter` refuses Google without Appl
|
|
|
290
291
|
imports it first, and the root layout is exported wrapped (`wrapRoot`). Release and dist come
|
|
291
292
|
from the version signature, with the update id and channel as tags. Source map upload is
|
|
292
293
|
optional: the commented plugin line in `app.config.ts` says what to turn on.
|
|
294
|
+
- **Errors per tab.** Each tab's `_layout.tsx` exports `ScreenErrorBoundary` (from
|
|
295
|
+
`src/lib/observability.ts`) as its Expo Router `ErrorBoundary`: a screen that throws shows "This
|
|
296
|
+
screen hit a problem" with Try again, the tab bar keeps working, and the error is reported
|
|
297
|
+
non-fatal (through Sentry's `wrapExpoRouterErrorBoundary`). Queries and mutations that fail
|
|
298
|
+
unexpectedly are reported too; offline, signed-out and refused requests are not.
|
|
299
|
+
- **Trace headers.** `tracePropagationTargets` lists the hosts that get Sentry's trace headers:
|
|
300
|
+
this app's Supabase project only. Add your own API's origin there; every other host gets none.
|
|
293
301
|
- **Source maps.** Builds upload theirs to EAS for EAS Observe (`uploadSourceMaps: true` in the
|
|
294
302
|
preview and production profiles of `eas.json`), so its stack traces are symbolicated. The
|
|
295
303
|
workflows' update jobs set `upload_sentry_sourcemaps: false`: left unset, EAS tries a Sentry
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { describe, expect, it, jest } from "@jest/globals";
|
|
2
|
+
import { screen, userEvent, within } from "@testing-library/react-native";
|
|
3
|
+
import { copy } from "@/copy";
|
|
4
|
+
import { expectPathname, renderApp } from "./render-app";
|
|
5
|
+
|
|
6
|
+
// This file's app has `features.productDemo` on (it is off by default); every other switch is the starter's own.
|
|
7
|
+
jest.mock("../../starter.config", () => {
|
|
8
|
+
const actual = jest.requireActual<{ default: { features: object } }>("../../starter.config").default;
|
|
9
|
+
return { __esModule: true, default: { ...actual, features: { ...actual.features, productDemo: true } } };
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const t = copy.productDemo;
|
|
13
|
+
|
|
14
|
+
describe("product demo", () => {
|
|
15
|
+
it("opens from Settings: the idea board votes at once, and the roadmap switches to Next", async () => {
|
|
16
|
+
const app = await renderApp("/settings", "person@example.com");
|
|
17
|
+
const user = userEvent.setup();
|
|
18
|
+
await user.press(await screen.findByTestId("open-product-demo"));
|
|
19
|
+
await expectPathname(app, "/settings/product");
|
|
20
|
+
expect(await screen.findByText(t.ideas.darkMode.title)).toBeOnTheScreen();
|
|
21
|
+
const row = screen.getByTestId("product-ideas-idea-dark-mode");
|
|
22
|
+
expect(within(row).getByText("12 votes · Planned")).toBeOnTheScreen();
|
|
23
|
+
await user.press(screen.getByTestId("product-ideas-vote-dark-mode"));
|
|
24
|
+
expect(await within(row).findByText("13 votes · Planned · You voted")).toBeOnTheScreen();
|
|
25
|
+
|
|
26
|
+
await user.press(screen.getByTestId("product-demo-tab-option-roadmap"));
|
|
27
|
+
expect(await screen.findByText(t.roadmap.search.title)).toBeOnTheScreen();
|
|
28
|
+
await user.press(screen.getByTestId("product-roadmap-horizon-option-next"));
|
|
29
|
+
expect(await screen.findByText(t.roadmap.offline.title)).toBeOnTheScreen();
|
|
30
|
+
expect(screen.queryByText(t.roadmap.search.title)).toBeNull();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @feat:native-starter @feat:app-updates @feat:push @feat:observability @feat:devtools-overlay @feat:support-feedback @feat:chat
|
|
1
|
+
// @feat:native-starter @feat:app-updates @feat:push @feat:observability @feat:devtools-overlay @feat:support-feedback @feat:chat @feat:product-roadmap
|
|
2
2
|
import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
@@ -389,6 +389,15 @@ describe("chat", () => {
|
|
|
389
389
|
}
|
|
390
390
|
});
|
|
391
391
|
|
|
392
|
+
it("gives every tab a reported screen boundary, and sends trace headers to its own Supabase only", () => {
|
|
393
|
+
for (const tab of ["(home)", "notifications", "messages", "settings"]) {
|
|
394
|
+
expect(read(join("src/app/(app)", tab, "_layout.tsx")), tab).toContain('export { ScreenErrorBoundary as ErrorBoundary } from "@/lib/observability";');
|
|
395
|
+
}
|
|
396
|
+
const observability = read("src/lib/observability.ts");
|
|
397
|
+
expect(observability).toContain("observability.screenBoundary()");
|
|
398
|
+
expect(observability).toMatch(/tracePropagationTargets: \[env\.supabaseUrl/);
|
|
399
|
+
});
|
|
400
|
+
|
|
392
401
|
it("starts each conversation's thread fresh: the screen is keyed by the conversation id", () => {
|
|
393
402
|
expect(read("src/app/(app)/messages/[id].tsx")).toMatch(/<ChatThreadScreen key=\{id\} conversationId=\{id\}/);
|
|
394
403
|
});
|
|
@@ -431,3 +440,26 @@ describe("chat", () => {
|
|
|
431
440
|
expect(Object.keys(pkg.dependencies)).toEqual(expect.arrayContaining(["expo-audio", "expo-image-picker", "expo-clipboard", "@marktiderman/genesis-chat"]));
|
|
432
441
|
});
|
|
433
442
|
});
|
|
443
|
+
|
|
444
|
+
describe("product demo", () => {
|
|
445
|
+
it("is off by default, behind the one `productDemo` switch: no Settings row, and the route goes back to Settings", () => {
|
|
446
|
+
expect(starter.features.productDemo).toBe(false);
|
|
447
|
+
expect(read("src/app/(app)/settings/index.tsx")).toContain("...(starter.features.productDemo");
|
|
448
|
+
expect(read("src/app/(app)/settings/product.tsx")).toContain('if (!starter.features.productDemo) return <Redirect href="/settings" />');
|
|
449
|
+
expect(read("app.config.ts")).not.toContain("features.productDemo");
|
|
450
|
+
const pkg = JSON.parse(read("package.json")) as { dependencies: Record<string, string> };
|
|
451
|
+
expect(Object.keys(pkg.dependencies)).toContain("@marktiderman/genesis-product");
|
|
452
|
+
});
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
describe("metro", () => {
|
|
456
|
+
it("watches every Genesis workspace package the app depends on, so an edit to one reloads the app", () => {
|
|
457
|
+
const pkg = JSON.parse(read("package.json")) as { dependencies: Record<string, string> };
|
|
458
|
+
const watched = /\.\.\.\[([^\]]+)\]\.map\(\(name\) => path\.resolve\(monorepoRoot, "packages", name\)\)/.exec(read("metro.config.js"))?.[1] ?? "";
|
|
459
|
+
const names = [...watched.matchAll(/"([^"]+)"/g)].map((m) => m[1]);
|
|
460
|
+
const genesis = Object.keys(pkg.dependencies)
|
|
461
|
+
.filter((d) => d.startsWith("@marktiderman/genesis-"))
|
|
462
|
+
.map((d) => d.slice("@marktiderman/genesis-".length));
|
|
463
|
+
for (const name of genesis) expect(names, name).toContain(name);
|
|
464
|
+
});
|
|
465
|
+
});
|
|
@@ -13,7 +13,7 @@ const config = getDefaultConfig(projectRoot);
|
|
|
13
13
|
// The workspace packages the app imports, so edits to them reload the app.
|
|
14
14
|
config.watchFolders = [
|
|
15
15
|
...(config.watchFolders || []),
|
|
16
|
-
...["chat", "core", "design-system", "features", "forms", "forms-native", "forms-react", "native", "supabase", "support", "ui-native"].map((name) => path.resolve(monorepoRoot, "packages", name)),
|
|
16
|
+
...["chat", "core", "design-system", "features", "forms", "forms-native", "forms-react", "native", "notifications", "product", "supabase", "support", "ui-native"].map((name) => path.resolve(monorepoRoot, "packages", name)),
|
|
17
17
|
];
|
|
18
18
|
|
|
19
19
|
config.resolver.nodeModulesPaths = [
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"@marktiderman/genesis-forms-react": "workspace:^",
|
|
28
28
|
"@marktiderman/genesis-native": "workspace:^",
|
|
29
29
|
"@marktiderman/genesis-notifications": "workspace:^",
|
|
30
|
+
"@marktiderman/genesis-product": "workspace:^",
|
|
30
31
|
"@marktiderman/genesis-supabase": "workspace:^",
|
|
31
32
|
"@marktiderman/genesis-support": "workspace:^",
|
|
32
33
|
"@marktiderman/genesis-ui-native": "workspace:^",
|
|
@@ -4,3 +4,6 @@ import { Stack } from "expo-router";
|
|
|
4
4
|
export default function HomeStack() {
|
|
5
5
|
return <Stack />;
|
|
6
6
|
}
|
|
7
|
+
|
|
8
|
+
/** A screen in this tab that throws shows Try again here; the tab bar and the other tabs keep working. */
|
|
9
|
+
export { ScreenErrorBoundary as ErrorBoundary } from "@/lib/observability";
|
|
@@ -9,3 +9,6 @@ export default function MessagesStack() {
|
|
|
9
9
|
if (!userId) return null;
|
|
10
10
|
return <Stack />;
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
/** A screen in this tab that throws shows Try again here; the tab bar and the other tabs keep working. */
|
|
14
|
+
export { ScreenErrorBoundary as ErrorBoundary } from "@/lib/observability";
|
|
@@ -4,3 +4,6 @@ import { Stack } from "expo-router";
|
|
|
4
4
|
export default function NotificationsStack() {
|
|
5
5
|
return <Stack />;
|
|
6
6
|
}
|
|
7
|
+
|
|
8
|
+
/** A screen in this tab that throws shows Try again here; the tab bar and the other tabs keep working. */
|
|
9
|
+
export { ScreenErrorBoundary as ErrorBoundary } from "@/lib/observability";
|
|
@@ -4,3 +4,6 @@ import { Stack } from "expo-router";
|
|
|
4
4
|
export default function SettingsStack() {
|
|
5
5
|
return <Stack />;
|
|
6
6
|
}
|
|
7
|
+
|
|
8
|
+
/** A screen in this tab that throws shows Try again here; the tab bar and the other tabs keep working. */
|
|
9
|
+
export { ScreenErrorBoundary as ErrorBoundary } from "@/lib/observability";
|
|
@@ -28,9 +28,15 @@ export default function SettingsScreen() {
|
|
|
28
28
|
{ id: "account", title: t.accountSection, rows: [{ id: "email", title: t.signedInAs, subtitle: session?.user.email ?? "" }] },
|
|
29
29
|
{
|
|
30
30
|
id: "general",
|
|
31
|
-
rows:
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
rows: [
|
|
32
|
+
...(starter.features.chat
|
|
33
|
+
? [{ id: "availability", title: t.availability, subtitle: t.availabilitySubtitle, showChevron: true, onPress: () => router.push("/settings/availability" as Href), testID: "open-availability" }]
|
|
34
|
+
: []),
|
|
35
|
+
// Off by default (`features.productDemo`).
|
|
36
|
+
...(starter.features.productDemo
|
|
37
|
+
? [{ id: "product-demo", title: copy.productDemo.settingsRow, subtitle: copy.productDemo.settingsRowSubtitle, showChevron: true, onPress: () => router.push("/settings/product" as Href), testID: "open-product-demo" }]
|
|
38
|
+
: []),
|
|
39
|
+
],
|
|
34
40
|
},
|
|
35
41
|
// The support block's Send feedback and Help rows (`features.support`).
|
|
36
42
|
{ id: "support", title: copy.support.settings.section, rows: [] },
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Redirect, Stack } from "expo-router";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import * as Haptics from "expo-haptics";
|
|
5
|
+
import { IdeaBoardScreen, RoadmapScreen } from "@marktiderman/genesis-product/native";
|
|
6
|
+
import { NativeSegmentedControl, getInboxPageStackOptions } from "@marktiderman/genesis-ui-native";
|
|
7
|
+
import starter from "../../../../starter.config";
|
|
8
|
+
import { copy } from "@/copy";
|
|
9
|
+
import { productDemoSource, productDemoVotes } from "@/lib/product-demo";
|
|
10
|
+
|
|
11
|
+
const t = copy.productDemo;
|
|
12
|
+
|
|
13
|
+
/** The product demo (`features.productDemo`): the idea board and the roadmap over sample data. */
|
|
14
|
+
export default function ProductDemoScreen() {
|
|
15
|
+
if (!starter.features.productDemo) return <Redirect href="/settings" />;
|
|
16
|
+
return <Demo />;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function Demo() {
|
|
20
|
+
const [tab, setTab] = useState<"ideas" | "roadmap">("ideas");
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<Stack.Screen options={getInboxPageStackOptions({ headerTitle: t.title, large: false })} />
|
|
24
|
+
<View style={{ paddingHorizontal: 16, paddingVertical: 8 }}>
|
|
25
|
+
<NativeSegmentedControl
|
|
26
|
+
testID="product-demo-tab"
|
|
27
|
+
value={tab}
|
|
28
|
+
onChange={setTab}
|
|
29
|
+
options={[
|
|
30
|
+
{ value: "ideas", label: t.ideasTab },
|
|
31
|
+
{ value: "roadmap", label: t.roadmapTab },
|
|
32
|
+
]}
|
|
33
|
+
/>
|
|
34
|
+
</View>
|
|
35
|
+
<View style={{ flex: 1 }}>
|
|
36
|
+
{tab === "ideas" ? (
|
|
37
|
+
<IdeaBoardScreen source={productDemoSource} queue={productDemoVotes} haptics={Haptics} />
|
|
38
|
+
) : (
|
|
39
|
+
<RoadmapScreen source={productDemoSource} haptics={Haptics} />
|
|
40
|
+
)}
|
|
41
|
+
</View>
|
|
42
|
+
</>
|
|
43
|
+
);
|
|
44
|
+
}
|
package/dist/starter/src/copy.ts
CHANGED
|
@@ -108,6 +108,24 @@ const en = {
|
|
|
108
108
|
ideas: { title: "Idea board" },
|
|
109
109
|
shipped: { title: "You asked, we shipped" },
|
|
110
110
|
},
|
|
111
|
+
// The product demo (`features.productDemo`): sample data for @marktiderman/genesis-product's screens.
|
|
112
|
+
productDemo: {
|
|
113
|
+
settingsRow: "Product demo",
|
|
114
|
+
settingsRowSubtitle: "Ideas and the roadmap, over sample data",
|
|
115
|
+
title: "Product",
|
|
116
|
+
ideasTab: "Ideas",
|
|
117
|
+
roadmapTab: "Roadmap",
|
|
118
|
+
ideas: {
|
|
119
|
+
darkMode: { title: "Dark mode", body: "Follow the phone's light or dark setting." },
|
|
120
|
+
calendar: { title: "Add sessions to my calendar", body: "One tap to put a booking in my phone's calendar." },
|
|
121
|
+
widgets: { title: "Home screen widget", body: "See today's plan without opening the app." },
|
|
122
|
+
},
|
|
123
|
+
roadmap: {
|
|
124
|
+
search: { title: "Search", summary: "Find any message, note or file." },
|
|
125
|
+
offline: { title: "Works offline", summary: "Read and write without a connection; it syncs when you're back." },
|
|
126
|
+
sharing: { title: "Share a plan", summary: "Send a plan to someone outside the app." },
|
|
127
|
+
},
|
|
128
|
+
},
|
|
111
129
|
// Chat's own strings (genesis-chat's `chatNativeCopy`); the ones here override its English.
|
|
112
130
|
chat: {
|
|
113
131
|
inboxTitle: "Messages",
|
|
@@ -101,6 +101,13 @@ export interface StarterFeatures {
|
|
|
101
101
|
* and expo-clipboard stay in the build either way.
|
|
102
102
|
*/
|
|
103
103
|
chat: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* A demo of `@marktiderman/genesis-product/native`, off by default: Settings > Product demo opens
|
|
106
|
+
* the idea board (votes with haptics, queued while offline) and the Now / Next / Later roadmap, over
|
|
107
|
+
* sample data in memory (`memoryProductSource`, `src/lib/product-demo.ts`). Nothing leaves the
|
|
108
|
+
* phone. JavaScript only.
|
|
109
|
+
*/
|
|
110
|
+
productDemo: boolean;
|
|
104
111
|
}
|
|
105
112
|
|
|
106
113
|
export interface StarterConfig {
|
|
@@ -14,9 +14,10 @@ import { useSegments } from "expo-router";
|
|
|
14
14
|
import * as Updates from "expo-updates";
|
|
15
15
|
import type { ComponentType } from "react";
|
|
16
16
|
import { Platform } from "react-native";
|
|
17
|
-
import { consoleSink, createObservability, defineEvents, sentrySink } from "@marktiderman/genesis-native/observability";
|
|
17
|
+
import { consoleSink, createObservability, createScreenErrorBoundary, defineEvents, sentrySink } from "@marktiderman/genesis-native/observability";
|
|
18
18
|
import { versionSignature } from "@marktiderman/genesis-native/updates";
|
|
19
19
|
import starter from "../../starter.config";
|
|
20
|
+
import { env } from "./env";
|
|
20
21
|
|
|
21
22
|
/** Every analytics event the app sends, and the props each may carry (closed lists, numbers, booleans: never free text). */
|
|
22
23
|
export const events = defineEvents({
|
|
@@ -34,6 +35,8 @@ export const observability = starter.features.observability
|
|
|
34
35
|
dsn: process.env.EXPO_PUBLIC_SENTRY_DSN,
|
|
35
36
|
signature: versionSignature({ application: Application, updates: Updates, platform: Platform.OS }),
|
|
36
37
|
applicationId: Application.applicationId,
|
|
38
|
+
// Trace headers go to this app's own Supabase project only, never to other hosts.
|
|
39
|
+
tracePropagationTargets: [env.supabaseUrl.replace(/\/+$/, "")],
|
|
37
40
|
}),
|
|
38
41
|
],
|
|
39
42
|
})
|
|
@@ -43,3 +46,11 @@ export const observability = starter.features.observability
|
|
|
43
46
|
export function wrapRoot<P extends Record<string, unknown>>(root: ComponentType<P>): ComponentType<P> {
|
|
44
47
|
return observability ? observability.wrap(root) : root;
|
|
45
48
|
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Each tab's `ErrorBoundary` (`export { ScreenErrorBoundary as ErrorBoundary }` in its
|
|
52
|
+
* `_layout.tsx`): a screen that throws shows "This screen hit a problem" with Try again, the tab
|
|
53
|
+
* bar and the other tabs keep working, and the error is reported non-fatal (through Sentry's
|
|
54
|
+
* Expo Router wrapper when the block is on).
|
|
55
|
+
*/
|
|
56
|
+
export const ScreenErrorBoundary = observability ? observability.screenBoundary() : createScreenErrorBoundary();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The product demo (`features.productDemo`, off by default): @marktiderman/genesis-product's
|
|
3
|
+
* native screens over sample data in memory. Nothing leaves the phone. A real app passes a
|
|
4
|
+
* `ProductSource` over its own backend instead, and a vote queue kept in AsyncStorage
|
|
5
|
+
* (`createVoteQueue({ source, store: storageVoteQueueStore(AsyncStorage) })`).
|
|
6
|
+
*/
|
|
7
|
+
import { createVoteQueue, memoryProductSource } from "@marktiderman/genesis-product/native";
|
|
8
|
+
import { copy } from "@/copy";
|
|
9
|
+
|
|
10
|
+
const t = copy.productDemo;
|
|
11
|
+
|
|
12
|
+
/** One source and one vote queue for the app's life, so votes survive leaving the screen. */
|
|
13
|
+
export const productDemoSource = memoryProductSource({
|
|
14
|
+
ideas: [
|
|
15
|
+
{ id: "dark-mode", ...t.ideas.darkMode, votes: 12, voted: false, status: "planned" },
|
|
16
|
+
{ id: "calendar", ...t.ideas.calendar, votes: 7, voted: true, status: "open" },
|
|
17
|
+
{ id: "widgets", ...t.ideas.widgets, votes: 3, voted: false, status: "open" },
|
|
18
|
+
],
|
|
19
|
+
roadmap: [
|
|
20
|
+
{ id: "search", ...t.roadmap.search, horizon: "now", votes: 9 },
|
|
21
|
+
{ id: "offline", ...t.roadmap.offline, horizon: "next", votes: 5 },
|
|
22
|
+
{ id: "sharing", ...t.roadmap.sharing, horizon: "later" },
|
|
23
|
+
],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const productDemoVotes = createVoteQueue({ source: productDemoSource });
|
package/dist/vite.js
CHANGED
|
@@ -1563,7 +1563,7 @@ function namedImportsFrom(code, pkg) {
|
|
|
1563
1563
|
// src/doctor/native.ts
|
|
1564
1564
|
var SCRIPT_EXTS3 = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs"]);
|
|
1565
1565
|
var JSX_EXTS3 = /* @__PURE__ */ new Set([".tsx", ".jsx"]);
|
|
1566
|
-
var LAYOUT_NAME = /(?:Page|Screen|ScreenContainer)$/;
|
|
1566
|
+
var LAYOUT_NAME = /(?:Page|Screen|ScreenContainer)$|^NativeResourceView$/;
|
|
1567
1567
|
var NON_SCREEN_ROUTE = /(?:^|\/)(?:_layout|\+html|\+native-intent|\+middleware)\.[jt]sx?$|\+api\.[jt]sx?$/;
|
|
1568
1568
|
var PART_HEADER = /(?:Section|List|Card|Dialog|Table|Group|Column|Row|Cell|Accordion|Sheet|Drawer|Modal|Popover|Menu|Panel|Form)Header$/;
|
|
1569
1569
|
var HIDES_HEADER = /\bheaderShown\s*(?::|=\s*\{)\s*false\b/;
|
|
@@ -3402,8 +3402,9 @@ var CONTAINER = /(?:Card|CardContent|Dialog|DialogContent|Sheet|SheetContent|Dra
|
|
|
3402
3402
|
var SWITCHER = /<(TabsList|SubNavTabs)(?=[\s>/])/g;
|
|
3403
3403
|
var SHELL = /<AppShell(?=[\s>/])/;
|
|
3404
3404
|
var GENESIS_PACKAGE2 = /^@marktiderman\/genesis(?:-[\w-]+)?(?:\/|$)/;
|
|
3405
|
-
var PAGE_LAYOUT = /^(?!Breadcrumb)[A-Z]\w*(?:Page|PageShell)$/;
|
|
3406
|
-
var
|
|
3405
|
+
var PAGE_LAYOUT = /^(?:(?!Breadcrumb)[A-Z]\w*(?:Page|PageShell)|ResourceView)$/;
|
|
3406
|
+
var EMBEDDED_RESOURCE_VIEW = /<ResourceView\b[^>]*?\blayout\s*=\s*(?:(["'`]) {8}\1|\{\s*(["'`]) {8}\2\s*\})[^>]*>/g;
|
|
3407
|
+
var PACKAGE_SCREEN = /^(?:(?!Breadcrumb)[A-Z]\w*(?:Page|PageShell|Screen|Workspace)|ResourceView)$/;
|
|
3407
3408
|
var isNative = (ctx) => ctx.config.packs?.includes("native") ?? false;
|
|
3408
3409
|
var rendersRe = (names) => {
|
|
3409
3410
|
const list = [...names];
|
|
@@ -3517,7 +3518,7 @@ function checkPageLayouts(ctx) {
|
|
|
3517
3518
|
const rendersLayout = (code) => {
|
|
3518
3519
|
const names = new Set(layouts);
|
|
3519
3520
|
for (const n of namedImportsFrom(code, GENESIS_PACKAGE2)) if (PACKAGE_SCREEN.test(n)) names.add(n);
|
|
3520
|
-
return rendersRe(names)?.test(code) ?? false;
|
|
3521
|
+
return rendersRe(names)?.test(code.replace(EMBEDDED_RESOURCE_VIEW, "")) ?? false;
|
|
3521
3522
|
};
|
|
3522
3523
|
const cache2 = /* @__PURE__ */ new Map();
|
|
3523
3524
|
const provides = (r) => {
|