anhedral 0.15.0 → 0.16.0
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 +29 -38
- package/assets/stack/ai-schema.ts.txt +5 -0
- package/assets/stack/ai.ts.txt +30 -0
- package/assets/stack/api-index.ts.txt +15 -0
- package/assets/stack/auth-features.ts.txt +4 -0
- package/assets/stack/auth-journal.json.txt +13 -0
- package/assets/stack/auth-migration.sql.txt +53 -0
- package/assets/stack/auth-routes.ts.txt +11 -0
- package/assets/stack/auth-schema.ts.txt +64 -0
- package/assets/stack/auth-snapshot.json.txt +346 -0
- package/assets/stack/auth.ts.txt +32 -0
- package/assets/stack/billing-mode.ts.txt +8 -0
- package/assets/stack/billing-schema.ts.txt +11 -0
- package/assets/stack/desktop.rs.txt +21 -0
- package/assets/stack/entitlement-guard.ts.txt +32 -0
- package/assets/stack/entitlements.ts.txt +8 -0
- package/assets/stack/events-schema.ts.txt +12 -0
- package/assets/stack/events.ts.txt +59 -0
- package/assets/stack/mobile-auth.ts.txt +25 -0
- package/assets/stack/mobile-billing.tsx.txt +63 -0
- package/assets/stack/mobile-session.tsx.txt +83 -0
- package/assets/stack/native-button.tsx.txt +108 -0
- package/assets/stack/native-global.css.txt +4 -0
- package/assets/stack/native-lib-utils.ts.txt +5 -0
- package/assets/stack/native-metro.config.js.txt +6 -0
- package/assets/stack/native-nativewind-env.d.ts.txt +1 -0
- package/assets/stack/native-tailwind.config.js.txt +73 -0
- package/assets/stack/native-text.tsx.txt +89 -0
- package/assets/stack/purchases.ts.txt +65 -0
- package/assets/stack/revenuecat.ts.txt +88 -0
- package/assets/stack/rtc-schema.ts.txt +10 -0
- package/assets/stack/rtc.ts.txt +122 -0
- package/assets/stack/security.ts.txt +31 -0
- package/assets/stack/storage.ts.txt +36 -0
- package/assets/stack/stripe.ts.txt +126 -0
- package/assets/stack/web-sign-in.tsx.txt +51 -0
- package/assets/ui/LICENSE.react-native-reusables +21 -0
- package/assets/ui/UPSTREAM.json +7 -1
- package/assets/ui/catalog.json +891 -0
- package/assets/ui/extensions/registry.json +6 -0
- package/assets/ui/native/_controls.tsx +521 -0
- package/assets/ui/native/_core.tsx +118 -0
- package/assets/ui/native/_data.tsx +200 -0
- package/assets/ui/native/_display.tsx +453 -0
- package/assets/ui/native/_feedback.tsx +242 -0
- package/assets/ui/native/_legacy-dialog.tsx +38 -0
- package/assets/ui/native/_motion.tsx +520 -0
- package/assets/ui/native/_overlay.tsx +402 -0
- package/assets/ui/native/_selection.tsx +366 -0
- package/assets/ui/native/accordion.tsx +1 -0
- package/assets/ui/native/alert-dialog.tsx +11 -0
- package/assets/ui/native/alert.tsx +1 -0
- package/assets/ui/native/aspect-ratio.tsx +1 -0
- package/assets/ui/native/attachment.tsx +8 -0
- package/assets/ui/native/avatar.tsx +8 -0
- package/assets/ui/native/badge.tsx +1 -0
- package/assets/ui/native/breadcrumb.tsx +9 -0
- package/assets/ui/native/bubble.tsx +1 -0
- package/assets/ui/native/button-group.tsx +1 -0
- package/assets/ui/native/button.tsx +2 -1
- package/assets/ui/native/calendar.tsx +170 -0
- package/assets/ui/native/card.tsx +16 -5
- package/assets/ui/native/carousel.tsx +1 -0
- package/assets/ui/native/chart.tsx +193 -0
- package/assets/ui/native/checkbox.tsx +1 -0
- package/assets/ui/native/code-block.tsx +137 -0
- package/assets/ui/native/collapsible.tsx +1 -0
- package/assets/ui/native/combobox.tsx +1 -0
- package/assets/ui/native/command.tsx +11 -0
- package/assets/ui/native/context-menu.tsx +16 -0
- package/assets/ui/native/data-table.tsx +1 -0
- package/assets/ui/native/date-picker.tsx +43 -0
- package/assets/ui/native/dialog.tsx +14 -74
- package/assets/ui/native/direction.tsx +1 -0
- package/assets/ui/native/drawer.tsx +10 -0
- package/assets/ui/native/dropdown-menu.tsx +16 -0
- package/assets/ui/native/empty.tsx +8 -0
- package/assets/ui/native/field.tsx +13 -0
- package/assets/ui/native/hover-card.tsx +1 -0
- package/assets/ui/native/input-group.tsx +8 -0
- package/assets/ui/native/input-otp.tsx +1 -0
- package/assets/ui/native/input.tsx +2 -1
- package/assets/ui/native/item.tsx +12 -0
- package/assets/ui/native/kbd.tsx +1 -0
- package/assets/ui/native/marker.tsx +1 -0
- package/assets/ui/native/menubar.tsx +17 -0
- package/assets/ui/native/message-scroller.tsx +6 -0
- package/assets/ui/native/message.tsx +10 -0
- package/assets/ui/native/native-select.tsx +1 -0
- package/assets/ui/native/navigation-menu.tsx +10 -0
- package/assets/ui/native/pagination.tsx +9 -0
- package/assets/ui/native/popover.tsx +1 -0
- package/assets/ui/native/progress.tsx +1 -0
- package/assets/ui/native/questionnaire.tsx +130 -0
- package/assets/ui/native/radio-group.tsx +1 -0
- package/assets/ui/native/registry.json +1103 -0
- package/assets/ui/native/resizable.tsx +1 -0
- package/assets/ui/native/scroll-area.tsx +1 -0
- package/assets/ui/native/select.tsx +11 -0
- package/assets/ui/native/separator.tsx +1 -0
- package/assets/ui/native/sheet.tsx +10 -0
- package/assets/ui/native/sidebar.tsx +22 -0
- package/assets/ui/native/skeleton.tsx +1 -0
- package/assets/ui/native/slider.tsx +1 -0
- package/assets/ui/native/spinner.tsx +1 -0
- package/assets/ui/native/switch.tsx +1 -0
- package/assets/ui/native/table.tsx +10 -0
- package/assets/ui/native/tabs.tsx +1 -0
- package/assets/ui/native/textarea.tsx +1 -0
- package/assets/ui/native/toast.tsx +11 -0
- package/assets/ui/native/toggle-group.tsx +1 -0
- package/assets/ui/native/toggle.tsx +1 -0
- package/assets/ui/native/tooltip.tsx +1 -0
- package/assets/ui/native/trace.tsx +20 -0
- package/assets/ui/native/typography.tsx +15 -0
- package/dist/bin.js +7 -12
- package/dist/capabilities.d.ts +4 -33
- package/dist/capabilities.js +2 -66
- package/dist/capability-catalog.d.ts +83 -0
- package/dist/capability-catalog.js +121 -0
- package/dist/capability-command.d.ts +3 -0
- package/dist/capability-command.js +188 -0
- package/dist/capability-editor.d.ts +17 -0
- package/dist/capability-editor.js +97 -0
- package/dist/capability-recipes.d.ts +4 -0
- package/dist/capability-recipes.js +520 -0
- package/dist/capability-references.d.ts +4 -0
- package/dist/capability-references.js +7 -0
- package/dist/cli-commands.d.ts +1 -2
- package/dist/cli-commands.js +10 -104
- package/dist/cli-output.d.ts +1 -2
- package/dist/cli-output.js +6 -251
- package/dist/command-schema.js +39 -322
- package/dist/dependencies.d.ts +29 -6
- package/dist/dependencies.js +61 -14
- package/dist/index.d.ts +1 -42
- package/dist/index.js +1 -27
- package/dist/platforms/mobile.js +1 -20
- package/dist/platforms/web.d.ts +1 -1
- package/dist/platforms/web.js +27 -75
- package/dist/project-config.d.ts +2 -13
- package/dist/project-config.js +10 -82
- package/dist/registry/options.js +1 -5
- package/dist/registry/resolve.d.ts +1 -1
- package/dist/registry/resolve.js +2 -10
- package/dist/registry/usage.js +3 -9
- package/dist/scaffold/backend.js +0 -3
- package/dist/scaffold/database.js +2 -1
- package/dist/scaffold/documentation.js +82 -20
- package/dist/scaffold/expo-runtime.js +3 -4
- package/dist/scaffold/native-ui.js +12 -7
- package/dist/scaffold/stack-documentation.js +1 -1
- package/dist/scaffold/storage.d.ts +2 -0
- package/dist/scaffold/storage.js +21 -0
- package/dist/scaffold/workspace.js +26 -21
- package/dist/stack-registry.d.ts +2 -8
- package/dist/stack-registry.js +11 -87
- package/dist/standard.js +1 -11
- package/dist/ui-catalog.d.ts +26 -0
- package/dist/ui-catalog.js +31 -0
- package/dist/ui-command.d.ts +3 -0
- package/dist/ui-command.js +219 -0
- package/dist/ui-project.d.ts +22 -0
- package/dist/ui-project.js +110 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/anhedral-stack.md +4 -20
- package/docs/capabilities.md +110 -0
- package/docs/native-ui.md +102 -0
- package/docs/software-factory.md +16 -44
- package/docs/stack-standard.md +11 -60
- package/docs/ui.md +33 -0
- package/docs/verification.md +191 -0
- package/package.json +19 -18
- package/dist/access.d.ts +0 -10
- package/dist/access.js +0 -93
- package/dist/auth-schema-snapshot.d.ts +0 -346
- package/dist/auth-schema-snapshot.js +0 -347
- package/dist/auth-schema.d.ts +0 -1
- package/dist/auth-schema.js +0 -57
- package/dist/capability-contract.d.ts +0 -47
- package/dist/capability-contract.js +0 -129
- package/dist/catalog-model.d.ts +0 -24
- package/dist/catalog-model.js +0 -1
- package/dist/catalog-registration.d.ts +0 -16
- package/dist/catalog-registration.js +0 -22
- package/dist/catalog-snapshot.d.ts +0 -5
- package/dist/catalog-snapshot.js +0 -97
- package/dist/cli-delivery.d.ts +0 -3
- package/dist/cli-delivery.js +0 -112
- package/dist/cloudflare.d.ts +0 -25
- package/dist/cloudflare.js +0 -226
- package/dist/delivery-evidence.d.ts +0 -62
- package/dist/delivery-evidence.js +0 -157
- package/dist/delivery.d.ts +0 -82
- package/dist/delivery.js +0 -489
- package/dist/inspector-model.d.ts +0 -123
- package/dist/inspector-model.js +0 -1
- package/dist/integration-service-readers.d.ts +0 -12
- package/dist/integration-service-readers.js +0 -92
- package/dist/lifecycle-model.d.ts +0 -15
- package/dist/lifecycle-model.js +0 -20
- package/dist/lifecycle.d.ts +0 -11
- package/dist/lifecycle.js +0 -91
- package/dist/management.d.ts +0 -3
- package/dist/management.js +0 -47
- package/dist/mobile-delivery.d.ts +0 -77
- package/dist/mobile-delivery.js +0 -370
- package/dist/project-catalog.d.ts +0 -41
- package/dist/project-catalog.js +0 -288
- package/dist/project-inspector.d.ts +0 -4
- package/dist/project-inspector.js +0 -671
- package/dist/project-lifecycle.d.ts +0 -25
- package/dist/project-lifecycle.js +0 -57
- package/dist/project-state.d.ts +0 -47
- package/dist/project-state.js +0 -480
- package/dist/provider-auth.d.ts +0 -41
- package/dist/provider-auth.js +0 -180
- package/dist/provider-readiness.d.ts +0 -30
- package/dist/provider-readiness.js +0 -85
- package/dist/providers/adapters.d.ts +0 -17
- package/dist/providers/adapters.js +0 -103
- package/dist/providers/api.d.ts +0 -29
- package/dist/providers/api.js +0 -253
- package/dist/providers/config.d.ts +0 -15
- package/dist/providers/config.js +0 -136
- package/dist/providers/definitions.d.ts +0 -115
- package/dist/providers/definitions.js +0 -42
- package/dist/providers/provision.d.ts +0 -24
- package/dist/providers/provision.js +0 -76
- package/dist/providers/receipts.d.ts +0 -20
- package/dist/providers/receipts.js +0 -56
- package/dist/providers/recovery-verification.d.ts +0 -7
- package/dist/providers/recovery-verification.js +0 -52
- package/dist/providers/recovery.d.ts +0 -30
- package/dist/providers/recovery.js +0 -34
- package/dist/providers/runtime.d.ts +0 -10
- package/dist/providers/runtime.js +0 -234
- package/dist/providers/schema.d.ts +0 -28
- package/dist/providers/schema.js +0 -49
- package/dist/providers/state.d.ts +0 -55
- package/dist/providers/state.js +0 -283
- package/dist/provision.d.ts +0 -47
- package/dist/provision.js +0 -208
- package/dist/r2-service-data.d.ts +0 -2
- package/dist/r2-service-data.js +0 -136
- package/dist/readiness.d.ts +0 -23
- package/dist/readiness.js +0 -117
- package/dist/registry/add.d.ts +0 -24
- package/dist/registry/add.js +0 -210
- package/dist/registry/bootstrap.d.ts +0 -3
- package/dist/registry/bootstrap.js +0 -5
- package/dist/registry/commands.d.ts +0 -3
- package/dist/registry/commands.js +0 -83
- package/dist/registry/preview.d.ts +0 -11
- package/dist/registry/preview.js +0 -91
- package/dist/registry/receipt.d.ts +0 -3
- package/dist/registry/receipt.js +0 -68
- package/dist/repository.d.ts +0 -24
- package/dist/repository.js +0 -96
- package/dist/scaffold/auth.d.ts +0 -2
- package/dist/scaffold/auth.js +0 -76
- package/dist/scaffold/billing-config.d.ts +0 -1
- package/dist/scaffold/billing-config.js +0 -73
- package/dist/scaffold/billing-contracts.d.ts +0 -2
- package/dist/scaffold/billing-contracts.js +0 -48
- package/dist/scaffold/billing-providers.d.ts +0 -1
- package/dist/scaffold/billing-providers.js +0 -249
- package/dist/scaffold/billing-schema.d.ts +0 -1
- package/dist/scaffold/billing-schema.js +0 -34
- package/dist/scaffold/billing-security.d.ts +0 -1
- package/dist/scaffold/billing-security.js +0 -46
- package/dist/scaffold/billing-server.d.ts +0 -1
- package/dist/scaffold/billing-server.js +0 -139
- package/dist/scaffold/billing-store.d.ts +0 -1
- package/dist/scaffold/billing-store.js +0 -72
- package/dist/scaffold/billing.d.ts +0 -2
- package/dist/scaffold/billing.js +0 -208
- package/dist/scaffold/expo-auth.d.ts +0 -3
- package/dist/scaffold/expo-auth.js +0 -203
- package/dist/scaffold/expo-billing.d.ts +0 -3
- package/dist/scaffold/expo-billing.js +0 -257
- package/dist/scaffold/integrations.d.ts +0 -2
- package/dist/scaffold/integrations.js +0 -11
- package/dist/scaffold/managed-email.d.ts +0 -3
- package/dist/scaffold/managed-email.js +0 -47
- package/dist/scaffold/password-reset.d.ts +0 -1
- package/dist/scaffold/password-reset.js +0 -99
- package/dist/scaffold/private-files.d.ts +0 -2
- package/dist/scaffold/private-files.js +0 -78
- package/dist/scaffold/web-billing.d.ts +0 -2
- package/dist/scaffold/web-billing.js +0 -48
- package/dist/service-deletion.d.ts +0 -29
- package/dist/service-deletion.js +0 -195
- package/dist/service-descriptor.d.ts +0 -10
- package/dist/service-descriptor.js +0 -71
- package/dist/service-model.d.ts +0 -49
- package/dist/service-model.js +0 -8
- package/dist/service-operations.d.ts +0 -29
- package/dist/service-operations.js +0 -48
- package/dist/service-readers.d.ts +0 -8
- package/dist/service-readers.js +0 -216
- package/dist/services-command.d.ts +0 -39
- package/dist/services-command.js +0 -96
- package/dist/ship.d.ts +0 -35
- package/dist/ship.js +0 -107
- package/docs/assets/anhedral-stack-light.png +0 -0
- package/docs/assets/anhedral-stack.png +0 -0
|
@@ -5,33 +5,38 @@ import { json, put } from './files.js';
|
|
|
5
5
|
import { writeReactLintConfig } from '../platforms/lint.js';
|
|
6
6
|
/** Anhedral-maintained native shadcn port. Never imported by the DOM application. */
|
|
7
7
|
export function scaffoldNativeUI(root) {
|
|
8
|
+
const assets = fileURLToPath(new URL('../../assets/ui/', import.meta.url));
|
|
9
|
+
const registry = JSON.parse(readFileSync(assets + 'native/registry.json', 'utf8'));
|
|
8
10
|
const components = [
|
|
9
|
-
|
|
10
|
-
'card',
|
|
11
|
-
'dialog',
|
|
12
|
-
'input',
|
|
13
|
-
'label',
|
|
11
|
+
...registry.components.map((item) => item.id),
|
|
14
12
|
'layout',
|
|
15
13
|
'text',
|
|
16
14
|
'theme-switcher',
|
|
17
15
|
];
|
|
16
|
+
const nativeFiles = [...registry.components.map((item) => item.file), ...registry.supportFiles];
|
|
18
17
|
for (const file of [
|
|
19
18
|
'theme.tsx',
|
|
20
19
|
'theme-storage.ts',
|
|
21
20
|
'LICENSE.shadcn',
|
|
22
21
|
'UPSTREAM.json',
|
|
23
|
-
...
|
|
22
|
+
...nativeFiles.map((name) => `native/${name}`),
|
|
24
23
|
]) {
|
|
25
24
|
const source = readFileSync(fileURLToPath(new URL(`../../assets/ui/${file}`, import.meta.url)), 'utf8');
|
|
26
25
|
put(root, `packages/native-ui/${file.endsWith('.tsx') || file.endsWith('.ts') ? 'src/' : ''}${file}`, source);
|
|
27
26
|
}
|
|
27
|
+
put(root, 'packages/native-ui/README.md', readFileSync(fileURLToPath(new URL('../../docs/native-ui.md', import.meta.url)), 'utf8'));
|
|
28
|
+
put(root, 'packages/native-ui/NATIVE_COMPONENTS.json', readFileSync(assets + 'native/registry.json', 'utf8'));
|
|
28
29
|
put(root, 'packages/native-ui/src/index.ts', `export * from './theme';\n` +
|
|
29
30
|
components.map((name) => `export * from './native/${name}';\n`).join(''));
|
|
30
31
|
json(root, 'packages/native-ui/package.json', {
|
|
31
32
|
name: '@workspace/native-ui',
|
|
32
33
|
private: true,
|
|
33
34
|
type: 'module',
|
|
34
|
-
exports: {
|
|
35
|
+
exports: {
|
|
36
|
+
'.': './src/index.ts',
|
|
37
|
+
'./components/*': './src/native/*.tsx',
|
|
38
|
+
'./theme': './src/theme.tsx',
|
|
39
|
+
},
|
|
35
40
|
scripts: { typecheck: 'tsc --noEmit', lint: 'eslint . --max-warnings 0' },
|
|
36
41
|
dependencies: {
|
|
37
42
|
...NATIVE_UI_DEPENDENCIES.dependencies,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { put } from './files.js';
|
|
2
2
|
export function writeStackDocumentation(root, registry) {
|
|
3
3
|
const sections = registry.items.map((item) => `## ${item.name}\n\n${item.description}.\n\nTargets: ${item.targets.join(', ')}.\n\n${item.environment.length ? 'Environment: ' + item.environment.join(', ') + '.\n\n' : ''}${item.setup ? 'Setup: ' + item.setup.resources.join('; ') + '.\n\nVerify: ' + item.setup.verify.join('; ') + '.\n' : ''}`);
|
|
4
|
-
put(root, 'docs/stack.md', '# Application stack\n\nEvery application uses Next.js App Router/OpenNext for web, Expo for iOS/Android, Hono, Drizzle/D1 and private R2.
|
|
4
|
+
put(root, 'docs/stack.md', '# Application stack\n\nEvery application uses Next.js App Router/OpenNext for web, Expo for iOS/Android, Hono, Drizzle/D1 and private R2. Shared contracts, styling and native shadcn UI are included. Consumers implement application features, identity and integrations.\n\nInit generates source and configuration only. Consumers own cloud provisioning, secrets, migrations and deployment.\n\n' +
|
|
5
5
|
sections.join('\n'));
|
|
6
6
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { put } from './files.js';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
export function scaffoldPrivateStorage({ root }) {
|
|
5
|
+
put(root, 'apps/api/src/private-storage.ts', `// Use only after your application has authorized the operation. No HTTP routes are exposed.
|
|
6
|
+
// R2 bucket privacy does not establish end-user authorization.
|
|
7
|
+
export function privateStorage(binding: R2Bucket) {
|
|
8
|
+
return {
|
|
9
|
+
get: (key: string) => binding.get(key),
|
|
10
|
+
put: (key: string, value: ArrayBuffer | ReadableStream) => binding.put(key, value),
|
|
11
|
+
delete: (key: string) => binding.delete(key),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
`);
|
|
15
|
+
const file = 'apps/api/src/index.ts';
|
|
16
|
+
const source = readFileSync(path.join(root, file), 'utf8');
|
|
17
|
+
put(root, file, "import { privateStorage } from './private-storage';\n" +
|
|
18
|
+
source
|
|
19
|
+
.replace('database: () => ReturnType<typeof createDatabase>', 'database: () => ReturnType<typeof createDatabase>; storage: () => ReturnType<typeof privateStorage>')
|
|
20
|
+
.replace("c.set('database', () => createDatabase(c.env.DB));", "c.set('database', () => createDatabase(c.env.DB)); c.set('storage', () => privateStorage(c.env.FILES));"));
|
|
21
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { writeProjectSection } from '../project-config.js';
|
|
2
2
|
import { OPENNEXT_GLOB_VERSION, STACK_DEPENDENCIES, WORKSPACE_NODE_ENGINE, PACKAGE_MANAGER, } from '../dependencies.js';
|
|
3
3
|
import { writeDependencyAudit } from '../dependency-patches.js';
|
|
4
4
|
import { setPnpmPolicy } from '../pnpm-policy.js';
|
|
@@ -8,7 +8,6 @@ import { json, put, patchPackage } from './files.js';
|
|
|
8
8
|
import { writeSetupDocumentation } from './documentation.js';
|
|
9
9
|
import { writeStackDocumentation } from './stack-documentation.js';
|
|
10
10
|
import { writeEnvironmentExample } from './environment.js';
|
|
11
|
-
import { providerConfigurationTemplate } from '../providers/config.js';
|
|
12
11
|
export function writeStandardRoot(root, options, registry, updating = false) {
|
|
13
12
|
patchPackage(root, 'package.json', {
|
|
14
13
|
name: options.name,
|
|
@@ -21,8 +20,12 @@ export function writeStandardRoot(root, options, registry, updating = false) {
|
|
|
21
20
|
lint: 'turbo lint',
|
|
22
21
|
typecheck: 'turbo typecheck',
|
|
23
22
|
test: 'turbo test',
|
|
24
|
-
'
|
|
25
|
-
|
|
23
|
+
...(options.products.includes('d1')
|
|
24
|
+
? {
|
|
25
|
+
'db:generate': 'turbo run db:generate --filter=@workspace/db',
|
|
26
|
+
'db:migrate': 'turbo run db:migrate --filter=@workspace/db',
|
|
27
|
+
}
|
|
28
|
+
: {}),
|
|
26
29
|
audit: 'node scripts/audit.mjs',
|
|
27
30
|
'audit:full': 'fallow --fail-on-issues',
|
|
28
31
|
'audit:deps': 'node scripts/audit-deps.mjs',
|
|
@@ -39,8 +42,10 @@ if (result.error) throw result.error;
|
|
|
39
42
|
process.exitCode = result.status ?? 1;
|
|
40
43
|
`);
|
|
41
44
|
json(root, '.fallowrc.json', {
|
|
42
|
-
publicPackages: ['@workspace/native-ui'],
|
|
43
|
-
ignoreDependencies:
|
|
45
|
+
publicPackages: options.products.includes('expo') ? ['@workspace/native-ui'] : [],
|
|
46
|
+
ignoreDependencies: options.products.includes('expo')
|
|
47
|
+
? ['react-native-reanimated', 'react-native-worklets']
|
|
48
|
+
: [],
|
|
44
49
|
ignorePatterns: [
|
|
45
50
|
'scripts/audit.mjs',
|
|
46
51
|
'scripts/audit-deps.mjs',
|
|
@@ -60,13 +65,20 @@ process.exitCode = result.status ?? 1;
|
|
|
60
65
|
tasks: {
|
|
61
66
|
dev: { cache: false, persistent: true },
|
|
62
67
|
lint: { dependsOn: ['^lint'] },
|
|
63
|
-
typecheck: {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
'db:migrate': {
|
|
67
|
-
cache: false,
|
|
68
|
-
passThroughEnv: ['CLOUDFLARE_API_TOKEN', 'CLOUDFLARE_ACCOUNT_ID'],
|
|
68
|
+
typecheck: {
|
|
69
|
+
dependsOn: ['^typecheck'],
|
|
70
|
+
outputs: ['worker-configuration.d.ts', 'next-env.d.ts', '.next/types/**'],
|
|
69
71
|
},
|
|
72
|
+
test: { dependsOn: ['^build'], outputs: ['coverage/**'] },
|
|
73
|
+
...(options.products.includes('d1')
|
|
74
|
+
? {
|
|
75
|
+
'db:generate': { cache: false },
|
|
76
|
+
'db:migrate': {
|
|
77
|
+
cache: false,
|
|
78
|
+
passThroughEnv: ['CLOUDFLARE_API_TOKEN', 'CLOUDFLARE_ACCOUNT_ID'],
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
: {}),
|
|
70
82
|
build: {
|
|
71
83
|
dependsOn: ['^build'],
|
|
72
84
|
outputs: ['dist/**', '.open-next/**', '.next/**', '!.next/cache/**'],
|
|
@@ -79,7 +91,7 @@ process.exitCode = result.status ?? 1;
|
|
|
79
91
|
overrides: {
|
|
80
92
|
'@node-minify/core>glob': OPENNEXT_GLOB_VERSION,
|
|
81
93
|
// Expo CLI's two schema consumers use APIs supported by the patched Zod release.
|
|
82
|
-
'@expo/cli>zod': STACK_DEPENDENCIES.zod,
|
|
94
|
+
...(options.products.includes('expo') ? { '@expo/cli>zod': STACK_DEPENDENCIES.zod } : {}),
|
|
83
95
|
'miniflare>undici': STACK_DEPENDENCIES.undici,
|
|
84
96
|
},
|
|
85
97
|
sharedWorkspaceLockfile: true,
|
|
@@ -106,6 +118,7 @@ process.exitCode = result.status ?? 1;
|
|
|
106
118
|
'.anhedral/',
|
|
107
119
|
'.anhedral-audit-report.json',
|
|
108
120
|
'worker-configuration.d.ts',
|
|
121
|
+
'next-env.d.ts',
|
|
109
122
|
]);
|
|
110
123
|
writeEnvironmentExample(root, registry);
|
|
111
124
|
writeStackDocumentation(root, registry);
|
|
@@ -119,14 +132,6 @@ process.exitCode = result.status ?? 1;
|
|
|
119
132
|
resourcesProvisioned: false,
|
|
120
133
|
});
|
|
121
134
|
writeProjectSection(root, 'setup', createSetupPlan({ ...options, dryRun: false }, registry));
|
|
122
|
-
const providers = providerConfigurationTemplate(options.products, options.name);
|
|
123
|
-
const prior = updating && hasProjectSection(root, 'providers')
|
|
124
|
-
? readProjectSection(root, 'providers')
|
|
125
|
-
: undefined;
|
|
126
|
-
writeProjectSection(root, 'providers', {
|
|
127
|
-
...providers,
|
|
128
|
-
providers: { ...providers.providers, ...prior?.providers },
|
|
129
|
-
});
|
|
130
135
|
if (!updating)
|
|
131
136
|
writeSetupDocumentation(root, options);
|
|
132
137
|
}
|
package/dist/stack-registry.d.ts
CHANGED
|
@@ -5,23 +5,17 @@ declare const PRODUCT_ITEMS: {
|
|
|
5
5
|
expo: ItemDefinition;
|
|
6
6
|
hono: ItemDefinition;
|
|
7
7
|
d1: ItemDefinition;
|
|
8
|
-
'better-auth': ItemDefinition;
|
|
9
8
|
r2: ItemDefinition;
|
|
10
|
-
stripe: ItemDefinition;
|
|
11
|
-
revenuecat: ItemDefinition;
|
|
12
9
|
styling: ItemDefinition;
|
|
13
10
|
};
|
|
14
11
|
export type StandardProduct = keyof typeof PRODUCT_ITEMS;
|
|
15
|
-
export declare const STANDARD_PRODUCTS: readonly ("
|
|
12
|
+
export declare const STANDARD_PRODUCTS: readonly ("hono" | "expo" | "r2" | "next" | "styling" | "d1")[];
|
|
16
13
|
declare const DEFINITIONS: {
|
|
17
14
|
next: ItemDefinition;
|
|
18
15
|
expo: ItemDefinition;
|
|
19
16
|
hono: ItemDefinition;
|
|
20
17
|
d1: ItemDefinition;
|
|
21
|
-
'better-auth': ItemDefinition;
|
|
22
18
|
r2: ItemDefinition;
|
|
23
|
-
stripe: ItemDefinition;
|
|
24
|
-
revenuecat: ItemDefinition;
|
|
25
19
|
styling: ItemDefinition;
|
|
26
20
|
workspace: ItemDefinition;
|
|
27
21
|
typescript: ItemDefinition;
|
|
@@ -30,7 +24,7 @@ declare const DEFINITIONS: {
|
|
|
30
24
|
export type StackItemId = keyof typeof DEFINITIONS;
|
|
31
25
|
export declare function getStackDefinition(name: string): ItemDefinition;
|
|
32
26
|
export declare function getStackItem(name: string): StackRegistryItem;
|
|
33
|
-
export declare const STACK_ITEMS: Record<"
|
|
27
|
+
export declare const STACK_ITEMS: Record<"hono" | "expo" | "r2" | "typescript" | "next" | "eslint" | "workspace" | "styling" | "d1", StackRegistryItem>;
|
|
34
28
|
export declare const STACK_REGISTRY: {
|
|
35
29
|
schemaVersion: number;
|
|
36
30
|
name: string;
|
package/dist/stack-registry.js
CHANGED
|
@@ -4,22 +4,13 @@ import { dependencyOrder } from './dependency-order.js';
|
|
|
4
4
|
import { GENERATOR_VERSION } from './version.js';
|
|
5
5
|
import { scaffoldApi } from './scaffold/api.js';
|
|
6
6
|
import { scaffoldDatabase } from './scaffold/database.js';
|
|
7
|
-
import { scaffoldBetterAuth } from './scaffold/auth.js';
|
|
8
7
|
import { scaffoldWeb } from './platforms/web.js';
|
|
9
8
|
import { scaffoldExpo } from './platforms/mobile.js';
|
|
10
|
-
import {
|
|
11
|
-
import { scaffoldBilling } from './scaffold/billing.js';
|
|
9
|
+
import { scaffoldPrivateStorage } from './scaffold/storage.js';
|
|
12
10
|
import { sharedPackage } from './scaffold/files.js';
|
|
13
11
|
function requirements(purpose, tools, access, credentials, resources, verify) {
|
|
14
12
|
return { purpose, tools, access, credentials, resources, verify };
|
|
15
13
|
}
|
|
16
|
-
const BILLING_ENVIRONMENT_KEYS = [
|
|
17
|
-
'BILLING_ORIGIN',
|
|
18
|
-
'BILLING_ENVIRONMENT',
|
|
19
|
-
'BILLING_PLANS_JSON',
|
|
20
|
-
'BILLING_ENTITLEMENTS_JSON',
|
|
21
|
-
'BILLING_PREMIUM_ENTITLEMENT',
|
|
22
|
-
];
|
|
23
14
|
function packageSource(name, source, dependencies) {
|
|
24
15
|
return { name, source, dependencies };
|
|
25
16
|
}
|
|
@@ -43,10 +34,10 @@ const PRODUCT_ITEMS = defineItems({
|
|
|
43
34
|
type: 'application',
|
|
44
35
|
description: 'Full Next.js App Router web application on Cloudflare OpenNext',
|
|
45
36
|
targets: ['apps/web'],
|
|
46
|
-
registryDependencies: ['workspace', 'typescript', 'eslint', 'styling'
|
|
47
|
-
setup: requirements('Server-rendered web application', ['Browser control', 'Wrangler'], ['Cloudflare Workers deployment access'], [], ['Next.js Worker
|
|
37
|
+
registryDependencies: ['workspace', 'typescript', 'eslint', 'styling'],
|
|
38
|
+
setup: requirements('Server-rendered web application', ['Browser control', 'Wrangler'], ['Cloudflare Workers deployment access'], [], ['Next.js Worker and assets; no backend or database provisioned'], ['Request-rendered HTML, RSC and editable Anhedral UI source']),
|
|
48
39
|
install: scaffoldWeb,
|
|
49
|
-
environment: ['
|
|
40
|
+
environment: ['ANHEDRAL_PREVIEW_ORIGIN'],
|
|
50
41
|
},
|
|
51
42
|
expo: {
|
|
52
43
|
type: 'application',
|
|
@@ -62,7 +53,7 @@ const PRODUCT_ITEMS = defineItems({
|
|
|
62
53
|
description: 'Shared Hono OpenAPI Worker',
|
|
63
54
|
targets: ['apps/api'],
|
|
64
55
|
registryDependencies: ['workspace', 'typescript', 'eslint'],
|
|
65
|
-
setup: requirements('Shared OpenAPI backend', ['Wrangler'], ['Cloudflare Workers deployment access'], [], ['API Worker; application routes and authorization'], ['
|
|
56
|
+
setup: requirements('Shared OpenAPI backend', ['Wrangler'], ['Cloudflare Workers deployment access'], [], ['API Worker; application routes and authorization'], ['Health contract and application-owned authorization']),
|
|
66
57
|
install: scaffoldApi,
|
|
67
58
|
},
|
|
68
59
|
d1: {
|
|
@@ -85,87 +76,20 @@ const PRODUCT_ITEMS = defineItems({
|
|
|
85
76
|
}),
|
|
86
77
|
runtime: 'worker',
|
|
87
78
|
},
|
|
88
|
-
'better-auth': {
|
|
89
|
-
type: 'integration',
|
|
90
|
-
description: 'Database-backed identity schema and runtime routes',
|
|
91
|
-
targets: [
|
|
92
|
-
'packages/auth',
|
|
93
|
-
'packages/managed-email',
|
|
94
|
-
'packages/db',
|
|
95
|
-
'apps/api',
|
|
96
|
-
'apps/mobile',
|
|
97
|
-
'apps/web',
|
|
98
|
-
],
|
|
99
|
-
selection: { requiresAll: ['d1', 'hono', 'expo'] },
|
|
100
|
-
registryDependencies: ['workspace', 'typescript', 'eslint', 'd1', 'expo', 'next'],
|
|
101
|
-
setup: requirements('Application-managed identity', ['Selected database tooling'], ['Selected database migration/runtime access'], ['BETTER_AUTH_SECRET; BETTER_AUTH_URL'], ['D1 database, auth schema, trusted origins and application routes'], ['Sign-in/out, session expiry, sign-up policy and resource authorization']),
|
|
102
|
-
install: scaffoldBetterAuth,
|
|
103
|
-
environment: ['BETTER_AUTH_SECRET', 'BETTER_AUTH_URL'],
|
|
104
|
-
runtime: 'server',
|
|
105
|
-
},
|
|
106
79
|
r2: {
|
|
107
80
|
type: 'integration',
|
|
108
|
-
description: '
|
|
109
|
-
targets: ['apps/api/src/private-
|
|
110
|
-
registryDependencies: ['workspace', 'typescript', 'eslint', '
|
|
111
|
-
setup: requirements('Private remote files', ['Wrangler'], ['Cloudflare R2 bucket/binding access'], [], ['Private R2 bucket and FILES binding;
|
|
112
|
-
'
|
|
81
|
+
description: 'Server-only private R2 storage foundation',
|
|
82
|
+
targets: ['apps/api/src/private-storage.ts'],
|
|
83
|
+
registryDependencies: ['workspace', 'typescript', 'eslint', 'hono'],
|
|
84
|
+
setup: requirements('Private remote files', ['Wrangler'], ['Cloudflare R2 bucket/binding access'], [], ['Private R2 bucket and FILES binding; no public object routes'], [
|
|
85
|
+
'Keep public access disabled; implement application authorization before adding object routes',
|
|
113
86
|
]),
|
|
114
|
-
install:
|
|
87
|
+
install: scaffoldPrivateStorage,
|
|
115
88
|
configure: ({ options }) => ({
|
|
116
89
|
r2_buckets: [{ binding: 'FILES', bucket_name: resourceName(options.name, 'private-files') }],
|
|
117
90
|
}),
|
|
118
91
|
runtime: 'worker',
|
|
119
92
|
},
|
|
120
|
-
stripe: {
|
|
121
|
-
type: 'integration',
|
|
122
|
-
description: 'Authenticated Stripe checkout, portal and server entitlement projection',
|
|
123
|
-
targets: ['packages/billing', 'packages/contracts', 'apps/api', 'apps/mobile', 'apps/web'],
|
|
124
|
-
selection: { requiresAll: ['hono', 'better-auth', 'd1'] },
|
|
125
|
-
registryDependencies: [
|
|
126
|
-
'workspace',
|
|
127
|
-
'typescript',
|
|
128
|
-
'eslint',
|
|
129
|
-
'hono',
|
|
130
|
-
'd1',
|
|
131
|
-
'better-auth',
|
|
132
|
-
'expo',
|
|
133
|
-
'next',
|
|
134
|
-
],
|
|
135
|
-
setup: requirements('Web payments and subscriptions', ['Stripe integration or CLI'], ['Client-owned Stripe account; test/live access as required'], ['STRIPE_SECRET_KEY; STRIPE_WEBHOOK_SECRET'], ['Products/prices, signed webhooks and entitlement implementation'], ['Test purchase/cancellation, webhook replay and transactional idempotency']),
|
|
136
|
-
install: scaffoldBilling,
|
|
137
|
-
environment: [...BILLING_ENVIRONMENT_KEYS, 'STRIPE_SECRET_KEY', 'STRIPE_WEBHOOK_SECRET'],
|
|
138
|
-
},
|
|
139
|
-
revenuecat: {
|
|
140
|
-
type: 'integration',
|
|
141
|
-
description: 'Native purchases, restore and server-enforced cross-store entitlements',
|
|
142
|
-
targets: ['packages/billing', 'packages/contracts', 'apps/api', 'apps/mobile', 'apps/web'],
|
|
143
|
-
selection: { requiresAll: ['hono', 'better-auth', 'd1'] },
|
|
144
|
-
registryDependencies: [
|
|
145
|
-
'workspace',
|
|
146
|
-
'typescript',
|
|
147
|
-
'eslint',
|
|
148
|
-
'hono',
|
|
149
|
-
'd1',
|
|
150
|
-
'better-auth',
|
|
151
|
-
'expo',
|
|
152
|
-
'next',
|
|
153
|
-
],
|
|
154
|
-
setup: requirements('Cross-store subscription entitlements; Stripe is optional', ['RevenueCat integration or API', 'Selected mobile store tooling'], ['RevenueCat project; App Store/Play Store product access'], ['Platform public SDK keys; server API/webhook credentials as required'], [
|
|
155
|
-
'Native purchase SDK and authenticated entitlement APIs; configure offerings/store products before acceptance',
|
|
156
|
-
], ['Sandbox purchase/restore, verified webhooks and entitlement reconciliation']),
|
|
157
|
-
install: scaffoldBilling,
|
|
158
|
-
environment: [
|
|
159
|
-
...BILLING_ENVIRONMENT_KEYS,
|
|
160
|
-
'REVENUECAT_SECRET_KEY',
|
|
161
|
-
'REVENUECAT_WEBHOOK_AUTHORIZATION',
|
|
162
|
-
'REVENUECAT_WEBHOOK_SIGNING_SECRET',
|
|
163
|
-
'REVENUECAT_APP_IDS_JSON',
|
|
164
|
-
'REVENUECAT_PROJECT_ID',
|
|
165
|
-
'EXPO_PUBLIC_REVENUECAT_IOS_API_KEY',
|
|
166
|
-
'EXPO_PUBLIC_REVENUECAT_ANDROID_API_KEY',
|
|
167
|
-
],
|
|
168
|
-
},
|
|
169
93
|
styling: {
|
|
170
94
|
type: 'package',
|
|
171
95
|
description: 'Shared platform-independent styling tokens',
|
package/dist/standard.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { writeProjectSection } from './project-config.js';
|
|
2
2
|
import { configureDependencyPatches } from './dependency-patches.js';
|
|
3
3
|
import { randomUUID } from 'node:crypto';
|
|
4
|
-
import { registerGeneratedProject } from './catalog-registration.js';
|
|
5
|
-
import { recordScaffoldFiles } from './registry/receipt.js';
|
|
6
4
|
import { existsSync, lstatSync, mkdirSync, readdirSync, realpathSync, rmdirSync } from 'node:fs';
|
|
7
5
|
import path from 'node:path';
|
|
8
6
|
import { spawnSync } from 'node:child_process';
|
|
9
7
|
import { execFile } from './util.js';
|
|
10
|
-
import { registerApplication } from './delivery.js';
|
|
11
8
|
import { runStagedTransaction } from './transaction.js';
|
|
12
9
|
import { createSetupPlan } from './capabilities.js';
|
|
13
10
|
import { bootstrapWorkspace, assertWorkspaceRuntime } from './scaffold/bootstrap.js';
|
|
@@ -50,7 +47,7 @@ export async function scaffoldStandardProject(options, run = execFile, output =
|
|
|
50
47
|
throw new Error('Destination changed before generation.');
|
|
51
48
|
},
|
|
52
49
|
build: async (stageRoot) => {
|
|
53
|
-
printProgress('Creating the Next.js
|
|
50
|
+
printProgress('Creating the Next.js and Anhedral UI workspace…', display);
|
|
54
51
|
bootstrapWorkspace(stageRoot, options.name, run);
|
|
55
52
|
printProgress('Composing the selected stack…', display);
|
|
56
53
|
await composeStack(stageRoot, options, plan.registry);
|
|
@@ -58,16 +55,12 @@ export async function scaffoldStandardProject(options, run = execFile, output =
|
|
|
58
55
|
schemaVersion: 1,
|
|
59
56
|
id: randomUUID(),
|
|
60
57
|
});
|
|
61
|
-
if (readdirSync(path.join(stageRoot, 'apps')).some((app) => existsSync(path.join(stageRoot, 'apps', app, 'wrangler.jsonc')) ||
|
|
62
|
-
existsSync(path.join(stageRoot, 'apps', app, 'anhedral.cloudflare.json'))))
|
|
63
|
-
registerApplication(stageRoot);
|
|
64
58
|
if (!options.skipInstall) {
|
|
65
59
|
printProgress('Resolving pinned dependencies…', display);
|
|
66
60
|
run('pnpm', ['install', '--lockfile-only', '--no-frozen-lockfile'], stageRoot);
|
|
67
61
|
if (configureDependencyPatches(stageRoot))
|
|
68
62
|
run('pnpm', ['install', '--lockfile-only', '--no-frozen-lockfile'], stageRoot);
|
|
69
63
|
}
|
|
70
|
-
recordScaffoldFiles(stageRoot);
|
|
71
64
|
commitPaths.push(...readdirSync(stageRoot).filter((name) => name !== 'node_modules'));
|
|
72
65
|
},
|
|
73
66
|
afterCommit: () => {
|
|
@@ -88,9 +81,6 @@ export async function scaffoldStandardProject(options, run = execFile, output =
|
|
|
88
81
|
printResult('init', {
|
|
89
82
|
...plan,
|
|
90
83
|
generated: true,
|
|
91
|
-
catalog: run === execFile || process.env.ANHEDRAL_PLUGIN_DATA || process.env.PLUGIN_DATA
|
|
92
|
-
? registerGeneratedProject(root)
|
|
93
|
-
: { state: 'not-enabled' },
|
|
94
84
|
}, { ...output, json: options.json });
|
|
95
85
|
}
|
|
96
86
|
finally {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type UiPlatform = 'web' | 'native';
|
|
2
|
+
export interface UiSource {
|
|
3
|
+
item: string;
|
|
4
|
+
dependencies: string[];
|
|
5
|
+
registryDependencies: string[];
|
|
6
|
+
compatibility: string;
|
|
7
|
+
}
|
|
8
|
+
export interface UiComponent {
|
|
9
|
+
name: string;
|
|
10
|
+
web: UiSource | null;
|
|
11
|
+
native: UiSource | null;
|
|
12
|
+
}
|
|
13
|
+
export declare const UI_CATALOG: {
|
|
14
|
+
schemaVersion: number;
|
|
15
|
+
revision: string;
|
|
16
|
+
nativeStyling: string;
|
|
17
|
+
shadcnCliVersion: string;
|
|
18
|
+
sources: Record<string, string>;
|
|
19
|
+
components: UiComponent[];
|
|
20
|
+
};
|
|
21
|
+
/** Resolve names only. Upstream shadcn owns dependency resolution and source installation. */
|
|
22
|
+
export declare function resolveUiItems(names: string[], platform: UiPlatform, extensionRoot?: string): {
|
|
23
|
+
name: string;
|
|
24
|
+
source: string;
|
|
25
|
+
item: string;
|
|
26
|
+
}[];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
export const UI_CATALOG = JSON.parse(readFileSync(new URL('../assets/ui/catalog.json', import.meta.url), 'utf8'));
|
|
5
|
+
const extensions = fileURLToPath(new URL('../assets/ui/extensions/', import.meta.url));
|
|
6
|
+
/** Resolve names only. Upstream shadcn owns dependency resolution and source installation. */
|
|
7
|
+
export function resolveUiItems(names, platform, extensionRoot = extensions) {
|
|
8
|
+
const registry = JSON.parse(readFileSync(path.join(extensionRoot, 'registry.json'), 'utf8'));
|
|
9
|
+
return [...new Set(names)].map((name) => {
|
|
10
|
+
if (!/^[a-z][a-z0-9-]{0,79}$/.test(name))
|
|
11
|
+
throw Error(`Invalid component name: ${name}.`);
|
|
12
|
+
const component = UI_CATALOG.components.find((item) => item.name === name);
|
|
13
|
+
if (!component)
|
|
14
|
+
throw Error(`Unknown UI component: ${name}. Run anhedral ui list.`);
|
|
15
|
+
if (platform === 'native' && registry.items.some((item) => item.name === name)) {
|
|
16
|
+
const file = path.join(extensionRoot, `${name}.json`);
|
|
17
|
+
if (!existsSync(file))
|
|
18
|
+
throw Error(`Missing reviewed Anhedral extension: ${name}.`);
|
|
19
|
+
return { name, source: 'anhedral', item: file };
|
|
20
|
+
}
|
|
21
|
+
if (!component[platform])
|
|
22
|
+
throw Error(`${name} is not yet available for ${platform}. No substitute was installed.`);
|
|
23
|
+
return {
|
|
24
|
+
name,
|
|
25
|
+
source: platform === 'web' ? 'shadcn' : 'react-native-reusables',
|
|
26
|
+
item: platform === 'web'
|
|
27
|
+
? name
|
|
28
|
+
: `https://reactnativereusables.com/r/nativewind/${component.native.item}.json`,
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
}
|