anhedral 0.13.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 +23 -229
- package/assets/patches/audit-deps.mjs +12 -2
- 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/LICENSE.shadcn +21 -0
- package/assets/ui/UPSTREAM.json +39 -0
- 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 +86 -0
- package/assets/ui/native/calendar.tsx +170 -0
- package/assets/ui/native/card.tsx +44 -0
- 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 +15 -0
- 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 +28 -0
- package/assets/ui/native/item.tsx +12 -0
- package/assets/ui/native/kbd.tsx +1 -0
- package/assets/ui/native/label.tsx +4 -0
- package/assets/ui/native/layout.tsx +26 -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/text.tsx +20 -0
- package/assets/ui/native/textarea.tsx +1 -0
- package/assets/ui/native/theme-switcher.tsx +22 -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/assets/ui/theme-storage.ts +25 -0
- package/assets/ui/theme.tsx +66 -0
- package/assets/ui/web/button.tsx +59 -0
- package/assets/ui/web/input.tsx +21 -0
- package/assets/ui/web/label.tsx +19 -0
- package/dist/bin.js +7 -12
- package/dist/capabilities.d.ts +4 -33
- package/dist/capabilities.js +2 -84
- 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 +40 -374
- package/dist/dependencies.d.ts +34 -62
- package/dist/dependencies.js +112 -199
- package/dist/index.d.ts +1 -45
- package/dist/index.js +1 -30
- package/dist/platforms/mobile.js +29 -139
- package/dist/platforms/web.d.ts +3 -0
- package/dist/platforms/web.js +251 -0
- package/dist/project-config.d.ts +2 -13
- package/dist/project-config.js +10 -83
- package/dist/registry/context.js +0 -1
- package/dist/registry/options.js +6 -40
- package/dist/registry/resolve.d.ts +3 -4
- package/dist/registry/resolve.js +18 -108
- package/dist/registry/types.d.ts +1 -7
- package/dist/registry/usage.js +3 -9
- package/dist/runtime-policy.d.ts +0 -2
- package/dist/runtime-policy.js +0 -16
- package/dist/scaffold/backend.d.ts +0 -4
- package/dist/scaffold/backend.js +1 -189
- package/dist/scaffold/bootstrap.d.ts +2 -3
- package/dist/scaffold/bootstrap.js +37 -43
- package/dist/scaffold/compose.js +2 -14
- package/dist/scaffold/database.d.ts +1 -1
- package/dist/scaffold/database.js +19 -126
- package/dist/scaffold/documentation.d.ts +0 -1
- package/dist/scaffold/documentation.js +82 -84
- package/dist/scaffold/expo-runtime.d.ts +2 -2
- package/dist/scaffold/expo-runtime.js +9 -101
- package/dist/scaffold/native-ui.d.ts +2 -0
- package/dist/scaffold/native-ui.js +74 -0
- package/dist/scaffold/stack-documentation.d.ts +0 -1
- package/dist/scaffold/stack-documentation.js +3 -49
- package/dist/scaffold/storage.d.ts +2 -0
- package/dist/scaffold/storage.js +21 -0
- package/dist/scaffold/styling.d.ts +1 -1
- package/dist/scaffold/styling.js +20 -28
- package/dist/scaffold/workspace.js +63 -199
- package/dist/stack-registry.d.ts +2 -58
- package/dist/stack-registry.js +22 -446
- package/dist/standard.js +7 -24
- 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 -119
- package/docs/capabilities.md +110 -0
- package/docs/native-ui.md +102 -0
- package/docs/software-factory.md +16 -577
- package/docs/stack-standard.md +11 -307
- package/docs/ui.md +33 -0
- package/docs/verification.md +511 -0
- package/package.json +26 -27
- 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 -168
- 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 -172
- 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 -186
- package/dist/delivery.d.ts +0 -88
- package/dist/delivery.js +0 -570
- package/dist/inspector-model.d.ts +0 -123
- package/dist/inspector-model.js +0 -1
- package/dist/integration-service-readers.d.ts +0 -13
- package/dist/integration-service-readers.js +0 -173
- 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 -366
- package/dist/neon-service-data.d.ts +0 -8
- package/dist/neon-service-data.js +0 -117
- package/dist/platforms/desktop.d.ts +0 -2
- package/dist/platforms/desktop.js +0 -415
- package/dist/platforms/extension.d.ts +0 -2
- package/dist/platforms/extension.js +0 -328
- 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 -702
- package/dist/project-lifecycle.d.ts +0 -25
- package/dist/project-lifecycle.js +0 -57
- package/dist/project-state.d.ts +0 -49
- package/dist/project-state.js +0 -563
- package/dist/provider-auth.d.ts +0 -41
- package/dist/provider-auth.js +0 -215
- package/dist/provider-readiness.d.ts +0 -30
- package/dist/provider-readiness.js +0 -104
- package/dist/providers/adapters.d.ts +0 -17
- package/dist/providers/adapters.js +0 -278
- 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 -182
- package/dist/providers/definitions.d.ts +0 -318
- package/dist/providers/definitions.js +0 -127
- 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 -66
- package/dist/providers/recovery-verification.d.ts +0 -7
- package/dist/providers/recovery-verification.js +0 -112
- 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 -265
- 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 -289
- package/dist/provision.d.ts +0 -55
- package/dist/provision.js +0 -284
- 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 -122
- package/dist/registry/add.d.ts +0 -24
- package/dist/registry/add.js +0 -270
- package/dist/registry/bootstrap.d.ts +0 -2
- package/dist/registry/bootstrap.js +0 -14
- package/dist/registry/commands.d.ts +0 -3
- package/dist/registry/commands.js +0 -85
- package/dist/registry/presets.d.ts +0 -4
- package/dist/registry/presets.js +0 -41
- 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 -3
- package/dist/scaffold/auth.js +0 -151
- 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 -216
- package/dist/scaffold/cloudflare-services.d.ts +0 -8
- package/dist/scaffold/cloudflare-services.js +0 -198
- package/dist/scaffold/expo-auth.d.ts +0 -3
- package/dist/scaffold/expo-auth.js +0 -192
- package/dist/scaffold/expo-billing.d.ts +0 -3
- package/dist/scaffold/expo-billing.js +0 -292
- package/dist/scaffold/integrations.d.ts +0 -4
- package/dist/scaffold/integrations.js +0 -12
- package/dist/scaffold/lint.d.ts +0 -4
- package/dist/scaffold/lint.js +0 -56
- package/dist/scaffold/neon-realtime.d.ts +0 -2
- package/dist/scaffold/neon-realtime.js +0 -97
- package/dist/scaffold/services.d.ts +0 -5
- package/dist/scaffold/services.js +0 -108
- package/dist/scaffold/stream.d.ts +0 -2
- package/dist/scaffold/stream.js +0 -114
- package/dist/scaffold/void.d.ts +0 -4
- package/dist/scaffold/void.js +0 -264
- package/dist/scaffold/web.d.ts +0 -2
- package/dist/scaffold/web.js +0 -130
- 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 -78
- 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 -78
- package/dist/service-readers.d.ts +0 -8
- package/dist/service-readers.js +0 -247
- package/dist/services-command.d.ts +0 -39
- package/dist/services-command.js +0 -102
- package/dist/ship.d.ts +0 -348
- package/dist/ship.js +0 -239
- package/dist/vercel-project.d.ts +0 -101
- package/dist/vercel-project.js +0 -305
- package/dist/vercel.d.ts +0 -67
- package/dist/vercel.js +0 -581
- package/dist/vinext.d.ts +0 -2
- package/dist/vinext.js +0 -86
- package/dist/void-execution.d.ts +0 -10
- package/dist/void-execution.js +0 -94
- package/dist/void-migrations.d.ts +0 -6
- package/dist/void-migrations.js +0 -110
- package/dist/void-state.d.ts +0 -16
- package/dist/void-state.js +0 -65
- package/dist/void.d.ts +0 -3
- package/dist/void.js +0 -5
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { NATIVE_ESLINT_VERSION, NATIVE_UI_DEPENDENCIES, MOBILE_APP_DEPENDENCIES, } from '../dependencies.js';
|
|
4
|
+
import { json, put } from './files.js';
|
|
5
|
+
import { writeReactLintConfig } from '../platforms/lint.js';
|
|
6
|
+
/** Anhedral-maintained native shadcn port. Never imported by the DOM application. */
|
|
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'));
|
|
10
|
+
const components = [
|
|
11
|
+
...registry.components.map((item) => item.id),
|
|
12
|
+
'layout',
|
|
13
|
+
'text',
|
|
14
|
+
'theme-switcher',
|
|
15
|
+
];
|
|
16
|
+
const nativeFiles = [...registry.components.map((item) => item.file), ...registry.supportFiles];
|
|
17
|
+
for (const file of [
|
|
18
|
+
'theme.tsx',
|
|
19
|
+
'theme-storage.ts',
|
|
20
|
+
'LICENSE.shadcn',
|
|
21
|
+
'UPSTREAM.json',
|
|
22
|
+
...nativeFiles.map((name) => `native/${name}`),
|
|
23
|
+
]) {
|
|
24
|
+
const source = readFileSync(fileURLToPath(new URL(`../../assets/ui/${file}`, import.meta.url)), 'utf8');
|
|
25
|
+
put(root, `packages/native-ui/${file.endsWith('.tsx') || file.endsWith('.ts') ? 'src/' : ''}${file}`, source);
|
|
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'));
|
|
29
|
+
put(root, 'packages/native-ui/src/index.ts', `export * from './theme';\n` +
|
|
30
|
+
components.map((name) => `export * from './native/${name}';\n`).join(''));
|
|
31
|
+
json(root, 'packages/native-ui/package.json', {
|
|
32
|
+
name: '@workspace/native-ui',
|
|
33
|
+
private: true,
|
|
34
|
+
type: 'module',
|
|
35
|
+
exports: {
|
|
36
|
+
'.': './src/index.ts',
|
|
37
|
+
'./components/*': './src/native/*.tsx',
|
|
38
|
+
'./theme': './src/theme.tsx',
|
|
39
|
+
},
|
|
40
|
+
scripts: { typecheck: 'tsc --noEmit', lint: 'eslint . --max-warnings 0' },
|
|
41
|
+
dependencies: {
|
|
42
|
+
...NATIVE_UI_DEPENDENCIES.dependencies,
|
|
43
|
+
'react-native-safe-area-context': MOBILE_APP_DEPENDENCIES.dependencies['react-native-safe-area-context'],
|
|
44
|
+
'@workspace/styling': 'workspace:*',
|
|
45
|
+
},
|
|
46
|
+
peerDependencies: {
|
|
47
|
+
react: MOBILE_APP_DEPENDENCIES.dependencies.react,
|
|
48
|
+
'react-native': MOBILE_APP_DEPENDENCIES.dependencies['react-native'],
|
|
49
|
+
},
|
|
50
|
+
devDependencies: {
|
|
51
|
+
typescript: MOBILE_APP_DEPENDENCIES.devDependencies.typescript,
|
|
52
|
+
'@types/react': MOBILE_APP_DEPENDENCIES.devDependencies['@types/react'],
|
|
53
|
+
react: MOBILE_APP_DEPENDENCIES.dependencies.react,
|
|
54
|
+
'react-native': MOBILE_APP_DEPENDENCIES.dependencies['react-native'],
|
|
55
|
+
'@workspace/eslint-config': 'workspace:*',
|
|
56
|
+
eslint: NATIVE_ESLINT_VERSION,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
json(root, 'packages/native-ui/tsconfig.json', {
|
|
60
|
+
compilerOptions: {
|
|
61
|
+
target: 'ES2022',
|
|
62
|
+
lib: ['ES2022'],
|
|
63
|
+
module: 'ESNext',
|
|
64
|
+
moduleResolution: 'Bundler',
|
|
65
|
+
strict: true,
|
|
66
|
+
jsx: 'react-jsx',
|
|
67
|
+
noEmit: true,
|
|
68
|
+
skipLibCheck: true,
|
|
69
|
+
esModuleInterop: true,
|
|
70
|
+
},
|
|
71
|
+
include: ['src/**/*.ts', 'src/**/*.tsx'],
|
|
72
|
+
});
|
|
73
|
+
writeReactLintConfig(root + '/packages/native-ui');
|
|
74
|
+
}
|
|
@@ -1,52 +1,6 @@
|
|
|
1
|
-
import { WORKER_DEV_PORTS } from '../dependencies.js';
|
|
2
1
|
import { put } from './files.js';
|
|
3
|
-
/** Human-readable companion to the current resolved registry, refreshed by add. */
|
|
4
2
|
export function writeStackDocumentation(root, registry) {
|
|
5
|
-
const sections = registry.items.map((item) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
'',
|
|
9
|
-
item.description + '.',
|
|
10
|
-
'',
|
|
11
|
-
`Targets: ${item.targets.map((target) => `\`${target}\``).join(', ')}.`,
|
|
12
|
-
];
|
|
13
|
-
if (item.environment.length)
|
|
14
|
-
lines.push(`Environment: ${item.environment.map((key) => `\`${key}\``).join(', ')}.`);
|
|
15
|
-
if (item.bindings)
|
|
16
|
-
lines.push('', 'Worker configuration:', '', '```json', JSON.stringify(item.bindings, null, 2), '```');
|
|
17
|
-
if (item.setup) {
|
|
18
|
-
for (const [label, entries] of [
|
|
19
|
-
['Required setup', item.setup.resources],
|
|
20
|
-
['Credentials', item.setup.credentials],
|
|
21
|
-
['Verify before delivery', item.setup.verify],
|
|
22
|
-
]) {
|
|
23
|
-
if (!entries.length)
|
|
24
|
-
continue;
|
|
25
|
-
lines.push('', `${label}:`, '', ...entries.map((entry) => `- ${entry}`));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return lines.join('\n');
|
|
29
|
-
});
|
|
30
|
-
const ports = Object.entries(WORKER_DEV_PORTS)
|
|
31
|
-
.filter(([app]) => registry.items.some((item) => item.targets.includes(`apps/${app}`)))
|
|
32
|
-
.map(([app, port]) => `| ${app} | ${port.http} | ${port.inspector} |`);
|
|
33
|
-
put(root, 'docs/stack.md', [
|
|
34
|
-
'# Selected stack',
|
|
35
|
-
'',
|
|
36
|
-
`Generated from the bundled Anhedral ${registry.cliVersion} registry. Project configuration lives in anhedral.json; setup and registry record the current selection and generated source, providers holds integration settings, and cloudflare/vercel hold selected hosting configuration. This document is refreshed by add. Keep product decisions in docs/architecture.md and acceptance evidence in docs/verification.md.`,
|
|
37
|
-
'',
|
|
38
|
-
'These are scaffolds and integration boundaries. Provider access, migrations, authorization and live behavior require the setup and checks listed below.',
|
|
39
|
-
...(ports.length
|
|
40
|
-
? [
|
|
41
|
-
'',
|
|
42
|
-
'## Local Worker ports',
|
|
43
|
-
'',
|
|
44
|
-
'| Application | HTTP | Inspector |',
|
|
45
|
-
'| --- | --- | --- |',
|
|
46
|
-
...ports,
|
|
47
|
-
]
|
|
48
|
-
: []),
|
|
49
|
-
'',
|
|
50
|
-
...sections.flatMap((section) => [section, '']),
|
|
51
|
-
].join('\n'));
|
|
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. 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
|
+
sections.join('\n'));
|
|
52
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,3 +1,3 @@
|
|
|
1
1
|
import type { RecipeContext } from '../registry/types.js';
|
|
2
|
-
/**
|
|
2
|
+
/** One shared token source for native components and DOM CSS. */
|
|
3
3
|
export declare function scaffoldStyling({ root }: RecipeContext): void;
|
package/dist/scaffold/styling.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import path from 'node:path';
|
|
1
3
|
import { json, patchPackage, put, readJson } from './files.js';
|
|
2
|
-
/**
|
|
4
|
+
/** One shared token source for native components and DOM CSS. */
|
|
3
5
|
export function scaffoldStyling({ root }) {
|
|
4
6
|
put(root, 'packages/styling/src/tokens.cjs', `exports.light = {
|
|
5
7
|
'--background': '0 0% 100%',
|
|
@@ -46,39 +48,29 @@ exports.dark = {
|
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
exports.spacing = { small: 4, medium: 8, large: 16 };
|
|
49
|
-
`);
|
|
50
|
-
put(root, 'packages/styling/tailwind.cjs', `const { light, dark } = require('./src/tokens.cjs');
|
|
51
|
-
const color = (name) => 'hsl(var(--' + name + '))';
|
|
52
|
-
const surface = (name) => ({ DEFAULT: color(name), foreground: color(name + '-foreground') });
|
|
53
|
-
|
|
54
|
-
module.exports = {
|
|
55
|
-
darkMode: 'class',
|
|
56
|
-
theme: {
|
|
57
|
-
extend: {
|
|
58
|
-
colors: {
|
|
59
|
-
border: color('border'), input: color('input'), ring: color('ring'),
|
|
60
|
-
background: color('background'), foreground: color('foreground'),
|
|
61
|
-
primary: surface('primary'), secondary: surface('secondary'),
|
|
62
|
-
destructive: surface('destructive'), muted: surface('muted'),
|
|
63
|
-
accent: surface('accent'), popover: surface('popover'), card: surface('card'),
|
|
64
|
-
},
|
|
65
|
-
borderRadius: {
|
|
66
|
-
lg: 'var(--radius)', md: 'calc(var(--radius) - 2px)', sm: 'calc(var(--radius) - 4px)',
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
plugins: [function themeVariables({ addBase }) {
|
|
71
|
-
addBase({ ':root': light, '.dark:root': dark });
|
|
72
|
-
}],
|
|
73
|
-
};
|
|
74
51
|
`);
|
|
75
52
|
patchPackage(root, 'packages/styling/package.json', {
|
|
76
|
-
exports: {
|
|
53
|
+
exports: {
|
|
54
|
+
'.': './src/index.ts',
|
|
55
|
+
'./globals.css': './globals.css',
|
|
56
|
+
},
|
|
77
57
|
});
|
|
58
|
+
const tokens = createRequire(import.meta.url)(path.join(root, 'packages/styling/src/tokens.cjs'));
|
|
59
|
+
const rule = (selector, values) => selector +
|
|
60
|
+
' {\n' +
|
|
61
|
+
Object.entries(values)
|
|
62
|
+
.map(([key, value]) => ' ' + key + ': ' + value + ';')
|
|
63
|
+
.join('\n') +
|
|
64
|
+
'\n}\n';
|
|
65
|
+
put(root, 'packages/styling/globals.css', rule(':root', tokens.light) +
|
|
66
|
+
'@media (prefers-color-scheme: dark) {\n' +
|
|
67
|
+
rule(':root', tokens.dark) +
|
|
68
|
+
'}\n');
|
|
69
|
+
put(root, 'packages/styling/src/tokens.d.cts', 'export const light: Record<string, string>;\nexport const dark: Record<string, string>;\nexport const spacing: { small: number; medium: number; large: number };\n');
|
|
78
70
|
const config = readJson(root, 'packages/styling/tsconfig.json');
|
|
79
71
|
json(root, 'packages/styling/tsconfig.json', {
|
|
80
72
|
...config,
|
|
81
73
|
compilerOptions: { ...config.compilerOptions, allowJs: true },
|
|
82
|
-
include: ['src/**/*.ts', 'src/**/*.cjs'
|
|
74
|
+
include: ['src/**/*.ts', 'src/**/*.cjs'],
|
|
83
75
|
});
|
|
84
76
|
}
|
|
@@ -1,135 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { STACK_DEPENDENCIES, WORKSPACE_NODE_ENGINE,
|
|
1
|
+
import { writeProjectSection } from '../project-config.js';
|
|
2
|
+
import { OPENNEXT_GLOB_VERSION, STACK_DEPENDENCIES, WORKSPACE_NODE_ENGINE, PACKAGE_MANAGER, } from '../dependencies.js';
|
|
3
3
|
import { writeDependencyAudit } from '../dependency-patches.js';
|
|
4
|
-
import { usesVoidSelection } from '../runtime-policy.js';
|
|
5
|
-
import { VOID_NODE_ENGINE } from '../void.js';
|
|
6
4
|
import { setPnpmPolicy } from '../pnpm-policy.js';
|
|
7
|
-
import { BOOTSTRAP_COMMAND } from '../registry/bootstrap.js';
|
|
8
5
|
import { appendGitignore } from '../util.js';
|
|
9
|
-
import { PACKAGE_MANAGER } from '../dependencies.js';
|
|
10
6
|
import { createSetupPlan } from '../capabilities.js';
|
|
11
|
-
import { json, put,
|
|
12
|
-
import { writeSetupDocumentation
|
|
7
|
+
import { json, put, patchPackage } from './files.js';
|
|
8
|
+
import { writeSetupDocumentation } from './documentation.js';
|
|
13
9
|
import { writeStackDocumentation } from './stack-documentation.js';
|
|
14
10
|
import { writeEnvironmentExample } from './environment.js';
|
|
15
|
-
import { providerConfigurationTemplate } from '../providers/config.js';
|
|
16
|
-
import { existsSync, readdirSync, rmSync } from 'node:fs';
|
|
17
|
-
import path from 'node:path';
|
|
18
|
-
function securityOverrides(options) {
|
|
19
|
-
const has = (value) => options.products.includes(value);
|
|
20
|
-
return {
|
|
21
|
-
...(has('wxt')
|
|
22
|
-
? {
|
|
23
|
-
'@wxt-dev/module-react>@vitejs/plugin-react': SECURITY_OVERRIDE_DEPENDENCIES['@vitejs/plugin-react'],
|
|
24
|
-
}
|
|
25
|
-
: {}),
|
|
26
|
-
...(has('next') || has('vinext')
|
|
27
|
-
? { 'sharp@<0.35.5': SECURITY_OVERRIDE_DEPENDENCIES.sharp }
|
|
28
|
-
: {}),
|
|
29
|
-
...(options.products.some((product) => ['vinext', 'next', 'expo', 'electron', 'wxt', 'neon', 'd1'].includes(product))
|
|
30
|
-
? { 'source-map-js@<1.2.2': SECURITY_OVERRIDE_DEPENDENCIES['source-map-js'] }
|
|
31
|
-
: {}),
|
|
32
|
-
...(has('next') && options.hosting === 'cloudflare'
|
|
33
|
-
? {
|
|
34
|
-
'glob@>=10.2.0 <10.5.0': GLOB_10_OVERRIDE_VERSION,
|
|
35
|
-
'glob@>=11.0.0 <11.1.0': GLOB_11_OVERRIDE_VERSION,
|
|
36
|
-
}
|
|
37
|
-
: {}),
|
|
38
|
-
...(has('wxt')
|
|
39
|
-
? {
|
|
40
|
-
'shell-quote@<1.12.0': SECURITY_OVERRIDE_DEPENDENCIES['shell-quote'],
|
|
41
|
-
'tmp@<0.2.7': SECURITY_OVERRIDE_DEPENDENCIES.tmp,
|
|
42
|
-
'adm-zip@<0.6.1': SECURITY_OVERRIDE_DEPENDENCIES['adm-zip'],
|
|
43
|
-
}
|
|
44
|
-
: {}),
|
|
45
|
-
'baseline-browser-mapping@<2.11.0': SECURITY_OVERRIDE_DEPENDENCIES['baseline-browser-mapping'],
|
|
46
|
-
'browserslist@<4.28.7': SECURITY_OVERRIDE_DEPENDENCIES.browserslist,
|
|
47
|
-
...(((has('next') || has('vinext')) && options.hosting === 'cloudflare') ||
|
|
48
|
-
has('hono') ||
|
|
49
|
-
has('electron') ||
|
|
50
|
-
has('wxt')
|
|
51
|
-
? { 'esbuild@<0.25.0': SECURITY_OVERRIDE_DEPENDENCIES.esbuild }
|
|
52
|
-
: {}),
|
|
53
|
-
'brace-expansion@<2': BRACE_EXPANSION_1_OVERRIDE_VERSION,
|
|
54
|
-
'brace-expansion@>=2 <3': BRACE_EXPANSION_2_OVERRIDE_VERSION,
|
|
55
|
-
'brace-expansion@>=4 <5.0.12': BRACE_EXPANSION_5_OVERRIDE_VERSION,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function writeTurboConfiguration(root, registry) {
|
|
59
|
-
const turbo = existsSync(path.join(root, 'turbo.json'))
|
|
60
|
-
? readJson(root, 'turbo.json')
|
|
61
|
-
: { tasks: {} };
|
|
62
|
-
turbo.$schema = 'https://turbo.build/schema.json';
|
|
63
|
-
turbo.globalDependencies = [
|
|
64
|
-
...new Set([
|
|
65
|
-
...(turbo.globalDependencies ?? []),
|
|
66
|
-
'**/.env',
|
|
67
|
-
'**/.env.*',
|
|
68
|
-
'**/.dev.vars',
|
|
69
|
-
'**/.dev.vars.*',
|
|
70
|
-
]),
|
|
71
|
-
];
|
|
72
|
-
turbo.globalEnv = [
|
|
73
|
-
...new Set([
|
|
74
|
-
...(turbo.globalEnv ?? []),
|
|
75
|
-
'VOID_CLOUDFLARE_DEPLOY_BUILD',
|
|
76
|
-
...(registry.items.some(({ name }) => name === 'expo') ? ['EXPO_PUBLIC_API_URL'] : []),
|
|
77
|
-
...(registry.items.some(({ name }) => name === 'next') &&
|
|
78
|
-
registry.items.some(({ name }) => name === 'hono')
|
|
79
|
-
? ['API_URL', 'API_ACCESS_CLIENT_ID', 'API_ACCESS_CLIENT_SECRET']
|
|
80
|
-
: []),
|
|
81
|
-
'npm_execpath',
|
|
82
|
-
...registry.items.flatMap((item) => item.environment),
|
|
83
|
-
]),
|
|
84
|
-
].sort();
|
|
85
|
-
turbo.tasks = {
|
|
86
|
-
...turbo.tasks,
|
|
87
|
-
dev: { ...turbo.tasks.dev, cache: false, persistent: true },
|
|
88
|
-
lint: { ...turbo.tasks.lint, dependsOn: ['^lint'] },
|
|
89
|
-
typecheck: { ...turbo.tasks.typecheck, dependsOn: ['^typecheck'] },
|
|
90
|
-
test: { dependsOn: ['^build'], outputs: ['coverage/**'] },
|
|
91
|
-
'db:generate': { cache: false },
|
|
92
|
-
'db:migrate': {
|
|
93
|
-
cache: false,
|
|
94
|
-
passThroughEnv: ['CLOUDFLARE_API_TOKEN', 'CLOUDFLARE_ACCOUNT_ID'],
|
|
95
|
-
},
|
|
96
|
-
build: {
|
|
97
|
-
...turbo.tasks.build,
|
|
98
|
-
dependsOn: [...new Set(['^build', ...(turbo.tasks.build?.dependsOn ?? [])])],
|
|
99
|
-
outputs: [
|
|
100
|
-
'.next/**',
|
|
101
|
-
'!.next/cache/**',
|
|
102
|
-
'!.next/dev/**',
|
|
103
|
-
'.open-next/**',
|
|
104
|
-
'dist/**',
|
|
105
|
-
'.output/**',
|
|
106
|
-
],
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
|
-
json(root, 'turbo.json', turbo);
|
|
110
|
-
}
|
|
111
11
|
export function writeStandardRoot(root, options, registry, updating = false) {
|
|
112
|
-
const has = (value) => options.products.includes(value);
|
|
113
|
-
const existing = readJson(root, 'package.json');
|
|
114
12
|
patchPackage(root, 'package.json', {
|
|
115
13
|
name: options.name,
|
|
116
14
|
private: true,
|
|
117
15
|
packageManager: PACKAGE_MANAGER,
|
|
118
|
-
engines: {
|
|
119
|
-
node: usesVoidSelection(options.products, options.hosting)
|
|
120
|
-
? VOID_NODE_ENGINE
|
|
121
|
-
: WORKSPACE_NODE_ENGINE,
|
|
122
|
-
},
|
|
16
|
+
engines: { node: WORKSPACE_NODE_ENGINE },
|
|
123
17
|
scripts: {
|
|
124
18
|
dev: 'turbo dev',
|
|
125
|
-
build: 'turbo build',
|
|
126
|
-
...((has('next') || has('vinext')) && options.hosting === 'cloudflare'
|
|
127
|
-
? { 'build:worker': 'pnpm --dir apps/web run build:worker' }
|
|
128
|
-
: {}),
|
|
19
|
+
build: 'turbo build --concurrency=1',
|
|
129
20
|
lint: 'turbo lint',
|
|
130
21
|
typecheck: 'turbo typecheck',
|
|
131
22
|
test: 'turbo test',
|
|
132
|
-
...(
|
|
23
|
+
...(options.products.includes('d1')
|
|
133
24
|
? {
|
|
134
25
|
'db:generate': 'turbo run db:generate --filter=@workspace/db',
|
|
135
26
|
'db:migrate': 'turbo run db:migrate --filter=@workspace/db',
|
|
@@ -138,101 +29,85 @@ export function writeStandardRoot(root, options, registry, updating = false) {
|
|
|
138
29
|
audit: 'node scripts/audit.mjs',
|
|
139
30
|
'audit:full': 'fallow --fail-on-issues',
|
|
140
31
|
'audit:deps': 'node scripts/audit-deps.mjs',
|
|
141
|
-
check:
|
|
142
|
-
},
|
|
143
|
-
devDependencies: { turbo: STACK_DEPENDENCIES['turbo'], fallow: STACK_DEPENDENCIES['fallow'] },
|
|
144
|
-
// Upstream starter lockfiles can retain vulnerable transitive versions. Keep fixes within compatible majors.
|
|
145
|
-
pnpm: {
|
|
146
|
-
...existing.pnpm,
|
|
147
|
-
overrides: { ...existing.pnpm?.overrides, ...securityOverrides(options) },
|
|
32
|
+
check: 'pnpm lint && pnpm typecheck && pnpm run audit && pnpm audit:deps && pnpm test && pnpm build',
|
|
148
33
|
},
|
|
34
|
+
devDependencies: { turbo: STACK_DEPENDENCIES.turbo, fallow: STACK_DEPENDENCIES.fallow },
|
|
149
35
|
});
|
|
150
36
|
writeDependencyAudit(root, updating);
|
|
151
37
|
put(root, 'scripts/audit.mjs', `import { spawnSync } from 'node:child_process';
|
|
152
|
-
const base = process.env.AUDIT_BASE;
|
|
153
|
-
const hasBase = base || ['origin/main', 'main'].find((ref) => spawnSync('git', ['rev-parse', '--verify', ref], { stdio: 'ignore' }).status === 0);
|
|
154
|
-
const args = hasBase ? ['exec', 'fallow', 'audit', '--base', hasBase] : ['exec', 'fallow', '--fail-on-issues'];
|
|
155
38
|
const entry = process.env.npm_execpath;
|
|
156
39
|
if (!entry) throw new Error('Run this check through pnpm run audit.');
|
|
157
|
-
const result = spawnSync(process.execPath, [entry,
|
|
40
|
+
const result = spawnSync(process.execPath, [entry, 'exec', 'fallow', '--fail-on-issues'], { stdio: 'inherit', shell: false });
|
|
158
41
|
if (result.error) throw result.error;
|
|
159
42
|
process.exitCode = result.status ?? 1;
|
|
160
43
|
`);
|
|
161
44
|
json(root, '.fallowrc.json', {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
'apps/*/env.ts',
|
|
167
|
-
'apps/*/src/void-entry.ts',
|
|
168
|
-
'apps/*/crons/**/*.{ts,mts,js,mjs}',
|
|
169
|
-
...(has('electron') ? ['apps/desktop/src/main/preload.cts'] : []),
|
|
170
|
-
],
|
|
171
|
-
// Expo web export and NativeWind load these runtime dependencies dynamically.
|
|
172
|
-
...(has('expo')
|
|
173
|
-
? {
|
|
174
|
-
ignoreDependencies: [
|
|
175
|
-
'react-native-web',
|
|
176
|
-
'react-native-css-interop',
|
|
177
|
-
'react-native-reanimated',
|
|
178
|
-
'react-native-worklets',
|
|
179
|
-
],
|
|
180
|
-
}
|
|
181
|
-
: {}),
|
|
45
|
+
publicPackages: options.products.includes('expo') ? ['@workspace/native-ui'] : [],
|
|
46
|
+
ignoreDependencies: options.products.includes('expo')
|
|
47
|
+
? ['react-native-reanimated', 'react-native-worklets']
|
|
48
|
+
: [],
|
|
182
49
|
ignorePatterns: [
|
|
183
|
-
// Maintained bundled tooling is regression-tested in the CLI repository;
|
|
184
|
-
// app audits cover customer code without re-auditing vendored CLI helpers.
|
|
185
50
|
'scripts/audit.mjs',
|
|
186
51
|
'scripts/audit-deps.mjs',
|
|
187
|
-
'scripts/void-migrations.mjs',
|
|
188
|
-
'scripts/prepare-void-migrations.mjs',
|
|
189
|
-
'**/next-env.d.ts',
|
|
190
|
-
'**/.next/**',
|
|
191
|
-
'**/.open-next/**',
|
|
192
|
-
'**/.vinext/**',
|
|
193
52
|
'**/.wrangler/**',
|
|
194
53
|
'**/dist/**',
|
|
54
|
+
'**/.next/**',
|
|
55
|
+
'**/.open-next/**',
|
|
195
56
|
'**/worker-configuration.d.ts',
|
|
196
|
-
'**/cloudflare-env.d.ts',
|
|
197
57
|
],
|
|
198
58
|
});
|
|
199
|
-
|
|
59
|
+
json(root, 'turbo.json', {
|
|
60
|
+
$schema: 'https://turbo.build/schema.json',
|
|
61
|
+
globalDependencies: ['**/.env', '**/.env.*', '**/.dev.vars', '**/.dev.vars.*'],
|
|
62
|
+
globalEnv: [
|
|
63
|
+
...new Set(['npm_execpath', ...registry.items.flatMap((item) => item.environment)]),
|
|
64
|
+
].sort(),
|
|
65
|
+
tasks: {
|
|
66
|
+
dev: { cache: false, persistent: true },
|
|
67
|
+
lint: { dependsOn: ['^lint'] },
|
|
68
|
+
typecheck: {
|
|
69
|
+
dependsOn: ['^typecheck'],
|
|
70
|
+
outputs: ['worker-configuration.d.ts', 'next-env.d.ts', '.next/types/**'],
|
|
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
|
+
: {}),
|
|
82
|
+
build: {
|
|
83
|
+
dependsOn: ['^build'],
|
|
84
|
+
outputs: ['dist/**', '.open-next/**', '.next/**', '!.next/cache/**'],
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
});
|
|
200
88
|
setPnpmPolicy(root, {
|
|
201
89
|
...(!updating ? { packages: ['apps/*', 'packages/*'] } : {}),
|
|
90
|
+
// OpenNext's node-minify dependency pins the vulnerable glob CLI.
|
|
91
|
+
overrides: {
|
|
92
|
+
'@node-minify/core>glob': OPENNEXT_GLOB_VERSION,
|
|
93
|
+
// Expo CLI's two schema consumers use APIs supported by the patched Zod release.
|
|
94
|
+
...(options.products.includes('expo') ? { '@expo/cli>zod': STACK_DEPENDENCIES.zod } : {}),
|
|
95
|
+
'miniflare>undici': STACK_DEPENDENCIES.undici,
|
|
96
|
+
},
|
|
202
97
|
sharedWorkspaceLockfile: true,
|
|
203
98
|
allowBuilds: undefined,
|
|
204
|
-
onlyBuiltDependencies: [
|
|
205
|
-
'esbuild',
|
|
206
|
-
'sharp',
|
|
207
|
-
'unrs-resolver',
|
|
208
|
-
'workerd',
|
|
209
|
-
...(has('electron') ? ['electron'] : []),
|
|
210
|
-
],
|
|
99
|
+
onlyBuiltDependencies: ['esbuild', 'sharp', 'unrs-resolver', 'workerd'],
|
|
211
100
|
});
|
|
212
|
-
// Upstream app/package lockfiles would create competing dependency authorities.
|
|
213
|
-
if (!updating) {
|
|
214
|
-
for (const parent of ['apps', 'packages']) {
|
|
215
|
-
const directory = path.join(root, parent);
|
|
216
|
-
if (!existsSync(directory))
|
|
217
|
-
continue;
|
|
218
|
-
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
|
219
|
-
if (!entry.isDirectory())
|
|
220
|
-
continue;
|
|
221
|
-
for (const lock of ['pnpm-lock.yaml', 'package-lock.json', 'yarn.lock'])
|
|
222
|
-
rmSync(path.join(directory, entry.name, lock), { force: true });
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
for (const lock of ['package-lock.json', 'yarn.lock'])
|
|
226
|
-
rmSync(path.join(root, lock), { force: true });
|
|
227
|
-
}
|
|
228
101
|
appendGitignore(root, [
|
|
229
102
|
'node_modules/',
|
|
103
|
+
'dist/',
|
|
104
|
+
'.output/',
|
|
105
|
+
'.next/',
|
|
230
106
|
'.open-next/',
|
|
231
|
-
'
|
|
107
|
+
'*.tsbuildinfo',
|
|
108
|
+
'.turbo/',
|
|
109
|
+
'.expo/',
|
|
232
110
|
'.wrangler/',
|
|
233
|
-
'.void/',
|
|
234
|
-
'.void-wrangler.jsonc',
|
|
235
|
-
'/apps/*/db/migrations/',
|
|
236
111
|
'.dev.vars',
|
|
237
112
|
'.dev.vars.*',
|
|
238
113
|
'!.dev.vars.example',
|
|
@@ -242,6 +117,8 @@ process.exitCode = result.status ?? 1;
|
|
|
242
117
|
'.fallow/',
|
|
243
118
|
'.anhedral/',
|
|
244
119
|
'.anhedral-audit-report.json',
|
|
120
|
+
'worker-configuration.d.ts',
|
|
121
|
+
'next-env.d.ts',
|
|
245
122
|
]);
|
|
246
123
|
writeEnvironmentExample(root, registry);
|
|
247
124
|
writeStackDocumentation(root, registry);
|
|
@@ -249,25 +126,12 @@ process.exitCode = result.status ?? 1;
|
|
|
249
126
|
schemaVersion: 1,
|
|
250
127
|
standard: 'anhedral-application-stack',
|
|
251
128
|
products: options.products,
|
|
252
|
-
hosting:
|
|
253
|
-
bootstrap:
|
|
254
|
-
? readProjectSection(root, 'standard').bootstrap
|
|
255
|
-
: {
|
|
256
|
-
command: BOOTSTRAP_COMMAND.join(' '),
|
|
257
|
-
upstreamPackageManager: existing.packageManager,
|
|
258
|
-
},
|
|
129
|
+
hosting: 'cloudflare',
|
|
130
|
+
bootstrap: { command: 'anhedral init', source: 'bundled' },
|
|
259
131
|
status: 'starter',
|
|
260
132
|
resourcesProvisioned: false,
|
|
261
133
|
});
|
|
262
134
|
writeProjectSection(root, 'setup', createSetupPlan({ ...options, dryRun: false }, registry));
|
|
263
|
-
const providers = providerConfigurationTemplate(options.products, options.name);
|
|
264
|
-
const prior = updating && hasProjectSection(root, 'providers')
|
|
265
|
-
? readProjectSection(root, 'providers')
|
|
266
|
-
: undefined;
|
|
267
|
-
writeProjectSection(root, 'providers', {
|
|
268
|
-
...providers,
|
|
269
|
-
providers: { ...providers.providers, ...prior?.providers },
|
|
270
|
-
});
|
|
271
135
|
if (!updating)
|
|
272
136
|
writeSetupDocumentation(root, options);
|
|
273
137
|
}
|
package/dist/stack-registry.d.ts
CHANGED
|
@@ -1,86 +1,30 @@
|
|
|
1
1
|
import type { ItemDefinition, StackRegistryItem, RecipeContext } from './registry/types.js';
|
|
2
2
|
/** Every product owns its source recipe, setup requirements and composition policy here. */
|
|
3
3
|
declare const PRODUCT_ITEMS: {
|
|
4
|
-
vinext: ItemDefinition;
|
|
5
4
|
next: ItemDefinition;
|
|
6
5
|
expo: ItemDefinition;
|
|
7
|
-
electron: ItemDefinition;
|
|
8
|
-
wxt: ItemDefinition;
|
|
9
6
|
hono: ItemDefinition;
|
|
10
|
-
neon: ItemDefinition;
|
|
11
|
-
'neon-realtime': ItemDefinition;
|
|
12
7
|
d1: ItemDefinition;
|
|
13
|
-
'local-data': ItemDefinition;
|
|
14
|
-
clerk: ItemDefinition;
|
|
15
|
-
'better-auth': ItemDefinition;
|
|
16
8
|
r2: ItemDefinition;
|
|
17
|
-
kv: ItemDefinition;
|
|
18
|
-
realtime: ItemDefinition;
|
|
19
|
-
stream: ItemDefinition;
|
|
20
|
-
queues: ItemDefinition;
|
|
21
|
-
cron: ItemDefinition;
|
|
22
|
-
workflows: ItemDefinition;
|
|
23
|
-
'analytics-engine': ItemDefinition;
|
|
24
|
-
images: ItemDefinition;
|
|
25
|
-
realtimekit: ItemDefinition;
|
|
26
|
-
video: ItemDefinition;
|
|
27
|
-
openai: ItemDefinition;
|
|
28
|
-
'ai-sdk': ItemDefinition;
|
|
29
|
-
'workers-ai': ItemDefinition;
|
|
30
|
-
resend: ItemDefinition;
|
|
31
|
-
stripe: ItemDefinition;
|
|
32
|
-
revenuecat: ItemDefinition;
|
|
33
|
-
sentry: ItemDefinition;
|
|
34
|
-
basin: ItemDefinition;
|
|
35
|
-
posthog: ItemDefinition;
|
|
36
9
|
styling: ItemDefinition;
|
|
37
10
|
};
|
|
38
11
|
export type StandardProduct = keyof typeof PRODUCT_ITEMS;
|
|
39
|
-
export declare const STANDARD_PRODUCTS: readonly ("
|
|
12
|
+
export declare const STANDARD_PRODUCTS: readonly ("hono" | "expo" | "r2" | "next" | "styling" | "d1")[];
|
|
40
13
|
declare const DEFINITIONS: {
|
|
41
|
-
vinext: ItemDefinition;
|
|
42
14
|
next: ItemDefinition;
|
|
43
15
|
expo: ItemDefinition;
|
|
44
|
-
electron: ItemDefinition;
|
|
45
|
-
wxt: ItemDefinition;
|
|
46
16
|
hono: ItemDefinition;
|
|
47
|
-
neon: ItemDefinition;
|
|
48
|
-
'neon-realtime': ItemDefinition;
|
|
49
17
|
d1: ItemDefinition;
|
|
50
|
-
'local-data': ItemDefinition;
|
|
51
|
-
clerk: ItemDefinition;
|
|
52
|
-
'better-auth': ItemDefinition;
|
|
53
18
|
r2: ItemDefinition;
|
|
54
|
-
kv: ItemDefinition;
|
|
55
|
-
realtime: ItemDefinition;
|
|
56
|
-
stream: ItemDefinition;
|
|
57
|
-
queues: ItemDefinition;
|
|
58
|
-
cron: ItemDefinition;
|
|
59
|
-
workflows: ItemDefinition;
|
|
60
|
-
'analytics-engine': ItemDefinition;
|
|
61
|
-
images: ItemDefinition;
|
|
62
|
-
realtimekit: ItemDefinition;
|
|
63
|
-
video: ItemDefinition;
|
|
64
|
-
openai: ItemDefinition;
|
|
65
|
-
'ai-sdk': ItemDefinition;
|
|
66
|
-
'workers-ai': ItemDefinition;
|
|
67
|
-
resend: ItemDefinition;
|
|
68
|
-
stripe: ItemDefinition;
|
|
69
|
-
revenuecat: ItemDefinition;
|
|
70
|
-
sentry: ItemDefinition;
|
|
71
|
-
basin: ItemDefinition;
|
|
72
|
-
posthog: ItemDefinition;
|
|
73
19
|
styling: ItemDefinition;
|
|
74
20
|
workspace: ItemDefinition;
|
|
75
21
|
typescript: ItemDefinition;
|
|
76
22
|
eslint: ItemDefinition;
|
|
77
|
-
'cloudflare-api': ItemDefinition;
|
|
78
|
-
ui: ItemDefinition;
|
|
79
23
|
};
|
|
80
24
|
export type StackItemId = keyof typeof DEFINITIONS;
|
|
81
25
|
export declare function getStackDefinition(name: string): ItemDefinition;
|
|
82
26
|
export declare function getStackItem(name: string): StackRegistryItem;
|
|
83
|
-
export declare const STACK_ITEMS: Record<"
|
|
27
|
+
export declare const STACK_ITEMS: Record<"hono" | "expo" | "r2" | "typescript" | "next" | "eslint" | "workspace" | "styling" | "d1", StackRegistryItem>;
|
|
84
28
|
export declare const STACK_REGISTRY: {
|
|
85
29
|
schemaVersion: number;
|
|
86
30
|
name: string;
|