anhedral 0.15.0 → 0.17.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 +82 -34
- 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 +0 -11
- package/assets/ui/catalog.json +891 -0
- package/assets/ui/extensions/registry.json +6 -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 -9
- package/dist/dependencies.js +57 -64
- package/dist/index.d.ts +1 -42
- package/dist/index.js +1 -27
- 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 +4 -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 +56 -25
- 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 +21 -22
- package/dist/stack-registry.d.ts +2 -10
- package/dist/stack-registry.js +12 -98
- 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 +12 -23
- package/docs/assets/anhedral-stack-light.png +0 -0
- package/docs/assets/anhedral-stack.png +0 -0
- package/docs/capabilities.md +110 -0
- package/docs/native-ui.md +47 -0
- package/docs/software-factory.md +35 -50
- package/docs/stack-standard.md +19 -70
- package/docs/ui.md +33 -0
- package/docs/verification.md +6 -876
- package/package.json +21 -16
- package/assets/ui/native/button.tsx +0 -85
- package/assets/ui/native/card.tsx +0 -33
- package/assets/ui/native/dialog.tsx +0 -75
- package/assets/ui/native/input.tsx +0 -27
- package/assets/ui/native/label.tsx +0 -4
- package/assets/ui/native/layout.tsx +0 -26
- package/assets/ui/native/text.tsx +0 -20
- package/assets/ui/native/theme-switcher.tsx +0 -22
- package/assets/ui/theme-storage.ts +0 -25
- package/assets/ui/theme.tsx +0 -66
- 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/platforms/mobile.d.ts +0 -2
- package/dist/platforms/mobile.js +0 -156
- 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/expo-runtime.d.ts +0 -3
- package/dist/scaffold/expo-runtime.js +0 -43
- 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/native-ui.d.ts +0 -2
- package/dist/scaffold/native-ui.js +0 -69
- 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
|
@@ -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,6 @@ 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: ['react-native-reanimated', 'react-native-worklets'],
|
|
44
45
|
ignorePatterns: [
|
|
45
46
|
'scripts/audit.mjs',
|
|
46
47
|
'scripts/audit-deps.mjs',
|
|
@@ -60,13 +61,20 @@ process.exitCode = result.status ?? 1;
|
|
|
60
61
|
tasks: {
|
|
61
62
|
dev: { cache: false, persistent: true },
|
|
62
63
|
lint: { dependsOn: ['^lint'] },
|
|
63
|
-
typecheck: {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
'db:migrate': {
|
|
67
|
-
cache: false,
|
|
68
|
-
passThroughEnv: ['CLOUDFLARE_API_TOKEN', 'CLOUDFLARE_ACCOUNT_ID'],
|
|
64
|
+
typecheck: {
|
|
65
|
+
dependsOn: ['^typecheck'],
|
|
66
|
+
outputs: ['worker-configuration.d.ts', 'next-env.d.ts', '.next/types/**'],
|
|
69
67
|
},
|
|
68
|
+
test: { dependsOn: ['^build'], outputs: ['coverage/**'] },
|
|
69
|
+
...(options.products.includes('d1')
|
|
70
|
+
? {
|
|
71
|
+
'db:generate': { cache: false },
|
|
72
|
+
'db:migrate': {
|
|
73
|
+
cache: false,
|
|
74
|
+
passThroughEnv: ['CLOUDFLARE_API_TOKEN', 'CLOUDFLARE_ACCOUNT_ID'],
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
: {}),
|
|
70
78
|
build: {
|
|
71
79
|
dependsOn: ['^build'],
|
|
72
80
|
outputs: ['dist/**', '.open-next/**', '.next/**', '!.next/cache/**'],
|
|
@@ -78,8 +86,6 @@ process.exitCode = result.status ?? 1;
|
|
|
78
86
|
// OpenNext's node-minify dependency pins the vulnerable glob CLI.
|
|
79
87
|
overrides: {
|
|
80
88
|
'@node-minify/core>glob': OPENNEXT_GLOB_VERSION,
|
|
81
|
-
// Expo CLI's two schema consumers use APIs supported by the patched Zod release.
|
|
82
|
-
'@expo/cli>zod': STACK_DEPENDENCIES.zod,
|
|
83
89
|
'miniflare>undici': STACK_DEPENDENCIES.undici,
|
|
84
90
|
},
|
|
85
91
|
sharedWorkspaceLockfile: true,
|
|
@@ -106,6 +112,7 @@ process.exitCode = result.status ?? 1;
|
|
|
106
112
|
'.anhedral/',
|
|
107
113
|
'.anhedral-audit-report.json',
|
|
108
114
|
'worker-configuration.d.ts',
|
|
115
|
+
'next-env.d.ts',
|
|
109
116
|
]);
|
|
110
117
|
writeEnvironmentExample(root, registry);
|
|
111
118
|
writeStackDocumentation(root, registry);
|
|
@@ -119,14 +126,6 @@ process.exitCode = result.status ?? 1;
|
|
|
119
126
|
resourcesProvisioned: false,
|
|
120
127
|
});
|
|
121
128
|
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
129
|
if (!updating)
|
|
131
130
|
writeSetupDocumentation(root, options);
|
|
132
131
|
}
|
package/dist/stack-registry.d.ts
CHANGED
|
@@ -2,26 +2,18 @@ import type { ItemDefinition, StackRegistryItem, RecipeContext } from './registr
|
|
|
2
2
|
/** Every product owns its source recipe, setup requirements and composition policy here. */
|
|
3
3
|
declare const PRODUCT_ITEMS: {
|
|
4
4
|
next: ItemDefinition;
|
|
5
|
-
expo: ItemDefinition;
|
|
6
5
|
hono: ItemDefinition;
|
|
7
6
|
d1: ItemDefinition;
|
|
8
|
-
'better-auth': ItemDefinition;
|
|
9
7
|
r2: ItemDefinition;
|
|
10
|
-
stripe: ItemDefinition;
|
|
11
|
-
revenuecat: ItemDefinition;
|
|
12
8
|
styling: ItemDefinition;
|
|
13
9
|
};
|
|
14
10
|
export type StandardProduct = keyof typeof PRODUCT_ITEMS;
|
|
15
|
-
export declare const STANDARD_PRODUCTS: readonly ("
|
|
11
|
+
export declare const STANDARD_PRODUCTS: readonly ("hono" | "r2" | "next" | "styling" | "d1")[];
|
|
16
12
|
declare const DEFINITIONS: {
|
|
17
13
|
next: ItemDefinition;
|
|
18
|
-
expo: ItemDefinition;
|
|
19
14
|
hono: ItemDefinition;
|
|
20
15
|
d1: ItemDefinition;
|
|
21
|
-
'better-auth': ItemDefinition;
|
|
22
16
|
r2: ItemDefinition;
|
|
23
|
-
stripe: ItemDefinition;
|
|
24
|
-
revenuecat: ItemDefinition;
|
|
25
17
|
styling: ItemDefinition;
|
|
26
18
|
workspace: ItemDefinition;
|
|
27
19
|
typescript: ItemDefinition;
|
|
@@ -30,7 +22,7 @@ declare const DEFINITIONS: {
|
|
|
30
22
|
export type StackItemId = keyof typeof DEFINITIONS;
|
|
31
23
|
export declare function getStackDefinition(name: string): ItemDefinition;
|
|
32
24
|
export declare function getStackItem(name: string): StackRegistryItem;
|
|
33
|
-
export declare const STACK_ITEMS: Record<"
|
|
25
|
+
export declare const STACK_ITEMS: Record<"hono" | "r2" | "next" | "eslint" | "typescript" | "workspace" | "styling" | "d1", StackRegistryItem>;
|
|
34
26
|
export declare const STACK_REGISTRY: {
|
|
35
27
|
schemaVersion: number;
|
|
36
28
|
name: string;
|
package/dist/stack-registry.js
CHANGED
|
@@ -4,22 +4,12 @@ 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
|
-
import {
|
|
10
|
-
import { scaffoldPrivateFiles } from './scaffold/integrations.js';
|
|
11
|
-
import { scaffoldBilling } from './scaffold/billing.js';
|
|
8
|
+
import { scaffoldPrivateStorage } from './scaffold/storage.js';
|
|
12
9
|
import { sharedPackage } from './scaffold/files.js';
|
|
13
10
|
function requirements(purpose, tools, access, credentials, resources, verify) {
|
|
14
11
|
return { purpose, tools, access, credentials, resources, verify };
|
|
15
12
|
}
|
|
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
13
|
function packageSource(name, source, dependencies) {
|
|
24
14
|
return { name, source, dependencies };
|
|
25
15
|
}
|
|
@@ -43,26 +33,17 @@ const PRODUCT_ITEMS = defineItems({
|
|
|
43
33
|
type: 'application',
|
|
44
34
|
description: 'Full Next.js App Router web application on Cloudflare OpenNext',
|
|
45
35
|
targets: ['apps/web'],
|
|
46
|
-
registryDependencies: ['workspace', 'typescript', 'eslint', 'styling', 'hono'],
|
|
47
|
-
setup: requirements('Server-rendered web application', ['Browser control', 'Wrangler'], ['Cloudflare Workers deployment access'], [], ['Next.js Worker, assets and scoped ANHEDRAL_API binding'], ['Request-rendered HTML, RSC, cookies and authenticated API routes']),
|
|
48
|
-
install: scaffoldWeb,
|
|
49
|
-
environment: ['API_INTERNAL_URL', 'ANHEDRAL_PREVIEW_ORIGIN'],
|
|
50
|
-
},
|
|
51
|
-
expo: {
|
|
52
|
-
type: 'application',
|
|
53
|
-
description: 'Native Expo iOS and Android application with Anhedral native shadcn UI',
|
|
54
|
-
targets: ['apps/mobile', 'packages/native-ui'],
|
|
55
36
|
registryDependencies: ['workspace', 'typescript', 'eslint', 'styling'],
|
|
56
|
-
setup: requirements('
|
|
57
|
-
install:
|
|
58
|
-
environment: ['
|
|
37
|
+
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']),
|
|
38
|
+
install: scaffoldWeb,
|
|
39
|
+
environment: ['ANHEDRAL_PREVIEW_ORIGIN'],
|
|
59
40
|
},
|
|
60
41
|
hono: {
|
|
61
42
|
type: 'application',
|
|
62
43
|
description: 'Shared Hono OpenAPI Worker',
|
|
63
44
|
targets: ['apps/api'],
|
|
64
45
|
registryDependencies: ['workspace', 'typescript', 'eslint'],
|
|
65
|
-
setup: requirements('Shared OpenAPI backend', ['Wrangler'], ['Cloudflare Workers deployment access'], [], ['API Worker; application routes and authorization'], ['
|
|
46
|
+
setup: requirements('Shared OpenAPI backend', ['Wrangler'], ['Cloudflare Workers deployment access'], [], ['API Worker; application routes and authorization'], ['Health contract and application-owned authorization']),
|
|
66
47
|
install: scaffoldApi,
|
|
67
48
|
},
|
|
68
49
|
d1: {
|
|
@@ -85,93 +66,26 @@ const PRODUCT_ITEMS = defineItems({
|
|
|
85
66
|
}),
|
|
86
67
|
runtime: 'worker',
|
|
87
68
|
},
|
|
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
69
|
r2: {
|
|
107
70
|
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
|
-
'
|
|
71
|
+
description: 'Server-only private R2 storage foundation',
|
|
72
|
+
targets: ['apps/api/src/private-storage.ts'],
|
|
73
|
+
registryDependencies: ['workspace', 'typescript', 'eslint', 'hono'],
|
|
74
|
+
setup: requirements('Private remote files', ['Wrangler'], ['Cloudflare R2 bucket/binding access'], [], ['Private R2 bucket and FILES binding; no public object routes'], [
|
|
75
|
+
'Keep public access disabled; implement application authorization before adding object routes',
|
|
113
76
|
]),
|
|
114
|
-
install:
|
|
77
|
+
install: scaffoldPrivateStorage,
|
|
115
78
|
configure: ({ options }) => ({
|
|
116
79
|
r2_buckets: [{ binding: 'FILES', bucket_name: resourceName(options.name, 'private-files') }],
|
|
117
80
|
}),
|
|
118
81
|
runtime: 'worker',
|
|
119
82
|
},
|
|
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
83
|
styling: {
|
|
170
84
|
type: 'package',
|
|
171
85
|
description: 'Shared platform-independent styling tokens',
|
|
172
86
|
targets: ['packages/styling'],
|
|
173
87
|
registryDependencies: ['workspace', 'typescript', 'eslint'],
|
|
174
|
-
setup: requirements('Shared styling definitions', [], [], [], ['Shared light/dark tokens, web CSS and
|
|
88
|
+
setup: requirements('Shared styling definitions', [], [], [], ['Shared light/dark tokens, web CSS and optional RNR/NativeWind source'], ['Consistency across selected interfaces; preserve platform-specific components']),
|
|
175
89
|
package: packageSource('styling', `import { light, dark, spacing } from './tokens.cjs';
|
|
176
90
|
|
|
177
91
|
export const styling = {
|
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
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { existsSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { stripVTControlCharacters } from 'node:util';
|
|
4
|
+
import { spawn, spawnSync } from 'node:child_process';
|
|
5
|
+
import { commandArguments, commandArgumentError } from './cli-arguments.js';
|
|
6
|
+
import { resolveCommand } from './command.js';
|
|
7
|
+
import { UI_CATALOG, resolveUiItems } from './ui-catalog.js';
|
|
8
|
+
import { detectUiTargets, initializeUiMetadata, inspectUiTarget } from './ui-project.js';
|
|
9
|
+
function runUpstream(args, cwd) {
|
|
10
|
+
const invocation = resolveCommand('pnpm', [
|
|
11
|
+
'dlx',
|
|
12
|
+
`shadcn@${UI_CATALOG.shadcnCliVersion}`,
|
|
13
|
+
...args,
|
|
14
|
+
]);
|
|
15
|
+
return new Promise((resolve, reject) => {
|
|
16
|
+
const child = spawn(invocation.command, invocation.args, {
|
|
17
|
+
cwd,
|
|
18
|
+
shell: false,
|
|
19
|
+
detached: process.platform !== 'win32',
|
|
20
|
+
windowsHide: true,
|
|
21
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
22
|
+
env: { ...process.env, CI: '1', NO_COLOR: '1' },
|
|
23
|
+
});
|
|
24
|
+
let stdout = '', stderr = '', answered = 0, bytes = 0;
|
|
25
|
+
const fail = (reason) => {
|
|
26
|
+
clearTimeout(timer);
|
|
27
|
+
if (child.pid) {
|
|
28
|
+
if (process.platform === 'win32')
|
|
29
|
+
spawnSync('taskkill', ['/pid', String(child.pid), '/T', '/F'], {
|
|
30
|
+
shell: false,
|
|
31
|
+
stdio: 'ignore',
|
|
32
|
+
windowsHide: true,
|
|
33
|
+
timeout: 5000,
|
|
34
|
+
});
|
|
35
|
+
else {
|
|
36
|
+
try {
|
|
37
|
+
process.kill(-child.pid, 'SIGKILL');
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
child.kill();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
reject(Error(`Upstream UI command failed in ${cwd}: ${reason}`));
|
|
45
|
+
};
|
|
46
|
+
const timer = setTimeout(() => fail('installer timed out; inspect consumer changes before retrying'), 120000);
|
|
47
|
+
child.stdin.on('error', () => {
|
|
48
|
+
/* Process exit can close stdin before its final answer. */
|
|
49
|
+
});
|
|
50
|
+
child.stdout.setEncoding('utf8');
|
|
51
|
+
child.stderr.setEncoding('utf8');
|
|
52
|
+
const receive = (chunk, stream) => {
|
|
53
|
+
bytes += Buffer.byteLength(chunk);
|
|
54
|
+
if (bytes > 4 * 1024 * 1024)
|
|
55
|
+
return fail('installer output exceeded its bound');
|
|
56
|
+
if (stream === 'stdout')
|
|
57
|
+
stdout += chunk;
|
|
58
|
+
else
|
|
59
|
+
stderr += chunk;
|
|
60
|
+
// shadcn --yes skips confirmation, not overwrite prompts. Reply to each
|
|
61
|
+
// pinned CLI prompt when it appears; prefeeding stdin loses later answers.
|
|
62
|
+
const visible = stripVTControlCharacters(stdout + stderr);
|
|
63
|
+
const prompts = visible.match(/› \(y\/N\)/g)?.length ?? 0;
|
|
64
|
+
while (answered < prompts) {
|
|
65
|
+
answered++;
|
|
66
|
+
child.stdin.write('n\r');
|
|
67
|
+
}
|
|
68
|
+
// prompts retains a stdin listener after confirmations. Close input only
|
|
69
|
+
// after the pinned installer reports its completed file operations.
|
|
70
|
+
if (answered && /(?:Created|Updated|Skipped) \d+ files?\b/.test(visible))
|
|
71
|
+
child.stdin.end();
|
|
72
|
+
};
|
|
73
|
+
child.stdout.on('data', (chunk) => receive(chunk, 'stdout'));
|
|
74
|
+
child.stderr.on('data', (chunk) => receive(chunk, 'stderr'));
|
|
75
|
+
child.on('error', (error) => {
|
|
76
|
+
clearTimeout(timer);
|
|
77
|
+
reject(error);
|
|
78
|
+
});
|
|
79
|
+
child.on('close', (status) => {
|
|
80
|
+
clearTimeout(timer);
|
|
81
|
+
if (status !== 0)
|
|
82
|
+
reject(Error(`Upstream UI command failed in ${cwd}: ${stderr.slice(-2000) || 'check the project configuration'}`));
|
|
83
|
+
else
|
|
84
|
+
resolve(stdout);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
export async function runUiCommand(args, output, run = runUpstream) {
|
|
89
|
+
const parsed = commandArguments('ui', args);
|
|
90
|
+
const [action, ...names] = parsed.positional;
|
|
91
|
+
if (!['init', 'add', 'list', 'diff', 'doctor'].includes(action))
|
|
92
|
+
throw commandArgumentError('ui', 'Choose ui init, add, list, diff or doctor.');
|
|
93
|
+
if (['add', 'diff'].includes(action) ? !names.length || names.length > 50 : names.length > 0)
|
|
94
|
+
throw commandArgumentError('ui', 'Supply component names only for add/diff (at most 50).');
|
|
95
|
+
const selectors = ['--web', '--native', '--all'].filter((flag) => parsed.has(flag));
|
|
96
|
+
if (selectors.length > 1)
|
|
97
|
+
throw commandArgumentError('ui', 'Choose one of --web, --native or --all.');
|
|
98
|
+
const selector = selectors[0]?.slice(2);
|
|
99
|
+
let result;
|
|
100
|
+
if (action === 'list') {
|
|
101
|
+
result = {
|
|
102
|
+
catalogRevision: UI_CATALOG.revision,
|
|
103
|
+
nativeStyling: UI_CATALOG.nativeStyling,
|
|
104
|
+
components: UI_CATALOG.components.filter((item) => !selector || selector === 'all' || item[selector]),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
const targets = detectUiTargets(process.cwd(), selector);
|
|
109
|
+
if (action === 'doctor') {
|
|
110
|
+
const reports = targets.map(inspectUiTarget);
|
|
111
|
+
result = {
|
|
112
|
+
targets: reports,
|
|
113
|
+
configurationReady: reports.every((report) => report.configurationReady),
|
|
114
|
+
};
|
|
115
|
+
if (!reports.every((report) => report.configurationReady))
|
|
116
|
+
process.exitCode = 1;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
// Preflight every target before invoking any installer, including explicit --all.
|
|
120
|
+
const plans = targets.map((target) => {
|
|
121
|
+
const report = inspectUiTarget(target);
|
|
122
|
+
const configExists = existsSync(path.join(target.root, 'components.json'));
|
|
123
|
+
const nativeInit = action === 'init' && target.platform === 'native';
|
|
124
|
+
const issues = nativeInit
|
|
125
|
+
? report.issues.filter((issue) => !issue.startsWith('Missing components.json'))
|
|
126
|
+
: report.issues;
|
|
127
|
+
if ((action !== 'init' || target.platform === 'native' || configExists) && issues.length)
|
|
128
|
+
throw Error(issues.join('\n') + '\n' + report.guide);
|
|
129
|
+
if (nativeInit && !configExists && !existsSync(path.join(target.root, 'global.css')))
|
|
130
|
+
throw Error('Native init needs the upstream NativeWind global.css. Complete the RNR setup first.');
|
|
131
|
+
const items = action === 'init' ? [] : resolveUiItems(names, target.platform);
|
|
132
|
+
return {
|
|
133
|
+
root: target.root,
|
|
134
|
+
platform: target.platform,
|
|
135
|
+
items,
|
|
136
|
+
nativeInit,
|
|
137
|
+
command: action === 'init'
|
|
138
|
+
? configExists || nativeInit
|
|
139
|
+
? []
|
|
140
|
+
: ['init', '--base', 'base', '--defaults', '--no-reinstall', '--no-monorepo']
|
|
141
|
+
: [
|
|
142
|
+
'add',
|
|
143
|
+
...items.map((item) => item.item),
|
|
144
|
+
'--yes',
|
|
145
|
+
...(action === 'diff' ? ['--diff'] : []),
|
|
146
|
+
],
|
|
147
|
+
};
|
|
148
|
+
});
|
|
149
|
+
if (!parsed.has('--dry-run')) {
|
|
150
|
+
for (const plan of plans) {
|
|
151
|
+
if (plan.nativeInit && !existsSync(path.join(plan.root, 'components.json'))) {
|
|
152
|
+
if (!existsSync(path.join(plan.root, 'global.css')))
|
|
153
|
+
throw Error('Native init needs the upstream NativeWind global.css. Complete the RNR setup first.');
|
|
154
|
+
writeFileSync(path.join(plan.root, 'components.json'), JSON.stringify({
|
|
155
|
+
$schema: 'https://ui.shadcn.com/schema.json',
|
|
156
|
+
style: 'new-york',
|
|
157
|
+
rsc: false,
|
|
158
|
+
tsx: true,
|
|
159
|
+
tailwind: {
|
|
160
|
+
config: 'tailwind.config.js',
|
|
161
|
+
css: 'global.css',
|
|
162
|
+
baseColor: 'neutral',
|
|
163
|
+
cssVariables: true,
|
|
164
|
+
},
|
|
165
|
+
aliases: {
|
|
166
|
+
components: '@/components',
|
|
167
|
+
ui: '@/components/ui',
|
|
168
|
+
utils: '@/lib/utils',
|
|
169
|
+
lib: '@/lib',
|
|
170
|
+
hooks: '@/hooks',
|
|
171
|
+
},
|
|
172
|
+
}, null, 2) + '\n', { flag: 'wx' });
|
|
173
|
+
}
|
|
174
|
+
const vendorOutput = plan.command.length ? await run(plan.command, plan.root) : '';
|
|
175
|
+
if (action === 'init' || action === 'add')
|
|
176
|
+
initializeUiMetadata(plan.root, plan.platform);
|
|
177
|
+
Object.assign(plan, { output: vendorOutput });
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
result = {
|
|
181
|
+
action,
|
|
182
|
+
dryRun: parsed.has('--dry-run'),
|
|
183
|
+
installer: `shadcn@${UI_CATALOG.shadcnCliVersion}`,
|
|
184
|
+
targets: plans,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (output.json)
|
|
189
|
+
console.log(JSON.stringify(result, null, 2));
|
|
190
|
+
else if (!output.quiet)
|
|
191
|
+
console.log(action === 'list'
|
|
192
|
+
? UI_CATALOG.components
|
|
193
|
+
.filter((item) => !selector || selector === 'all' || item[selector])
|
|
194
|
+
.map((item) => `${item.name}\tweb: ${item.web ? 'shadcn' : 'unavailable'}\tnative: ${item.native ? 'RNR (validation required)' : 'unavailable'}`)
|
|
195
|
+
.join('\n')
|
|
196
|
+
: action === 'doctor'
|
|
197
|
+
? result.targets
|
|
198
|
+
.map((report) => [
|
|
199
|
+
`${report.platform}: ${report.configurationReady ? 'configuration ready' : 'setup needed'} (${report.root})`,
|
|
200
|
+
...report.issues,
|
|
201
|
+
'Runtime acceptance: not evaluated.',
|
|
202
|
+
].join('\n'))
|
|
203
|
+
.join('\n\n')
|
|
204
|
+
: result.targets
|
|
205
|
+
.map((target) => [
|
|
206
|
+
`${action}${parsed.has('--dry-run') ? ' (dry run)' : ''}: ${target.platform} (${target.root})`,
|
|
207
|
+
...(parsed.has('--dry-run')
|
|
208
|
+
? [
|
|
209
|
+
target.command.length
|
|
210
|
+
? `shadcn@${UI_CATALOG.shadcnCliVersion} ${target.command.join(' ')}`
|
|
211
|
+
: 'Validate existing configuration; initialize metadata and attribution if absent.',
|
|
212
|
+
]
|
|
213
|
+
: []),
|
|
214
|
+
target.output?.trim() ?? '',
|
|
215
|
+
]
|
|
216
|
+
.filter(Boolean)
|
|
217
|
+
.join('\n'))
|
|
218
|
+
.join('\n\n'));
|
|
219
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type UiPlatform } from './ui-catalog.js';
|
|
2
|
+
type Manifest = {
|
|
3
|
+
dependencies?: Record<string, string>;
|
|
4
|
+
devDependencies?: Record<string, string>;
|
|
5
|
+
};
|
|
6
|
+
export interface UiTarget {
|
|
7
|
+
root: string;
|
|
8
|
+
platform: UiPlatform;
|
|
9
|
+
manifest: Manifest;
|
|
10
|
+
}
|
|
11
|
+
export declare function detectUiTargets(cwd: string, selector?: UiPlatform | 'all'): UiTarget[];
|
|
12
|
+
export declare function inspectUiTarget(target: UiTarget): {
|
|
13
|
+
root: string;
|
|
14
|
+
platform: UiPlatform;
|
|
15
|
+
configurationReady: boolean;
|
|
16
|
+
issues: string[];
|
|
17
|
+
runtimeAcceptance: string;
|
|
18
|
+
guide: string;
|
|
19
|
+
};
|
|
20
|
+
/** New metadata and attribution only; never overwrite consumer-owned files. */
|
|
21
|
+
export declare function initializeUiMetadata(root: string, platform: UiPlatform): void;
|
|
22
|
+
export {};
|