@stacksjs/buddy 0.70.86 → 0.70.88
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/package.json +2 -2
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -165
- package/dist/commands/about.d.ts +0 -2
- package/dist/commands/about.js +0 -35
- package/dist/commands/add.d.ts +0 -2
- package/dist/commands/add.js +0 -33
- package/dist/commands/auth.d.ts +0 -2
- package/dist/commands/auth.js +0 -68
- package/dist/commands/build.d.ts +0 -2
- package/dist/commands/build.js +0 -153
- package/dist/commands/cd.d.ts +0 -20
- package/dist/commands/cd.js +0 -39
- package/dist/commands/changelog.d.ts +0 -2
- package/dist/commands/changelog.js +0 -32
- package/dist/commands/clean.d.ts +0 -2
- package/dist/commands/clean.js +0 -37
- package/dist/commands/cloud.d.ts +0 -2
- package/dist/commands/cloud.js +0 -503
- package/dist/commands/commit.d.ts +0 -2
- package/dist/commands/commit.js +0 -16
- package/dist/commands/completion.d.ts +0 -2
- package/dist/commands/completion.js +0 -143
- package/dist/commands/config-migrate.d.ts +0 -26
- package/dist/commands/config-migrate.js +0 -94
- package/dist/commands/configure.d.ts +0 -2
- package/dist/commands/configure.js +0 -48
- package/dist/commands/create.d.ts +0 -2
- package/dist/commands/create.js +0 -141
- package/dist/commands/deploy.d.ts +0 -107
- package/dist/commands/deploy.js +0 -1439
- package/dist/commands/dev.d.ts +0 -10
- package/dist/commands/dev.js +0 -907
- package/dist/commands/dns.d.ts +0 -2
- package/dist/commands/dns.js +0 -102
- package/dist/commands/doctor.d.ts +0 -2
- package/dist/commands/doctor.js +0 -285
- package/dist/commands/domains.d.ts +0 -2
- package/dist/commands/domains.js +0 -159
- package/dist/commands/email.d.ts +0 -2
- package/dist/commands/email.js +0 -524
- package/dist/commands/env.d.ts +0 -2
- package/dist/commands/env.js +0 -246
- package/dist/commands/extension.d.ts +0 -8
- package/dist/commands/extension.js +0 -78
- package/dist/commands/features.d.ts +0 -180
- package/dist/commands/features.js +0 -422
- package/dist/commands/fresh.d.ts +0 -2
- package/dist/commands/fresh.js +0 -39
- package/dist/commands/generate.d.ts +0 -2
- package/dist/commands/generate.js +0 -104
- package/dist/commands/http.d.ts +0 -2
- package/dist/commands/http.js +0 -33
- package/dist/commands/index.d.ts +0 -53
- package/dist/commands/index.js +0 -53
- package/dist/commands/install.d.ts +0 -2
- package/dist/commands/install.js +0 -22
- package/dist/commands/key.d.ts +0 -2
- package/dist/commands/key.js +0 -23
- package/dist/commands/lint.d.ts +0 -2
- package/dist/commands/lint.js +0 -46
- package/dist/commands/list.d.ts +0 -2
- package/dist/commands/list.js +0 -108
- package/dist/commands/mail.d.ts +0 -2
- package/dist/commands/mail.js +0 -693
- package/dist/commands/maintenance.d.ts +0 -2
- package/dist/commands/maintenance.js +0 -141
- package/dist/commands/make.d.ts +0 -2
- package/dist/commands/make.js +0 -375
- package/dist/commands/migrate-project.d.ts +0 -2
- package/dist/commands/migrate-project.js +0 -49
- package/dist/commands/migrate.d.ts +0 -4
- package/dist/commands/migrate.js +0 -455
- package/dist/commands/outdated.d.ts +0 -2
- package/dist/commands/outdated.js +0 -19
- package/dist/commands/package.d.ts +0 -2
- package/dist/commands/package.js +0 -17
- package/dist/commands/phone.d.ts +0 -2
- package/dist/commands/phone.js +0 -188
- package/dist/commands/ports.d.ts +0 -2
- package/dist/commands/ports.js +0 -118
- package/dist/commands/prepublish.d.ts +0 -2
- package/dist/commands/prepublish.js +0 -17
- package/dist/commands/projects.d.ts +0 -2
- package/dist/commands/projects.js +0 -29
- package/dist/commands/publish.d.ts +0 -2
- package/dist/commands/publish.js +0 -172
- package/dist/commands/queue.d.ts +0 -2
- package/dist/commands/queue.js +0 -248
- package/dist/commands/release.d.ts +0 -2
- package/dist/commands/release.js +0 -30
- package/dist/commands/route.d.ts +0 -2
- package/dist/commands/route.js +0 -21
- package/dist/commands/saas.d.ts +0 -2
- package/dist/commands/saas.js +0 -25
- package/dist/commands/schedule.d.ts +0 -2
- package/dist/commands/schedule.js +0 -61
- package/dist/commands/search.d.ts +0 -2
- package/dist/commands/search.js +0 -84
- package/dist/commands/seed.d.ts +0 -2
- package/dist/commands/seed.js +0 -71
- package/dist/commands/serve.d.ts +0 -25
- package/dist/commands/serve.js +0 -182
- package/dist/commands/setup.d.ts +0 -12
- package/dist/commands/setup.js +0 -215
- package/dist/commands/share.d.ts +0 -2
- package/dist/commands/share.js +0 -214
- package/dist/commands/sms.d.ts +0 -2
- package/dist/commands/sms.js +0 -328
- package/dist/commands/stacks.d.ts +0 -2
- package/dist/commands/stacks.js +0 -69
- package/dist/commands/telemetry.d.ts +0 -2
- package/dist/commands/telemetry.js +0 -74
- package/dist/commands/test.d.ts +0 -2
- package/dist/commands/test.js +0 -130
- package/dist/commands/tinker.d.ts +0 -2
- package/dist/commands/tinker.js +0 -37
- package/dist/commands/types.d.ts +0 -2
- package/dist/commands/types.js +0 -18
- package/dist/commands/upgrade.d.ts +0 -2
- package/dist/commands/upgrade.js +0 -98
- package/dist/commands/version.d.ts +0 -2
- package/dist/commands/version.js +0 -16
- package/dist/config.d.ts +0 -43
- package/dist/config.js +0 -223
- package/dist/custom-cli.d.ts +0 -1
- package/dist/custom-cli.js +0 -23
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/lazy-commands.d.ts +0 -61
- package/dist/lazy-commands.js +0 -188
- package/dist/migrators/index.d.ts +0 -9
- package/dist/migrators/index.js +0 -62
- package/dist/migrators/laravel/index.d.ts +0 -2
- package/dist/migrators/laravel/index.js +0 -148
- package/dist/migrators/laravel/migrations.d.ts +0 -52
- package/dist/migrators/laravel/migrations.js +0 -232
- package/dist/migrators/laravel/models.d.ts +0 -34
- package/dist/migrators/laravel/models.js +0 -134
- package/dist/migrators/rails/index.d.ts +0 -2
- package/dist/migrators/rails/index.js +0 -11
- package/dist/migrators/types.d.ts +0 -44
- package/dist/migrators/types.js +0 -0
|
@@ -1,422 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { cp, rm } from "node:fs/promises";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import process from "node:process";
|
|
5
|
-
import { frameworkPath, projectPath } from "@stacksjs/path";
|
|
6
|
-
import { ExitCode } from "@stacksjs/types";
|
|
7
|
-
export const FEATURE_NAMES = [
|
|
8
|
-
"dashboard",
|
|
9
|
-
"commerce",
|
|
10
|
-
"cms",
|
|
11
|
-
"marketing",
|
|
12
|
-
"monitoring",
|
|
13
|
-
"realtime",
|
|
14
|
-
"queue"
|
|
15
|
-
], FEATURE_FILES = {
|
|
16
|
-
cms: [
|
|
17
|
-
"app/Actions/Cms/",
|
|
18
|
-
"app/Actions/Dashboard/Content/",
|
|
19
|
-
"app/Models/Content/",
|
|
20
|
-
"app/Models/Tag.ts",
|
|
21
|
-
"app/Models/Comment.ts",
|
|
22
|
-
"resources/views/dashboard/content/"
|
|
23
|
-
],
|
|
24
|
-
commerce: [
|
|
25
|
-
"app/Actions/Commerce/",
|
|
26
|
-
"app/Actions/Dashboard/Commerce/",
|
|
27
|
-
"app/Models/commerce/",
|
|
28
|
-
"resources/components/Dashboard/Commerce/",
|
|
29
|
-
"resources/views/dashboard/commerce/"
|
|
30
|
-
],
|
|
31
|
-
dashboard: [
|
|
32
|
-
"app/Actions/Dashboard/",
|
|
33
|
-
"resources/components/Dashboard/",
|
|
34
|
-
"resources/views/dashboard/",
|
|
35
|
-
"routes/dashboard.ts",
|
|
36
|
-
"routes/dashboard-api.ts"
|
|
37
|
-
],
|
|
38
|
-
marketing: [
|
|
39
|
-
"app/Actions/Dashboard/Marketing/",
|
|
40
|
-
"app/Models/Campaign.ts",
|
|
41
|
-
"app/Models/CampaignSend.ts",
|
|
42
|
-
"app/Models/EmailList.ts",
|
|
43
|
-
"app/Models/EmailListSubscriber.ts",
|
|
44
|
-
"app/Models/SocialPost.ts",
|
|
45
|
-
"resources/components/Marketing/",
|
|
46
|
-
"resources/views/dashboard/marketing/"
|
|
47
|
-
],
|
|
48
|
-
monitoring: [
|
|
49
|
-
"app/Actions/Monitoring/",
|
|
50
|
-
"app/Actions/TestErrorAction.ts",
|
|
51
|
-
"app/Models/Error.ts",
|
|
52
|
-
"functions/monitoring/",
|
|
53
|
-
"resources/views/dashboard/monitoring/",
|
|
54
|
-
"resources/views/dashboard/errors/"
|
|
55
|
-
],
|
|
56
|
-
realtime: [
|
|
57
|
-
"app/Actions/Realtime/",
|
|
58
|
-
"app/Actions/Dashboard/Realtime/",
|
|
59
|
-
"app/Models/realtime/",
|
|
60
|
-
"app/Broadcasts/",
|
|
61
|
-
"functions/realtime/",
|
|
62
|
-
"resources/views/dashboard/realtime/"
|
|
63
|
-
],
|
|
64
|
-
queue: [
|
|
65
|
-
"app/Actions/Queue/",
|
|
66
|
-
"app/Actions/Dashboard/Jobs/",
|
|
67
|
-
"app/Jobs/",
|
|
68
|
-
"app/Models/Job.ts",
|
|
69
|
-
"app/Models/FailedJob.ts",
|
|
70
|
-
"functions/jobs.ts",
|
|
71
|
-
"resources/views/dashboard/queue/",
|
|
72
|
-
"resources/views/dashboard/jobs/"
|
|
73
|
-
]
|
|
74
|
-
}, FEATURE_TABLES = {
|
|
75
|
-
cms: ["posts", "pages", "comments", "tags", "authors", "categories"],
|
|
76
|
-
commerce: [
|
|
77
|
-
"products",
|
|
78
|
-
"product_variants",
|
|
79
|
-
"product_units",
|
|
80
|
-
"manufacturers",
|
|
81
|
-
"orders",
|
|
82
|
-
"order_items",
|
|
83
|
-
"carts",
|
|
84
|
-
"cart_items",
|
|
85
|
-
"payments",
|
|
86
|
-
"payment_methods",
|
|
87
|
-
"payment_products",
|
|
88
|
-
"payment_transactions",
|
|
89
|
-
"customers",
|
|
90
|
-
"subscribers",
|
|
91
|
-
"subscriber_emails",
|
|
92
|
-
"subscriptions",
|
|
93
|
-
"gift_cards",
|
|
94
|
-
"coupons",
|
|
95
|
-
"transactions",
|
|
96
|
-
"reviews",
|
|
97
|
-
"drivers",
|
|
98
|
-
"delivery_routes",
|
|
99
|
-
"digital_deliveries",
|
|
100
|
-
"shipping_methods",
|
|
101
|
-
"shipping_rates",
|
|
102
|
-
"shipping_zones",
|
|
103
|
-
"license_keys",
|
|
104
|
-
"loyalty_points",
|
|
105
|
-
"loyalty_rewards",
|
|
106
|
-
"print_devices",
|
|
107
|
-
"receipts",
|
|
108
|
-
"tax_rates",
|
|
109
|
-
"waitlist_products",
|
|
110
|
-
"waitlist_restaurants"
|
|
111
|
-
],
|
|
112
|
-
dashboard: [
|
|
113
|
-
"boards",
|
|
114
|
-
"board_columns",
|
|
115
|
-
"cards",
|
|
116
|
-
"card_labels",
|
|
117
|
-
"card_assignees",
|
|
118
|
-
"card_comments",
|
|
119
|
-
"labels",
|
|
120
|
-
"ci_run_states",
|
|
121
|
-
"ci_runner_samples",
|
|
122
|
-
"ci_runner_alert_states",
|
|
123
|
-
"requests",
|
|
124
|
-
"logs"
|
|
125
|
-
],
|
|
126
|
-
marketing: [],
|
|
127
|
-
monitoring: ["errors"],
|
|
128
|
-
realtime: ["websockets"],
|
|
129
|
-
queue: ["jobs", "failed_jobs"]
|
|
130
|
-
};
|
|
131
|
-
export function migrationTable(filename) {
|
|
132
|
-
const inMatch = filename.match(/-in-([a-z0-9_]+)\.sql$/i);
|
|
133
|
-
if (inMatch)
|
|
134
|
-
return inMatch[1] ?? null;
|
|
135
|
-
const createMatch = filename.match(/-create-([a-z0-9_]+)-table\.sql$/i);
|
|
136
|
-
if (createMatch)
|
|
137
|
-
return createMatch[1] ?? null;
|
|
138
|
-
const alterMatch = filename.match(/-alter-([a-z0-9_]+)-/i);
|
|
139
|
-
if (alterMatch)
|
|
140
|
-
return alterMatch[1] ?? null;
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
export function migrationFeature(filename) {
|
|
144
|
-
const table = migrationTable(filename);
|
|
145
|
-
if (!table)
|
|
146
|
-
return null;
|
|
147
|
-
for (const f of FEATURE_NAMES)
|
|
148
|
-
if (FEATURE_TABLES[f].includes(table))
|
|
149
|
-
return f;
|
|
150
|
-
return null;
|
|
151
|
-
}
|
|
152
|
-
export function featurePathsPresent(feature, root = projectPath()) {
|
|
153
|
-
return FEATURE_FILES[feature].filter((rel) => existsSync(`${root}/${rel}`));
|
|
154
|
-
}
|
|
155
|
-
export async function deleteFeatureFiles(feature, root = projectPath()) {
|
|
156
|
-
const removed = [];
|
|
157
|
-
for (const rel of FEATURE_FILES[feature]) {
|
|
158
|
-
const full = `${root}/${rel}`;
|
|
159
|
-
if (!existsSync(full))
|
|
160
|
-
continue;
|
|
161
|
-
await rm(full, { recursive: !0, force: !0 });
|
|
162
|
-
removed.push(rel);
|
|
163
|
-
}
|
|
164
|
-
return removed;
|
|
165
|
-
}
|
|
166
|
-
export async function copyFeatureFiles(feature, options = {}) {
|
|
167
|
-
const source = options.source ?? frameworkPath("defaults"), target = options.target ?? projectPath(), force = options.force === !0, copied = [], skipped = [];
|
|
168
|
-
for (const rel of FEATURE_FILES[feature]) {
|
|
169
|
-
const sourceFull = join(source, rel);
|
|
170
|
-
if (!existsSync(sourceFull)) {
|
|
171
|
-
skipped.push(rel);
|
|
172
|
-
continue;
|
|
173
|
-
}
|
|
174
|
-
const targetFull = join(target, rel);
|
|
175
|
-
if (existsSync(targetFull) && !force) {
|
|
176
|
-
skipped.push(rel);
|
|
177
|
-
continue;
|
|
178
|
-
}
|
|
179
|
-
await cp(sourceFull, targetFull, { recursive: !0, force });
|
|
180
|
-
copied.push(rel);
|
|
181
|
-
}
|
|
182
|
-
return { copied, skipped };
|
|
183
|
-
}
|
|
184
|
-
const FEATURE_DESCRIPTIONS = {
|
|
185
|
-
dashboard: "Admin SPA shell + Activity/Log/Request/Deployment/Notification dashboards.",
|
|
186
|
-
commerce: "Order/Cart/Product/Customer/Coupon/GiftCard/Shipping + storefront API.",
|
|
187
|
-
cms: "Post/Page/Author/Comment/Tag models + content edit dashboards.",
|
|
188
|
-
marketing: "/api/email/subscribe, /api/contact, Campaign/EmailList/SocialPost.",
|
|
189
|
-
monitoring: "Error model + error-tracking views and actions.",
|
|
190
|
-
realtime: "WebSocket broadcaster + Websocket model + realtime-stats actions.",
|
|
191
|
-
queue: "Job + FailedJob models + queue dashboard pages."
|
|
192
|
-
}, STARTER_TEMPLATES = {
|
|
193
|
-
dashboard: `import type { DashboardConfig } from '@stacksjs/types'
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* **Dashboard Configuration**
|
|
197
|
-
*
|
|
198
|
-
* Top-level feature gate plus per-section visibility toggles for the
|
|
199
|
-
* \`buddy dev --dashboard\` sidebar. Userland models in \`app/Models/\`
|
|
200
|
-
* always appear regardless of these flags.
|
|
201
|
-
*/
|
|
202
|
-
export default {
|
|
203
|
-
enabled: true,
|
|
204
|
-
|
|
205
|
-
sections: {
|
|
206
|
-
library: { enabled: true },
|
|
207
|
-
content: { enabled: true },
|
|
208
|
-
commerce: { enabled: true },
|
|
209
|
-
marketing: { enabled: true },
|
|
210
|
-
analytics: { enabled: true },
|
|
211
|
-
management: { enabled: true },
|
|
212
|
-
utilities: { enabled: true },
|
|
213
|
-
data: {
|
|
214
|
-
dashboard: { enabled: true },
|
|
215
|
-
activity: { enabled: true },
|
|
216
|
-
users: { enabled: true },
|
|
217
|
-
teams: { enabled: true },
|
|
218
|
-
subscribers: { enabled: true },
|
|
219
|
-
allModels: { enabled: true },
|
|
220
|
-
},
|
|
221
|
-
},
|
|
222
|
-
} satisfies DashboardConfig
|
|
223
|
-
`,
|
|
224
|
-
commerce: `import type { CommerceConfig } from '@stacksjs/types'
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* **Commerce Configuration**
|
|
228
|
-
*
|
|
229
|
-
* Controls the commerce feature bundle (Order, Cart, Product, Customer,
|
|
230
|
-
* Coupon, GiftCard, Receipt, Shipping models + storefront API).
|
|
231
|
-
*/
|
|
232
|
-
export default {
|
|
233
|
-
enabled: true,
|
|
234
|
-
|
|
235
|
-
/** Default storefront currency (ISO 4217). */
|
|
236
|
-
currency: 'USD',
|
|
237
|
-
|
|
238
|
-
/** Default tax rate applied when a product/region rule doesn't override. */
|
|
239
|
-
defaultTaxRate: 0,
|
|
240
|
-
} satisfies CommerceConfig
|
|
241
|
-
`,
|
|
242
|
-
cms: `import type { CmsConfig } from '@stacksjs/types'
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* **CMS Configuration**
|
|
246
|
-
*
|
|
247
|
-
* Controls the CMS feature bundle (Post, Page, Author, Comment, Tag,
|
|
248
|
-
* Category models + content-edit dashboards).
|
|
249
|
-
*/
|
|
250
|
-
export default {
|
|
251
|
-
enabled: true,
|
|
252
|
-
} satisfies CmsConfig
|
|
253
|
-
`,
|
|
254
|
-
marketing: `import type { MarketingConfig } from '@stacksjs/types'
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* **Marketing Configuration**
|
|
258
|
-
*
|
|
259
|
-
* Controls the marketing feature bundle (\`/api/email/subscribe\`,
|
|
260
|
-
* \`/api/contact\`, Campaign / EmailList / SocialPost).
|
|
261
|
-
*/
|
|
262
|
-
export default {
|
|
263
|
-
enabled: true,
|
|
264
|
-
} satisfies MarketingConfig
|
|
265
|
-
`,
|
|
266
|
-
monitoring: `import type { MonitoringConfig } from '@stacksjs/types'
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* **Monitoring Configuration**
|
|
270
|
-
*
|
|
271
|
-
* Controls the monitoring feature bundle (Error model + error-tracking
|
|
272
|
-
* views and actions).
|
|
273
|
-
*/
|
|
274
|
-
export default {
|
|
275
|
-
enabled: true,
|
|
276
|
-
} satisfies MonitoringConfig
|
|
277
|
-
`,
|
|
278
|
-
realtime: `import type { RealtimeConfig } from '@stacksjs/types'
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* **Realtime Configuration**
|
|
282
|
-
*
|
|
283
|
-
* Controls the realtime feature bundle (WebSocket broadcaster + Websocket
|
|
284
|
-
* model + realtime-stats actions). The full set of options (driver, server,
|
|
285
|
-
* channels, etc.) is documented at @stacksjs/realtime; this starter
|
|
286
|
-
* template just flips the feature on.
|
|
287
|
-
*/
|
|
288
|
-
export default {
|
|
289
|
-
enabled: true,
|
|
290
|
-
} satisfies RealtimeConfig
|
|
291
|
-
`,
|
|
292
|
-
queue: `import type { QueueConfig } from '@stacksjs/types'
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* **Queue Configuration**
|
|
296
|
-
*
|
|
297
|
-
* Controls the queue feature bundle (Job + FailedJob models + queue
|
|
298
|
-
* dashboard pages). The full set of options (drivers, connections, worker
|
|
299
|
-
* concurrency, etc.) is documented at @stacksjs/queue; this starter
|
|
300
|
-
* template ships the \`sync\` driver so jobs execute immediately in dev.
|
|
301
|
-
*/
|
|
302
|
-
export default {
|
|
303
|
-
enabled: true,
|
|
304
|
-
|
|
305
|
-
default: 'sync',
|
|
306
|
-
|
|
307
|
-
connections: {
|
|
308
|
-
sync: { driver: 'sync' },
|
|
309
|
-
},
|
|
310
|
-
|
|
311
|
-
failed: {
|
|
312
|
-
driver: 'database',
|
|
313
|
-
table: 'failed_jobs',
|
|
314
|
-
},
|
|
315
|
-
} satisfies QueueConfig
|
|
316
|
-
`
|
|
317
|
-
};
|
|
318
|
-
export async function setFeatureEnabled(feature, enabled, options) {
|
|
319
|
-
const path = options.root ? join(options.root, `config/${feature}.ts`) : projectPath(`config/${feature}.ts`), file = Bun.file(path);
|
|
320
|
-
if (!await file.exists()) {
|
|
321
|
-
if (!options.createIfMissing)
|
|
322
|
-
return "missing";
|
|
323
|
-
await Bun.write(path, STARTER_TEMPLATES[feature]);
|
|
324
|
-
return "created";
|
|
325
|
-
}
|
|
326
|
-
const src = await file.text(), enabledRegex = /(^|\{)(\s*)enabled\s*:\s*(true|false)(\s*,?)/m;
|
|
327
|
-
if (enabledRegex.test(src)) {
|
|
328
|
-
const replaced = src.replace(enabledRegex, (_full, anchor, ws, current, trailing) => {
|
|
329
|
-
if (current === String(enabled))
|
|
330
|
-
return `${anchor}${ws}enabled: ${current}${trailing}`;
|
|
331
|
-
return `${anchor}${ws}enabled: ${enabled}${trailing}`;
|
|
332
|
-
});
|
|
333
|
-
if (replaced === src)
|
|
334
|
-
return "unchanged";
|
|
335
|
-
await Bun.write(path, replaced);
|
|
336
|
-
return "flipped";
|
|
337
|
-
}
|
|
338
|
-
const insertRegex = /(export default\s*\{)/;
|
|
339
|
-
if (!insertRegex.test(src))
|
|
340
|
-
throw Error(`Could not locate \`export default {\` in ${path} \u2014 please add \`enabled: ${enabled}\` manually.`);
|
|
341
|
-
const next = src.replace(insertRegex, `$1
|
|
342
|
-
enabled: ${enabled},`);
|
|
343
|
-
await Bun.write(path, next);
|
|
344
|
-
return "flipped";
|
|
345
|
-
}
|
|
346
|
-
export async function uninstallAllFeatures(options = {}) {
|
|
347
|
-
const root = options.root ?? projectPath(), results = [];
|
|
348
|
-
for (const feature of FEATURE_NAMES) {
|
|
349
|
-
const configOutcome = await setFeatureEnabled(feature, !1, { createIfMissing: !1, root }), filesRemoved = await deleteFeatureFiles(feature, root);
|
|
350
|
-
results.push({ feature, configOutcome, filesRemoved });
|
|
351
|
-
}
|
|
352
|
-
return results;
|
|
353
|
-
}
|
|
354
|
-
function registerInstallPair(buddy, feature) {
|
|
355
|
-
const desc = FEATURE_DESCRIPTIONS[feature], configRel = `config/${feature}.ts`;
|
|
356
|
-
buddy.command(`${feature}:install`, `Activate the ${feature} feature bundle. ${desc}`).option("--force", `Overwrite any existing ${feature} files in the project (default skips existing paths so the install is idempotent).`).action(async (options) => {
|
|
357
|
-
try {
|
|
358
|
-
switch (await setFeatureEnabled(feature, !0, { createIfMissing: !0 })) {
|
|
359
|
-
case "created":
|
|
360
|
-
console.log(`\u2713 Created ${configRel} with '${feature}' enabled.`);
|
|
361
|
-
break;
|
|
362
|
-
case "flipped":
|
|
363
|
-
console.log(`\u2713 Enabled '${feature}' in ${configRel}.`);
|
|
364
|
-
break;
|
|
365
|
-
case "unchanged":
|
|
366
|
-
console.log(`\u2713 '${feature}' is already enabled in ${configRel}.`);
|
|
367
|
-
break;
|
|
368
|
-
}
|
|
369
|
-
const { copied } = await copyFeatureFiles(feature, { force: options.force === !0 });
|
|
370
|
-
if (copied.length > 0) {
|
|
371
|
-
console.log(`\u2713 Copied ${copied.length} stamped path(s) from framework defaults:`);
|
|
372
|
-
for (const path of copied)
|
|
373
|
-
console.log(` - ${path}`);
|
|
374
|
-
} else if (featurePathsPresent(feature).length > 0)
|
|
375
|
-
console.log(` \u2192 ${feature} scaffolding already in place \u2014 use --force to overwrite.`);
|
|
376
|
-
console.log(` \u2192 next ./buddy dev will boot with ${feature} loaded.`);
|
|
377
|
-
process.exit(ExitCode.Success);
|
|
378
|
-
} catch (err) {
|
|
379
|
-
console.error(`\u2717 Failed to install ${feature}:`, err);
|
|
380
|
-
process.exit(ExitCode.FatalError);
|
|
381
|
-
}
|
|
382
|
-
});
|
|
383
|
-
buddy.command(`${feature}:uninstall`, `Deactivate the ${feature} feature bundle.`).option("--keep-files", `Don't delete the ${feature} scaffolding (action/model/view files). Flip the flag only.`).action(async (options) => {
|
|
384
|
-
try {
|
|
385
|
-
switch (await setFeatureEnabled(feature, !1, { createIfMissing: !1 })) {
|
|
386
|
-
case "missing":
|
|
387
|
-
console.log(`\u2713 '${feature}' is already disabled (${configRel} is absent).`);
|
|
388
|
-
break;
|
|
389
|
-
case "flipped":
|
|
390
|
-
console.log(`\u2713 Disabled '${feature}' in ${configRel}. Custom config preserved.`);
|
|
391
|
-
break;
|
|
392
|
-
case "unchanged":
|
|
393
|
-
console.log(`\u2713 '${feature}' is already disabled in ${configRel}.`);
|
|
394
|
-
break;
|
|
395
|
-
case "created":
|
|
396
|
-
console.log(`\u2717 Unexpected create on uninstall for ${feature}; please re-run with --force or report this bug.`);
|
|
397
|
-
break;
|
|
398
|
-
}
|
|
399
|
-
if (options.keepFiles) {
|
|
400
|
-
const stillPresent = featurePathsPresent(feature);
|
|
401
|
-
if (stillPresent.length > 0)
|
|
402
|
-
console.log(` \u2192 ${stillPresent.length} stamped path(s) preserved (--keep-files).`);
|
|
403
|
-
} else {
|
|
404
|
-
const removed = await deleteFeatureFiles(feature);
|
|
405
|
-
if (removed.length > 0) {
|
|
406
|
-
console.log(`\u2713 Removed ${removed.length} stamped path(s):`);
|
|
407
|
-
for (const path of removed)
|
|
408
|
-
console.log(` - ${path}`);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
console.log(` \u2192 next ./buddy dev will boot without ${feature}.`);
|
|
412
|
-
process.exit(ExitCode.Success);
|
|
413
|
-
} catch (err) {
|
|
414
|
-
console.error(`\u2717 Failed to uninstall ${feature}:`, err);
|
|
415
|
-
process.exit(ExitCode.FatalError);
|
|
416
|
-
}
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
export function features(buddy) {
|
|
420
|
-
for (const feature of FEATURE_NAMES)
|
|
421
|
-
registerInstallPair(buddy, feature);
|
|
422
|
-
}
|
package/dist/commands/fresh.d.ts
DELETED
package/dist/commands/fresh.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import process from "node:process";
|
|
2
|
-
import { runAction } from "@stacksjs/actions";
|
|
3
|
-
import { intro, log, onUnknownSubcommand, outro } from "@stacksjs/cli";
|
|
4
|
-
import { Action } from "@stacksjs/enums";
|
|
5
|
-
import { ExitCode } from "@stacksjs/types";
|
|
6
|
-
export function fresh(buddy) {
|
|
7
|
-
const descriptions = {
|
|
8
|
-
fresh: "Re-installs your npm dependencies",
|
|
9
|
-
project: "Target a specific project",
|
|
10
|
-
verbose: "Enable verbose output"
|
|
11
|
-
};
|
|
12
|
-
buddy.command("fresh", descriptions.fresh).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (options) => {
|
|
13
|
-
log.debug("Running `buddy fresh` ...", options);
|
|
14
|
-
if (!buddy.isForce && !buddy.isNoInteraction) {
|
|
15
|
-
const { confirm } = await import("@stacksjs/cli");
|
|
16
|
-
if (!await confirm({
|
|
17
|
-
message: "This will remove and reinstall all dependencies. Continue?",
|
|
18
|
-
initial: !1
|
|
19
|
-
})) {
|
|
20
|
-
log.info("Fresh install cancelled");
|
|
21
|
-
process.exit(ExitCode.Success);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const perf = await intro("buddy fresh"), result = await runAction(Action.Fresh, {
|
|
25
|
-
...options,
|
|
26
|
-
stdout: "inherit"
|
|
27
|
-
});
|
|
28
|
-
if (result.isErr) {
|
|
29
|
-
await outro("While running `buddy fresh`, there was an issue", { startTime: perf, useSeconds: !0 }, result.error);
|
|
30
|
-
process.exit(ExitCode.FatalError);
|
|
31
|
-
}
|
|
32
|
-
await outro("Freshly reinstalled your dependencies", {
|
|
33
|
-
startTime: perf,
|
|
34
|
-
useSeconds: !0
|
|
35
|
-
});
|
|
36
|
-
process.exit(ExitCode.Success);
|
|
37
|
-
});
|
|
38
|
-
onUnknownSubcommand(buddy, "fresh");
|
|
39
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import process from "node:process";
|
|
2
|
-
import {
|
|
3
|
-
generateComponentMeta,
|
|
4
|
-
generateCoreSymlink,
|
|
5
|
-
generateIdeHelpers,
|
|
6
|
-
generateLibEntries,
|
|
7
|
-
generateOpenApiSpec,
|
|
8
|
-
generatePantryConfig,
|
|
9
|
-
generateTypes,
|
|
10
|
-
generateVsCodeCustomData,
|
|
11
|
-
generateWebTypes,
|
|
12
|
-
invoke as startGenerationProcess,
|
|
13
|
-
watchTypes
|
|
14
|
-
} from "@stacksjs/actions";
|
|
15
|
-
import { intro, log, onUnknownSubcommand, outro } from "@stacksjs/cli";
|
|
16
|
-
import { ExitCode } from "@stacksjs/types";
|
|
17
|
-
export function generate(buddy) {
|
|
18
|
-
const descriptions = {
|
|
19
|
-
command: "Automagically build any of your libraries/packages for production use. Select any of the following packages",
|
|
20
|
-
types: "Generate your TypeScript types",
|
|
21
|
-
entries: "Generate your function & Component Library Entry Points",
|
|
22
|
-
webTypes: "Generate web-types.json for IDEs",
|
|
23
|
-
customData: "Generate VS Code custom data (custom-elements.json) for IDEs",
|
|
24
|
-
ideHelpers: "Generate IDE helpers",
|
|
25
|
-
componentMeta: "Generate component meta information",
|
|
26
|
-
coreSymlink: "Generate symlink of the core framework to the project root",
|
|
27
|
-
pantry: "Generate the pantry configuration file",
|
|
28
|
-
openApi: "Generate the OpenAPI specification",
|
|
29
|
-
select: "What are you trying to generate?",
|
|
30
|
-
project: "Target a specific project",
|
|
31
|
-
verbose: "Enable verbose output"
|
|
32
|
-
};
|
|
33
|
-
buddy.command("generate", descriptions.command).option("-t, --types", descriptions.types).option("-e, --entries", descriptions.entries).option("-w, --web-types", descriptions.webTypes).option("-c, --custom-data", descriptions.customData).option("-i, --ide-helpers", descriptions.ideHelpers).option("-c, --component-meta", descriptions.componentMeta).option("-p, --pantry", descriptions.pantry).option("-o, --openapi", descriptions.openApi).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--core-symlink", descriptions.coreSymlink).option("--verbose", descriptions.verbose, { default: !1 }).action(async (options) => {
|
|
34
|
-
log.debug("Running `buddy generate` ...", options);
|
|
35
|
-
await startGenerationProcess(options);
|
|
36
|
-
process.exit(ExitCode.Success);
|
|
37
|
-
});
|
|
38
|
-
buddy.command("generate:types", descriptions.types).option("-p, --project [project]", descriptions.project, { default: !1 }).option("-w, --watch", "Re-run on changes to models/ and config/", { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).alias("types:generate").action(async (options) => {
|
|
39
|
-
log.debug("Running `buddy generate:types` ...", options);
|
|
40
|
-
await generateTypes(options);
|
|
41
|
-
try {
|
|
42
|
-
const { buildDatabaseSchema } = await import("@stacksjs/orm");
|
|
43
|
-
await buildDatabaseSchema();
|
|
44
|
-
} catch (err) {
|
|
45
|
-
log.warn(`[generate:db-types] skipped: ${err.message}`);
|
|
46
|
-
}
|
|
47
|
-
if (options.watch)
|
|
48
|
-
await watchTypes(options);
|
|
49
|
-
});
|
|
50
|
-
buddy.command("generate:db-types", "Refresh database/types.d.ts for db.selectFrom autocomplete (stacksjs/stacks#1923)").option("--dry-run", "Print the would-be file content without writing", { default: !1 }).action(async (options) => {
|
|
51
|
-
const { buildDatabaseSchema } = await import("@stacksjs/orm"), result = await buildDatabaseSchema({ dryRun: options.dryRun });
|
|
52
|
-
if (options.dryRun)
|
|
53
|
-
console.log(result.content);
|
|
54
|
-
for (const e of result.errors)
|
|
55
|
-
log.warn(`[generate:db-types] ${e.file}: ${e.error}`);
|
|
56
|
-
log.info(`[generate:db-types] resolved ${result.tables.length} table(s)`);
|
|
57
|
-
});
|
|
58
|
-
buddy.command("generate:entries", descriptions.entries).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (options) => {
|
|
59
|
-
log.debug("Running `buddy generate:entries` ...", options);
|
|
60
|
-
await generateLibEntries(options);
|
|
61
|
-
});
|
|
62
|
-
buddy.command("generate:web-types", descriptions.webTypes).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (options) => {
|
|
63
|
-
log.debug("Running `buddy generate:web-types` ...", options);
|
|
64
|
-
await generateWebTypes(options);
|
|
65
|
-
});
|
|
66
|
-
buddy.command("generate:vscode-custom-data", descriptions.customData).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (options) => {
|
|
67
|
-
log.debug("Running `buddy generate:vscode-custom-data` ...", options);
|
|
68
|
-
await generateVsCodeCustomData(options);
|
|
69
|
-
});
|
|
70
|
-
buddy.command("generate:ide-helpers", descriptions.ideHelpers).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (options) => {
|
|
71
|
-
log.debug("Running `buddy generate:ide-helpers` ...", options);
|
|
72
|
-
await generateIdeHelpers(options);
|
|
73
|
-
});
|
|
74
|
-
buddy.command("generate:component-meta", descriptions.componentMeta).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (options) => {
|
|
75
|
-
log.debug("Running `buddy generate:component-meta` ...", options);
|
|
76
|
-
await generateComponentMeta();
|
|
77
|
-
});
|
|
78
|
-
buddy.command("generate:pantry-config", descriptions.pantry).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (options) => {
|
|
79
|
-
log.debug("Running `buddy generate:pantry-config` ...", options);
|
|
80
|
-
await generatePantryConfig();
|
|
81
|
-
});
|
|
82
|
-
buddy.command("generate:openapi-spec", descriptions.openApi).alias("generate:openapi").option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (options) => {
|
|
83
|
-
log.debug("Running `buddy generate:openapi-spec` ...", options);
|
|
84
|
-
const perf = await intro("buddy generate:openapi-spec");
|
|
85
|
-
await generateOpenApiSpec();
|
|
86
|
-
await outro("Generated OpenAPI specification", {
|
|
87
|
-
startTime: perf,
|
|
88
|
-
useSeconds: !0
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
buddy.command("generate:migrations", "Generate Migrations").action(async (options) => {
|
|
92
|
-
log.debug("Running `buddy generate:migrations` ...", options);
|
|
93
|
-
const { generateMigrations } = await import("@stacksjs/database"), result = await generateMigrations();
|
|
94
|
-
if (result?.isErr) {
|
|
95
|
-
log.error("generateMigrations failed", result.error);
|
|
96
|
-
process.exit(ExitCode.FatalError);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
buddy.command("generate:core-symlink", "Generate core symlink. A shortcut for core developers.").action(async (options) => {
|
|
100
|
-
log.debug("Running `buddy core-symlink` ...", options);
|
|
101
|
-
await generateCoreSymlink();
|
|
102
|
-
});
|
|
103
|
-
onUnknownSubcommand(buddy, "generate");
|
|
104
|
-
}
|
package/dist/commands/http.d.ts
DELETED
package/dist/commands/http.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import process from "node:process";
|
|
2
|
-
import { log } from "@stacksjs/cli";
|
|
3
|
-
import { config } from "@stacksjs/config";
|
|
4
|
-
import { HttxClient } from "@stacksjs/httx";
|
|
5
|
-
import { ExitCode } from "@stacksjs/types";
|
|
6
|
-
export function http(buddy) {
|
|
7
|
-
const descriptions = {
|
|
8
|
-
http: "Send an HTTP request to a domain",
|
|
9
|
-
project: "Target a specific project",
|
|
10
|
-
verbose: "Enable verbose output"
|
|
11
|
-
};
|
|
12
|
-
buddy.command("http [domain]", descriptions.http).option("-p, --project [project]", descriptions.project, { default: !1 }).option("-v, --verbose", descriptions.verbose, { default: !1 }).action(async (domain, options) => {
|
|
13
|
-
log.debug("Running `buddy http [domain]` ...", options);
|
|
14
|
-
const url = domain || config.app.url;
|
|
15
|
-
if (!url)
|
|
16
|
-
throw Error("No domain configured. Pass a domain or set config.app.url.");
|
|
17
|
-
const client = new HttxClient({ verbose: options.verbose });
|
|
18
|
-
log.info(`GET ${url}`);
|
|
19
|
-
(await client.request(url.startsWith("http") ? url : `https://${url}`, {
|
|
20
|
-
method: "GET"
|
|
21
|
-
})).match({
|
|
22
|
-
ok: (response) => {
|
|
23
|
-
log.info(`${response.status} ${response.statusText} (${response.timings.duration.toFixed(0)}ms)`);
|
|
24
|
-
console.log(typeof response.data === "string" ? response.data : JSON.stringify(response.data, null, 2));
|
|
25
|
-
process.exit(ExitCode.Success);
|
|
26
|
-
},
|
|
27
|
-
err: (error) => {
|
|
28
|
-
log.error(`Request failed: ${error.message}`);
|
|
29
|
-
process.exit(ExitCode.FatalError);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
}
|
package/dist/commands/index.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
export * from './about';
|
|
2
|
-
export * from './auth';
|
|
3
|
-
export * from './build';
|
|
4
|
-
export * from './cd';
|
|
5
|
-
export * from './changelog';
|
|
6
|
-
export * from './clean';
|
|
7
|
-
export * from './cloud';
|
|
8
|
-
export * from './commit';
|
|
9
|
-
export * from './completion';
|
|
10
|
-
export * from './config-migrate';
|
|
11
|
-
export * from './configure';
|
|
12
|
-
export * from './create';
|
|
13
|
-
export * from './deploy';
|
|
14
|
-
export * from './dev';
|
|
15
|
-
export * from './dns';
|
|
16
|
-
export * from './doctor';
|
|
17
|
-
export * from './domains';
|
|
18
|
-
export * from './email';
|
|
19
|
-
export * from './env';
|
|
20
|
-
export * from './features';
|
|
21
|
-
export * from './fresh';
|
|
22
|
-
export * from './generate';
|
|
23
|
-
export * from './http';
|
|
24
|
-
export * from './install';
|
|
25
|
-
export * from './key';
|
|
26
|
-
export * from './lint';
|
|
27
|
-
export * from './list';
|
|
28
|
-
export * from './mail';
|
|
29
|
-
export * from './make';
|
|
30
|
-
export * from './migrate';
|
|
31
|
-
export * from './migrate-project';
|
|
32
|
-
export * from './outdated';
|
|
33
|
-
export * from './phone';
|
|
34
|
-
export * from './ports';
|
|
35
|
-
export * from './prepublish';
|
|
36
|
-
export * from './projects';
|
|
37
|
-
export * from './publish';
|
|
38
|
-
export * from './queue';
|
|
39
|
-
export * from './release';
|
|
40
|
-
export * from './route';
|
|
41
|
-
export * from './saas';
|
|
42
|
-
export * from './schedule';
|
|
43
|
-
export * from './search';
|
|
44
|
-
export * from './seed';
|
|
45
|
-
export * from './serve';
|
|
46
|
-
export * from './setup';
|
|
47
|
-
export * from './sms';
|
|
48
|
-
export * from './telemetry';
|
|
49
|
-
export * from './test';
|
|
50
|
-
export * from './tinker';
|
|
51
|
-
export * from './types';
|
|
52
|
-
export * from './upgrade';
|
|
53
|
-
export * from './version';
|