@betterstart/cli 0.1.3 → 0.1.5
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 +133 -0
- package/dist/cli.d.ts +1 -9
- package/dist/cli.js +13585 -367
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +24 -266
- package/dist/index.js +4 -11378
- package/dist/index.js.map +1 -1
- package/package.json +29 -42
- package/templates/schema.json +959 -0
- package/templates/tiptap/hooks/use-composed-ref.ts +43 -0
- package/templates/tiptap/hooks/use-cursor-visibility.ts +68 -0
- package/templates/tiptap/hooks/use-element-rect.ts +166 -0
- package/templates/tiptap/hooks/use-is-breakpoint.ts +32 -0
- package/templates/tiptap/hooks/use-menu-navigation.ts +182 -0
- package/templates/tiptap/hooks/use-scrolling.ts +64 -0
- package/templates/tiptap/hooks/use-throttled-callback.ts +146 -0
- package/templates/tiptap/hooks/use-tiptap-editor.ts +46 -0
- package/templates/tiptap/hooks/use-unmount.ts +21 -0
- package/templates/tiptap/hooks/use-window-size.ts +87 -0
- package/templates/tiptap/lib/tiptap-utils.ts +587 -0
- package/templates/tiptap/styles/_keyframe-animations.scss +91 -0
- package/templates/tiptap/styles/_variables.scss +296 -0
- package/templates/tiptap/tiptap-extension/node-background-extension.ts +138 -0
- package/templates/tiptap/tiptap-icons/align-center-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/align-justify-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/align-left-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/align-right-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/arrow-left-icon.tsx +24 -0
- package/templates/tiptap/tiptap-icons/ban-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/blockquote-icon.tsx +44 -0
- package/templates/tiptap/tiptap-icons/bold-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/chevron-down-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/close-icon.tsx +24 -0
- package/templates/tiptap/tiptap-icons/code-block-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/code2-icon.tsx +32 -0
- package/templates/tiptap/tiptap-icons/corner-down-left-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/external-link-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/heading-five-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/heading-four-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/heading-icon.tsx +24 -0
- package/templates/tiptap/tiptap-icons/heading-one-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/heading-six-icon.tsx +30 -0
- package/templates/tiptap/tiptap-icons/heading-three-icon.tsx +36 -0
- package/templates/tiptap/tiptap-icons/heading-two-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/highlighter-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/image-plus-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/italic-icon.tsx +24 -0
- package/templates/tiptap/tiptap-icons/link-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/list-icon.tsx +56 -0
- package/templates/tiptap/tiptap-icons/list-ordered-icon.tsx +56 -0
- package/templates/tiptap/tiptap-icons/list-todo-icon.tsx +50 -0
- package/templates/tiptap/tiptap-icons/moon-star-icon.tsx +30 -0
- package/templates/tiptap/tiptap-icons/redo2-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/strike-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/subscript-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/sun-icon.tsx +58 -0
- package/templates/tiptap/tiptap-icons/superscript-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/trash-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/underline-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/undo2-icon.tsx +26 -0
- package/templates/tiptap/tiptap-node/blockquote-node/blockquote-node.scss +37 -0
- package/templates/tiptap/tiptap-node/code-block-node/code-block-node.scss +54 -0
- package/templates/tiptap/tiptap-node/heading-node/heading-node.scss +45 -0
- package/templates/tiptap/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.ts +10 -0
- package/templates/tiptap/tiptap-node/horizontal-rule-node/horizontal-rule-node.scss +25 -0
- package/templates/tiptap/tiptap-node/image-node/image-node.scss +35 -0
- package/templates/tiptap/tiptap-node/image-upload-node/image-upload-node-extension.ts +154 -0
- package/templates/tiptap/tiptap-node/image-upload-node/image-upload-node.scss +249 -0
- package/templates/tiptap/tiptap-node/image-upload-node/image-upload-node.tsx +522 -0
- package/templates/tiptap/tiptap-node/image-upload-node/index.tsx +1 -0
- package/templates/tiptap/tiptap-node/list-node/list-node.scss +208 -0
- package/templates/tiptap/tiptap-node/paragraph-node/paragraph-node.scss +273 -0
- package/templates/tiptap/tiptap-ui/blockquote-button/blockquote-button.tsx +104 -0
- package/templates/tiptap/tiptap-ui/blockquote-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/blockquote-button/use-blockquote.ts +252 -0
- package/templates/tiptap/tiptap-ui/code-block-button/code-block-button.tsx +106 -0
- package/templates/tiptap/tiptap-ui/code-block-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/code-block-button/use-code-block.ts +261 -0
- package/templates/tiptap/tiptap-ui/color-highlight-button/color-highlight-button.scss +49 -0
- package/templates/tiptap/tiptap-ui/color-highlight-button/color-highlight-button.tsx +153 -0
- package/templates/tiptap/tiptap-ui/color-highlight-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/color-highlight-button/use-color-highlight.ts +345 -0
- package/templates/tiptap/tiptap-ui/color-highlight-popover/color-highlight-popover.tsx +207 -0
- package/templates/tiptap/tiptap-ui/color-highlight-popover/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui/heading-button/heading-button.tsx +107 -0
- package/templates/tiptap/tiptap-ui/heading-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/heading-button/use-heading.ts +314 -0
- package/templates/tiptap/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.tsx +131 -0
- package/templates/tiptap/tiptap-ui/heading-dropdown-menu/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.ts +130 -0
- package/templates/tiptap/tiptap-ui/image-upload-button/image-upload-button.tsx +114 -0
- package/templates/tiptap/tiptap-ui/image-upload-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/image-upload-button/use-image-upload.ts +192 -0
- package/templates/tiptap/tiptap-ui/link-popover/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/link-popover/link-popover.tsx +285 -0
- package/templates/tiptap/tiptap-ui/link-popover/use-link-popover.ts +286 -0
- package/templates/tiptap/tiptap-ui/list-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/list-button/list-button.tsx +108 -0
- package/templates/tiptap/tiptap-ui/list-button/use-list.ts +329 -0
- package/templates/tiptap/tiptap-ui/list-dropdown-menu/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui/list-dropdown-menu/list-dropdown-menu.tsx +123 -0
- package/templates/tiptap/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.ts +203 -0
- package/templates/tiptap/tiptap-ui/mark-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/mark-button/mark-button.tsx +107 -0
- package/templates/tiptap/tiptap-ui/mark-button/use-mark.ts +206 -0
- package/templates/tiptap/tiptap-ui/text-align-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/text-align-button/text-align-button.tsx +118 -0
- package/templates/tiptap/tiptap-ui/text-align-button/use-text-align.ts +212 -0
- package/templates/tiptap/tiptap-ui/undo-redo-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/undo-redo-button/undo-redo-button.tsx +105 -0
- package/templates/tiptap/tiptap-ui/undo-redo-button/use-undo-redo.ts +173 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/badge-colors.scss +395 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/badge-group.scss +16 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/badge.scss +99 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/badge.tsx +46 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/button/button-colors.scss +429 -0
- package/templates/tiptap/tiptap-ui-primitive/button/button-group.scss +22 -0
- package/templates/tiptap/tiptap-ui-primitive/button/button.scss +314 -0
- package/templates/tiptap/tiptap-ui-primitive/button/button.tsx +102 -0
- package/templates/tiptap/tiptap-ui-primitive/button/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/card/card.scss +77 -0
- package/templates/tiptap/tiptap-ui-primitive/card/card.tsx +59 -0
- package/templates/tiptap/tiptap-ui-primitive/card/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/dropdown-menu/dropdown-menu.scss +63 -0
- package/templates/tiptap/tiptap-ui-primitive/dropdown-menu/dropdown-menu.tsx +95 -0
- package/templates/tiptap/tiptap-ui-primitive/dropdown-menu/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/input/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/input/input.scss +45 -0
- package/templates/tiptap/tiptap-ui-primitive/input/input.tsx +18 -0
- package/templates/tiptap/tiptap-ui-primitive/popover/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/popover/popover.scss +63 -0
- package/templates/tiptap/tiptap-ui-primitive/popover/popover.tsx +33 -0
- package/templates/tiptap/tiptap-ui-primitive/separator/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/separator/separator.scss +23 -0
- package/templates/tiptap/tiptap-ui-primitive/separator/separator.tsx +33 -0
- package/templates/tiptap/tiptap-ui-primitive/spacer/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/spacer/spacer.tsx +21 -0
- package/templates/tiptap/tiptap-ui-primitive/toolbar/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/toolbar/toolbar.scss +98 -0
- package/templates/tiptap/tiptap-ui-primitive/toolbar/toolbar.tsx +113 -0
- package/templates/tiptap/tiptap-ui-primitive/tooltip/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/tooltip/tooltip.scss +43 -0
- package/templates/tiptap/tiptap-ui-primitive/tooltip/tooltip.tsx +223 -0
- package/templates/ui/accordion.tsx +52 -0
- package/templates/ui/alert-dialog.tsx +116 -0
- package/templates/ui/alert.tsx +48 -0
- package/templates/ui/aspect-ratio.tsx +7 -0
- package/templates/ui/avatar.tsx +46 -0
- package/templates/ui/badge.tsx +32 -0
- package/templates/ui/breadcrumb.tsx +98 -0
- package/templates/ui/button-group.tsx +77 -0
- package/templates/ui/button.tsx +48 -0
- package/templates/ui/calendar.tsx +176 -0
- package/templates/ui/card.tsx +54 -0
- package/templates/ui/carousel.tsx +234 -0
- package/templates/ui/chart.tsx +349 -0
- package/templates/ui/checkbox.tsx +27 -0
- package/templates/ui/collapsible.tsx +11 -0
- package/templates/ui/command.tsx +142 -0
- package/templates/ui/context-menu.tsx +188 -0
- package/templates/ui/curriculum-editor.tsx +601 -0
- package/templates/ui/date-picker.tsx +70 -0
- package/templates/ui/dialog.tsx +103 -0
- package/templates/ui/drawer.tsx +99 -0
- package/templates/ui/dropdown-menu.tsx +185 -0
- package/templates/ui/dynamic-list-field.tsx +95 -0
- package/templates/ui/empty.tsx +90 -0
- package/templates/ui/field.tsx +231 -0
- package/templates/ui/file-upload-example.tsx +113 -0
- package/templates/ui/form.tsx +172 -0
- package/templates/ui/hover-card.tsx +28 -0
- package/templates/ui/icon-picker.tsx +435 -0
- package/templates/ui/icons-data.ts +6 -0
- package/templates/ui/image-upload-field.tsx +360 -0
- package/templates/ui/input-group.tsx +160 -0
- package/templates/ui/input-otp.tsx +70 -0
- package/templates/ui/input.tsx +21 -0
- package/templates/ui/item.tsx +171 -0
- package/templates/ui/kbd.tsx +28 -0
- package/templates/ui/label.tsx +20 -0
- package/templates/ui/logo.tsx +113 -0
- package/templates/ui/markdown-editor.tsx +303 -0
- package/templates/ui/markdown-utils.ts +128 -0
- package/templates/ui/media-upload-field.tsx +255 -0
- package/templates/ui/menubar.tsx +230 -0
- package/templates/ui/navigation-menu.tsx +119 -0
- package/templates/ui/pagination.tsx +96 -0
- package/templates/ui/placeholder.tsx +25 -0
- package/templates/ui/popover.tsx +32 -0
- package/templates/ui/progress.tsx +24 -0
- package/templates/ui/radio-group.tsx +37 -0
- package/templates/ui/resizable.tsx +41 -0
- package/templates/ui/rich-text-editor.tsx +374 -0
- package/templates/ui/scroll-area.tsx +45 -0
- package/templates/ui/select.tsx +151 -0
- package/templates/ui/separator.tsx +25 -0
- package/templates/ui/sheet.tsx +120 -0
- package/templates/ui/sidebar.tsx +687 -0
- package/templates/ui/skeleton.tsx +7 -0
- package/templates/ui/slider.tsx +24 -0
- package/templates/ui/sonner.tsx +29 -0
- package/templates/ui/spinner.tsx +15 -0
- package/templates/ui/switch.tsx +28 -0
- package/templates/ui/table.tsx +93 -0
- package/templates/ui/tabs.tsx +54 -0
- package/templates/ui/textarea.tsx +20 -0
- package/templates/ui/toast.tsx +127 -0
- package/templates/ui/toggle-group.tsx +56 -0
- package/templates/ui/toggle.tsx +43 -0
- package/templates/ui/tooltip.tsx +31 -0
- package/templates/ui/use-mobile.tsx +19 -0
- package/templates/ui/video-upload-field.tsx +368 -0
- package/dist/chunk-EIH4RRIJ.js +0 -183
- package/dist/chunk-EIH4RRIJ.js.map +0 -1
- package/dist/chunk-NKRQYAS6.js +0 -260
- package/dist/chunk-NKRQYAS6.js.map +0 -1
- package/dist/chunk-QLVSHP7X.js +0 -235
- package/dist/chunk-QLVSHP7X.js.map +0 -1
- package/dist/chunk-WY6BC55D.js +0 -357
- package/dist/chunk-WY6BC55D.js.map +0 -1
- package/dist/config/index.d.ts +0 -93
- package/dist/config/index.js +0 -58
- package/dist/config/index.js.map +0 -1
- package/dist/core/index.d.ts +0 -415
- package/dist/core/index.js +0 -906
- package/dist/core/index.js.map +0 -1
- package/dist/import-resolver-BaZ-rzkH.d.ts +0 -123
- package/dist/logger-awLb347n.d.ts +0 -81
- package/dist/plugins/index.d.ts +0 -213
- package/dist/plugins/index.js +0 -365
- package/dist/plugins/index.js.map +0 -1
- package/dist/types-ByX_gl6y.d.ts +0 -232
- package/dist/types-eI549DEG.d.ts +0 -331
package/dist/chunk-NKRQYAS6.js
DELETED
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
// src/config/presets.ts
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import path from "path";
|
|
4
|
-
var DEFAULT_OUTPUT_PATHS = {
|
|
5
|
-
actions: "src/actions",
|
|
6
|
-
hooks: "src",
|
|
7
|
-
components: "components",
|
|
8
|
-
pages: "app/(admin)/admin",
|
|
9
|
-
emails: "emails"
|
|
10
|
-
};
|
|
11
|
-
var DEFAULT_DATABASE_CONFIG = {
|
|
12
|
-
provider: "drizzle",
|
|
13
|
-
schemaFile: "src/schema.ts",
|
|
14
|
-
migrationsDir: "drizzle",
|
|
15
|
-
autoMigrate: true
|
|
16
|
-
};
|
|
17
|
-
var DEFAULT_UI_CONFIG = {
|
|
18
|
-
framework: "shadcn",
|
|
19
|
-
components: {
|
|
20
|
-
path: "@/components/ui",
|
|
21
|
-
adminPath: "@/components/admin"
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
var MONOREPO_IMPORT_PATHS = {
|
|
25
|
-
database: "@betterstart/database",
|
|
26
|
-
adminUi: "@betterstart/admin-ui",
|
|
27
|
-
webUi: "@betterstart/web-ui",
|
|
28
|
-
hooks: "@betterstart/hooks",
|
|
29
|
-
utils: "@betterstart/utils",
|
|
30
|
-
types: "@betterstart/types",
|
|
31
|
-
lib: "@betterstart/lib",
|
|
32
|
-
actions: "@betterstart/lib/actions/{name}",
|
|
33
|
-
libMarkdown: "@betterstart/lib/markdown"
|
|
34
|
-
};
|
|
35
|
-
var STANDALONE_IMPORT_PATHS = {
|
|
36
|
-
database: "@/lib/db",
|
|
37
|
-
adminUi: "@/components/ui",
|
|
38
|
-
webUi: "@/components/ui",
|
|
39
|
-
hooks: "@/hooks",
|
|
40
|
-
utils: "@/lib/utils",
|
|
41
|
-
types: "@/types",
|
|
42
|
-
lib: "@/lib",
|
|
43
|
-
actions: "@/lib/actions/{name}",
|
|
44
|
-
libMarkdown: "@/lib/markdown"
|
|
45
|
-
};
|
|
46
|
-
var DEFAULT_GENERATOR_CONFIG = {
|
|
47
|
-
core: [
|
|
48
|
-
"database",
|
|
49
|
-
"actions",
|
|
50
|
-
"hooks",
|
|
51
|
-
"columns",
|
|
52
|
-
"table",
|
|
53
|
-
"page",
|
|
54
|
-
"page-content",
|
|
55
|
-
"form",
|
|
56
|
-
"create-page",
|
|
57
|
-
"edit-page",
|
|
58
|
-
"navigation"
|
|
59
|
-
],
|
|
60
|
-
optional: ["csv-upload", "json-upload"]
|
|
61
|
-
};
|
|
62
|
-
var nextjsMonorepoPreset = {
|
|
63
|
-
name: "nextjs-monorepo",
|
|
64
|
-
description: "Next.js app in a Turborepo/pnpm monorepo structure",
|
|
65
|
-
detect: (cwd) => {
|
|
66
|
-
const hasPnpmWorkspace = fs.existsSync(path.join(cwd, "pnpm-workspace.yaml"));
|
|
67
|
-
const hasTurboJson = fs.existsSync(path.join(cwd, "turbo.json"));
|
|
68
|
-
const hasAppsDir = fs.existsSync(path.join(cwd, "apps"));
|
|
69
|
-
const hasPackagesDir = fs.existsSync(path.join(cwd, "packages"));
|
|
70
|
-
return (hasPnpmWorkspace || hasTurboJson) && (hasAppsDir || hasPackagesDir);
|
|
71
|
-
},
|
|
72
|
-
config: {
|
|
73
|
-
paths: {
|
|
74
|
-
app: "apps/web",
|
|
75
|
-
database: "packages/database",
|
|
76
|
-
lib: "packages/lib",
|
|
77
|
-
hooks: "packages/hooks",
|
|
78
|
-
schemas: "packages/codegen/src/schemas",
|
|
79
|
-
output: {
|
|
80
|
-
actions: "src/actions",
|
|
81
|
-
hooks: "src",
|
|
82
|
-
components: "app/(admin)/admin",
|
|
83
|
-
pages: "app/(admin)/admin",
|
|
84
|
-
emails: "emails"
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
imports: MONOREPO_IMPORT_PATHS,
|
|
88
|
-
database: {
|
|
89
|
-
...DEFAULT_DATABASE_CONFIG
|
|
90
|
-
},
|
|
91
|
-
ui: {
|
|
92
|
-
framework: "shadcn",
|
|
93
|
-
components: {
|
|
94
|
-
path: "@betterstart/admin-ui",
|
|
95
|
-
adminPath: "@betterstart/admin-ui"
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
generators: {
|
|
99
|
-
...DEFAULT_GENERATOR_CONFIG
|
|
100
|
-
},
|
|
101
|
-
plugins: []
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
var nextjsStandalonePreset = {
|
|
105
|
-
name: "nextjs-standalone",
|
|
106
|
-
description: "Standalone Next.js application",
|
|
107
|
-
detect: (cwd) => {
|
|
108
|
-
const hasNextConfig = fs.existsSync(path.join(cwd, "next.config.js")) || fs.existsSync(path.join(cwd, "next.config.mjs")) || fs.existsSync(path.join(cwd, "next.config.ts"));
|
|
109
|
-
const hasPackageJson = fs.existsSync(path.join(cwd, "package.json"));
|
|
110
|
-
if (!hasNextConfig || !hasPackageJson) return false;
|
|
111
|
-
const hasPnpmWorkspace = fs.existsSync(path.join(cwd, "pnpm-workspace.yaml"));
|
|
112
|
-
const hasTurboJson = fs.existsSync(path.join(cwd, "turbo.json"));
|
|
113
|
-
return !(hasPnpmWorkspace || hasTurboJson);
|
|
114
|
-
},
|
|
115
|
-
config: {
|
|
116
|
-
paths: {
|
|
117
|
-
app: ".",
|
|
118
|
-
database: ".",
|
|
119
|
-
lib: ".",
|
|
120
|
-
hooks: ".",
|
|
121
|
-
schemas: "schemas",
|
|
122
|
-
output: {
|
|
123
|
-
actions: "src/actions",
|
|
124
|
-
hooks: "src/hooks",
|
|
125
|
-
components: "src/components/admin",
|
|
126
|
-
pages: "src/app/(admin)/admin",
|
|
127
|
-
emails: "src/emails"
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
imports: STANDALONE_IMPORT_PATHS,
|
|
131
|
-
database: {
|
|
132
|
-
...DEFAULT_DATABASE_CONFIG,
|
|
133
|
-
schemaFile: "src/db/schema.ts",
|
|
134
|
-
migrationsDir: "src/db/migrations"
|
|
135
|
-
},
|
|
136
|
-
ui: {
|
|
137
|
-
...DEFAULT_UI_CONFIG
|
|
138
|
-
},
|
|
139
|
-
generators: {
|
|
140
|
-
...DEFAULT_GENERATOR_CONFIG
|
|
141
|
-
},
|
|
142
|
-
plugins: []
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
var customPreset = {
|
|
146
|
-
name: "custom",
|
|
147
|
-
description: "Custom project structure - configure paths manually",
|
|
148
|
-
config: {
|
|
149
|
-
paths: {
|
|
150
|
-
app: ".",
|
|
151
|
-
database: ".",
|
|
152
|
-
lib: ".",
|
|
153
|
-
hooks: ".",
|
|
154
|
-
schemas: "schemas",
|
|
155
|
-
output: DEFAULT_OUTPUT_PATHS
|
|
156
|
-
},
|
|
157
|
-
imports: STANDALONE_IMPORT_PATHS,
|
|
158
|
-
database: DEFAULT_DATABASE_CONFIG,
|
|
159
|
-
ui: DEFAULT_UI_CONFIG,
|
|
160
|
-
generators: DEFAULT_GENERATOR_CONFIG,
|
|
161
|
-
plugins: []
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
var presets = {
|
|
165
|
-
"nextjs-monorepo": nextjsMonorepoPreset,
|
|
166
|
-
"nextjs-standalone": nextjsStandalonePreset,
|
|
167
|
-
custom: customPreset
|
|
168
|
-
};
|
|
169
|
-
function getPreset(name) {
|
|
170
|
-
return presets[name];
|
|
171
|
-
}
|
|
172
|
-
function getPresetNames() {
|
|
173
|
-
return Object.keys(presets);
|
|
174
|
-
}
|
|
175
|
-
function detectPreset(cwd) {
|
|
176
|
-
const presetOrder = ["nextjs-monorepo", "nextjs-standalone"];
|
|
177
|
-
for (const presetName of presetOrder) {
|
|
178
|
-
const preset = presets[presetName];
|
|
179
|
-
if (preset.detect?.(cwd)) {
|
|
180
|
-
return preset;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return customPreset;
|
|
184
|
-
}
|
|
185
|
-
function getDefaultConfig(cwd) {
|
|
186
|
-
const preset = detectPreset(cwd);
|
|
187
|
-
return preset.config;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// src/config/import-resolver.ts
|
|
191
|
-
var ImportResolver = class {
|
|
192
|
-
constructor(imports) {
|
|
193
|
-
this.imports = imports;
|
|
194
|
-
}
|
|
195
|
-
/** Import path for database package (db instance, table schemas) */
|
|
196
|
-
get database() {
|
|
197
|
-
return this.imports.database;
|
|
198
|
-
}
|
|
199
|
-
/** Import path for admin UI components */
|
|
200
|
-
get adminUi() {
|
|
201
|
-
return this.imports.adminUi;
|
|
202
|
-
}
|
|
203
|
-
/** Import path for public/web UI components */
|
|
204
|
-
get webUi() {
|
|
205
|
-
return this.imports.webUi;
|
|
206
|
-
}
|
|
207
|
-
/** Import path for React Query hooks */
|
|
208
|
-
get hooks() {
|
|
209
|
-
return this.imports.hooks;
|
|
210
|
-
}
|
|
211
|
-
/** Import path for utility functions (cn, truncate, hexToOklab) */
|
|
212
|
-
get utils() {
|
|
213
|
-
return this.imports.utils;
|
|
214
|
-
}
|
|
215
|
-
/** Import path for lib base (renderMarkdownInline, etc.) */
|
|
216
|
-
get lib() {
|
|
217
|
-
return this.imports.lib;
|
|
218
|
-
}
|
|
219
|
-
/** Import path for lib/markdown sub-module */
|
|
220
|
-
get libMarkdown() {
|
|
221
|
-
return this.imports.libMarkdown;
|
|
222
|
-
}
|
|
223
|
-
/** Import path for table-meta type augmentation */
|
|
224
|
-
get tableMeta() {
|
|
225
|
-
return `${this.imports.types}/table-meta`;
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Resolve the import path for a schema's server actions.
|
|
229
|
-
* Replaces `{name}` placeholder with the actual schema name.
|
|
230
|
-
*/
|
|
231
|
-
actions(schemaName) {
|
|
232
|
-
return this.imports.actions.replace("{name}", schemaName);
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Get the escaped lib import path for use in regex matching.
|
|
236
|
-
* Used by hook.ts to update existing hook files.
|
|
237
|
-
*/
|
|
238
|
-
get libEscaped() {
|
|
239
|
-
return this.imports.lib.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
export {
|
|
244
|
-
DEFAULT_OUTPUT_PATHS,
|
|
245
|
-
DEFAULT_DATABASE_CONFIG,
|
|
246
|
-
DEFAULT_UI_CONFIG,
|
|
247
|
-
MONOREPO_IMPORT_PATHS,
|
|
248
|
-
STANDALONE_IMPORT_PATHS,
|
|
249
|
-
DEFAULT_GENERATOR_CONFIG,
|
|
250
|
-
nextjsMonorepoPreset,
|
|
251
|
-
nextjsStandalonePreset,
|
|
252
|
-
customPreset,
|
|
253
|
-
presets,
|
|
254
|
-
getPreset,
|
|
255
|
-
getPresetNames,
|
|
256
|
-
detectPreset,
|
|
257
|
-
getDefaultConfig,
|
|
258
|
-
ImportResolver
|
|
259
|
-
};
|
|
260
|
-
//# sourceMappingURL=chunk-NKRQYAS6.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config/presets.ts","../src/config/import-resolver.ts"],"sourcesContent":["/**\n * Project presets for common project structures\n * Each preset provides default configuration for a specific project type\n */\n\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport type { ImportPaths, Preset, UserConfig } from './types'\n\n// ============================================================================\n// Default Configuration Values\n// ============================================================================\n\n/**\n * Default output paths\n */\nexport const DEFAULT_OUTPUT_PATHS = {\n actions: 'src/actions',\n hooks: 'src',\n components: 'components',\n pages: 'app/(admin)/admin',\n emails: 'emails'\n}\n\n/**\n * Default database configuration\n */\nexport const DEFAULT_DATABASE_CONFIG = {\n provider: 'drizzle' as const,\n schemaFile: 'src/schema.ts',\n migrationsDir: 'drizzle',\n autoMigrate: true\n}\n\n/**\n * Default UI configuration\n */\nexport const DEFAULT_UI_CONFIG = {\n framework: 'shadcn' as const,\n components: {\n path: '@/components/ui',\n adminPath: '@/components/admin'\n }\n}\n\n/**\n * Monorepo import paths (for @betterstart/* packages)\n */\nexport const MONOREPO_IMPORT_PATHS: ImportPaths = {\n database: '@betterstart/database',\n adminUi: '@betterstart/admin-ui',\n webUi: '@betterstart/web-ui',\n hooks: '@betterstart/hooks',\n utils: '@betterstart/utils',\n types: '@betterstart/types',\n lib: '@betterstart/lib',\n actions: '@betterstart/lib/actions/{name}',\n libMarkdown: '@betterstart/lib/markdown'\n}\n\n/**\n * Standalone import paths (for @/ alias in single Next.js apps)\n */\nexport const STANDALONE_IMPORT_PATHS: ImportPaths = {\n database: '@/lib/db',\n adminUi: '@/components/ui',\n webUi: '@/components/ui',\n hooks: '@/hooks',\n utils: '@/lib/utils',\n types: '@/types',\n lib: '@/lib',\n actions: '@/lib/actions/{name}',\n libMarkdown: '@/lib/markdown'\n}\n\n/**\n * Default generator configuration\n */\nexport const DEFAULT_GENERATOR_CONFIG = {\n core: [\n 'database',\n 'actions',\n 'hooks',\n 'columns',\n 'table',\n 'page',\n 'page-content',\n 'form',\n 'create-page',\n 'edit-page',\n 'navigation'\n ] as string[],\n optional: ['csv-upload', 'json-upload'] as string[]\n}\n\n// ============================================================================\n// Presets\n// ============================================================================\n\n/**\n * Next.js monorepo preset (Turborepo/pnpm style)\n * Similar to the current betterstart structure\n */\nexport const nextjsMonorepoPreset: Preset = {\n name: 'nextjs-monorepo',\n description: 'Next.js app in a Turborepo/pnpm monorepo structure',\n detect: (cwd: string) => {\n // Check for pnpm-workspace.yaml or turbo.json\n const hasPnpmWorkspace = fs.existsSync(path.join(cwd, 'pnpm-workspace.yaml'))\n const hasTurboJson = fs.existsSync(path.join(cwd, 'turbo.json'))\n const hasAppsDir = fs.existsSync(path.join(cwd, 'apps'))\n const hasPackagesDir = fs.existsSync(path.join(cwd, 'packages'))\n\n return (hasPnpmWorkspace || hasTurboJson) && (hasAppsDir || hasPackagesDir)\n },\n config: {\n paths: {\n app: 'apps/web',\n database: 'packages/database',\n lib: 'packages/lib',\n hooks: 'packages/hooks',\n schemas: 'packages/codegen/src/schemas',\n output: {\n actions: 'src/actions',\n hooks: 'src',\n components: 'app/(admin)/admin',\n pages: 'app/(admin)/admin',\n emails: 'emails'\n }\n },\n imports: MONOREPO_IMPORT_PATHS,\n database: {\n ...DEFAULT_DATABASE_CONFIG\n },\n ui: {\n framework: 'shadcn',\n components: {\n path: '@betterstart/admin-ui',\n adminPath: '@betterstart/admin-ui'\n }\n },\n generators: {\n ...DEFAULT_GENERATOR_CONFIG\n },\n plugins: []\n }\n}\n\n/**\n * Standalone Next.js preset\n * For single Next.js apps without monorepo structure\n */\nexport const nextjsStandalonePreset: Preset = {\n name: 'nextjs-standalone',\n description: 'Standalone Next.js application',\n detect: (cwd: string) => {\n const hasNextConfig =\n fs.existsSync(path.join(cwd, 'next.config.js')) ||\n fs.existsSync(path.join(cwd, 'next.config.mjs')) ||\n fs.existsSync(path.join(cwd, 'next.config.ts'))\n const hasPackageJson = fs.existsSync(path.join(cwd, 'package.json'))\n\n if (!hasNextConfig || !hasPackageJson) return false\n\n // Make sure it's not a monorepo\n const hasPnpmWorkspace = fs.existsSync(path.join(cwd, 'pnpm-workspace.yaml'))\n const hasTurboJson = fs.existsSync(path.join(cwd, 'turbo.json'))\n\n return !(hasPnpmWorkspace || hasTurboJson)\n },\n config: {\n paths: {\n app: '.',\n database: '.',\n lib: '.',\n hooks: '.',\n schemas: 'schemas',\n output: {\n actions: 'src/actions',\n hooks: 'src/hooks',\n components: 'src/components/admin',\n pages: 'src/app/(admin)/admin',\n emails: 'src/emails'\n }\n },\n imports: STANDALONE_IMPORT_PATHS,\n database: {\n ...DEFAULT_DATABASE_CONFIG,\n schemaFile: 'src/db/schema.ts',\n migrationsDir: 'src/db/migrations'\n },\n ui: {\n ...DEFAULT_UI_CONFIG\n },\n generators: {\n ...DEFAULT_GENERATOR_CONFIG\n },\n plugins: []\n }\n}\n\n/**\n * Custom/minimal preset\n * Provides minimal defaults, user must configure paths\n */\nexport const customPreset: Preset = {\n name: 'custom',\n description: 'Custom project structure - configure paths manually',\n config: {\n paths: {\n app: '.',\n database: '.',\n lib: '.',\n hooks: '.',\n schemas: 'schemas',\n output: DEFAULT_OUTPUT_PATHS\n },\n imports: STANDALONE_IMPORT_PATHS,\n database: DEFAULT_DATABASE_CONFIG,\n ui: DEFAULT_UI_CONFIG,\n generators: DEFAULT_GENERATOR_CONFIG,\n plugins: []\n }\n}\n\n// ============================================================================\n// Preset Registry\n// ============================================================================\n\n/**\n * All available presets\n */\nexport const presets: Record<string, Preset> = {\n 'nextjs-monorepo': nextjsMonorepoPreset,\n 'nextjs-standalone': nextjsStandalonePreset,\n custom: customPreset\n}\n\n/**\n * Get a preset by name\n */\nexport function getPreset(name: string): Preset | undefined {\n return presets[name]\n}\n\n/**\n * Get all preset names\n */\nexport function getPresetNames(): string[] {\n return Object.keys(presets)\n}\n\n/**\n * Auto-detect the best preset for a project\n * @param cwd - The project root directory\n * @returns The detected preset or 'custom' if none match\n */\nexport function detectPreset(cwd: string): Preset {\n // Try presets in order of specificity\n const presetOrder = ['nextjs-monorepo', 'nextjs-standalone']\n\n for (const presetName of presetOrder) {\n const preset = presets[presetName]\n if (preset.detect?.(cwd)) {\n return preset\n }\n }\n\n return customPreset\n}\n\n/**\n * Get the default configuration based on project detection\n */\nexport function getDefaultConfig(cwd: string): UserConfig {\n const preset = detectPreset(cwd)\n return preset.config\n}\n","import type { ImportPaths } from './types'\n\n/**\n * Resolves import paths from config for use in generated code.\n * All generators should use this instead of hardcoding import paths.\n */\nexport class ImportResolver {\n constructor(private readonly imports: ImportPaths) {}\n\n /** Import path for database package (db instance, table schemas) */\n get database(): string {\n return this.imports.database\n }\n\n /** Import path for admin UI components */\n get adminUi(): string {\n return this.imports.adminUi\n }\n\n /** Import path for public/web UI components */\n get webUi(): string {\n return this.imports.webUi\n }\n\n /** Import path for React Query hooks */\n get hooks(): string {\n return this.imports.hooks\n }\n\n /** Import path for utility functions (cn, truncate, hexToOklab) */\n get utils(): string {\n return this.imports.utils\n }\n\n /** Import path for lib base (renderMarkdownInline, etc.) */\n get lib(): string {\n return this.imports.lib\n }\n\n /** Import path for lib/markdown sub-module */\n get libMarkdown(): string {\n return this.imports.libMarkdown\n }\n\n /** Import path for table-meta type augmentation */\n get tableMeta(): string {\n return `${this.imports.types}/table-meta`\n }\n\n /**\n * Resolve the import path for a schema's server actions.\n * Replaces `{name}` placeholder with the actual schema name.\n */\n actions(schemaName: string): string {\n return this.imports.actions.replace('{name}', schemaName)\n }\n\n /**\n * Get the escaped lib import path for use in regex matching.\n * Used by hook.ts to update existing hook files.\n */\n get libEscaped(): string {\n return this.imports.lib.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n }\n}\n"],"mappings":";AAKA,OAAO,QAAQ;AACf,OAAO,UAAU;AAUV,IAAM,uBAAuB;AAAA,EAClC,SAAS;AAAA,EACT,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,QAAQ;AACV;AAKO,IAAM,0BAA0B;AAAA,EACrC,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,aAAa;AACf;AAKO,IAAM,oBAAoB;AAAA,EAC/B,WAAW;AAAA,EACX,YAAY;AAAA,IACV,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AACF;AAKO,IAAM,wBAAqC;AAAA,EAChD,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,KAAK;AAAA,EACL,SAAS;AAAA,EACT,aAAa;AACf;AAKO,IAAM,0BAAuC;AAAA,EAClD,UAAU;AAAA,EACV,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,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QAAQ,UAAU,UAAU;AAAA,EAC1D;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,aAAqB;AACvB,WAAO,KAAK,QAAQ,IAAI,QAAQ,uBAAuB,MAAM;AAAA,EAC/D;AACF;","names":[]}
|
package/dist/chunk-QLVSHP7X.js
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
detectPreset,
|
|
3
|
-
getDefaultConfig,
|
|
4
|
-
getPreset
|
|
5
|
-
} from "./chunk-NKRQYAS6.js";
|
|
6
|
-
import {
|
|
7
|
-
ConfigurationError,
|
|
8
|
-
getLogger
|
|
9
|
-
} from "./chunk-WY6BC55D.js";
|
|
10
|
-
|
|
11
|
-
// src/config/loader.ts
|
|
12
|
-
import fs from "fs";
|
|
13
|
-
import path from "path";
|
|
14
|
-
import { fileURLToPath } from "url";
|
|
15
|
-
var CONFIG_FILE_NAMES = [
|
|
16
|
-
"betterstart.config.ts",
|
|
17
|
-
"betterstart.config.js",
|
|
18
|
-
"betterstart.config.mjs",
|
|
19
|
-
"betterstart.config.json",
|
|
20
|
-
".betterstartrc.json",
|
|
21
|
-
".betterstartrc"
|
|
22
|
-
];
|
|
23
|
-
function findConfigFile(cwd) {
|
|
24
|
-
for (const fileName of CONFIG_FILE_NAMES) {
|
|
25
|
-
const filePath = path.join(cwd, fileName);
|
|
26
|
-
if (fs.existsSync(filePath)) {
|
|
27
|
-
return filePath;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return void 0;
|
|
31
|
-
}
|
|
32
|
-
async function loadConfigFile(configPath) {
|
|
33
|
-
const ext = path.extname(configPath);
|
|
34
|
-
const logger = getLogger();
|
|
35
|
-
try {
|
|
36
|
-
if (ext === ".json" || configPath.endsWith(".betterstartrc")) {
|
|
37
|
-
const content = fs.readFileSync(configPath, "utf-8");
|
|
38
|
-
return JSON.parse(content);
|
|
39
|
-
}
|
|
40
|
-
if (ext === ".ts") {
|
|
41
|
-
const { createJiti } = await import("jiti");
|
|
42
|
-
const alias = {};
|
|
43
|
-
try {
|
|
44
|
-
alias["@betterstart/cli"] = fileURLToPath(import.meta.resolve("@betterstart/cli"));
|
|
45
|
-
} catch {
|
|
46
|
-
}
|
|
47
|
-
const jiti = createJiti(import.meta.url, { alias });
|
|
48
|
-
const module = await jiti.import(configPath);
|
|
49
|
-
return module.default || module;
|
|
50
|
-
}
|
|
51
|
-
if (ext === ".js" || ext === ".mjs") {
|
|
52
|
-
const configUrl = `file://${configPath}`;
|
|
53
|
-
const module = await import(configUrl);
|
|
54
|
-
return module.default || module;
|
|
55
|
-
}
|
|
56
|
-
throw new ConfigurationError(`Unsupported config file type: ${ext}`, { path: configPath });
|
|
57
|
-
} catch (error) {
|
|
58
|
-
if (error instanceof ConfigurationError) {
|
|
59
|
-
throw error;
|
|
60
|
-
}
|
|
61
|
-
logger.error(`Failed to load config file: ${configPath}`);
|
|
62
|
-
throw new ConfigurationError(
|
|
63
|
-
`Failed to load configuration from ${configPath}: ${error instanceof Error ? error.message : String(error)}`,
|
|
64
|
-
{ path: configPath, originalError: error }
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function deepMerge(base, override) {
|
|
69
|
-
const result = { ...base };
|
|
70
|
-
for (const key of Object.keys(override)) {
|
|
71
|
-
const baseValue = base[key];
|
|
72
|
-
const overrideValue = override[key];
|
|
73
|
-
if (overrideValue === void 0) {
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
if (typeof baseValue === "object" && baseValue !== null && !Array.isArray(baseValue) && typeof overrideValue === "object" && overrideValue !== null && !Array.isArray(overrideValue)) {
|
|
77
|
-
result[key] = deepMerge(
|
|
78
|
-
baseValue,
|
|
79
|
-
overrideValue
|
|
80
|
-
);
|
|
81
|
-
} else {
|
|
82
|
-
result[key] = overrideValue;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return result;
|
|
86
|
-
}
|
|
87
|
-
async function loadConfig(cwd, presetName) {
|
|
88
|
-
const workingDir = cwd || process.cwd();
|
|
89
|
-
const logger = getLogger();
|
|
90
|
-
let baseConfig;
|
|
91
|
-
if (presetName) {
|
|
92
|
-
const preset = getPreset(presetName);
|
|
93
|
-
if (!preset) {
|
|
94
|
-
throw new ConfigurationError(`Unknown preset: ${presetName}`, {
|
|
95
|
-
availablePresets: ["nextjs-monorepo", "nextjs-standalone", "custom"]
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
baseConfig = preset.config;
|
|
99
|
-
logger.debug(`Using preset: ${presetName}`);
|
|
100
|
-
} else {
|
|
101
|
-
baseConfig = getDefaultConfig(workingDir);
|
|
102
|
-
const detectedPreset = detectPreset(workingDir);
|
|
103
|
-
logger.debug(`Auto-detected preset: ${detectedPreset.name}`);
|
|
104
|
-
}
|
|
105
|
-
const configPath = findConfigFile(workingDir);
|
|
106
|
-
let userConfig = {};
|
|
107
|
-
if (configPath) {
|
|
108
|
-
logger.debug(`Loading config from: ${configPath}`);
|
|
109
|
-
userConfig = await loadConfigFile(configPath);
|
|
110
|
-
}
|
|
111
|
-
const mergedConfig = deepMerge(
|
|
112
|
-
baseConfig,
|
|
113
|
-
userConfig
|
|
114
|
-
);
|
|
115
|
-
return mergedConfig;
|
|
116
|
-
}
|
|
117
|
-
function findProjectRoot(startDir) {
|
|
118
|
-
let currentDir = path.resolve(startDir);
|
|
119
|
-
const _rootIndicators = ["pnpm-workspace.yaml", "turbo.json", "package.json"];
|
|
120
|
-
while (currentDir !== path.dirname(currentDir)) {
|
|
121
|
-
if (fs.existsSync(path.join(currentDir, "pnpm-workspace.yaml")) || fs.existsSync(path.join(currentDir, "turbo.json"))) {
|
|
122
|
-
return currentDir;
|
|
123
|
-
}
|
|
124
|
-
if (fs.existsSync(path.join(currentDir, "package.json"))) {
|
|
125
|
-
const parentDir = path.dirname(currentDir);
|
|
126
|
-
if (fs.existsSync(path.join(parentDir, "pnpm-workspace.yaml")) || fs.existsSync(path.join(parentDir, "turbo.json"))) {
|
|
127
|
-
return parentDir;
|
|
128
|
-
}
|
|
129
|
-
return currentDir;
|
|
130
|
-
}
|
|
131
|
-
currentDir = path.dirname(currentDir);
|
|
132
|
-
}
|
|
133
|
-
return path.resolve(startDir);
|
|
134
|
-
}
|
|
135
|
-
function resolvePaths(config, projectRoot) {
|
|
136
|
-
const root = path.resolve(projectRoot);
|
|
137
|
-
const appPath = path.resolve(root, config.paths.app);
|
|
138
|
-
const databasePath = path.resolve(root, config.paths.database);
|
|
139
|
-
const libPath = path.resolve(root, config.paths.lib);
|
|
140
|
-
const hooksPath = path.resolve(root, config.paths.hooks);
|
|
141
|
-
const schemasPath = path.resolve(root, config.paths.schemas);
|
|
142
|
-
const outputPaths = {
|
|
143
|
-
actions: path.resolve(libPath, config.paths.output.actions),
|
|
144
|
-
hooks: path.resolve(hooksPath, config.paths.output.hooks),
|
|
145
|
-
components: path.resolve(appPath, config.paths.output.components),
|
|
146
|
-
pages: path.resolve(appPath, config.paths.output.pages),
|
|
147
|
-
emails: path.resolve(appPath, config.paths.output.emails)
|
|
148
|
-
};
|
|
149
|
-
return {
|
|
150
|
-
root,
|
|
151
|
-
app: appPath,
|
|
152
|
-
database: databasePath,
|
|
153
|
-
lib: libPath,
|
|
154
|
-
hooks: hooksPath,
|
|
155
|
-
schemas: schemasPath,
|
|
156
|
-
output: outputPaths
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
function resolveConfig(config, projectRoot) {
|
|
160
|
-
const root = projectRoot || findProjectRoot(process.cwd());
|
|
161
|
-
const resolvedPaths = resolvePaths(config, root);
|
|
162
|
-
return {
|
|
163
|
-
...config,
|
|
164
|
-
paths: resolvedPaths
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
function defineConfig(config) {
|
|
168
|
-
return config;
|
|
169
|
-
}
|
|
170
|
-
function validateConfig(config) {
|
|
171
|
-
const errors = [];
|
|
172
|
-
if (!config.paths) {
|
|
173
|
-
errors.push('Configuration must have a "paths" object');
|
|
174
|
-
} else {
|
|
175
|
-
if (!config.paths.app) errors.push("paths.app is required");
|
|
176
|
-
if (!config.paths.database) errors.push("paths.database is required");
|
|
177
|
-
if (!config.paths.lib) errors.push("paths.lib is required");
|
|
178
|
-
if (!config.paths.hooks) errors.push("paths.hooks is required");
|
|
179
|
-
if (!config.paths.schemas) errors.push("paths.schemas is required");
|
|
180
|
-
}
|
|
181
|
-
if (!config.database) {
|
|
182
|
-
errors.push('Configuration must have a "database" object');
|
|
183
|
-
} else {
|
|
184
|
-
if (config.database.provider !== "drizzle") {
|
|
185
|
-
errors.push('database.provider must be "drizzle"');
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
if (!config.ui) {
|
|
189
|
-
errors.push('Configuration must have a "ui" object');
|
|
190
|
-
} else {
|
|
191
|
-
if (config.ui.framework !== "shadcn") {
|
|
192
|
-
errors.push('ui.framework must be "shadcn"');
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
return errors;
|
|
196
|
-
}
|
|
197
|
-
function checkPaths(paths) {
|
|
198
|
-
const exists = (p) => {
|
|
199
|
-
try {
|
|
200
|
-
fs.accessSync(p);
|
|
201
|
-
return true;
|
|
202
|
-
} catch {
|
|
203
|
-
return false;
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
return {
|
|
207
|
-
root: exists(paths.root),
|
|
208
|
-
app: exists(paths.app),
|
|
209
|
-
database: exists(paths.database),
|
|
210
|
-
lib: exists(paths.lib),
|
|
211
|
-
hooks: exists(paths.hooks),
|
|
212
|
-
schemas: exists(paths.schemas),
|
|
213
|
-
output: {
|
|
214
|
-
actions: exists(paths.output.actions),
|
|
215
|
-
hooks: exists(paths.output.hooks),
|
|
216
|
-
components: exists(paths.output.components),
|
|
217
|
-
pages: exists(paths.output.pages),
|
|
218
|
-
emails: exists(paths.output.emails)
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export {
|
|
224
|
-
CONFIG_FILE_NAMES,
|
|
225
|
-
findConfigFile,
|
|
226
|
-
loadConfigFile,
|
|
227
|
-
loadConfig,
|
|
228
|
-
findProjectRoot,
|
|
229
|
-
resolvePaths,
|
|
230
|
-
resolveConfig,
|
|
231
|
-
defineConfig,
|
|
232
|
-
validateConfig,
|
|
233
|
-
checkPaths
|
|
234
|
-
};
|
|
235
|
-
//# sourceMappingURL=chunk-QLVSHP7X.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config/loader.ts"],"sourcesContent":["/**\n * Configuration loader for @betterstart/cli\n * Handles loading, merging, and resolving configuration\n */\n\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { ConfigurationError } from '../core/errors'\nimport { getLogger } from '../core/logger'\nimport { detectPreset, getDefaultConfig, getPreset } from './presets'\nimport type { BetterstartConfig, ResolvedConfig, ResolvedPaths, UserConfig } from './types'\n\n// ============================================================================\n// Configuration File Names\n// ============================================================================\n\n/**\n * Supported configuration file names (in priority order)\n */\nexport const CONFIG_FILE_NAMES = [\n 'betterstart.config.ts',\n 'betterstart.config.js',\n 'betterstart.config.mjs',\n 'betterstart.config.json',\n '.betterstartrc.json',\n '.betterstartrc'\n]\n\n// ============================================================================\n// Configuration Loading\n// ============================================================================\n\n/**\n * Find the configuration file in a directory\n * @param cwd - Directory to search in\n * @returns Path to the config file or undefined if not found\n */\nexport function findConfigFile(cwd: string): string | undefined {\n for (const fileName of CONFIG_FILE_NAMES) {\n const filePath = path.join(cwd, fileName)\n if (fs.existsSync(filePath)) {\n return filePath\n }\n }\n return undefined\n}\n\n/**\n * Load configuration from a file\n * @param configPath - Path to the configuration file\n * @returns The loaded configuration\n */\nexport async function loadConfigFile(configPath: string): Promise<UserConfig> {\n const ext = path.extname(configPath)\n const logger = getLogger()\n\n try {\n if (ext === '.json' || configPath.endsWith('.betterstartrc')) {\n // Load JSON config\n const content = fs.readFileSync(configPath, 'utf-8')\n return JSON.parse(content) as UserConfig\n }\n\n if (ext === '.ts') {\n // Use jiti to transpile TypeScript config at runtime\n const { createJiti } = await import('jiti')\n // Alias @betterstart/cli so jiti can resolve it even when the CLI\n // is invoked via npx and isn't installed in the project's node_modules\n const alias: Record<string, string> = {}\n try {\n alias['@betterstart/cli'] = fileURLToPath(import.meta.resolve('@betterstart/cli'))\n } catch {\n // Not critical — config may not import from us\n }\n const jiti = createJiti(import.meta.url, { alias })\n const module = await jiti.import(configPath)\n return ((module as Record<string, unknown>).default || module) as UserConfig\n }\n\n if (ext === '.js' || ext === '.mjs') {\n const configUrl = `file://${configPath}`\n const module = await import(configUrl)\n return (module.default || module) as UserConfig\n }\n\n throw new ConfigurationError(`Unsupported config file type: ${ext}`, { path: configPath })\n } catch (error) {\n if (error instanceof ConfigurationError) {\n throw error\n }\n logger.error(`Failed to load config file: ${configPath}`)\n throw new ConfigurationError(\n `Failed to load configuration from ${configPath}: ${error instanceof Error ? error.message : String(error)}`,\n { path: configPath, originalError: error }\n )\n }\n}\n\n/**\n * Deep merge two configuration objects\n * Arrays are replaced, not merged\n */\nfunction deepMerge<T extends Record<string, unknown>>(base: T, override: Partial<T>): T {\n const result = { ...base }\n\n for (const key of Object.keys(override) as Array<keyof T>) {\n const baseValue = base[key]\n const overrideValue = override[key]\n\n if (overrideValue === undefined) {\n continue\n }\n\n if (\n typeof baseValue === 'object' &&\n baseValue !== null &&\n !Array.isArray(baseValue) &&\n typeof overrideValue === 'object' &&\n overrideValue !== null &&\n !Array.isArray(overrideValue)\n ) {\n // Recursively merge objects\n result[key] = deepMerge(\n baseValue as Record<string, unknown>,\n overrideValue as Record<string, unknown>\n ) as T[keyof T]\n } else {\n // Replace arrays and primitives\n result[key] = overrideValue as T[keyof T]\n }\n }\n\n return result\n}\n\n/**\n * Load configuration from a directory\n * Automatically finds and loads the config file, or uses defaults\n *\n * @param cwd - Directory to load config from (defaults to process.cwd())\n * @param presetName - Optional preset name to use as base\n * @returns The loaded and merged configuration\n */\nexport async function loadConfig(cwd?: string, presetName?: string): Promise<BetterstartConfig> {\n const workingDir = cwd || process.cwd()\n const logger = getLogger()\n\n // Get base configuration from preset or auto-detection\n let baseConfig: UserConfig\n if (presetName) {\n const preset = getPreset(presetName)\n if (!preset) {\n throw new ConfigurationError(`Unknown preset: ${presetName}`, {\n availablePresets: ['nextjs-monorepo', 'nextjs-standalone', 'custom']\n })\n }\n baseConfig = preset.config\n logger.debug(`Using preset: ${presetName}`)\n } else {\n baseConfig = getDefaultConfig(workingDir)\n const detectedPreset = detectPreset(workingDir)\n logger.debug(`Auto-detected preset: ${detectedPreset.name}`)\n }\n\n // Look for config file\n const configPath = findConfigFile(workingDir)\n let userConfig: UserConfig = {}\n\n if (configPath) {\n logger.debug(`Loading config from: ${configPath}`)\n userConfig = await loadConfigFile(configPath)\n }\n\n // Merge configurations\n const mergedConfig = deepMerge(\n baseConfig as Record<string, unknown>,\n userConfig as Record<string, unknown>\n )\n\n return mergedConfig as unknown as BetterstartConfig\n}\n\n// ============================================================================\n// Path Resolution\n// ============================================================================\n\n/**\n * Find the project root directory\n * Looks for common root indicators (package.json, pnpm-workspace.yaml, turbo.json)\n *\n * @param startDir - Directory to start searching from\n * @returns The project root directory\n */\nexport function findProjectRoot(startDir: string): string {\n let currentDir = path.resolve(startDir)\n const _rootIndicators = ['pnpm-workspace.yaml', 'turbo.json', 'package.json']\n\n // Walk up the directory tree\n while (currentDir !== path.dirname(currentDir)) {\n // Check for monorepo root indicators first\n if (\n fs.existsSync(path.join(currentDir, 'pnpm-workspace.yaml')) ||\n fs.existsSync(path.join(currentDir, 'turbo.json'))\n ) {\n return currentDir\n }\n\n // Check for package.json\n if (fs.existsSync(path.join(currentDir, 'package.json'))) {\n // If there's a package.json but no monorepo indicators,\n // check if parent has monorepo indicators\n const parentDir = path.dirname(currentDir)\n if (\n fs.existsSync(path.join(parentDir, 'pnpm-workspace.yaml')) ||\n fs.existsSync(path.join(parentDir, 'turbo.json'))\n ) {\n return parentDir\n }\n // Otherwise, this package.json is our root\n return currentDir\n }\n\n currentDir = path.dirname(currentDir)\n }\n\n // Fallback to start directory\n return path.resolve(startDir)\n}\n\n/**\n * Resolve configuration paths to absolute paths\n *\n * @param config - The configuration to resolve\n * @param projectRoot - The project root directory\n * @returns Configuration with resolved absolute paths\n */\nexport function resolvePaths(config: BetterstartConfig, projectRoot: string): ResolvedPaths {\n const root = path.resolve(projectRoot)\n\n // Resolve main paths\n const appPath = path.resolve(root, config.paths.app)\n const databasePath = path.resolve(root, config.paths.database)\n const libPath = path.resolve(root, config.paths.lib)\n const hooksPath = path.resolve(root, config.paths.hooks)\n const schemasPath = path.resolve(root, config.paths.schemas)\n\n // Resolve output paths relative to their parent packages\n const outputPaths = {\n actions: path.resolve(libPath, config.paths.output.actions),\n hooks: path.resolve(hooksPath, config.paths.output.hooks),\n components: path.resolve(appPath, config.paths.output.components),\n pages: path.resolve(appPath, config.paths.output.pages),\n emails: path.resolve(appPath, config.paths.output.emails)\n }\n\n return {\n root,\n app: appPath,\n database: databasePath,\n lib: libPath,\n hooks: hooksPath,\n schemas: schemasPath,\n output: outputPaths\n }\n}\n\n/**\n * Fully resolve configuration including paths\n *\n * @param config - The configuration to resolve\n * @param projectRoot - The project root directory (optional, auto-detected if not provided)\n * @returns Fully resolved configuration\n */\nexport function resolveConfig(config: BetterstartConfig, projectRoot?: string): ResolvedConfig {\n const root = projectRoot || findProjectRoot(process.cwd())\n const resolvedPaths = resolvePaths(config, root)\n\n return {\n ...config,\n paths: resolvedPaths\n }\n}\n\n// ============================================================================\n// Configuration Helper\n// ============================================================================\n\n/**\n * Helper function for defining configuration in betterstart.config.ts\n * Provides type checking and autocomplete\n *\n * @example\n * ```ts\n * // betterstart.config.ts\n * import { defineConfig } from '@betterstart/cli'\n *\n * export default defineConfig({\n * paths: {\n * app: 'apps/web',\n * database: 'packages/database'\n * }\n * })\n * ```\n */\nexport function defineConfig(config: UserConfig): UserConfig {\n return config\n}\n\n// ============================================================================\n// Validation\n// ============================================================================\n\n/**\n * Validate a configuration\n * @param config - The configuration to validate\n * @returns Array of validation errors (empty if valid)\n */\nexport function validateConfig(config: BetterstartConfig): string[] {\n const errors: string[] = []\n\n // Validate paths\n if (!config.paths) {\n errors.push('Configuration must have a \"paths\" object')\n } else {\n if (!config.paths.app) errors.push('paths.app is required')\n if (!config.paths.database) errors.push('paths.database is required')\n if (!config.paths.lib) errors.push('paths.lib is required')\n if (!config.paths.hooks) errors.push('paths.hooks is required')\n if (!config.paths.schemas) errors.push('paths.schemas is required')\n }\n\n // Validate database config\n if (!config.database) {\n errors.push('Configuration must have a \"database\" object')\n } else {\n if (config.database.provider !== 'drizzle') {\n errors.push('database.provider must be \"drizzle\"')\n }\n }\n\n // Validate UI config\n if (!config.ui) {\n errors.push('Configuration must have a \"ui\" object')\n } else {\n if (config.ui.framework !== 'shadcn') {\n errors.push('ui.framework must be \"shadcn\"')\n }\n }\n\n return errors\n}\n\n/**\n * Check if resolved paths exist and are accessible\n * @param paths - The resolved paths to check\n * @returns Object with path existence status\n */\nexport function checkPaths(paths: ResolvedPaths): Record<keyof ResolvedPaths, boolean> {\n const exists = (p: string) => {\n try {\n fs.accessSync(p)\n return true\n } catch {\n return false\n }\n }\n\n return {\n root: exists(paths.root),\n app: exists(paths.app),\n database: exists(paths.database),\n lib: exists(paths.lib),\n hooks: exists(paths.hooks),\n schemas: exists(paths.schemas),\n output: {\n actions: exists(paths.output.actions),\n hooks: exists(paths.output.hooks),\n components: exists(paths.output.components),\n pages: exists(paths.output.pages),\n emails: exists(paths.output.emails)\n }\n } as unknown as Record<keyof ResolvedPaths, boolean>\n}\n"],"mappings":";;;;;;;;;;;AAKA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAavB,IAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAWO,SAAS,eAAe,KAAiC;AAC9D,aAAW,YAAY,mBAAmB;AACxC,UAAM,WAAW,KAAK,K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