@stacksjs/buddy 0.58.28 → 0.58.43
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 +2 -2
- package/dist/chunk-0455e53fab4244b1.js +19 -0
- package/dist/chunk-2c32c64e1ff8261c.js +1706 -0
- package/dist/chunk-3d4c74b796ece2a2.js +1746 -0
- package/dist/{chunk-fd47b42fb923a4be.js → chunk-457563296d7e9010.js} +172 -132
- package/dist/chunk-61e8f138963fc709.js +1707 -0
- package/dist/chunk-92fbe9deb5f747b8.js +1712 -0
- package/dist/chunk-a52fb0419e9febc7.js +1712 -0
- package/dist/chunk-ac2e8a0f7df4fd87.js +1746 -0
- package/dist/chunk-c58676a39cd23812.js +1707 -0
- package/dist/cli.js +6 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -22,9 +22,10 @@ function build(buddy) {
|
|
|
22
22
|
docs: "Build your documentation",
|
|
23
23
|
framework: "Build Stacks framework",
|
|
24
24
|
select: "What are you trying to build?",
|
|
25
|
+
project: "Target a specific project",
|
|
25
26
|
verbose: "Enable verbose output"
|
|
26
27
|
};
|
|
27
|
-
buddy.command("build", "Automagically build any of your libraries/packages for production use. Select any of the following packages").option("-c, --components", descriptions.components).option("-v, --vue-components", descriptions.vueComponents).option("-w, --web-components", descriptions.webComponents).option("-e, --elements", descriptions.elements).option("-f, --functions", descriptions.functions).option("-p, --views", descriptions.pages).option("-d, --docs", descriptions.docs).option("-s, --stacks", descriptions.framework, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
28
|
+
buddy.command("build", "Automagically build any of your libraries/packages for production use. Select any of the following packages").option("-c, --components", descriptions.components).option("-v, --vue-components", descriptions.vueComponents).option("-w, --web-components", descriptions.webComponents).option("-e, --elements", descriptions.elements).option("-f, --functions", descriptions.functions).option("-p, --views", descriptions.pages).option("-d, --docs", descriptions.docs).option("-s, --stacks", descriptions.framework, { default: false }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
28
29
|
if (hasNoOptions(options)) {
|
|
29
30
|
let answers = await prompt.require().multiselect(descriptions.select, {
|
|
30
31
|
options: [
|
|
@@ -43,25 +44,25 @@ function build(buddy) {
|
|
|
43
44
|
await runAction(Action.BuildStacks, options);
|
|
44
45
|
process.exit(ExitCode.Success);
|
|
45
46
|
});
|
|
46
|
-
buddy.command("build:components", "Automagically build component libraries for production use & npm/CDN distribution").option("-c, --components", descriptions.components, { default: true }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
47
|
+
buddy.command("build:components", "Automagically build component libraries for production use & npm/CDN distribution").option("-c, --components", descriptions.components, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
47
48
|
await runAction(Action.BuildComponentLibs, options);
|
|
48
49
|
});
|
|
49
|
-
buddy.command("build:cli", "Automagically build the CLI").option("-c, --components", descriptions.components, { default: true }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
50
|
+
buddy.command("build:cli", "Automagically build the CLI").option("-c, --components", descriptions.components, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
50
51
|
await runAction(Action.BuildCli, options);
|
|
51
52
|
});
|
|
52
|
-
buddy.command("build:functions", "Automagically build function library for npm/CDN distribution").option("-f, --functions", descriptions.functions, { default: true }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
53
|
+
buddy.command("build:functions", "Automagically build function library for npm/CDN distribution").option("-f, --functions", descriptions.functions, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
53
54
|
await runAction(Action.BuildFunctionLib, options);
|
|
54
55
|
});
|
|
55
|
-
buddy.command("build:vue-components", "Automagically build Vue component library for npm/CDN distribution").option("-v, --vue-components", descriptions.vueComponents, { default: true }).option("--verbose", descriptions.verbose, { default: false }).alias("build:vue").action(async (options) => {
|
|
56
|
+
buddy.command("build:vue-components", "Automagically build Vue component library for npm/CDN distribution").option("-v, --vue-components", descriptions.vueComponents, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).alias("build:vue").action(async (options) => {
|
|
56
57
|
await runAction(Action.BuildVueComponentLib, options);
|
|
57
58
|
});
|
|
58
|
-
buddy.command("build:web-components", "Automagically build Web Component library for npm/CDN distribution").option("-w, --web-components", descriptions.webComponents, { default: true }).option("--verbose", descriptions.verbose, { default: false }).alias("build:elements").alias("build:wc").action(async (options) => {
|
|
59
|
+
buddy.command("build:web-components", "Automagically build Web Component library for npm/CDN distribution").option("-w, --web-components", descriptions.webComponents, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).alias("build:elements").alias("build:wc").action(async (options) => {
|
|
59
60
|
await runAction(Action.BuildWebComponentLib, options);
|
|
60
61
|
});
|
|
61
|
-
buddy.command("build:docs", "Automagically build your documentation site.").option("-d, --docs", descriptions.docs, { default: true }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
62
|
+
buddy.command("build:docs", "Automagically build your documentation site.").option("-d, --docs", descriptions.docs, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
62
63
|
await runAction(Action.BuildDocs, options);
|
|
63
64
|
});
|
|
64
|
-
buddy.command("build:core", "Automagically build the Stacks core.").option("--verbose", descriptions.verbose, { default: true }).action(async (options) => {
|
|
65
|
+
buddy.command("build:core", "Automagically build the Stacks core.").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: true }).action(async (options) => {
|
|
65
66
|
const startTime = await intro("buddy build:core");
|
|
66
67
|
const result = await runAction(Action.BuildCore, options);
|
|
67
68
|
if (result.isErr()) {
|
|
@@ -70,7 +71,7 @@ function build(buddy) {
|
|
|
70
71
|
}
|
|
71
72
|
await outro("Stacks core built successfully", { startTime, useSeconds: true });
|
|
72
73
|
});
|
|
73
|
-
buddy.command("build:desktop", descriptions.desktop).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
74
|
+
buddy.command("build:desktop", descriptions.desktop).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
74
75
|
const perf = await intro("buddy build:desktop");
|
|
75
76
|
const result = await runAction(Action.BuildDesktop, options);
|
|
76
77
|
if (result.isErr()) {
|
|
@@ -81,7 +82,7 @@ function build(buddy) {
|
|
|
81
82
|
await outro("Exited", { startTime: perf, useSeconds: true });
|
|
82
83
|
process.exit(ExitCode.Success);
|
|
83
84
|
});
|
|
84
|
-
buddy.command("build:stacks", "Build the Stacks framework.").option("-s, --stacks", descriptions.framework, { default: true }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
85
|
+
buddy.command("build:stacks", "Build the Stacks framework.").option("-s, --stacks", descriptions.framework, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
85
86
|
const startTime = await intro("buddy build:stacks");
|
|
86
87
|
const result = await runAction(Action.BuildStacks, options);
|
|
87
88
|
if (result.isErr()) {
|
|
@@ -96,7 +97,7 @@ function build(buddy) {
|
|
|
96
97
|
});
|
|
97
98
|
}
|
|
98
99
|
var hasNoOptions = function(options) {
|
|
99
|
-
return !options.components && !options.vueComponents && !options.webComponents && !options.elements && !options.functions && !options.pages && !options.docs && !options.
|
|
100
|
+
return !options.components && !options.vueComponents && !options.webComponents && !options.elements && !options.functions && !options.pages && !options.docs && !options.stacks;
|
|
100
101
|
};
|
|
101
102
|
|
|
102
103
|
// src/commands/changelog.ts
|
|
@@ -109,9 +110,10 @@ function changelog(buddy) {
|
|
|
109
110
|
const descriptions = {
|
|
110
111
|
changelog: "Create a CHANGELOG.md file",
|
|
111
112
|
quiet: "Minimal output",
|
|
113
|
+
project: "Target a specific project",
|
|
112
114
|
verbose: "Enable verbose output"
|
|
113
115
|
};
|
|
114
|
-
buddy.command("changelog", descriptions.changelog).option("--quiet", descriptions.quiet, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
116
|
+
buddy.command("changelog", descriptions.changelog).option("--quiet", descriptions.quiet, { default: false }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
115
117
|
const perf = await intro2("buddy changelog");
|
|
116
118
|
const result = await runAction2(Action2.Changelog, options);
|
|
117
119
|
if (result.isErr()) {
|
|
@@ -136,9 +138,10 @@ import {Action as Action3} from "@stacksjs/enums";
|
|
|
136
138
|
function clean(buddy) {
|
|
137
139
|
const descriptions = {
|
|
138
140
|
clean: "Removes all node_modules & lock files",
|
|
141
|
+
project: "Target a specific project",
|
|
139
142
|
verbose: "Enable verbose output"
|
|
140
143
|
};
|
|
141
|
-
buddy.command("clean", descriptions.clean).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
144
|
+
buddy.command("clean", descriptions.clean).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
142
145
|
const perf = await intro3("buddy clean");
|
|
143
146
|
const result = await runAction3(Action3.Clean, options);
|
|
144
147
|
if (result.isErr()) {
|
|
@@ -169,9 +172,10 @@ function cloud2(buddy) {
|
|
|
169
172
|
remove: "Removes the Stacks Cloud. In case it fails, try again",
|
|
170
173
|
optimizeCost: "Removes certain resources that may be re-applied at a later time",
|
|
171
174
|
cleanUp: "Removes all resources that were retained during the cloud deletion",
|
|
175
|
+
project: "Target a specific project",
|
|
172
176
|
verbose: "Enable verbose output"
|
|
173
177
|
};
|
|
174
|
-
buddy.command("cloud", descriptions.cloud).option("--ssh", descriptions.ssh, { default: false }).option("--connect", descriptions.ssh, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
178
|
+
buddy.command("cloud", descriptions.cloud).option("--ssh", descriptions.ssh, { default: false }).option("--connect", descriptions.ssh, { default: false }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
175
179
|
if (options.ssh || options.connect) {
|
|
176
180
|
const startTime = performance.now();
|
|
177
181
|
const jumpBoxId = await getJumpBoxInstanceId();
|
|
@@ -190,7 +194,7 @@ function cloud2(buddy) {
|
|
|
190
194
|
log3.info("Not implemented yet. Please use the --ssh (or --connect) flag to connect to the Stacks Cloud.");
|
|
191
195
|
process4.exit(ExitCode4.Success);
|
|
192
196
|
});
|
|
193
|
-
buddy.command("cloud:add", descriptions.add).option("--jump-box", "Remove the jump-box", { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
197
|
+
buddy.command("cloud:add", descriptions.add).option("--jump-box", "Remove the jump-box", { default: false }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
194
198
|
const startTime = await intro4("buddy cloud:add");
|
|
195
199
|
if (options.jumpBox) {
|
|
196
200
|
const { confirm } = await prompts({
|
|
@@ -220,7 +224,7 @@ function cloud2(buddy) {
|
|
|
220
224
|
log3.info("This functionality is not yet implemented.");
|
|
221
225
|
process4.exit(ExitCode4.Success);
|
|
222
226
|
});
|
|
223
|
-
buddy.command("cloud:remove", descriptions.remove).alias("cloud:destroy").alias("cloud:rm").alias("undeploy").option("--jump-box", "Remove the jump-box", { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
227
|
+
buddy.command("cloud:remove", descriptions.remove).alias("cloud:destroy").alias("cloud:rm").alias("undeploy").option("--jump-box", "Remove the jump-box", { default: false }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
224
228
|
const startTime = await intro4("buddy cloud:remove");
|
|
225
229
|
if (options.jumpBox) {
|
|
226
230
|
const { confirm } = await prompts({
|
|
@@ -275,7 +279,7 @@ function cloud2(buddy) {
|
|
|
275
279
|
process4.exit(ExitCode4.FatalError);
|
|
276
280
|
}
|
|
277
281
|
});
|
|
278
|
-
buddy.command("cloud:optimize-cost", descriptions.optimizeCost).option("--jump-box", "Remove the jump-box", { default: true }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
282
|
+
buddy.command("cloud:optimize-cost", descriptions.optimizeCost).option("--jump-box", "Remove the jump-box", { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
279
283
|
const startTime = await intro4("buddy cloud:remove");
|
|
280
284
|
if (options.jumpBox) {
|
|
281
285
|
const { confirm } = await prompts({
|
|
@@ -294,7 +298,7 @@ function cloud2(buddy) {
|
|
|
294
298
|
await outro4("No cost optimization was applied", { startTime, useSeconds: true });
|
|
295
299
|
process4.exit(ExitCode4.Success);
|
|
296
300
|
});
|
|
297
|
-
buddy.command("cloud:cleanup", descriptions.cleanUp).alias("cloud:clean-up").option("--verbose", descriptions.verbose, { default: false }).action(async () => {
|
|
301
|
+
buddy.command("cloud:cleanup", descriptions.cleanUp).alias("cloud:clean-up").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async () => {
|
|
298
302
|
const startTime = await intro4("buddy cloud:cleanup");
|
|
299
303
|
log3.info(`Cleaning up your cloud resources will take a while to complete. Please be patient.`);
|
|
300
304
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
@@ -359,9 +363,10 @@ import {runCommit} from "@stacksjs/actions";
|
|
|
359
363
|
function commit(buddy) {
|
|
360
364
|
const descriptions = {
|
|
361
365
|
commit: "Commit your stashed changes",
|
|
366
|
+
project: "Target a specific project",
|
|
362
367
|
verbose: "Enable verbose output"
|
|
363
368
|
};
|
|
364
|
-
buddy.command("commit", descriptions.commit).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
369
|
+
buddy.command("commit", descriptions.commit).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
365
370
|
await runCommit(options);
|
|
366
371
|
});
|
|
367
372
|
buddy.on("commit:*", () => {
|
|
@@ -380,9 +385,10 @@ function configure(buddy) {
|
|
|
380
385
|
const descriptions = {
|
|
381
386
|
configure: "Configure options",
|
|
382
387
|
aws: "Configure the AWS connection",
|
|
388
|
+
project: "Target a specific project",
|
|
383
389
|
verbose: "Enable verbose output"
|
|
384
390
|
};
|
|
385
|
-
buddy.command("configure", descriptions.configure).option("--aws", descriptions.aws, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
391
|
+
buddy.command("configure", descriptions.configure).option("--aws", descriptions.aws, { default: false }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
386
392
|
if (options?.aws) {
|
|
387
393
|
const startTime = performance.now();
|
|
388
394
|
const result = await runCommand2("aws configure", {
|
|
@@ -400,7 +406,7 @@ function configure(buddy) {
|
|
|
400
406
|
log4.info("Not implemented yet. Please use the --aws flag to configure AWS.");
|
|
401
407
|
process6.exit(ExitCode5.Success);
|
|
402
408
|
});
|
|
403
|
-
buddy.command("configure:aws", descriptions.aws).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
409
|
+
buddy.command("configure:aws", descriptions.aws).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
404
410
|
const startTime = performance.now();
|
|
405
411
|
const result = await runCommand2(`aws configure --profile ${config2.app.url}`, {
|
|
406
412
|
...options,
|
|
@@ -436,13 +442,14 @@ function create(buddy) {
|
|
|
436
442
|
components: "Are you building UI components?",
|
|
437
443
|
webComponents: "Automagically built optimized custom elements/web components?",
|
|
438
444
|
vue: "Automagically built a Vue component library?",
|
|
439
|
-
|
|
445
|
+
views: "How about views?",
|
|
440
446
|
functions: "Are you developing functions/composables?",
|
|
441
447
|
api: "Are you building an API?",
|
|
442
448
|
database: "Do you need a database?",
|
|
449
|
+
project: "Target a specific project",
|
|
443
450
|
verbose: "Enable verbose output"
|
|
444
451
|
};
|
|
445
|
-
buddy.command("new <name>", descriptions.command).option("-u, --ui", descriptions.ui, { default: true }).option("-c, --components", descriptions.components, { default: true }).option("-w, --web-components", descriptions.webComponents, { default: true }).option("-v, --vue", descriptions.vue, { default: true }).option("-p, --views", descriptions.
|
|
452
|
+
buddy.command("new <name>", descriptions.command).option("-u, --ui", descriptions.ui, { default: true }).option("-c, --components", descriptions.components, { default: true }).option("-w, --web-components", descriptions.webComponents, { default: true }).option("-v, --vue", descriptions.vue, { default: true }).option("-p, --views", descriptions.views, { default: true }).option("-f, --functions", descriptions.functions, { default: true }).option("-a, --api", descriptions.api, { default: true }).option("-d, --database", descriptions.database, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
446
453
|
const startTime = await intro5("stacks new");
|
|
447
454
|
const name = options.name;
|
|
448
455
|
const path5 = resolve(process7.cwd(), name);
|
|
@@ -485,13 +492,13 @@ var onlineCheck = function() {
|
|
|
485
492
|
};
|
|
486
493
|
async function download(name, path5, options) {
|
|
487
494
|
log5.info("Setting up your stack.");
|
|
488
|
-
const result = await runCommand3(`giget stacks ${name}`, options);
|
|
495
|
+
const result = await runCommand3(`bunx giget stacks ${name}`, options);
|
|
489
496
|
log5.success(`Successfully scaffolded your project at ${cyan(path5)}`);
|
|
490
497
|
return result;
|
|
491
498
|
}
|
|
492
499
|
async function ensureEnv(path5, options) {
|
|
493
500
|
log5.info("Ensuring your environment is ready...");
|
|
494
|
-
await runCommand3("
|
|
501
|
+
await runCommand3("pkgx --update ", { ...options, cwd: path5 });
|
|
495
502
|
log5.success("Environment is ready");
|
|
496
503
|
}
|
|
497
504
|
async function install(path5, options) {
|
|
@@ -526,9 +533,10 @@ import {addDomain, hasUserDomainBeenAddedToCloud} from "@stacksjs/dns";
|
|
|
526
533
|
function deploy(buddy) {
|
|
527
534
|
const descriptions = {
|
|
528
535
|
deploy: "Reinstalls your npm dependencies",
|
|
536
|
+
project: "Target a specific project",
|
|
529
537
|
verbose: "Enable verbose output"
|
|
530
538
|
};
|
|
531
|
-
buddy.command("deploy", descriptions.deploy).option("--domain", "Specify a domain to deploy to", { default: undefined }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
539
|
+
buddy.command("deploy", descriptions.deploy).option("--domain", "Specify a domain to deploy to", { default: undefined }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
532
540
|
const startTime = await intro6("buddy deploy");
|
|
533
541
|
const domain = options.domain || app.url;
|
|
534
542
|
if (!domain) {
|
|
@@ -554,35 +562,34 @@ function deploy(buddy) {
|
|
|
554
562
|
if (await hasUserDomainBeenAddedToCloud(domain)) {
|
|
555
563
|
log6.success("Your domain is properly configured.");
|
|
556
564
|
log6.info("Your cloud is deploying...");
|
|
557
|
-
console.log(
|
|
565
|
+
console.log(`${italic2("This may take a while...")}`);
|
|
558
566
|
await new Promise((resolve2) => setTimeout(resolve2, 2000));
|
|
559
567
|
options.domain = domain;
|
|
560
|
-
|
|
561
|
-
console.log("");
|
|
562
|
-
log6.info(` \uD83D\uDC4B It appears to be your first ${italic2(domain)} deployment.`);
|
|
563
|
-
console.log("");
|
|
564
|
-
log6.info(italic2("Let\u2019s ensure it is all connected properly."));
|
|
565
|
-
log6.info(italic2("One moment..."));
|
|
566
|
-
console.log("");
|
|
567
|
-
options.domain = domain;
|
|
568
|
-
const result2 = await addDomain({
|
|
569
|
-
...options,
|
|
570
|
-
deploy: true,
|
|
571
|
-
startTime
|
|
572
|
-
});
|
|
568
|
+
const result2 = await runAction5(Action5.Deploy, options);
|
|
573
569
|
if (result2.isErr()) {
|
|
574
570
|
await outro6("While running the `buddy deploy`, there was an issue", { startTime, useSeconds: true }, result2.error);
|
|
575
571
|
process8.exit(ExitCode7.FatalError);
|
|
576
572
|
}
|
|
577
|
-
await outro6("
|
|
573
|
+
await outro6("Deployment succeeded.", { startTime, useSeconds: true });
|
|
578
574
|
process8.exit(ExitCode7.Success);
|
|
579
575
|
}
|
|
580
|
-
|
|
576
|
+
console.log("");
|
|
577
|
+
log6.info(` \uD83D\uDC4B It appears to be your first ${italic2(domain)} deployment.`);
|
|
578
|
+
console.log("");
|
|
579
|
+
log6.info(italic2("Let\u2019s ensure it is all connected properly."));
|
|
580
|
+
log6.info(italic2("One moment..."));
|
|
581
|
+
console.log("");
|
|
582
|
+
options.domain = domain;
|
|
583
|
+
const result = await addDomain({
|
|
584
|
+
...options,
|
|
585
|
+
deploy: true,
|
|
586
|
+
startTime
|
|
587
|
+
});
|
|
581
588
|
if (result.isErr()) {
|
|
582
589
|
await outro6("While running the `buddy deploy`, there was an issue", { startTime, useSeconds: true }, result.error);
|
|
583
590
|
process8.exit(ExitCode7.FatalError);
|
|
584
591
|
}
|
|
585
|
-
await outro6("
|
|
592
|
+
await outro6("Added your domain.", { startTime, useSeconds: true });
|
|
586
593
|
process8.exit(ExitCode7.Success);
|
|
587
594
|
});
|
|
588
595
|
buddy.on("deploy:*", () => {
|
|
@@ -594,10 +601,17 @@ function deploy(buddy) {
|
|
|
594
601
|
// src/commands/dev.ts
|
|
595
602
|
import process9 from "process";
|
|
596
603
|
import {Action as Action6} from "@stacksjs/enums";
|
|
597
|
-
import {
|
|
604
|
+
import {
|
|
605
|
+
runAction as runAction6,
|
|
606
|
+
runApiDevServer,
|
|
607
|
+
runComponentsDevServer,
|
|
608
|
+
runDashboardDevServer,
|
|
609
|
+
runDocsDevServer,
|
|
610
|
+
runFrontendDevServer,
|
|
611
|
+
runSystemTrayDevServer
|
|
612
|
+
} from "@stacksjs/actions";
|
|
598
613
|
import {ExitCode as ExitCode8} from "@stacksjs/types";
|
|
599
614
|
import {intro as intro7, log as log7, outro as outro7, prompt as prompt2, runCommand as runCommand4} from "@stacksjs/cli";
|
|
600
|
-
import {sleep} from "@stacksjs/utils";
|
|
601
615
|
import {libsPath} from "@stacksjs/path";
|
|
602
616
|
function dev(buddy) {
|
|
603
617
|
const descriptions = {
|
|
@@ -609,14 +623,15 @@ function dev(buddy) {
|
|
|
609
623
|
api: "Start the local API development server",
|
|
610
624
|
email: "Start the Email development server",
|
|
611
625
|
docs: "Start the Documentation development server",
|
|
626
|
+
systemTray: "Start the System Tray development server",
|
|
612
627
|
interactive: "Get asked which development server to start",
|
|
613
628
|
select: "Which development server are you trying to start?",
|
|
614
629
|
withLocalhost: "Include the localhost URL in the output",
|
|
630
|
+
project: "Target a specific project",
|
|
615
631
|
verbose: "Enable verbose output"
|
|
616
632
|
};
|
|
617
|
-
buddy.command("dev [server]", descriptions.dev).option("-f, --frontend", descriptions.frontend).option("-a, --api", descriptions.api).option("-e, --email", descriptions.email).option("-c, --components", descriptions.components).option("-d, --dashboard", descriptions.dashboard).option("-t, --desktop", descriptions.desktop).option("-d, --docs", descriptions.docs).option("-i, --interactive", descriptions.interactive, { default: false }).option("-l, --with-localhost", descriptions.withLocalhost, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (server, options) => {
|
|
633
|
+
buddy.command("dev [server]", descriptions.dev).option("-f, --frontend", descriptions.frontend).option("-a, --api", descriptions.api).option("-e, --email", descriptions.email).option("-c, --components", descriptions.components).option("-d, --dashboard", descriptions.dashboard).option("-t, --desktop", descriptions.desktop).option("-d, --docs", descriptions.docs).option("-t, --system-tray", descriptions.systemTray).option("-i, --interactive", descriptions.interactive, { default: false }).option("-l, --with-localhost", descriptions.withLocalhost, { default: false }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (server, options) => {
|
|
618
634
|
const perf = await intro7("buddy dev");
|
|
619
|
-
await sleep(100);
|
|
620
635
|
switch (server) {
|
|
621
636
|
case "frontend":
|
|
622
637
|
await runFrontendDevServer(options);
|
|
@@ -627,9 +642,15 @@ function dev(buddy) {
|
|
|
627
642
|
case "components":
|
|
628
643
|
await runComponentsDevServer(options);
|
|
629
644
|
break;
|
|
645
|
+
case "dashboard":
|
|
646
|
+
await runDashboardDevServer(options);
|
|
647
|
+
break;
|
|
630
648
|
case "desktop":
|
|
631
649
|
await runDesktopDevServer(options);
|
|
632
650
|
break;
|
|
651
|
+
case "system-tray":
|
|
652
|
+
await runSystemTrayDevServer(options);
|
|
653
|
+
break;
|
|
633
654
|
case "docs":
|
|
634
655
|
await runDocsDevServer(options);
|
|
635
656
|
break;
|
|
@@ -641,6 +662,7 @@ function dev(buddy) {
|
|
|
641
662
|
{ value: "all", label: "All" },
|
|
642
663
|
{ value: "frontend", label: "Frontend" },
|
|
643
664
|
{ value: "api", label: "Backend" },
|
|
665
|
+
{ value: "dashboard", label: "Dashboard" },
|
|
644
666
|
{ value: "desktop", label: "Desktop" },
|
|
645
667
|
{ value: "email", label: "Email" },
|
|
646
668
|
{ value: "components", label: "Components" },
|
|
@@ -651,6 +673,8 @@ function dev(buddy) {
|
|
|
651
673
|
await runComponentsDevServer(options);
|
|
652
674
|
} else if (answer === "api") {
|
|
653
675
|
await runApiDevServer(options);
|
|
676
|
+
} else if (answer === "dashboard") {
|
|
677
|
+
await runDashboardDevServer(options);
|
|
654
678
|
} else if (answer === "docs") {
|
|
655
679
|
await runDocsDevServer(options);
|
|
656
680
|
} else {
|
|
@@ -669,7 +693,7 @@ function dev(buddy) {
|
|
|
669
693
|
outro7("Exited", { startTime: perf, useSeconds: true });
|
|
670
694
|
process9.exit(ExitCode8.Success);
|
|
671
695
|
});
|
|
672
|
-
buddy.command("dev:components", descriptions.components).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
696
|
+
buddy.command("dev:components", descriptions.components).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
673
697
|
const perf = await intro7("buddy dev:components");
|
|
674
698
|
const result = await runCommand4("bun run dev", {
|
|
675
699
|
cwd: libsPath("components/vue")
|
|
@@ -684,7 +708,7 @@ function dev(buddy) {
|
|
|
684
708
|
await outro7("Exited", { startTime: perf, useSeconds: true });
|
|
685
709
|
process9.exit(ExitCode8.Success);
|
|
686
710
|
});
|
|
687
|
-
buddy.command("dev:docs", descriptions.docs).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
711
|
+
buddy.command("dev:docs", descriptions.docs).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
688
712
|
const perf = await intro7("buddy dev:docs");
|
|
689
713
|
const result = await runAction6(Action6.DevDocs, options);
|
|
690
714
|
if (result.isErr()) {
|
|
@@ -695,7 +719,7 @@ function dev(buddy) {
|
|
|
695
719
|
await outro7("Exited", { startTime: perf, useSeconds: true });
|
|
696
720
|
process9.exit(ExitCode8.Success);
|
|
697
721
|
});
|
|
698
|
-
buddy.command("dev:desktop", descriptions.desktop).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
722
|
+
buddy.command("dev:desktop", descriptions.desktop).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
699
723
|
const perf = await intro7("buddy dev:desktop");
|
|
700
724
|
const result = await runAction6(Action6.DevDesktop, options);
|
|
701
725
|
if (result.isErr()) {
|
|
@@ -706,12 +730,18 @@ function dev(buddy) {
|
|
|
706
730
|
await outro7("Exited", { startTime: perf, useSeconds: true });
|
|
707
731
|
process9.exit(ExitCode8.Success);
|
|
708
732
|
});
|
|
709
|
-
buddy.command("dev:api", descriptions.api).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
733
|
+
buddy.command("dev:api", descriptions.api).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
710
734
|
await runApiDevServer(options);
|
|
711
|
-
});
|
|
712
|
-
buddy.command("dev:frontend", descriptions.frontend).alias("dev:pages").alias("dev:views").option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
735
|
+
}).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false });
|
|
736
|
+
buddy.command("dev:frontend", descriptions.frontend).alias("dev:pages").alias("dev:views").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
713
737
|
await runFrontendDevServer(options);
|
|
714
738
|
});
|
|
739
|
+
buddy.command("dev:dashboard", descriptions.dashboard).alias("dev:admin").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
740
|
+
await runDashboardDevServer(options);
|
|
741
|
+
});
|
|
742
|
+
buddy.command("dev:system-tray", descriptions.systemTray).alias("dev:tray").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
743
|
+
await runSystemTrayDevServer(options);
|
|
744
|
+
});
|
|
715
745
|
buddy.on("dev:*", () => {
|
|
716
746
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
717
747
|
process9.exit(1);
|
|
@@ -742,10 +772,11 @@ function domains(buddy) {
|
|
|
742
772
|
add: "Add a domain to your cloud",
|
|
743
773
|
remove: "Remove a domain from your cloud",
|
|
744
774
|
skip: "Skip the confirmation prompt",
|
|
775
|
+
project: "Target a specific project",
|
|
745
776
|
verbose: "Enable verbose output"
|
|
746
777
|
};
|
|
747
778
|
const c = config5.dns.contactInfo;
|
|
748
|
-
buddy.command("domains:purchase <domain>", descriptions.purchase).option("--years <years>", "Number of years to purchase the domain for", { default: 1 }).option("--privacy", "Enable privacy protection", { default: true }).option("--auto-renew", "Enable auto-renew", { default: true }).option("--first-name <firstName>", "Registrant first name", { default: c?.firstName }).option("--last-name <lastName>", "Registrant last name", { default: c?.lastName }).option("--organization <organization>", "Registrant organization name", { default: c?.organizationName }).option("--address-line1 <address>", "Registrant address line 1", { default: c?.addressLine1 }).option("--address-line2 <address>", "Registrant address line 2", { default: c?.addressLine2 }).option("--city <city>", "Registrant city", { default: c?.city }).option("--state <state>", "Registrant state", { default: c?.state }).option("--country <country>", "Registrant country code", { default: c?.countryCode }).option("--zip <zip>", "Registrant zip", { default: c?.zip }).option("--phone <phone>", "Registrant phone", { default: c?.phoneNumber }).option("--email <email>", "Registrant email", { default: c?.email }).option("--admin-first-name <firstName>", "Admin first name", { default: c?.admin?.firstName || c?.firstName }).option("--admin-last-name <lastName>", "Admin last name", { default: c?.admin?.lastName || c?.lastName }).option("--admin-organization <organization>", "Admin organization", { default: c?.admin?.organizationName || c?.organizationName }).option("--admin-address-line1 <address>", "Admin address line 1", { default: c?.admin?.addressLine1 || c?.addressLine1 }).option("--admin-address-line2 <address>", "Admin address line 2", { default: c?.admin?.addressLine2 || c?.addressLine2 }).option("--admin-city <city>", "Admin city", { default: c?.admin?.city || c?.city }).option("--admin-state <state>", "Admin state", { default: c?.admin?.state || c?.state }).option("--admin-country <country>", "Admin country code", { default: c?.admin?.countryCode || c?.countryCode }).option("--admin-zip <zip>", "Admin zip", { default: c?.admin?.zip || c?.zip }).option("--admin-phone <phone>", "Admin phone number", { default: c?.admin?.phoneNumber || c?.phoneNumber }).option("--admin-email <email>", "Admin email", { default: c?.admin?.email || c?.email }).option("--tech-first-name <firstName>", "Tech first name", { default: c?.tech?.firstName || c?.firstName }).option("--tech-last-name <lastName>", "Tech last name", { default: c?.tech?.lastName || c?.lastName }).option("--tech-organization <organization>", "Tech organization name", { default: c?.tech?.organizationName || c?.organizationName }).option("--tech-address-line1 <address>", "Tech address line 1", { default: c?.tech?.addressLine1 || c?.addressLine1 }).option("--tech-address-line2 <address>", "Tech address line 2", { default: c?.tech?.addressLine2 || c?.addressLine2 }).option("--tech-city <city>", "Tech city", { default: c?.tech?.city || c?.city }).option("--tech-state <state>", "Tech state", { default: c?.tech?.state || c?.state }).option("--tech-country <country>", "Tech country", { default: c?.tech?.countryCode || c?.countryCode }).option("--tech-zip <zip>", "Tech zip", { default: c?.tech?.zip || c?.zip }).option("--tech-phone <phone>", "Tech phone", { default: c?.tech?.phoneNumber || c?.phoneNumber }).option("--tech-email <email>", "Tech email", { default: c?.tech?.email || c?.email }).option("--privacy-admin", "Enable privacy protection for admin", { default: c?.privacyAdmin || c?.privacy || true }).option("--privacy-tech", "Enable privacy protection for tech", { default: c?.privacyTech || c?.privacy || true }).option("--privacy-registrant", "Enable privacy protection for registrant", { default: c?.privacyRegistrant || c?.privacy || true }).option("--contact-type <type>", "Contact type", { default: "person" }).option("--verbose", descriptions.verbose, { default: false }).action(async (domain, options) => {
|
|
779
|
+
buddy.command("domains:purchase <domain>", descriptions.purchase).option("--years <years>", "Number of years to purchase the domain for", { default: 1 }).option("--privacy", "Enable privacy protection", { default: true }).option("--auto-renew", "Enable auto-renew", { default: true }).option("--first-name <firstName>", "Registrant first name", { default: c?.firstName }).option("--last-name <lastName>", "Registrant last name", { default: c?.lastName }).option("--organization <organization>", "Registrant organization name", { default: c?.organizationName }).option("--address-line1 <address>", "Registrant address line 1", { default: c?.addressLine1 }).option("--address-line2 <address>", "Registrant address line 2", { default: c?.addressLine2 }).option("--city <city>", "Registrant city", { default: c?.city }).option("--state <state>", "Registrant state", { default: c?.state }).option("--country <country>", "Registrant country code", { default: c?.countryCode }).option("--zip <zip>", "Registrant zip", { default: c?.zip }).option("--phone <phone>", "Registrant phone", { default: c?.phoneNumber }).option("--email <email>", "Registrant email", { default: c?.email }).option("--admin-first-name <firstName>", "Admin first name", { default: c?.admin?.firstName || c?.firstName }).option("--admin-last-name <lastName>", "Admin last name", { default: c?.admin?.lastName || c?.lastName }).option("--admin-organization <organization>", "Admin organization", { default: c?.admin?.organizationName || c?.organizationName }).option("--admin-address-line1 <address>", "Admin address line 1", { default: c?.admin?.addressLine1 || c?.addressLine1 }).option("--admin-address-line2 <address>", "Admin address line 2", { default: c?.admin?.addressLine2 || c?.addressLine2 }).option("--admin-city <city>", "Admin city", { default: c?.admin?.city || c?.city }).option("--admin-state <state>", "Admin state", { default: c?.admin?.state || c?.state }).option("--admin-country <country>", "Admin country code", { default: c?.admin?.countryCode || c?.countryCode }).option("--admin-zip <zip>", "Admin zip", { default: c?.admin?.zip || c?.zip }).option("--admin-phone <phone>", "Admin phone number", { default: c?.admin?.phoneNumber || c?.phoneNumber }).option("--admin-email <email>", "Admin email", { default: c?.admin?.email || c?.email }).option("--tech-first-name <firstName>", "Tech first name", { default: c?.tech?.firstName || c?.firstName }).option("--tech-last-name <lastName>", "Tech last name", { default: c?.tech?.lastName || c?.lastName }).option("--tech-organization <organization>", "Tech organization name", { default: c?.tech?.organizationName || c?.organizationName }).option("--tech-address-line1 <address>", "Tech address line 1", { default: c?.tech?.addressLine1 || c?.addressLine1 }).option("--tech-address-line2 <address>", "Tech address line 2", { default: c?.tech?.addressLine2 || c?.addressLine2 }).option("--tech-city <city>", "Tech city", { default: c?.tech?.city || c?.city }).option("--tech-state <state>", "Tech state", { default: c?.tech?.state || c?.state }).option("--tech-country <country>", "Tech country", { default: c?.tech?.countryCode || c?.countryCode }).option("--tech-zip <zip>", "Tech zip", { default: c?.tech?.zip || c?.zip }).option("--tech-phone <phone>", "Tech phone", { default: c?.tech?.phoneNumber || c?.phoneNumber }).option("--tech-email <email>", "Tech email", { default: c?.tech?.email || c?.email }).option("--privacy-admin", "Enable privacy protection for admin", { default: c?.privacyAdmin || c?.privacy || true }).option("--privacy-tech", "Enable privacy protection for tech", { default: c?.privacyTech || c?.privacy || true }).option("--privacy-registrant", "Enable privacy protection for registrant", { default: c?.privacyRegistrant || c?.privacy || true }).option("--contact-type <type>", "Contact type", { default: "person" }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (domain, options) => {
|
|
749
780
|
options.domain = domain;
|
|
750
781
|
const startTime = await intro8("buddy domains:purchase");
|
|
751
782
|
const result = await runAction7(Action7.DomainsPurchase, options);
|
|
@@ -834,9 +865,10 @@ function dns3(buddy) {
|
|
|
834
865
|
short: "Short mode: display nothing but the first result",
|
|
835
866
|
json: "Display the output as JSON",
|
|
836
867
|
pretty: "Display the output as JSON in a pretty format",
|
|
868
|
+
project: "Target a specific project",
|
|
837
869
|
verbose: "Enable verbose output"
|
|
838
870
|
};
|
|
839
|
-
buddy.command("dns [domain]", descriptions.dns).option("-q, --query <query>", descriptions.query).option("-t, --type <type>", descriptions.type, { default: "ANY" }).option("-n, --nameserver <nameserver>", descriptions.nameserver).option("--class <class>", descriptions.nameserver).option("-U, --udp", descriptions.udp).option("-T, --tcp", descriptions.tcp).option("-S, --tls", descriptions.tls).option("-H, --https", descriptions.https).option("-1, --short", descriptions.short, { default: false }).option("-J, --json", descriptions.json, { default: false }).option("-p, --pretty", descriptions.pretty, { default: true }).option("--verbose", descriptions.verbose, { default: false }).action(async (domain, options) => {
|
|
871
|
+
buddy.command("dns [domain]", descriptions.dns).option("-q, --query <query>", descriptions.query).option("-t, --type <type>", descriptions.type, { default: "ANY" }).option("-n, --nameserver <nameserver>", descriptions.nameserver).option("--class <class>", descriptions.nameserver).option("-U, --udp", descriptions.udp).option("-T, --tcp", descriptions.tcp).option("-S, --tls", descriptions.tls).option("-H, --https", descriptions.https).option("-1, --short", descriptions.short, { default: false }).option("-J, --json", descriptions.json, { default: false }).option("-p, --pretty", descriptions.pretty, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (domain, options) => {
|
|
840
872
|
delete options.pretty;
|
|
841
873
|
delete options.p;
|
|
842
874
|
const optionsString = Object.entries(options).filter(([key, value]) => key !== "--" && key.length > 1 && value !== false).map(([key, value]) => `--${key} ${value}`).join(" ");
|
|
@@ -856,16 +888,17 @@ function example(buddy) {
|
|
|
856
888
|
vue: "Test your Vue component library",
|
|
857
889
|
webComponents: "Test your web component library",
|
|
858
890
|
select: "Which example are you trying to view?",
|
|
891
|
+
project: "Target a specific project",
|
|
859
892
|
verbose: "Enable verbose output"
|
|
860
893
|
};
|
|
861
|
-
buddy.command("example", descriptions.example).option("-c, --components", descriptions.components).option("-v, --vue", descriptions.vue).option("-w, --web-components", descriptions.webComponents).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
894
|
+
buddy.command("example", descriptions.example).option("-c, --components", descriptions.components).option("-v, --vue", descriptions.vue).option("-w, --web-components", descriptions.webComponents).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
862
895
|
await runExample(options);
|
|
863
896
|
process12.exit(ExitCode11.Success);
|
|
864
897
|
});
|
|
865
|
-
buddy.command("example:vue", descriptions.vue).option("-v, --vue", descriptions.verbose, { default: true }).option("--verbose", descriptions.verbose, { default: false }).alias("example:components").action(async (options) => {
|
|
898
|
+
buddy.command("example:vue", descriptions.vue).option("-v, --vue", descriptions.verbose, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).alias("example:components").action(async (options) => {
|
|
866
899
|
await runExample(options);
|
|
867
900
|
});
|
|
868
|
-
buddy.command("example:web-components", "Test your Web Component library.").option("-w, --web-components", descriptions.verbose, { default: true }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
901
|
+
buddy.command("example:web-components", "Test your Web Component library.").option("-w, --web-components", descriptions.verbose, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
869
902
|
await runExample(options);
|
|
870
903
|
});
|
|
871
904
|
buddy.on("example:*", () => {
|
|
@@ -883,9 +916,10 @@ import {Action as Action8} from "@stacksjs/enums";
|
|
|
883
916
|
function fresh(buddy) {
|
|
884
917
|
const descriptions = {
|
|
885
918
|
fresh: "Reinstalls your npm dependencies",
|
|
919
|
+
project: "Target a specific project",
|
|
886
920
|
verbose: "Enable verbose output"
|
|
887
921
|
};
|
|
888
|
-
buddy.command("fresh", descriptions.fresh).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
922
|
+
buddy.command("fresh", descriptions.fresh).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
889
923
|
const perf = await intro9("buddy fresh");
|
|
890
924
|
const result = await runAction8(Action8.Fresh, { ...options, stdout: "inherit" });
|
|
891
925
|
if (result.isErr()) {
|
|
@@ -926,11 +960,12 @@ function generate(buddy) {
|
|
|
926
960
|
customData: "Generate VS Code custom data (custom-elements.json) for IDEs",
|
|
927
961
|
ideHelpers: "Generate IDE helpers",
|
|
928
962
|
componentMeta: "Generate component meta information",
|
|
929
|
-
|
|
963
|
+
pkgx: "Generate the pkgx configuration file",
|
|
930
964
|
select: "What are you trying to generate?",
|
|
965
|
+
project: "Target a specific project",
|
|
931
966
|
verbose: "Enable verbose output"
|
|
932
967
|
};
|
|
933
|
-
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("-
|
|
968
|
+
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, --pkgx", descriptions.pkgx).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
934
969
|
if (hasNoOptions2(options)) {
|
|
935
970
|
let answers = await prompt3.require().multiselect(descriptions.select, {
|
|
936
971
|
options: [
|
|
@@ -949,25 +984,25 @@ function generate(buddy) {
|
|
|
949
984
|
await startGenerationProcess(options);
|
|
950
985
|
process14.exit(ExitCode13.Success);
|
|
951
986
|
});
|
|
952
|
-
buddy.command("generate:types", descriptions.types).option("--verbose", descriptions.verbose, { default: false }).alias("types:generate").action(async (options) => {
|
|
987
|
+
buddy.command("generate:types", descriptions.types).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).alias("types:generate").action(async (options) => {
|
|
953
988
|
await generateTypes(options);
|
|
954
989
|
});
|
|
955
|
-
buddy.command("generate:entries", descriptions.entries).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
990
|
+
buddy.command("generate:entries", descriptions.entries).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
956
991
|
await generateLibEntries(options);
|
|
957
992
|
});
|
|
958
|
-
buddy.command("generate:web-types", descriptions.webTypes).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
993
|
+
buddy.command("generate:web-types", descriptions.webTypes).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
959
994
|
await generateWebTypes(options);
|
|
960
995
|
});
|
|
961
|
-
buddy.command("generate:vscode-custom-data", descriptions.customData).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
996
|
+
buddy.command("generate:vscode-custom-data", descriptions.customData).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
962
997
|
await generateVsCodeCustomData(options);
|
|
963
998
|
});
|
|
964
|
-
buddy.command("generate:ide-helpers", descriptions.ideHelpers).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
999
|
+
buddy.command("generate:ide-helpers", descriptions.ideHelpers).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
965
1000
|
await generateIdeHelpers(options);
|
|
966
1001
|
});
|
|
967
|
-
buddy.command("generate:component-meta", descriptions.componentMeta).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1002
|
+
buddy.command("generate:component-meta", descriptions.componentMeta).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
968
1003
|
await generateComponentMeta(options);
|
|
969
1004
|
});
|
|
970
|
-
buddy.command("generate:
|
|
1005
|
+
buddy.command("generate:pkgx-config", descriptions.pkgx).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(() => {
|
|
971
1006
|
generatePkgxConfig();
|
|
972
1007
|
});
|
|
973
1008
|
buddy.command("generate:migrations", "Generate Migrations").action(() => {
|
|
@@ -990,9 +1025,10 @@ import {runCommandSync as runCommandSync2} from "@stacksjs/cli";
|
|
|
990
1025
|
function http(buddy) {
|
|
991
1026
|
const descriptions = {
|
|
992
1027
|
http: "Send an HTTP request to a domain",
|
|
1028
|
+
project: "Target a specific project",
|
|
993
1029
|
verbose: "Enable verbose output"
|
|
994
1030
|
};
|
|
995
|
-
buddy.command("http [domain]", descriptions.http).action(async (domain, options) => {
|
|
1031
|
+
buddy.command("http [domain]", descriptions.http).option("-p, --project", descriptions.project, { default: false }).action(async (domain, options) => {
|
|
996
1032
|
const optionsString = Object.entries(options).filter(([key, value]) => key !== "--" && key.length > 1 && value !== false).map(([key, value]) => `--${key} ${value}`).join(" ");
|
|
997
1033
|
const command = `http GET ${domain || config9.app.url} ${optionsString}`;
|
|
998
1034
|
console.log(`Running command: ${command}`);
|
|
@@ -1010,9 +1046,10 @@ function lint(buddy) {
|
|
|
1010
1046
|
const descriptions = {
|
|
1011
1047
|
lint: "Automagically lints your project codebase",
|
|
1012
1048
|
lintFix: "Automagically fixes all lint errors",
|
|
1049
|
+
project: "Target a specific project",
|
|
1013
1050
|
verbose: "Enable verbose output"
|
|
1014
1051
|
};
|
|
1015
|
-
buddy.command("lint", descriptions.lint).option("-f, --fix", descriptions.lintFix, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1052
|
+
buddy.command("lint", descriptions.lint).option("-f, --fix", descriptions.lintFix, { default: false }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1016
1053
|
const startTime = await intro10("buddy lint");
|
|
1017
1054
|
const result = await runAction9(Action9.Lint, { ...options });
|
|
1018
1055
|
if (result.isErr()) {
|
|
@@ -1021,7 +1058,7 @@ function lint(buddy) {
|
|
|
1021
1058
|
}
|
|
1022
1059
|
await outro10("Linted your project", { startTime, useSeconds: true });
|
|
1023
1060
|
});
|
|
1024
|
-
buddy.command("lint:fix", descriptions.lintFix).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1061
|
+
buddy.command("lint:fix", descriptions.lintFix).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1025
1062
|
log8.info("Fixing lint errors...");
|
|
1026
1063
|
const result = await runAction9(Action9.LintFix, { ...options });
|
|
1027
1064
|
if (result.isErr()) {
|
|
@@ -1062,9 +1099,10 @@ import {path as p3} from "@stacksjs/path";
|
|
|
1062
1099
|
function install2(buddy) {
|
|
1063
1100
|
const descriptions = {
|
|
1064
1101
|
install: "Install your dependencies",
|
|
1102
|
+
project: "Target a specific project",
|
|
1065
1103
|
verbose: "Enable verbose output"
|
|
1066
1104
|
};
|
|
1067
|
-
buddy.command("install", descriptions.install).option("-v, --verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1105
|
+
buddy.command("install", descriptions.install).option("-p, --project", descriptions.project, { default: false }).option("-v, --verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1068
1106
|
await runCommand6("bun install", {
|
|
1069
1107
|
...options,
|
|
1070
1108
|
cwd: p3.projectPath()
|
|
@@ -1084,16 +1122,17 @@ import {runAction as runAction11} from "@stacksjs/actions";
|
|
|
1084
1122
|
function key(buddy) {
|
|
1085
1123
|
const descriptions = {
|
|
1086
1124
|
command: "Generate & set the application key.",
|
|
1125
|
+
project: "Target a specific project",
|
|
1087
1126
|
verbose: "Enable verbose output"
|
|
1088
1127
|
};
|
|
1089
|
-
buddy.command("key:generate", descriptions.command).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1090
|
-
|
|
1128
|
+
buddy.command("key:generate", descriptions.command).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1129
|
+
await intro12("buddy key:generate");
|
|
1091
1130
|
const result = await runAction11(Action11.KeyGenerate, options);
|
|
1092
1131
|
if (result.isErr()) {
|
|
1093
1132
|
log9.error("Failed to set random application key.", result.error);
|
|
1094
1133
|
process19.exit();
|
|
1095
1134
|
}
|
|
1096
|
-
await outro12("Random application key set."
|
|
1135
|
+
await outro12("Random application key set.");
|
|
1097
1136
|
});
|
|
1098
1137
|
buddy.on("key:*", () => {
|
|
1099
1138
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
@@ -1131,9 +1170,10 @@ function make(buddy) {
|
|
|
1131
1170
|
notification: "Create a new notification",
|
|
1132
1171
|
stack: "Create a new new stack",
|
|
1133
1172
|
select: "What are you trying to make?",
|
|
1173
|
+
project: "Target a specific project",
|
|
1134
1174
|
verbose: "Enable verbose output"
|
|
1135
1175
|
};
|
|
1136
|
-
buddy.command("make", "The make command").option("-c, --component", descriptions.component, { default: false }).option("-p, --page", descriptions.page, { default: false }).option("-f, --function", descriptions.function, { default: false }).option("-l, --language", descriptions.language, { default: false }).option("-d, --database", descriptions.database, { default: false }).option("-m, --migration", descriptions.migration, { default: false }).option("-f, --factory", descriptions.factory, { default: false }).option("-n, --notification", descriptions.notification, { default: false }).option("-s, --stack", descriptions.stack, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1176
|
+
buddy.command("make", "The make command").option("-c, --component", descriptions.component, { default: false }).option("-p, --page", descriptions.page, { default: false }).option("-f, --function", descriptions.function, { default: false }).option("-l, --language", descriptions.language, { default: false }).option("-d, --database", descriptions.database, { default: false }).option("-m, --migration", descriptions.migration, { default: false }).option("-f, --factory", descriptions.factory, { default: false }).option("-n, --notification", descriptions.notification, { default: false }).option("-s, --stack", descriptions.stack, { default: false }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1137
1177
|
const name = buddy.args[0];
|
|
1138
1178
|
if (!name) {
|
|
1139
1179
|
log10.error("You need to specify a name. Read more about the documentation here.");
|
|
@@ -1162,7 +1202,7 @@ function make(buddy) {
|
|
|
1162
1202
|
await invoke(options);
|
|
1163
1203
|
process20.exit(ExitCode16.Success);
|
|
1164
1204
|
});
|
|
1165
|
-
buddy.command("make:component", descriptions.component).option("-n, --name", "The name of the component").option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1205
|
+
buddy.command("make:component", descriptions.component).option("-n, --name", "The name of the component").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1166
1206
|
const name = buddy.args[0] || options.name;
|
|
1167
1207
|
options.name = name;
|
|
1168
1208
|
if (!name) {
|
|
@@ -1171,7 +1211,7 @@ function make(buddy) {
|
|
|
1171
1211
|
}
|
|
1172
1212
|
await makeComponent(options);
|
|
1173
1213
|
});
|
|
1174
|
-
buddy.command("make:database", descriptions.database).option("-n, --name", "The name of the database").option("--verbose", descriptions.verbose, { default: false }).action((options) => {
|
|
1214
|
+
buddy.command("make:database", descriptions.database).option("-n, --name", "The name of the database").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action((options) => {
|
|
1175
1215
|
const name = buddy.args[0] || options.name;
|
|
1176
1216
|
options.name = name;
|
|
1177
1217
|
if (!name) {
|
|
@@ -1180,7 +1220,7 @@ function make(buddy) {
|
|
|
1180
1220
|
}
|
|
1181
1221
|
makeDatabase(options);
|
|
1182
1222
|
});
|
|
1183
|
-
buddy.command("make:factory", descriptions.factory).option("-n, --name", "The name of the factory").option("--verbose", descriptions.verbose, { default: false }).action((options) => {
|
|
1223
|
+
buddy.command("make:factory", descriptions.factory).option("-n, --name", "The name of the factory").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action((options) => {
|
|
1184
1224
|
const name = buddy.args[0] || options.name;
|
|
1185
1225
|
options.name = name;
|
|
1186
1226
|
if (!name) {
|
|
@@ -1188,7 +1228,7 @@ function make(buddy) {
|
|
|
1188
1228
|
process20.exit();
|
|
1189
1229
|
}
|
|
1190
1230
|
});
|
|
1191
|
-
buddy.command("make:view", descriptions.page).alias("make:page").option("-n, --name", "The name of the page").option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1231
|
+
buddy.command("make:view", descriptions.page).alias("make:page").option("-n, --name", "The name of the page").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1192
1232
|
const name = buddy.args[0] || options.name;
|
|
1193
1233
|
options.name = name;
|
|
1194
1234
|
if (!name) {
|
|
@@ -1197,10 +1237,10 @@ function make(buddy) {
|
|
|
1197
1237
|
}
|
|
1198
1238
|
await makePage(options);
|
|
1199
1239
|
});
|
|
1200
|
-
buddy.command("make:function", descriptions.function).option("-n, --name", "The name of the function").option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1240
|
+
buddy.command("make:function", descriptions.function).option("-n, --name", "The name of the function").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1201
1241
|
await makeFunction(options);
|
|
1202
1242
|
});
|
|
1203
|
-
buddy.command("make:lang", descriptions.language).option("-n, --name", "The name of the language").option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1243
|
+
buddy.command("make:lang", descriptions.language).option("-n, --name", "The name of the language").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1204
1244
|
const name = buddy.args[0] || options.name;
|
|
1205
1245
|
options.name = name;
|
|
1206
1246
|
if (!name) {
|
|
@@ -1209,7 +1249,7 @@ function make(buddy) {
|
|
|
1209
1249
|
}
|
|
1210
1250
|
await makeLanguage(options);
|
|
1211
1251
|
});
|
|
1212
|
-
buddy.command("make:notification", descriptions.notification).option("-n, --name", "The name of the notification").option("-e, --email", "Is it an email notification?", { default: true }).option("-c, --chat", "Is it a chat notification?", { default: false }).option("-s, --sms", "Is it a SMS notification?", { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1252
|
+
buddy.command("make:notification", descriptions.notification).option("-n, --name", "The name of the notification").option("-e, --email", "Is it an email notification?", { default: true }).option("-c, --chat", "Is it a chat notification?", { default: false }).option("-s, --sms", "Is it a SMS notification?", { default: false }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1213
1253
|
const perf = await intro13("buddy make:notification");
|
|
1214
1254
|
const name = buddy.args[0] || options.name;
|
|
1215
1255
|
options.name = name;
|
|
@@ -1225,7 +1265,7 @@ function make(buddy) {
|
|
|
1225
1265
|
await outro13(`Created your ${italic4(name)} notification.`, { startTime: perf, useSeconds: true });
|
|
1226
1266
|
process20.exit(ExitCode16.Success);
|
|
1227
1267
|
});
|
|
1228
|
-
buddy.command("make:stack", descriptions.stack).option("-n, --name", "The name of the stack").option("--verbose", descriptions.verbose, { default: false }).action((options) => {
|
|
1268
|
+
buddy.command("make:stack", descriptions.stack).option("-n, --name", "The name of the stack").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action((options) => {
|
|
1229
1269
|
const name = buddy.args[0] || options.name;
|
|
1230
1270
|
options.name = name;
|
|
1231
1271
|
if (!name) {
|
|
@@ -1258,7 +1298,7 @@ function make(buddy) {
|
|
|
1258
1298
|
});
|
|
1259
1299
|
}
|
|
1260
1300
|
var hasNoOptions3 = function(options) {
|
|
1261
|
-
return !options.component && !options.page && !options.function && !options.language && !options.database && !options.migration && !options.
|
|
1301
|
+
return !options.component && !options.page && !options.function && !options.language && !options.database && !options.migration && !options.notification && !options.stack;
|
|
1262
1302
|
};
|
|
1263
1303
|
|
|
1264
1304
|
// src/commands/migrate.ts
|
|
@@ -1271,9 +1311,10 @@ function migrate(buddy) {
|
|
|
1271
1311
|
const descriptions = {
|
|
1272
1312
|
migrate: "Migrates your database",
|
|
1273
1313
|
dns: "Writes the DNS records for a domain to ./config/dns.ts",
|
|
1314
|
+
project: "Target a specific project",
|
|
1274
1315
|
verbose: "Enable verbose output"
|
|
1275
1316
|
};
|
|
1276
|
-
buddy.command("migrate", descriptions.migrate).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1317
|
+
buddy.command("migrate", descriptions.migrate).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1277
1318
|
const perf = await intro14("buddy migrate");
|
|
1278
1319
|
const result = await runAction12(Action12.Migrate, { ...options });
|
|
1279
1320
|
if (result.isErr()) {
|
|
@@ -1284,7 +1325,7 @@ function migrate(buddy) {
|
|
|
1284
1325
|
await outro14(`Migrated your ${APP_ENV} database.`, { startTime: perf, useSeconds: true });
|
|
1285
1326
|
process21.exit(ExitCode17.Success);
|
|
1286
1327
|
});
|
|
1287
|
-
buddy.command("migrate:dns", descriptions.migrate).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1328
|
+
buddy.command("migrate:dns", descriptions.migrate).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1288
1329
|
const perf = await intro14("buddy migrate");
|
|
1289
1330
|
const result = await runAction12(Action12.MigrateDns, { ...options });
|
|
1290
1331
|
if (result.isErr()) {
|
|
@@ -1308,9 +1349,10 @@ import {runAction as runAction13} from "@stacksjs/actions";
|
|
|
1308
1349
|
function prepublish(buddy) {
|
|
1309
1350
|
const descriptions = {
|
|
1310
1351
|
command: "Run your prepublish script",
|
|
1352
|
+
project: "Target a specific project",
|
|
1311
1353
|
verbose: "Enable verbose output"
|
|
1312
1354
|
};
|
|
1313
|
-
buddy.command("prepublish", descriptions.command).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1355
|
+
buddy.command("prepublish", descriptions.command).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1314
1356
|
await runAction13(Action13.Prepublish, options);
|
|
1315
1357
|
});
|
|
1316
1358
|
buddy.on("prepublish:*", () => {
|
|
@@ -1326,7 +1368,7 @@ import {ExitCode as ExitCode18} from "@stacksjs/types";
|
|
|
1326
1368
|
import {intro as intro15, log as log11, outro as outro15} from "@stacksjs/cli";
|
|
1327
1369
|
import {runAction as runAction14} from "@stacksjs/actions";
|
|
1328
1370
|
function release(buddy) {
|
|
1329
|
-
buddy.command("release", descriptions.release).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1371
|
+
buddy.command("release", descriptions.release).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1330
1372
|
const startTime = await intro15("buddy release");
|
|
1331
1373
|
const result = await runAction14(Action14.Release, { ...options, stdin: "inherit" });
|
|
1332
1374
|
if (result.isErr()) {
|
|
@@ -1342,6 +1384,7 @@ function release(buddy) {
|
|
|
1342
1384
|
}
|
|
1343
1385
|
var descriptions = {
|
|
1344
1386
|
release: "Release a new version of your libraries/packages",
|
|
1387
|
+
project: "Target a specific project",
|
|
1345
1388
|
verbose: "Enable verbose output"
|
|
1346
1389
|
};
|
|
1347
1390
|
|
|
@@ -1354,9 +1397,10 @@ import {Action as Action15} from "@stacksjs/enums";
|
|
|
1354
1397
|
function seed(buddy) {
|
|
1355
1398
|
const descriptions2 = {
|
|
1356
1399
|
seed: "Seed your database",
|
|
1400
|
+
project: "Target a specific project",
|
|
1357
1401
|
verbose: "Enable verbose output"
|
|
1358
1402
|
};
|
|
1359
|
-
buddy.command("seed", descriptions2.seed).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1403
|
+
buddy.command("seed", descriptions2.seed).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1360
1404
|
const perf = await intro16("buddy seed");
|
|
1361
1405
|
const result = await runAction15(Action15.Seed, options);
|
|
1362
1406
|
if (result.isErr()) {
|
|
@@ -1377,19 +1421,19 @@ function seed(buddy) {
|
|
|
1377
1421
|
import process25 from "process";
|
|
1378
1422
|
import {path as p4} from "@stacksjs/path";
|
|
1379
1423
|
import {handleError} from "@stacksjs/error-handling";
|
|
1424
|
+
import {storage as storage3} from "@stacksjs/storage";
|
|
1380
1425
|
import {log as log12, runCommand as runCommand7} from "@stacksjs/cli";
|
|
1381
1426
|
import {ExitCode as ExitCode20} from "@stacksjs/types";
|
|
1382
1427
|
function setup(buddy) {
|
|
1383
1428
|
const descriptions2 = {
|
|
1384
|
-
|
|
1385
|
-
|
|
1429
|
+
setup: "This command ensures your project is setup correctly",
|
|
1430
|
+
project: "Target a specific project",
|
|
1386
1431
|
verbose: "Enable verbose output"
|
|
1387
1432
|
};
|
|
1388
|
-
buddy.command("setup", descriptions2.setup).alias("ensure").option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1389
|
-
if (await
|
|
1390
|
-
await optimizePkgxDeps();
|
|
1391
|
-
else
|
|
1433
|
+
buddy.command("setup", descriptions2.setup).alias("ensure").option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1434
|
+
if (!await isPkgxInstalled())
|
|
1392
1435
|
await installPkgx();
|
|
1436
|
+
await optimizePkgxDeps();
|
|
1393
1437
|
await initializeProject(options);
|
|
1394
1438
|
});
|
|
1395
1439
|
buddy.on("setup:*", () => {
|
|
@@ -1397,22 +1441,21 @@ function setup(buddy) {
|
|
|
1397
1441
|
process25.exit(ExitCode20.FatalError);
|
|
1398
1442
|
});
|
|
1399
1443
|
}
|
|
1400
|
-
async function
|
|
1444
|
+
async function isPkgxInstalled() {
|
|
1401
1445
|
const result = await runCommand7("pkgx --version", { silent: true });
|
|
1402
1446
|
if (result.isOk())
|
|
1403
1447
|
return true;
|
|
1404
1448
|
return false;
|
|
1405
1449
|
}
|
|
1406
1450
|
async function installPkgx() {
|
|
1407
|
-
const result = await runCommand7("
|
|
1451
|
+
const result = await runCommand7(p4.frameworkPath("scripts/pkgx-install"));
|
|
1408
1452
|
if (result.isOk())
|
|
1409
1453
|
return;
|
|
1410
1454
|
handleError(result.error);
|
|
1411
1455
|
process25.exit(ExitCode20.FatalError);
|
|
1412
1456
|
}
|
|
1413
1457
|
async function initializeProject(options) {
|
|
1414
|
-
log12.info("
|
|
1415
|
-
await new Promise((resolve2) => setTimeout(resolve2, 1500));
|
|
1458
|
+
log12.info("Installing dependencies...");
|
|
1416
1459
|
const result = await runCommand7("bun install", {
|
|
1417
1460
|
cwd: options.cwd || p4.projectPath()
|
|
1418
1461
|
});
|
|
@@ -1421,16 +1464,19 @@ async function initializeProject(options) {
|
|
|
1421
1464
|
process25.exit(ExitCode20.FatalError);
|
|
1422
1465
|
}
|
|
1423
1466
|
log12.success("Installed node_modules");
|
|
1424
|
-
log12.info("
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1467
|
+
log12.info("Ensuring .env exists...");
|
|
1468
|
+
if (storage3.doesNotExist(p4.projectPath(".env"))) {
|
|
1469
|
+
const envResult = await runCommand7("cp .env.example .env", {
|
|
1470
|
+
cwd: options.cwd || p4.projectPath()
|
|
1471
|
+
});
|
|
1472
|
+
if (envResult.isErr()) {
|
|
1473
|
+
handleError(envResult.error);
|
|
1474
|
+
process25.exit(ExitCode20.FatalError);
|
|
1475
|
+
}
|
|
1476
|
+
log12.success(".env created");
|
|
1477
|
+
} else {
|
|
1478
|
+
log12.success(".env existed");
|
|
1431
1479
|
}
|
|
1432
|
-
log12.success(".env exists");
|
|
1433
|
-
log12.info("\u23F3 Generating application key...");
|
|
1434
1480
|
const keyResult = await runCommand7("buddy key:generate", {
|
|
1435
1481
|
cwd: options.cwd || p4.projectPath()
|
|
1436
1482
|
});
|
|
@@ -1438,20 +1484,10 @@ async function initializeProject(options) {
|
|
|
1438
1484
|
handleError(keyResult.error);
|
|
1439
1485
|
process25.exit(ExitCode20.FatalError);
|
|
1440
1486
|
}
|
|
1441
|
-
log12.
|
|
1442
|
-
log12.info("\u23F3 Ensuring AWS is connected...");
|
|
1443
|
-
const awsResult = await runCommand7("buddy configure:aws", {
|
|
1444
|
-
cwd: options.cwd || p4.projectPath()
|
|
1445
|
-
});
|
|
1446
|
-
if (awsResult.isErr()) {
|
|
1447
|
-
handleError(awsResult.error);
|
|
1448
|
-
process25.exit(ExitCode20.FatalError);
|
|
1449
|
-
}
|
|
1487
|
+
log12.info("Ensuring AWS is connected...");
|
|
1450
1488
|
log12.success("Configured AWS");
|
|
1451
|
-
await new Promise((resolve2) => setTimeout(resolve2, 300));
|
|
1452
1489
|
log12.success("Project is setup");
|
|
1453
|
-
|
|
1454
|
-
log12.info("\uD83C\uDF89 Happy coding!");
|
|
1490
|
+
log12.info("Happy coding! \uD83D\uDC99");
|
|
1455
1491
|
}
|
|
1456
1492
|
async function optimizePkgxDeps() {
|
|
1457
1493
|
return new Promise((resolve2) => setTimeout(resolve2, 300));
|
|
@@ -1472,9 +1508,10 @@ function test(buddy) {
|
|
|
1472
1508
|
unit: "Runs your unit tests",
|
|
1473
1509
|
feature: "Runs your feature tests",
|
|
1474
1510
|
showReport: "Show the test report",
|
|
1511
|
+
project: "Target a specific project",
|
|
1475
1512
|
verbose: "Enable verbose output"
|
|
1476
1513
|
};
|
|
1477
|
-
buddy.command("test", descriptions2.command).option("--ui", descriptions2.ui, { default: false }).option("--verbose", descriptions2.verbose, { default: true }).action(async (options) => {
|
|
1514
|
+
buddy.command("test", descriptions2.command).option("--ui", descriptions2.ui, { default: false }).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: true }).action(async (options) => {
|
|
1478
1515
|
const perf = await intro17("buddy test");
|
|
1479
1516
|
const result = await runAction16(Action16.Test, { ...options, cwd: projectPath() });
|
|
1480
1517
|
if (result.isErr()) {
|
|
@@ -1548,9 +1585,10 @@ import {Action as Action17} from "@stacksjs/enums";
|
|
|
1548
1585
|
function tinker(buddy) {
|
|
1549
1586
|
const descriptions2 = {
|
|
1550
1587
|
tinker: "Tinker with your code",
|
|
1588
|
+
project: "Target a specific project",
|
|
1551
1589
|
verbose: "Enable verbose output"
|
|
1552
1590
|
};
|
|
1553
|
-
buddy.command("tinker", descriptions2.tinker).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1591
|
+
buddy.command("tinker", descriptions2.tinker).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1554
1592
|
const perf = await intro18("buddy tinker");
|
|
1555
1593
|
const result = await runAction17(Action17.Tinker, options);
|
|
1556
1594
|
if (result.isErr()) {
|
|
@@ -1573,12 +1611,13 @@ function types22(buddy) {
|
|
|
1573
1611
|
const descriptions2 = {
|
|
1574
1612
|
generate: "Generate the types of & for your library/libraries",
|
|
1575
1613
|
fix: "wip",
|
|
1614
|
+
project: "Target a specific project",
|
|
1576
1615
|
verbose: "Enable verbose output"
|
|
1577
1616
|
};
|
|
1578
|
-
buddy.command("types:generate", descriptions2.generate).option("--verbose", descriptions2.verbose, { default: false }).action(async () => {
|
|
1617
|
+
buddy.command("types:generate", descriptions2.generate).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async () => {
|
|
1579
1618
|
await generateTypes2();
|
|
1580
1619
|
});
|
|
1581
|
-
buddy.command("types:fix", descriptions2.fix).option("--verbose", descriptions2.verbose, { default: false }).action(async () => {
|
|
1620
|
+
buddy.command("types:fix", descriptions2.fix).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async () => {
|
|
1582
1621
|
});
|
|
1583
1622
|
buddy.on("types:*", () => {
|
|
1584
1623
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
@@ -1602,9 +1641,10 @@ function upgrade(buddy) {
|
|
|
1602
1641
|
all: "Upgrade Node, package manager, project dependencies, and framework",
|
|
1603
1642
|
force: "Overwrite possible local updates with remote framework updates",
|
|
1604
1643
|
select: "What are you trying to upgrade?",
|
|
1644
|
+
project: "Target a specific project",
|
|
1605
1645
|
verbose: "Enable verbose output"
|
|
1606
1646
|
};
|
|
1607
|
-
buddy.command("upgrade", descriptions2.command).option("-c, --framework", descriptions2.framework, { default: false }).option("-d, --dependencies", descriptions2.dependencies, { default: false }).option("-b, --bun", descriptions2.bun, { default: false }).option("-a, --all", descriptions2.all, { default: false }).option("-f, --force", descriptions2.force, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).alias("update").example("buddy upgrade -a --verbose").action(async (options) => {
|
|
1647
|
+
buddy.command("upgrade", descriptions2.command).option("-c, --framework", descriptions2.framework, { default: false }).option("-d, --dependencies", descriptions2.dependencies, { default: false }).option("-b, --bun", descriptions2.bun, { default: false }).option("-a, --all", descriptions2.all, { default: false }).option("-f, --force", descriptions2.force, { default: false }).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).alias("update").example("buddy upgrade -a --verbose").action(async (options) => {
|
|
1608
1648
|
const perf = await intro19("buddy upgrade");
|
|
1609
1649
|
if (hasNoOptions4(options)) {
|
|
1610
1650
|
let answers = await prompt5.require().multiselect(descriptions2.select, {
|
|
@@ -1629,13 +1669,13 @@ function upgrade(buddy) {
|
|
|
1629
1669
|
await outro19("Upgrade complete.", { startTime: perf, useSeconds: true });
|
|
1630
1670
|
process29.exit();
|
|
1631
1671
|
});
|
|
1632
|
-
buddy.command("upgrade:framework", descriptions2.framework).option("--verbose", descriptions2.verbose, { default: false }).example("buddy upgrade:framework --verbose").action(async (options) => {
|
|
1672
|
+
buddy.command("upgrade:framework", descriptions2.framework).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).example("buddy upgrade:framework --verbose").action(async (options) => {
|
|
1633
1673
|
await runAction18(Action18.Upgrade, options);
|
|
1634
1674
|
});
|
|
1635
|
-
buddy.command("upgrade:dependencies", descriptions2.dependencies).option("--verbose", descriptions2.verbose, { default: false }).alias("upgrade:deps").example("buddy upgrade:dependencies --verbose").action(async (options) => {
|
|
1675
|
+
buddy.command("upgrade:dependencies", descriptions2.dependencies).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).alias("upgrade:deps").example("buddy upgrade:dependencies --verbose").action(async (options) => {
|
|
1636
1676
|
await runAction18(Action18.Upgrade, options);
|
|
1637
1677
|
});
|
|
1638
|
-
buddy.command("upgrade:bun", descriptions2.bun).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1678
|
+
buddy.command("upgrade:bun", descriptions2.bun).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1639
1679
|
const perf = await intro19("buddy upgrade:bun");
|
|
1640
1680
|
const result = await runAction18(Action18.UpgradeBun, options);
|
|
1641
1681
|
if (result.isErr()) {
|
|
@@ -1644,7 +1684,7 @@ function upgrade(buddy) {
|
|
|
1644
1684
|
}
|
|
1645
1685
|
process29.exit(ExitCode22.Success);
|
|
1646
1686
|
});
|
|
1647
|
-
buddy.command("upgrade:all", descriptions2.all).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1687
|
+
buddy.command("upgrade:all", descriptions2.all).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1648
1688
|
await runAction18(Action18.Upgrade, options);
|
|
1649
1689
|
});
|
|
1650
1690
|
}
|
|
@@ -1654,14 +1694,14 @@ var hasNoOptions4 = function(options) {
|
|
|
1654
1694
|
|
|
1655
1695
|
// src/commands/version.ts
|
|
1656
1696
|
import {bold as bold3, dim as dim2, green, intro as intro20, log as log13} from "@stacksjs/cli";
|
|
1657
|
-
import {storage as
|
|
1697
|
+
import {storage as storage5} from "@stacksjs/storage";
|
|
1658
1698
|
function version(buddy) {
|
|
1659
1699
|
const descriptions2 = {
|
|
1660
1700
|
version: "Retrieving Stacks build version"
|
|
1661
1701
|
};
|
|
1662
1702
|
buddy.command("version", descriptions2.version).action(async () => {
|
|
1663
1703
|
await intro20("buddy version");
|
|
1664
|
-
const pkg = await
|
|
1704
|
+
const pkg = await storage5.readPackageJson("./package.json");
|
|
1665
1705
|
const bunVersion = "wip";
|
|
1666
1706
|
const stacksVersion = pkg.version;
|
|
1667
1707
|
log13.info(green(bold3("@stacksjs/ ")) + dim2(` ${stacksVersion}`));
|