handoff-app 2.0.0-7 → 2.0.0-9
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 +130 -14
- package/UPGRADE.md +20 -0
- package/dist/app-builder/build.js +10 -2
- package/dist/app-builder/client-config.js +3 -1
- package/dist/app-builder/watchers.js +17 -7
- package/dist/cache/build-cache.js +5 -1
- package/dist/catalog/normalize.js +3 -0
- package/dist/catalog/previews.js +5 -4
- package/dist/catalog/types.d.ts +8 -0
- package/dist/cli/auth/device.d.ts +6 -1
- package/dist/cli/auth/device.js +5 -2
- package/dist/cli/auth/store.d.ts +15 -6
- package/dist/cli/auth/store.js +72 -19
- package/dist/commands/login/index.d.ts +5 -0
- package/dist/commands/login/index.js +18 -6
- package/dist/commands/logout/index.d.ts +5 -0
- package/dist/commands/logout/index.js +54 -15
- package/dist/commands/types.d.ts +2 -0
- package/dist/commands/utils.d.ts +21 -7
- package/dist/commands/utils.js +11 -10
- package/dist/config/catalog-include.d.ts +2 -2
- package/dist/config/defaults.d.ts +3 -3
- package/dist/config/defaults.js +54 -48
- package/dist/config/env.d.ts +9 -0
- package/dist/config/env.js +43 -0
- package/dist/config/errors.d.ts +4 -0
- package/dist/config/errors.js +11 -0
- package/dist/config/from-env.d.ts +24 -0
- package/dist/config/from-env.js +7 -0
- package/dist/config/helpers.d.ts +2 -0
- package/dist/config/helpers.js +3 -1
- package/dist/config/index.d.ts +2 -1
- package/dist/config/index.js +6 -1
- package/dist/config/loader.d.ts +29 -11
- package/dist/config/loader.js +121 -46
- package/dist/config/resolve-env.d.ts +5 -0
- package/dist/config/resolve-env.js +102 -0
- package/dist/config/runtime.d.ts +3 -3
- package/dist/config/runtime.js +8 -10
- package/dist/config/validator.d.ts +2 -2
- package/dist/config/validator.js +2 -4
- package/dist/handlebars.d.ts +10 -2
- package/dist/index.d.ts +33 -4
- package/dist/index.js +60 -16
- package/dist/pipeline/index.d.ts +1 -1
- package/dist/pipeline/index.js +1 -1
- package/dist/registry/asset-storage/adapters/vercel-blob.js +1 -1
- package/dist/registry/asset-storage/resolve.d.ts +2 -2
- package/dist/registry/asset-storage/resolve.js +4 -1
- package/dist/registry/checkout/index.js +4 -4
- package/dist/registry/connection.d.ts +28 -24
- package/dist/registry/connection.js +53 -67
- package/dist/registry/db/driver.d.ts +4 -11
- package/dist/registry/db/driver.js +4 -16
- package/dist/registry/db/index.d.ts +1 -1
- package/dist/registry/db/index.js +1 -2
- package/dist/registry/publish/index.js +4 -4
- package/dist/store/filesystem.d.ts +2 -2
- package/dist/transformers/plugins/ssr-render.js +40 -15
- package/dist/transformers/preview/component/css.d.ts +1 -0
- package/dist/transformers/preview/component/css.js +85 -47
- package/dist/transformers/preview/pattern/html.js +3 -1
- package/dist/transformers/preview/types.d.ts +13 -0
- package/dist/transformers/utils/build.d.ts +19 -0
- package/dist/transformers/utils/build.js +83 -1
- package/dist/transformers/utils/module.js +2 -1
- package/dist/types/config.d.ts +54 -29
- package/docs/api.md +31 -0
- package/docs/cli.md +2 -2
- package/package.json +1 -1
- package/src/app/components/Component/PageSliceResolver.tsx +1 -0
- package/src/app/components/Component/Preview.tsx +380 -189
- package/src/app/components/Component/slices/ComponentDisplaySlice.tsx +4 -0
- package/src/app/pages/account/tokens.tsx +3 -1
- package/src/app-builder/build.ts +10 -2
- package/src/app-builder/client-config.ts +5 -3
- package/src/app-builder/watchers.ts +18 -8
- package/src/cache/build-cache.ts +5 -1
- package/src/catalog/README.md +3 -0
- package/src/catalog/normalize.ts +2 -0
- package/src/catalog/previews.ts +6 -3
- package/src/catalog/types.ts +8 -0
- package/src/cli/auth/device.ts +8 -3
- package/src/cli/auth/store.ts +75 -18
- package/src/commands/login/index.ts +20 -6
- package/src/commands/logout/index.ts +74 -20
- package/src/commands/types.ts +2 -0
- package/src/commands/utils.ts +14 -5
- package/src/config/README.md +61 -1
- package/src/config/catalog-include.ts +2 -2
- package/src/config/defaults.ts +24 -14
- package/src/config/env.ts +41 -0
- package/src/config/errors.ts +7 -0
- package/src/config/from-env.ts +26 -0
- package/src/config/helpers.ts +4 -2
- package/src/config/index.ts +4 -1
- package/src/config/loader.ts +158 -50
- package/src/config/resolve-env.ts +94 -0
- package/src/config/runtime.ts +12 -7
- package/src/config/validator.ts +4 -6
- package/src/handlebars.ts +8 -2
- package/src/index.d.ts +2 -2
- package/src/index.ts +85 -8
- package/src/pipeline/index.ts +1 -1
- package/src/registry/asset-storage/adapters/vercel-blob.ts +1 -1
- package/src/registry/asset-storage/resolve.ts +6 -3
- package/src/registry/checkout/index.ts +5 -5
- package/src/registry/connection.ts +72 -71
- package/src/registry/db/driver.ts +6 -17
- package/src/registry/db/index.ts +0 -1
- package/src/registry/publish/index.ts +5 -5
- package/src/store/filesystem.ts +2 -2
- package/src/transformers/plugins/ssr-render.ts +53 -16
- package/src/transformers/preview/component/css.ts +93 -50
- package/src/transformers/preview/pattern/html.ts +3 -1
- package/src/transformers/preview/types.ts +14 -0
- package/src/transformers/utils/build.ts +80 -0
- package/src/transformers/utils/module.ts +4 -2
- package/src/types/config.ts +51 -29
- package/templates/default/env.tpl +10 -0
- package/templates/default/gitignore.tpl +7 -0
- package/templates/default/handoff.config.js.tpl +21 -172
- package/templates/default/handoff.config.ts.tpl +21 -156
- package/templates/default/handoff.config.with-examples.js.tpl +20 -171
- package/templates/default/handoff.config.with-examples.ts.tpl +20 -155
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineConfig } from 'handoff-app';
|
|
1
|
+
import { defineConfig, fromEnv } from 'handoff-app';
|
|
2
2
|
|
|
3
3
|
export default defineConfig({
|
|
4
4
|
app: {
|
|
@@ -40,163 +40,28 @@ export default defineConfig({
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
|
|
43
|
-
// catalog
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
// * collection directory whose subdirectories are each treated as an item. An item declares
|
|
47
|
-
// * an implementation (React, Handlebars) or a composition of other items.
|
|
48
|
-
// */
|
|
49
|
-
// include: ["components", "patterns"],
|
|
50
|
-
// },
|
|
51
|
-
|
|
52
|
-
// Runtime settings, all optional. The default is workspace mode with the MCP endpoint served.
|
|
53
|
-
// `mcp: false` leaves the /api/mcp/ endpoint, and the connect affordance in the docs header, out
|
|
54
|
-
// of the build; the route then answers 404.
|
|
55
|
-
// The registry block is only needed when deploying a hosted registry, and is used by
|
|
56
|
-
// `build --target registry` and `db:migrate`. The default workspace mode uses no database.
|
|
57
|
-
// Handoff runs on PostgreSQL, and `driver` just picks the connection driver to use, not
|
|
58
|
-
// the database engine. Secrets are referenced by env var name and never written here.
|
|
59
|
-
// runtime: {
|
|
60
|
-
// mode: "registry",
|
|
61
|
-
// mcp: false,
|
|
62
|
-
// registry: {
|
|
63
|
-
// databaseUrlEnv: "DATABASE_URL",
|
|
64
|
-
// database: { driver: "pg" }, // 'pg' | 'neon'
|
|
65
|
-
// },
|
|
66
|
-
// },
|
|
67
|
-
|
|
68
|
-
// Optional handoff-docgen settings used by component docs generation
|
|
69
|
-
// reactDocgen: {
|
|
70
|
-
// maxDepth: 7,
|
|
71
|
-
// excludeDirectories: ["dist", "build", ".next"]
|
|
72
|
-
// },
|
|
73
|
-
|
|
74
|
-
hooks: {
|
|
75
|
-
/**
|
|
76
|
-
* Optional validation callback for components
|
|
77
|
-
* @param component - The component instance to validate
|
|
78
|
-
* @returns A record of validation results where keys are validation types and values are detailed validation results
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* validateComponent: async (component) => ({
|
|
82
|
-
* a11y: {
|
|
83
|
-
* description: 'Accessibility validation check',
|
|
84
|
-
* passed: true,
|
|
85
|
-
* messages: ['No accessibility issues found']
|
|
86
|
-
* },
|
|
87
|
-
* responsive: {
|
|
88
|
-
* description: 'Responsive design validation',
|
|
89
|
-
* passed: false,
|
|
90
|
-
* messages: ['Component breaks at mobile breakpoint']
|
|
91
|
-
* }
|
|
92
|
-
* })
|
|
93
|
-
*/
|
|
94
|
-
// validateComponent: async (component) => {
|
|
95
|
-
// // Add your custom validation logic here
|
|
96
|
-
// return {};
|
|
97
|
-
// },
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Optional hook to override the SSR build configuration used in the ssrRenderPlugin
|
|
101
|
-
* @param config - The default esbuild configuration
|
|
102
|
-
* @returns Modified esbuild configuration
|
|
103
|
-
*
|
|
104
|
-
* @example
|
|
105
|
-
* ssrBuildConfig: (config) => {
|
|
106
|
-
* // Modify the esbuild config as needed
|
|
107
|
-
* return config;
|
|
108
|
-
* }
|
|
109
|
-
*/
|
|
110
|
-
// ssrBuildConfig: (config) => {
|
|
111
|
-
// // Add your custom SSR build configuration here
|
|
112
|
-
// return config;
|
|
113
|
-
// },
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Optional hook to override the client-side build configuration used in the ssrRenderPlugin
|
|
117
|
-
* @param config - The default esbuild configuration
|
|
118
|
-
* @returns Modified esbuild configuration
|
|
119
|
-
*
|
|
120
|
-
* @example
|
|
121
|
-
* clientBuildConfig: (config) => {
|
|
122
|
-
* // Modify the esbuild config as needed
|
|
123
|
-
* return config;
|
|
124
|
-
* }
|
|
125
|
-
*/
|
|
126
|
-
// clientBuildConfig: (config) => {
|
|
127
|
-
// // Add your custom client build configuration here
|
|
128
|
-
// return config;
|
|
129
|
-
// },
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Optional hook to specify which export property contains the schema
|
|
133
|
-
* @param exports - The module exports object containing the schema
|
|
134
|
-
* @returns The schema object from the exports
|
|
135
|
-
*
|
|
136
|
-
* @example
|
|
137
|
-
* getSchemaFromExports: (exports) => exports.customSchema || exports.default
|
|
138
|
-
*/
|
|
139
|
-
// getSchemaFromExports: (exports) => {
|
|
140
|
-
// // Add your custom schema extraction logic here
|
|
141
|
-
// return exports.default;
|
|
142
|
-
// },
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Optional hook to transform the schema into properties
|
|
146
|
-
* @param schema - The schema object to transform
|
|
147
|
-
* @returns The transformed properties object
|
|
148
|
-
*/
|
|
149
|
-
// schemaToProperties: (schema) => {
|
|
150
|
-
// // Add your custom schema to properties transformation here
|
|
151
|
-
// return {};
|
|
152
|
-
// },
|
|
43
|
+
// Where catalog items live. A path is either an item directory, or a collection directory whose
|
|
44
|
+
// subdirectories are each an item.
|
|
45
|
+
// catalog: { include: ["components", "patterns"] },
|
|
153
46
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
*/
|
|
165
|
-
// jsBuildConfig: (config) => {
|
|
166
|
-
// // Add your custom JavaScript build configuration here
|
|
167
|
-
// return config;
|
|
47
|
+
// `mode` selects the runtime: "workspace" (no database) or "registry" (Postgres). The registry
|
|
48
|
+
// block is read only by `build --target registry` and `db:migrate`, and secrets are referenced by
|
|
49
|
+
// env var name. A named profile (`handoff.config.registry.*`, `--profile registry`) is a good home
|
|
50
|
+
// for it.
|
|
51
|
+
runtime: {
|
|
52
|
+
mode: "workspace",
|
|
53
|
+
// mcp: false,
|
|
54
|
+
// registry: {
|
|
55
|
+
// databaseUrl: fromEnv("DATABASE_URL"),
|
|
56
|
+
// database: { driver: "pg" }, // 'pg' | 'neon'
|
|
168
57
|
// },
|
|
58
|
+
},
|
|
169
59
|
|
|
170
|
-
|
|
171
|
-
* Optional hook to override the CSS Vite configuration
|
|
172
|
-
* @param config - The default Vite configuration
|
|
173
|
-
* @returns Modified Vite configuration
|
|
174
|
-
*
|
|
175
|
-
* @example
|
|
176
|
-
* cssBuildConfig: (config) => {
|
|
177
|
-
* // Modify the Vite config as needed
|
|
178
|
-
* return config;
|
|
179
|
-
* }
|
|
180
|
-
*/
|
|
181
|
-
// cssBuildConfig: (config) => {
|
|
182
|
-
// // Add your custom CSS build configuration here
|
|
183
|
-
// return config;
|
|
184
|
-
// },
|
|
60
|
+
// reactDocgen: { maxDepth: 7, excludeDirectories: ["dist", "build", ".next"] },
|
|
185
61
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
* @example
|
|
192
|
-
* htmlBuildConfig: (config) => {
|
|
193
|
-
* // Modify the Vite config as needed
|
|
194
|
-
* return config;
|
|
195
|
-
* }
|
|
196
|
-
*/
|
|
197
|
-
// htmlBuildConfig: (config) => {
|
|
198
|
-
// // Add your custom HTML build configuration here
|
|
199
|
-
// return config;
|
|
200
|
-
// },
|
|
201
|
-
},
|
|
62
|
+
// Optional build hooks: component validation, esbuild and Vite config overrides, Handlebars
|
|
63
|
+
// helper registration. Signatures and examples are on the `Config` type.
|
|
64
|
+
// hooks: {
|
|
65
|
+
// validateComponent: async (component) => ({}),
|
|
66
|
+
// },
|
|
202
67
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { defineConfig } = require('handoff-app');
|
|
1
|
+
const { defineConfig, fromEnv } = require('handoff-app');
|
|
2
2
|
/** @typedef {import('handoff-app').Config} HandoffConfig */
|
|
3
3
|
|
|
4
4
|
/** @type {HandoffConfig} */
|
|
@@ -42,183 +42,32 @@ const config = {
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
|
|
45
|
+
// A path is either an item directory, or a collection directory whose subdirectories are each an
|
|
46
|
+
// item.
|
|
45
47
|
catalog: {
|
|
46
|
-
/**
|
|
47
|
-
* Directories to search for catalog items. A path is either an item directory or a collection
|
|
48
|
-
* directory whose subdirectories are each treated as an item. An item declares an
|
|
49
|
-
* implementation (React, Handlebars) or a composition of other items.
|
|
50
|
-
*
|
|
51
|
-
* @example include: ["components", "patterns"]
|
|
52
|
-
*/
|
|
53
48
|
include: ["components/button"],
|
|
54
49
|
},
|
|
55
50
|
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// registry: {
|
|
67
|
-
// databaseUrlEnv: "DATABASE_URL",
|
|
68
|
-
// database: { driver: "pg" }, // 'pg' | 'neon'
|
|
69
|
-
// },
|
|
70
|
-
// },
|
|
71
|
-
|
|
72
|
-
// Optional handoff-docgen settings used by component docs generation
|
|
73
|
-
// reactDocgen: {
|
|
74
|
-
// maxDepth: 7,
|
|
75
|
-
// excludeDirectories: ["dist", "build", ".next"]
|
|
76
|
-
// },
|
|
77
|
-
|
|
78
|
-
hooks: {
|
|
79
|
-
/**
|
|
80
|
-
* Optional validation callback for components
|
|
81
|
-
* @param component - The component instance to validate
|
|
82
|
-
* @returns A record of validation results where keys are validation types and values are detailed validation results
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* validateComponent: async (component) => ({
|
|
86
|
-
* a11y: {
|
|
87
|
-
* description: 'Accessibility validation check',
|
|
88
|
-
* passed: true,
|
|
89
|
-
* messages: ['No accessibility issues found']
|
|
90
|
-
* },
|
|
91
|
-
* responsive: {
|
|
92
|
-
* description: 'Responsive design validation',
|
|
93
|
-
* passed: false,
|
|
94
|
-
* messages: ['Component breaks at mobile breakpoint']
|
|
95
|
-
* }
|
|
96
|
-
* })
|
|
97
|
-
*/
|
|
98
|
-
// validateComponent: async (component) => {
|
|
99
|
-
// // Add your custom validation logic here
|
|
100
|
-
// return {};
|
|
101
|
-
// },
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Optional hook to override the SSR build configuration used in the ssrRenderPlugin
|
|
105
|
-
* @param config - The default esbuild configuration
|
|
106
|
-
* @returns Modified esbuild configuration
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* ssrBuildConfig: (config) => {
|
|
110
|
-
* // Modify the esbuild config as needed
|
|
111
|
-
* return config;
|
|
112
|
-
* }
|
|
113
|
-
*/
|
|
114
|
-
// ssrBuildConfig: (config) => {
|
|
115
|
-
// // Add your custom SSR build configuration here
|
|
116
|
-
// return config;
|
|
117
|
-
// },
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Optional hook to override the client-side build configuration used in the ssrRenderPlugin
|
|
121
|
-
* @param config - The default esbuild configuration
|
|
122
|
-
* @returns Modified esbuild configuration
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* clientBuildConfig: (config) => {
|
|
126
|
-
* // Modify the esbuild config as needed
|
|
127
|
-
* return config;
|
|
128
|
-
* }
|
|
129
|
-
*/
|
|
130
|
-
// clientBuildConfig: (config) => {
|
|
131
|
-
// // Add your custom client build configuration here
|
|
132
|
-
// return config;
|
|
133
|
-
// },
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Optional hook to specify which export property contains the schema
|
|
137
|
-
* @param exports - The module exports object containing the schema
|
|
138
|
-
* @returns The schema object from the exports
|
|
139
|
-
*
|
|
140
|
-
* @example
|
|
141
|
-
* getSchemaFromExports: (exports) => exports.customSchema || exports.default
|
|
142
|
-
*/
|
|
143
|
-
// getSchemaFromExports: (exports) => {
|
|
144
|
-
// // Add your custom schema extraction logic here
|
|
145
|
-
// return exports.default;
|
|
146
|
-
// },
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Optional hook to transform the schema into properties
|
|
150
|
-
* @param schema - The schema object to transform
|
|
151
|
-
* @returns The transformed properties object
|
|
152
|
-
*/
|
|
153
|
-
// schemaToProperties: (schema) => {
|
|
154
|
-
// // Add your custom schema to properties transformation here
|
|
155
|
-
// return {};
|
|
156
|
-
// },
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Optional hook to override the JavaScript Vite configuration
|
|
160
|
-
* @param config - The default Vite configuration
|
|
161
|
-
* @returns Modified Vite configuration
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* jsBuildConfig: (config) => {
|
|
165
|
-
* // Modify the Vite config as needed
|
|
166
|
-
* return config;
|
|
167
|
-
* }
|
|
168
|
-
*/
|
|
169
|
-
// jsBuildConfig: (config) => {
|
|
170
|
-
// // Add your custom JavaScript build configuration here
|
|
171
|
-
// return config;
|
|
172
|
-
// },
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Optional hook to override the CSS Vite configuration
|
|
176
|
-
* @param config - The default Vite configuration
|
|
177
|
-
* @returns Modified Vite configuration
|
|
178
|
-
*
|
|
179
|
-
* @example
|
|
180
|
-
* cssBuildConfig: (config) => {
|
|
181
|
-
* // Modify the Vite config as needed
|
|
182
|
-
* return config;
|
|
183
|
-
* }
|
|
184
|
-
*/
|
|
185
|
-
// cssBuildConfig: (config) => {
|
|
186
|
-
// // Add your custom CSS build configuration here
|
|
187
|
-
// return config;
|
|
51
|
+
// `mode` selects the runtime: "workspace" (no database) or "registry" (Postgres). The registry
|
|
52
|
+
// block is read only by `build --target registry` and `db:migrate`, and secrets are referenced by
|
|
53
|
+
// env var name. A named profile (`handoff.config.registry.*`, `--profile registry`) is a good home
|
|
54
|
+
// for it.
|
|
55
|
+
runtime: {
|
|
56
|
+
mode: "workspace",
|
|
57
|
+
// mcp: false,
|
|
58
|
+
// registry: {
|
|
59
|
+
// databaseUrl: fromEnv("DATABASE_URL"),
|
|
60
|
+
// database: { driver: "pg" }, // 'pg' | 'neon'
|
|
188
61
|
// },
|
|
62
|
+
},
|
|
189
63
|
|
|
190
|
-
|
|
191
|
-
* Optional hook to override the HTML Vite configuration
|
|
192
|
-
* @param config - The default Vite configuration
|
|
193
|
-
* @returns Modified Vite configuration
|
|
194
|
-
*
|
|
195
|
-
* @example
|
|
196
|
-
* htmlBuildConfig: (config) => {
|
|
197
|
-
* // Modify the Vite config as needed
|
|
198
|
-
* return config;
|
|
199
|
-
* }
|
|
200
|
-
*/
|
|
201
|
-
// htmlBuildConfig: (config) => {
|
|
202
|
-
// // Add your custom HTML build configuration here
|
|
203
|
-
// return config;
|
|
204
|
-
// },
|
|
64
|
+
// reactDocgen: { maxDepth: 7, excludeDirectories: ["dist", "build", ".next"] },
|
|
205
65
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
* @param context.injectFieldWrappers - True when generating inspect-mode previews
|
|
212
|
-
*
|
|
213
|
-
* @example
|
|
214
|
-
* registerHandlebarsHelpers: ({ handlebars, componentId }) => {
|
|
215
|
-
* handlebars.registerHelper('upperId', () => componentId.toUpperCase());
|
|
216
|
-
* }
|
|
217
|
-
*/
|
|
218
|
-
// registerHandlebarsHelpers: ({ handlebars, componentId, properties, injectFieldWrappers }) => {
|
|
219
|
-
// // Add your custom Handlebars helpers here
|
|
220
|
-
// },
|
|
221
|
-
},
|
|
66
|
+
// Optional build hooks: component validation, esbuild and Vite config overrides, Handlebars
|
|
67
|
+
// helper registration. Signatures and examples are on the `Config` type.
|
|
68
|
+
// hooks: {
|
|
69
|
+
// validateComponent: async (component) => ({}),
|
|
70
|
+
// },
|
|
222
71
|
};
|
|
223
72
|
|
|
224
73
|
module.exports = defineConfig(config);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineConfig } from 'handoff-app';
|
|
1
|
+
import { defineConfig, fromEnv } from 'handoff-app';
|
|
2
2
|
|
|
3
3
|
export default defineConfig({
|
|
4
4
|
app: {
|
|
@@ -40,165 +40,30 @@ export default defineConfig({
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
|
|
43
|
+
// A path is either an item directory, or a collection directory whose subdirectories are each an
|
|
44
|
+
// item.
|
|
43
45
|
catalog: {
|
|
44
|
-
/**
|
|
45
|
-
* Directories to search for catalog items. A path is either an item directory or a collection
|
|
46
|
-
* directory whose subdirectories are each treated as an item. An item declares an
|
|
47
|
-
* implementation (React, Handlebars) or a composition of other items.
|
|
48
|
-
*
|
|
49
|
-
* @example include: ["components", "patterns"]
|
|
50
|
-
*/
|
|
51
46
|
include: ["components/button"],
|
|
52
47
|
},
|
|
53
48
|
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// registry: {
|
|
65
|
-
// databaseUrlEnv: "DATABASE_URL",
|
|
66
|
-
// database: { driver: "pg" }, // 'pg' | 'neon'
|
|
67
|
-
// },
|
|
68
|
-
// },
|
|
69
|
-
|
|
70
|
-
// Optional handoff-docgen settings used by component docs generation
|
|
71
|
-
// reactDocgen: {
|
|
72
|
-
// maxDepth: 7,
|
|
73
|
-
// excludeDirectories: ["dist", "build", ".next"]
|
|
74
|
-
// },
|
|
75
|
-
|
|
76
|
-
hooks: {
|
|
77
|
-
/**
|
|
78
|
-
* Optional validation callback for components
|
|
79
|
-
* @param component - The component instance to validate
|
|
80
|
-
* @returns A record of validation results where keys are validation types and values are detailed validation results
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* validateComponent: async (component) => ({
|
|
84
|
-
* a11y: {
|
|
85
|
-
* description: 'Accessibility validation check',
|
|
86
|
-
* passed: true,
|
|
87
|
-
* messages: ['No accessibility issues found']
|
|
88
|
-
* },
|
|
89
|
-
* responsive: {
|
|
90
|
-
* description: 'Responsive design validation',
|
|
91
|
-
* passed: false,
|
|
92
|
-
* messages: ['Component breaks at mobile breakpoint']
|
|
93
|
-
* }
|
|
94
|
-
* })
|
|
95
|
-
*/
|
|
96
|
-
// validateComponent: async (component) => {
|
|
97
|
-
// // Add your custom validation logic here
|
|
98
|
-
// return {};
|
|
99
|
-
// },
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Optional hook to override the SSR build configuration used in the ssrRenderPlugin
|
|
103
|
-
* @param config - The default esbuild configuration
|
|
104
|
-
* @returns Modified esbuild configuration
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* ssrBuildConfig: (config) => {
|
|
108
|
-
* // Modify the esbuild config as needed
|
|
109
|
-
* return config;
|
|
110
|
-
* }
|
|
111
|
-
*/
|
|
112
|
-
// ssrBuildConfig: (config) => {
|
|
113
|
-
// // Add your custom SSR build configuration here
|
|
114
|
-
// return config;
|
|
115
|
-
// },
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Optional hook to override the client-side build configuration used in the ssrRenderPlugin
|
|
119
|
-
* @param config - The default esbuild configuration
|
|
120
|
-
* @returns Modified esbuild configuration
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* clientBuildConfig: (config) => {
|
|
124
|
-
* // Modify the esbuild config as needed
|
|
125
|
-
* return config;
|
|
126
|
-
* }
|
|
127
|
-
*/
|
|
128
|
-
// clientBuildConfig: (config) => {
|
|
129
|
-
// // Add your custom client build configuration here
|
|
130
|
-
// return config;
|
|
131
|
-
// },
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Optional hook to specify which export property contains the schema
|
|
135
|
-
* @param exports - The module exports object containing the schema
|
|
136
|
-
* @returns The schema object from the exports
|
|
137
|
-
*
|
|
138
|
-
* @example
|
|
139
|
-
* getSchemaFromExports: (exports) => exports.customSchema || exports.default
|
|
140
|
-
*/
|
|
141
|
-
// getSchemaFromExports: (exports) => {
|
|
142
|
-
// // Add your custom schema extraction logic here
|
|
143
|
-
// return exports.default;
|
|
49
|
+
// `mode` selects the runtime: "workspace" (no database) or "registry" (Postgres). The registry
|
|
50
|
+
// block is read only by `build --target registry` and `db:migrate`, and secrets are referenced by
|
|
51
|
+
// env var name. A named profile (`handoff.config.registry.*`, `--profile registry`) is a good home
|
|
52
|
+
// for it.
|
|
53
|
+
runtime: {
|
|
54
|
+
mode: "workspace",
|
|
55
|
+
// mcp: false,
|
|
56
|
+
// registry: {
|
|
57
|
+
// databaseUrl: fromEnv("DATABASE_URL"),
|
|
58
|
+
// database: { driver: "pg" }, // 'pg' | 'neon'
|
|
144
59
|
// },
|
|
60
|
+
},
|
|
145
61
|
|
|
146
|
-
|
|
147
|
-
* Optional hook to transform the schema into properties
|
|
148
|
-
* @param schema - The schema object to transform
|
|
149
|
-
* @returns The transformed properties object
|
|
150
|
-
*/
|
|
151
|
-
// schemaToProperties: (schema) => {
|
|
152
|
-
// // Add your custom schema to properties transformation here
|
|
153
|
-
// return {};
|
|
154
|
-
// },
|
|
62
|
+
// reactDocgen: { maxDepth: 7, excludeDirectories: ["dist", "build", ".next"] },
|
|
155
63
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
* @example
|
|
162
|
-
* jsBuildConfig: (config) => {
|
|
163
|
-
* // Modify the Vite config as needed
|
|
164
|
-
* return config;
|
|
165
|
-
* }
|
|
166
|
-
*/
|
|
167
|
-
// jsBuildConfig: (config) => {
|
|
168
|
-
// // Add your custom JavaScript build configuration here
|
|
169
|
-
// return config;
|
|
170
|
-
// },
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Optional hook to override the CSS Vite configuration
|
|
174
|
-
* @param config - The default Vite configuration
|
|
175
|
-
* @returns Modified Vite configuration
|
|
176
|
-
*
|
|
177
|
-
* @example
|
|
178
|
-
* cssBuildConfig: (config) => {
|
|
179
|
-
* // Modify the Vite config as needed
|
|
180
|
-
* return config;
|
|
181
|
-
* }
|
|
182
|
-
*/
|
|
183
|
-
// cssBuildConfig: (config) => {
|
|
184
|
-
// // Add your custom CSS build configuration here
|
|
185
|
-
// return config;
|
|
186
|
-
// },
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Optional hook to override the HTML Vite configuration
|
|
190
|
-
* @param config - The default Vite configuration
|
|
191
|
-
* @returns Modified Vite configuration
|
|
192
|
-
*
|
|
193
|
-
* @example
|
|
194
|
-
* htmlBuildConfig: (config) => {
|
|
195
|
-
* // Modify the Vite config as needed
|
|
196
|
-
* return config;
|
|
197
|
-
* }
|
|
198
|
-
*/
|
|
199
|
-
// htmlBuildConfig: (config) => {
|
|
200
|
-
// // Add your custom HTML build configuration here
|
|
201
|
-
// return config;
|
|
202
|
-
// },
|
|
203
|
-
},
|
|
64
|
+
// Optional build hooks: component validation, esbuild and Vite config overrides, Handlebars
|
|
65
|
+
// helper registration. Signatures and examples are on the `Config` type.
|
|
66
|
+
// hooks: {
|
|
67
|
+
// validateComponent: async (component) => ({}),
|
|
68
|
+
// },
|
|
204
69
|
});
|