@stacksjs/buddy 0.58.28 → 0.58.44
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
CHANGED
|
@@ -114,7 +114,7 @@ Develop beautiful, reactive, composable UIs without learning a new set of langua
|
|
|
114
114
|
It's incredibly easy to get started with this framework. Simply run the following command in your terminal:
|
|
115
115
|
|
|
116
116
|
```bash
|
|
117
|
-
|
|
117
|
+
curl -Ssf stacksjs.org | sh # wip
|
|
118
118
|
|
|
119
119
|
# alternatively, if Bun >= v1.0 is installed already,
|
|
120
120
|
# you may also get started via:
|
|
@@ -171,7 +171,7 @@ buddy upgrade:all # auto-upgrades all of the above
|
|
|
171
171
|
buddy dev # starts the frontend dev server
|
|
172
172
|
buddy dev -i # prompts any of the dev servers (components, functions, views, or docs)
|
|
173
173
|
buddy dev:api # starts the API dev server
|
|
174
|
-
buddy dev:
|
|
174
|
+
buddy dev:dashboard # starts the Admin/Dashboard dev server
|
|
175
175
|
buddy dev:desktop # starts the Desktop dev server
|
|
176
176
|
buddy dev:views # starts frontend dev server
|
|
177
177
|
buddy dev:components # starts component dev server
|
|
@@ -15,8 +15,5 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
18
|
-
var __require = (id) => {
|
|
19
|
-
return import.meta.require(id);
|
|
20
|
-
};
|
|
21
18
|
|
|
22
|
-
export { __toESM, __commonJS
|
|
19
|
+
export { __toESM, __commonJS };
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__require,
|
|
3
|
-
__toESM
|
|
4
|
-
} from "./chunk-b75e6db0012faa55.js";
|
|
5
|
-
|
|
6
1
|
// src/commands/build.ts
|
|
7
2
|
import process from "process";
|
|
8
3
|
import {runAction} from "@stacksjs/actions";
|
|
@@ -12,25 +7,60 @@ import {Action} from "@stacksjs/enums";
|
|
|
12
7
|
import {isString} from "@stacksjs/validation";
|
|
13
8
|
function build(buddy) {
|
|
14
9
|
const descriptions = {
|
|
10
|
+
build: "Build any of your libraries (packages) for production use",
|
|
15
11
|
components: "Build your component library",
|
|
16
12
|
vueComponents: "Build your Vue component library",
|
|
17
13
|
webComponents: "Build your framework agnostic web component library",
|
|
18
14
|
elements: "An alias to the -w flag",
|
|
15
|
+
buddy: "Build the Buddy binary",
|
|
19
16
|
functions: "Build your function library",
|
|
20
17
|
desktop: "Build the Desktop Application",
|
|
21
18
|
pages: "Build your frontend",
|
|
22
19
|
docs: "Build your documentation",
|
|
23
20
|
framework: "Build Stacks framework",
|
|
24
21
|
select: "What are you trying to build?",
|
|
22
|
+
project: "Target a specific project",
|
|
25
23
|
verbose: "Enable verbose output"
|
|
26
24
|
};
|
|
27
|
-
buddy.command("build",
|
|
25
|
+
buddy.command("build [type]", descriptions.build).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("-b, --buddy", descriptions.buddy, { default: false }).option("-s, --stacks", descriptions.framework, { default: false }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (server, options) => {
|
|
26
|
+
switch (server) {
|
|
27
|
+
case "components":
|
|
28
|
+
options.components = true;
|
|
29
|
+
break;
|
|
30
|
+
case "vue":
|
|
31
|
+
options.vueComponents = true;
|
|
32
|
+
break;
|
|
33
|
+
case "web-components":
|
|
34
|
+
options.webComponents = true;
|
|
35
|
+
break;
|
|
36
|
+
case "functions":
|
|
37
|
+
options.functions = true;
|
|
38
|
+
break;
|
|
39
|
+
case "views":
|
|
40
|
+
options.views = true;
|
|
41
|
+
break;
|
|
42
|
+
case "docs":
|
|
43
|
+
options.docs = true;
|
|
44
|
+
break;
|
|
45
|
+
case "buddy":
|
|
46
|
+
options.buddy = true;
|
|
47
|
+
break;
|
|
48
|
+
case "cli":
|
|
49
|
+
options.buddy = true;
|
|
50
|
+
break;
|
|
51
|
+
case "stacks":
|
|
52
|
+
options.stacks = true;
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
28
57
|
if (hasNoOptions(options)) {
|
|
29
58
|
let answers = await prompt.require().multiselect(descriptions.select, {
|
|
30
59
|
options: [
|
|
31
60
|
{ label: "Components", value: "components" },
|
|
61
|
+
{ label: "Web Components", value: "web-components" },
|
|
32
62
|
{ label: "Functions", value: "functions" },
|
|
33
|
-
{ label: "
|
|
63
|
+
{ label: "Views", value: "views" },
|
|
34
64
|
{ label: "Documentation", value: "docs" }
|
|
35
65
|
]
|
|
36
66
|
});
|
|
@@ -43,34 +73,34 @@ function build(buddy) {
|
|
|
43
73
|
await runAction(Action.BuildStacks, options);
|
|
44
74
|
process.exit(ExitCode.Success);
|
|
45
75
|
});
|
|
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) => {
|
|
76
|
+
buddy.command("build:components", "Automagically build component libraries for production use & npm/CDN distribution").alias("prod:components").option("-c, --components", descriptions.components, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
47
77
|
await runAction(Action.BuildComponentLibs, options);
|
|
48
78
|
});
|
|
49
|
-
buddy.command("build:cli", "Automagically build the CLI").option("-
|
|
79
|
+
buddy.command("build:cli", "Automagically build the CLI").alias("prod:cli").option("-b, --buddy", descriptions.buddy, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
50
80
|
await runAction(Action.BuildCli, options);
|
|
51
81
|
});
|
|
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) => {
|
|
82
|
+
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
83
|
await runAction(Action.BuildFunctionLib, options);
|
|
54
84
|
});
|
|
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) => {
|
|
85
|
+
buddy.command("build:vue-components", "Automagically build Vue component library for npm/CDN distribution").alias("build:vue").alias("prod:vue-components").alias("prod:vue").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
86
|
await runAction(Action.BuildVueComponentLib, options);
|
|
57
87
|
});
|
|
58
|
-
buddy.command("build:web-components", "Automagically build Web Component library for npm/CDN distribution").option("-w, --web-components", descriptions.webComponents, { default: true }).option("--
|
|
88
|
+
buddy.command("build:web-components", "Automagically build Web Component library for npm/CDN distribution").alias("build:wc").alias("prod:web-components").alias("prod:wc").option("-w, --web-components", descriptions.webComponents, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
59
89
|
await runAction(Action.BuildWebComponentLib, options);
|
|
60
90
|
});
|
|
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) => {
|
|
91
|
+
buddy.command("build:docs", "Automagically build your documentation site.").alias("prod:docs").alias("build:documentation").alias("prod:documentation").option("-d, --docs", descriptions.docs, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
62
92
|
await runAction(Action.BuildDocs, options);
|
|
63
93
|
});
|
|
64
|
-
buddy.command("build:core", "Automagically build the Stacks core.").option("--verbose", descriptions.verbose, { default:
|
|
94
|
+
buddy.command("build:core", "Automagically build the Stacks core.").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
65
95
|
const startTime = await intro("buddy build:core");
|
|
66
96
|
const result = await runAction(Action.BuildCore, options);
|
|
67
97
|
if (result.isErr()) {
|
|
68
98
|
log2.error("Failed to build the Stacks core.", result.error);
|
|
69
99
|
process.exit();
|
|
70
100
|
}
|
|
71
|
-
await outro("
|
|
101
|
+
await outro("Core packages built successfully", { startTime, useSeconds: true });
|
|
72
102
|
});
|
|
73
|
-
buddy.command("build:desktop", descriptions.desktop).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
103
|
+
buddy.command("build:desktop", descriptions.desktop).alias("prod:desktop").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
74
104
|
const perf = await intro("buddy build:desktop");
|
|
75
105
|
const result = await runAction(Action.BuildDesktop, options);
|
|
76
106
|
if (result.isErr()) {
|
|
@@ -81,7 +111,7 @@ function build(buddy) {
|
|
|
81
111
|
await outro("Exited", { startTime: perf, useSeconds: true });
|
|
82
112
|
process.exit(ExitCode.Success);
|
|
83
113
|
});
|
|
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) => {
|
|
114
|
+
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
115
|
const startTime = await intro("buddy build:stacks");
|
|
86
116
|
const result = await runAction(Action.BuildStacks, options);
|
|
87
117
|
if (result.isErr()) {
|
|
@@ -96,7 +126,7 @@ function build(buddy) {
|
|
|
96
126
|
});
|
|
97
127
|
}
|
|
98
128
|
var hasNoOptions = function(options) {
|
|
99
|
-
return !options.components && !options.vueComponents && !options.webComponents && !options.elements && !options.functions && !options.
|
|
129
|
+
return !options.components && !options.vueComponents && !options.webComponents && !options.elements && !options.functions && !options.views && !options.docs && !options.stacks && !options.buddy;
|
|
100
130
|
};
|
|
101
131
|
|
|
102
132
|
// src/commands/changelog.ts
|
|
@@ -109,9 +139,10 @@ function changelog(buddy) {
|
|
|
109
139
|
const descriptions = {
|
|
110
140
|
changelog: "Create a CHANGELOG.md file",
|
|
111
141
|
quiet: "Minimal output",
|
|
142
|
+
project: "Target a specific project",
|
|
112
143
|
verbose: "Enable verbose output"
|
|
113
144
|
};
|
|
114
|
-
buddy.command("changelog", descriptions.changelog).option("--quiet", descriptions.quiet, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
145
|
+
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
146
|
const perf = await intro2("buddy changelog");
|
|
116
147
|
const result = await runAction2(Action2.Changelog, options);
|
|
117
148
|
if (result.isErr()) {
|
|
@@ -136,9 +167,10 @@ import {Action as Action3} from "@stacksjs/enums";
|
|
|
136
167
|
function clean(buddy) {
|
|
137
168
|
const descriptions = {
|
|
138
169
|
clean: "Removes all node_modules & lock files",
|
|
170
|
+
project: "Target a specific project",
|
|
139
171
|
verbose: "Enable verbose output"
|
|
140
172
|
};
|
|
141
|
-
buddy.command("clean", descriptions.clean).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
173
|
+
buddy.command("clean", descriptions.clean).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
142
174
|
const perf = await intro3("buddy clean");
|
|
143
175
|
const result = await runAction3(Action3.Clean, options);
|
|
144
176
|
if (result.isErr()) {
|
|
@@ -169,9 +201,10 @@ function cloud2(buddy) {
|
|
|
169
201
|
remove: "Removes the Stacks Cloud. In case it fails, try again",
|
|
170
202
|
optimizeCost: "Removes certain resources that may be re-applied at a later time",
|
|
171
203
|
cleanUp: "Removes all resources that were retained during the cloud deletion",
|
|
204
|
+
project: "Target a specific project",
|
|
172
205
|
verbose: "Enable verbose output"
|
|
173
206
|
};
|
|
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) => {
|
|
207
|
+
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
208
|
if (options.ssh || options.connect) {
|
|
176
209
|
const startTime = performance.now();
|
|
177
210
|
const jumpBoxId = await getJumpBoxInstanceId();
|
|
@@ -190,7 +223,7 @@ function cloud2(buddy) {
|
|
|
190
223
|
log3.info("Not implemented yet. Please use the --ssh (or --connect) flag to connect to the Stacks Cloud.");
|
|
191
224
|
process4.exit(ExitCode4.Success);
|
|
192
225
|
});
|
|
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) => {
|
|
226
|
+
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
227
|
const startTime = await intro4("buddy cloud:add");
|
|
195
228
|
if (options.jumpBox) {
|
|
196
229
|
const { confirm } = await prompts({
|
|
@@ -220,7 +253,7 @@ function cloud2(buddy) {
|
|
|
220
253
|
log3.info("This functionality is not yet implemented.");
|
|
221
254
|
process4.exit(ExitCode4.Success);
|
|
222
255
|
});
|
|
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) => {
|
|
256
|
+
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
257
|
const startTime = await intro4("buddy cloud:remove");
|
|
225
258
|
if (options.jumpBox) {
|
|
226
259
|
const { confirm } = await prompts({
|
|
@@ -275,7 +308,7 @@ function cloud2(buddy) {
|
|
|
275
308
|
process4.exit(ExitCode4.FatalError);
|
|
276
309
|
}
|
|
277
310
|
});
|
|
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) => {
|
|
311
|
+
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
312
|
const startTime = await intro4("buddy cloud:remove");
|
|
280
313
|
if (options.jumpBox) {
|
|
281
314
|
const { confirm } = await prompts({
|
|
@@ -294,7 +327,7 @@ function cloud2(buddy) {
|
|
|
294
327
|
await outro4("No cost optimization was applied", { startTime, useSeconds: true });
|
|
295
328
|
process4.exit(ExitCode4.Success);
|
|
296
329
|
});
|
|
297
|
-
buddy.command("cloud:cleanup", descriptions.cleanUp).alias("cloud:clean-up").option("--verbose", descriptions.verbose, { default: false }).action(async () => {
|
|
330
|
+
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
331
|
const startTime = await intro4("buddy cloud:cleanup");
|
|
299
332
|
log3.info(`Cleaning up your cloud resources will take a while to complete. Please be patient.`);
|
|
300
333
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
@@ -359,9 +392,10 @@ import {runCommit} from "@stacksjs/actions";
|
|
|
359
392
|
function commit(buddy) {
|
|
360
393
|
const descriptions = {
|
|
361
394
|
commit: "Commit your stashed changes",
|
|
395
|
+
project: "Target a specific project",
|
|
362
396
|
verbose: "Enable verbose output"
|
|
363
397
|
};
|
|
364
|
-
buddy.command("commit", descriptions.commit).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
398
|
+
buddy.command("commit", descriptions.commit).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
365
399
|
await runCommit(options);
|
|
366
400
|
});
|
|
367
401
|
buddy.on("commit:*", () => {
|
|
@@ -380,9 +414,10 @@ function configure(buddy) {
|
|
|
380
414
|
const descriptions = {
|
|
381
415
|
configure: "Configure options",
|
|
382
416
|
aws: "Configure the AWS connection",
|
|
417
|
+
project: "Target a specific project",
|
|
383
418
|
verbose: "Enable verbose output"
|
|
384
419
|
};
|
|
385
|
-
buddy.command("configure", descriptions.configure).option("--aws", descriptions.aws, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
420
|
+
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
421
|
if (options?.aws) {
|
|
387
422
|
const startTime = performance.now();
|
|
388
423
|
const result = await runCommand2("aws configure", {
|
|
@@ -400,7 +435,7 @@ function configure(buddy) {
|
|
|
400
435
|
log4.info("Not implemented yet. Please use the --aws flag to configure AWS.");
|
|
401
436
|
process6.exit(ExitCode5.Success);
|
|
402
437
|
});
|
|
403
|
-
buddy.command("configure:aws", descriptions.aws).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
438
|
+
buddy.command("configure:aws", descriptions.aws).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
404
439
|
const startTime = performance.now();
|
|
405
440
|
const result = await runCommand2(`aws configure --profile ${config2.app.url}`, {
|
|
406
441
|
...options,
|
|
@@ -436,13 +471,14 @@ function create(buddy) {
|
|
|
436
471
|
components: "Are you building UI components?",
|
|
437
472
|
webComponents: "Automagically built optimized custom elements/web components?",
|
|
438
473
|
vue: "Automagically built a Vue component library?",
|
|
439
|
-
|
|
474
|
+
views: "How about views?",
|
|
440
475
|
functions: "Are you developing functions/composables?",
|
|
441
476
|
api: "Are you building an API?",
|
|
442
477
|
database: "Do you need a database?",
|
|
478
|
+
project: "Target a specific project",
|
|
443
479
|
verbose: "Enable verbose output"
|
|
444
480
|
};
|
|
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.
|
|
481
|
+
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
482
|
const startTime = await intro5("stacks new");
|
|
447
483
|
const name = options.name;
|
|
448
484
|
const path5 = resolve(process7.cwd(), name);
|
|
@@ -485,13 +521,13 @@ var onlineCheck = function() {
|
|
|
485
521
|
};
|
|
486
522
|
async function download(name, path5, options) {
|
|
487
523
|
log5.info("Setting up your stack.");
|
|
488
|
-
const result = await runCommand3(`giget stacks ${name}`, options);
|
|
524
|
+
const result = await runCommand3(`bunx giget stacks ${name}`, options);
|
|
489
525
|
log5.success(`Successfully scaffolded your project at ${cyan(path5)}`);
|
|
490
526
|
return result;
|
|
491
527
|
}
|
|
492
528
|
async function ensureEnv(path5, options) {
|
|
493
529
|
log5.info("Ensuring your environment is ready...");
|
|
494
|
-
await runCommand3("
|
|
530
|
+
await runCommand3("pkgx --update ", { ...options, cwd: path5 });
|
|
495
531
|
log5.success("Environment is ready");
|
|
496
532
|
}
|
|
497
533
|
async function install(path5, options) {
|
|
@@ -526,9 +562,10 @@ import {addDomain, hasUserDomainBeenAddedToCloud} from "@stacksjs/dns";
|
|
|
526
562
|
function deploy(buddy) {
|
|
527
563
|
const descriptions = {
|
|
528
564
|
deploy: "Reinstalls your npm dependencies",
|
|
565
|
+
project: "Target a specific project",
|
|
529
566
|
verbose: "Enable verbose output"
|
|
530
567
|
};
|
|
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) => {
|
|
568
|
+
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
569
|
const startTime = await intro6("buddy deploy");
|
|
533
570
|
const domain = options.domain || app.url;
|
|
534
571
|
if (!domain) {
|
|
@@ -554,35 +591,34 @@ function deploy(buddy) {
|
|
|
554
591
|
if (await hasUserDomainBeenAddedToCloud(domain)) {
|
|
555
592
|
log6.success("Your domain is properly configured.");
|
|
556
593
|
log6.info("Your cloud is deploying...");
|
|
557
|
-
console.log(
|
|
594
|
+
console.log(`${italic2("This may take a while...")}`);
|
|
558
595
|
await new Promise((resolve2) => setTimeout(resolve2, 2000));
|
|
559
596
|
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
|
-
});
|
|
597
|
+
const result2 = await runAction5(Action5.Deploy, options);
|
|
573
598
|
if (result2.isErr()) {
|
|
574
599
|
await outro6("While running the `buddy deploy`, there was an issue", { startTime, useSeconds: true }, result2.error);
|
|
575
600
|
process8.exit(ExitCode7.FatalError);
|
|
576
601
|
}
|
|
577
|
-
await outro6("
|
|
602
|
+
await outro6("Deployment succeeded.", { startTime, useSeconds: true });
|
|
578
603
|
process8.exit(ExitCode7.Success);
|
|
579
604
|
}
|
|
580
|
-
|
|
605
|
+
console.log("");
|
|
606
|
+
log6.info(` \uD83D\uDC4B It appears to be your first ${italic2(domain)} deployment.`);
|
|
607
|
+
console.log("");
|
|
608
|
+
log6.info(italic2("Let\u2019s ensure it is all connected properly."));
|
|
609
|
+
log6.info(italic2("One moment..."));
|
|
610
|
+
console.log("");
|
|
611
|
+
options.domain = domain;
|
|
612
|
+
const result = await addDomain({
|
|
613
|
+
...options,
|
|
614
|
+
deploy: true,
|
|
615
|
+
startTime
|
|
616
|
+
});
|
|
581
617
|
if (result.isErr()) {
|
|
582
618
|
await outro6("While running the `buddy deploy`, there was an issue", { startTime, useSeconds: true }, result.error);
|
|
583
619
|
process8.exit(ExitCode7.FatalError);
|
|
584
620
|
}
|
|
585
|
-
await outro6("
|
|
621
|
+
await outro6("Added your domain.", { startTime, useSeconds: true });
|
|
586
622
|
process8.exit(ExitCode7.Success);
|
|
587
623
|
});
|
|
588
624
|
buddy.on("deploy:*", () => {
|
|
@@ -594,10 +630,18 @@ function deploy(buddy) {
|
|
|
594
630
|
// src/commands/dev.ts
|
|
595
631
|
import process9 from "process";
|
|
596
632
|
import {Action as Action6} from "@stacksjs/enums";
|
|
597
|
-
import {
|
|
633
|
+
import {
|
|
634
|
+
runAction as runAction6,
|
|
635
|
+
runApiDevServer,
|
|
636
|
+
runComponentsDevServer,
|
|
637
|
+
runDashboardDevServer,
|
|
638
|
+
runDesktopDevServer,
|
|
639
|
+
runDocsDevServer,
|
|
640
|
+
runFrontendDevServer,
|
|
641
|
+
runSystemTrayDevServer
|
|
642
|
+
} from "@stacksjs/actions";
|
|
598
643
|
import {ExitCode as ExitCode8} from "@stacksjs/types";
|
|
599
644
|
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
645
|
import {libsPath} from "@stacksjs/path";
|
|
602
646
|
function dev(buddy) {
|
|
603
647
|
const descriptions = {
|
|
@@ -609,14 +653,15 @@ function dev(buddy) {
|
|
|
609
653
|
api: "Start the local API development server",
|
|
610
654
|
email: "Start the Email development server",
|
|
611
655
|
docs: "Start the Documentation development server",
|
|
656
|
+
systemTray: "Start the System Tray development server",
|
|
612
657
|
interactive: "Get asked which development server to start",
|
|
613
658
|
select: "Which development server are you trying to start?",
|
|
614
659
|
withLocalhost: "Include the localhost URL in the output",
|
|
660
|
+
project: "Target a specific project",
|
|
615
661
|
verbose: "Enable verbose output"
|
|
616
662
|
};
|
|
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) => {
|
|
663
|
+
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
664
|
const perf = await intro7("buddy dev");
|
|
619
|
-
await sleep(100);
|
|
620
665
|
switch (server) {
|
|
621
666
|
case "frontend":
|
|
622
667
|
await runFrontendDevServer(options);
|
|
@@ -627,9 +672,15 @@ function dev(buddy) {
|
|
|
627
672
|
case "components":
|
|
628
673
|
await runComponentsDevServer(options);
|
|
629
674
|
break;
|
|
675
|
+
case "dashboard":
|
|
676
|
+
await runDashboardDevServer(options);
|
|
677
|
+
break;
|
|
630
678
|
case "desktop":
|
|
631
679
|
await runDesktopDevServer(options);
|
|
632
680
|
break;
|
|
681
|
+
case "system-tray":
|
|
682
|
+
await runSystemTrayDevServer(options);
|
|
683
|
+
break;
|
|
633
684
|
case "docs":
|
|
634
685
|
await runDocsDevServer(options);
|
|
635
686
|
break;
|
|
@@ -641,6 +692,7 @@ function dev(buddy) {
|
|
|
641
692
|
{ value: "all", label: "All" },
|
|
642
693
|
{ value: "frontend", label: "Frontend" },
|
|
643
694
|
{ value: "api", label: "Backend" },
|
|
695
|
+
{ value: "dashboard", label: "Dashboard" },
|
|
644
696
|
{ value: "desktop", label: "Desktop" },
|
|
645
697
|
{ value: "email", label: "Email" },
|
|
646
698
|
{ value: "components", label: "Components" },
|
|
@@ -651,6 +703,8 @@ function dev(buddy) {
|
|
|
651
703
|
await runComponentsDevServer(options);
|
|
652
704
|
} else if (answer === "api") {
|
|
653
705
|
await runApiDevServer(options);
|
|
706
|
+
} else if (answer === "dashboard") {
|
|
707
|
+
await runDashboardDevServer(options);
|
|
654
708
|
} else if (answer === "docs") {
|
|
655
709
|
await runDocsDevServer(options);
|
|
656
710
|
} else {
|
|
@@ -669,7 +723,7 @@ function dev(buddy) {
|
|
|
669
723
|
outro7("Exited", { startTime: perf, useSeconds: true });
|
|
670
724
|
process9.exit(ExitCode8.Success);
|
|
671
725
|
});
|
|
672
|
-
buddy.command("dev:components", descriptions.components).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
726
|
+
buddy.command("dev:components", descriptions.components).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
673
727
|
const perf = await intro7("buddy dev:components");
|
|
674
728
|
const result = await runCommand4("bun run dev", {
|
|
675
729
|
cwd: libsPath("components/vue")
|
|
@@ -684,7 +738,7 @@ function dev(buddy) {
|
|
|
684
738
|
await outro7("Exited", { startTime: perf, useSeconds: true });
|
|
685
739
|
process9.exit(ExitCode8.Success);
|
|
686
740
|
});
|
|
687
|
-
buddy.command("dev:docs", descriptions.docs).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
741
|
+
buddy.command("dev:docs", descriptions.docs).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
688
742
|
const perf = await intro7("buddy dev:docs");
|
|
689
743
|
const result = await runAction6(Action6.DevDocs, options);
|
|
690
744
|
if (result.isErr()) {
|
|
@@ -695,7 +749,7 @@ function dev(buddy) {
|
|
|
695
749
|
await outro7("Exited", { startTime: perf, useSeconds: true });
|
|
696
750
|
process9.exit(ExitCode8.Success);
|
|
697
751
|
});
|
|
698
|
-
buddy.command("dev:desktop", descriptions.desktop).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
752
|
+
buddy.command("dev:desktop", descriptions.desktop).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
699
753
|
const perf = await intro7("buddy dev:desktop");
|
|
700
754
|
const result = await runAction6(Action6.DevDesktop, options);
|
|
701
755
|
if (result.isErr()) {
|
|
@@ -706,12 +760,18 @@ function dev(buddy) {
|
|
|
706
760
|
await outro7("Exited", { startTime: perf, useSeconds: true });
|
|
707
761
|
process9.exit(ExitCode8.Success);
|
|
708
762
|
});
|
|
709
|
-
buddy.command("dev:api", descriptions.api).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
763
|
+
buddy.command("dev:api", descriptions.api).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
710
764
|
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) => {
|
|
765
|
+
}).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false });
|
|
766
|
+
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
767
|
await runFrontendDevServer(options);
|
|
714
768
|
});
|
|
769
|
+
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) => {
|
|
770
|
+
await runDashboardDevServer(options);
|
|
771
|
+
});
|
|
772
|
+
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) => {
|
|
773
|
+
await runSystemTrayDevServer(options);
|
|
774
|
+
});
|
|
715
775
|
buddy.on("dev:*", () => {
|
|
716
776
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
717
777
|
process9.exit(1);
|
|
@@ -742,10 +802,11 @@ function domains(buddy) {
|
|
|
742
802
|
add: "Add a domain to your cloud",
|
|
743
803
|
remove: "Remove a domain from your cloud",
|
|
744
804
|
skip: "Skip the confirmation prompt",
|
|
805
|
+
project: "Target a specific project",
|
|
745
806
|
verbose: "Enable verbose output"
|
|
746
807
|
};
|
|
747
808
|
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) => {
|
|
809
|
+
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
810
|
options.domain = domain;
|
|
750
811
|
const startTime = await intro8("buddy domains:purchase");
|
|
751
812
|
const result = await runAction7(Action7.DomainsPurchase, options);
|
|
@@ -834,9 +895,10 @@ function dns3(buddy) {
|
|
|
834
895
|
short: "Short mode: display nothing but the first result",
|
|
835
896
|
json: "Display the output as JSON",
|
|
836
897
|
pretty: "Display the output as JSON in a pretty format",
|
|
898
|
+
project: "Target a specific project",
|
|
837
899
|
verbose: "Enable verbose output"
|
|
838
900
|
};
|
|
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) => {
|
|
901
|
+
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
902
|
delete options.pretty;
|
|
841
903
|
delete options.p;
|
|
842
904
|
const optionsString = Object.entries(options).filter(([key, value]) => key !== "--" && key.length > 1 && value !== false).map(([key, value]) => `--${key} ${value}`).join(" ");
|
|
@@ -856,16 +918,17 @@ function example(buddy) {
|
|
|
856
918
|
vue: "Test your Vue component library",
|
|
857
919
|
webComponents: "Test your web component library",
|
|
858
920
|
select: "Which example are you trying to view?",
|
|
921
|
+
project: "Target a specific project",
|
|
859
922
|
verbose: "Enable verbose output"
|
|
860
923
|
};
|
|
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) => {
|
|
924
|
+
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
925
|
await runExample(options);
|
|
863
926
|
process12.exit(ExitCode11.Success);
|
|
864
927
|
});
|
|
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) => {
|
|
928
|
+
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
929
|
await runExample(options);
|
|
867
930
|
});
|
|
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) => {
|
|
931
|
+
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
932
|
await runExample(options);
|
|
870
933
|
});
|
|
871
934
|
buddy.on("example:*", () => {
|
|
@@ -883,9 +946,10 @@ import {Action as Action8} from "@stacksjs/enums";
|
|
|
883
946
|
function fresh(buddy) {
|
|
884
947
|
const descriptions = {
|
|
885
948
|
fresh: "Reinstalls your npm dependencies",
|
|
949
|
+
project: "Target a specific project",
|
|
886
950
|
verbose: "Enable verbose output"
|
|
887
951
|
};
|
|
888
|
-
buddy.command("fresh", descriptions.fresh).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
952
|
+
buddy.command("fresh", descriptions.fresh).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
889
953
|
const perf = await intro9("buddy fresh");
|
|
890
954
|
const result = await runAction8(Action8.Fresh, { ...options, stdout: "inherit" });
|
|
891
955
|
if (result.isErr()) {
|
|
@@ -921,16 +985,17 @@ function generate(buddy) {
|
|
|
921
985
|
const descriptions = {
|
|
922
986
|
command: "Automagically build any of your libraries/packages for production use. Select any of the following packages",
|
|
923
987
|
types: "Generate your TypeScript types",
|
|
924
|
-
entries: "Generate your function &
|
|
988
|
+
entries: "Generate your function & Component Library Entry Points",
|
|
925
989
|
webTypes: "Generate web-types.json for IDEs",
|
|
926
990
|
customData: "Generate VS Code custom data (custom-elements.json) for IDEs",
|
|
927
991
|
ideHelpers: "Generate IDE helpers",
|
|
928
992
|
componentMeta: "Generate component meta information",
|
|
929
|
-
|
|
993
|
+
pkgx: "Generate the pkgx configuration file",
|
|
930
994
|
select: "What are you trying to generate?",
|
|
995
|
+
project: "Target a specific project",
|
|
931
996
|
verbose: "Enable verbose output"
|
|
932
997
|
};
|
|
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("-
|
|
998
|
+
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
999
|
if (hasNoOptions2(options)) {
|
|
935
1000
|
let answers = await prompt3.require().multiselect(descriptions.select, {
|
|
936
1001
|
options: [
|
|
@@ -949,25 +1014,25 @@ function generate(buddy) {
|
|
|
949
1014
|
await startGenerationProcess(options);
|
|
950
1015
|
process14.exit(ExitCode13.Success);
|
|
951
1016
|
});
|
|
952
|
-
buddy.command("generate:types", descriptions.types).option("--verbose", descriptions.verbose, { default: false }).alias("types:generate").action(async (options) => {
|
|
1017
|
+
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
1018
|
await generateTypes(options);
|
|
954
1019
|
});
|
|
955
|
-
buddy.command("generate:entries", descriptions.entries).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1020
|
+
buddy.command("generate:entries", descriptions.entries).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
956
1021
|
await generateLibEntries(options);
|
|
957
1022
|
});
|
|
958
|
-
buddy.command("generate:web-types", descriptions.webTypes).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1023
|
+
buddy.command("generate:web-types", descriptions.webTypes).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
959
1024
|
await generateWebTypes(options);
|
|
960
1025
|
});
|
|
961
|
-
buddy.command("generate:vscode-custom-data", descriptions.customData).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1026
|
+
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
1027
|
await generateVsCodeCustomData(options);
|
|
963
1028
|
});
|
|
964
|
-
buddy.command("generate:ide-helpers", descriptions.ideHelpers).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1029
|
+
buddy.command("generate:ide-helpers", descriptions.ideHelpers).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
965
1030
|
await generateIdeHelpers(options);
|
|
966
1031
|
});
|
|
967
|
-
buddy.command("generate:component-meta", descriptions.componentMeta).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1032
|
+
buddy.command("generate:component-meta", descriptions.componentMeta).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
968
1033
|
await generateComponentMeta(options);
|
|
969
1034
|
});
|
|
970
|
-
buddy.command("generate:
|
|
1035
|
+
buddy.command("generate:pkgx-config", descriptions.pkgx).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(() => {
|
|
971
1036
|
generatePkgxConfig();
|
|
972
1037
|
});
|
|
973
1038
|
buddy.command("generate:migrations", "Generate Migrations").action(() => {
|
|
@@ -990,9 +1055,10 @@ import {runCommandSync as runCommandSync2} from "@stacksjs/cli";
|
|
|
990
1055
|
function http(buddy) {
|
|
991
1056
|
const descriptions = {
|
|
992
1057
|
http: "Send an HTTP request to a domain",
|
|
1058
|
+
project: "Target a specific project",
|
|
993
1059
|
verbose: "Enable verbose output"
|
|
994
1060
|
};
|
|
995
|
-
buddy.command("http [domain]", descriptions.http).action(async (domain, options) => {
|
|
1061
|
+
buddy.command("http [domain]", descriptions.http).option("-p, --project", descriptions.project, { default: false }).action(async (domain, options) => {
|
|
996
1062
|
const optionsString = Object.entries(options).filter(([key, value]) => key !== "--" && key.length > 1 && value !== false).map(([key, value]) => `--${key} ${value}`).join(" ");
|
|
997
1063
|
const command = `http GET ${domain || config9.app.url} ${optionsString}`;
|
|
998
1064
|
console.log(`Running command: ${command}`);
|
|
@@ -1010,18 +1076,19 @@ function lint(buddy) {
|
|
|
1010
1076
|
const descriptions = {
|
|
1011
1077
|
lint: "Automagically lints your project codebase",
|
|
1012
1078
|
lintFix: "Automagically fixes all lint errors",
|
|
1079
|
+
project: "Target a specific project",
|
|
1013
1080
|
verbose: "Enable verbose output"
|
|
1014
1081
|
};
|
|
1015
|
-
buddy.command("lint", descriptions.lint).option("-f, --fix", descriptions.lintFix, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1082
|
+
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
1083
|
const startTime = await intro10("buddy lint");
|
|
1017
|
-
const result = await runAction9(Action9.Lint,
|
|
1084
|
+
const result = await runAction9(Action9.Lint, options);
|
|
1018
1085
|
if (result.isErr()) {
|
|
1019
1086
|
await outro10("While running `buddy lint`, there was an issue", { startTime, useSeconds: true }, result.error);
|
|
1020
1087
|
process16.exit();
|
|
1021
1088
|
}
|
|
1022
1089
|
await outro10("Linted your project", { startTime, useSeconds: true });
|
|
1023
1090
|
});
|
|
1024
|
-
buddy.command("lint:fix", descriptions.lintFix).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1091
|
+
buddy.command("lint:fix", descriptions.lintFix).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1025
1092
|
log8.info("Fixing lint errors...");
|
|
1026
1093
|
const result = await runAction9(Action9.LintFix, { ...options });
|
|
1027
1094
|
if (result.isErr()) {
|
|
@@ -1062,9 +1129,10 @@ import {path as p3} from "@stacksjs/path";
|
|
|
1062
1129
|
function install2(buddy) {
|
|
1063
1130
|
const descriptions = {
|
|
1064
1131
|
install: "Install your dependencies",
|
|
1132
|
+
project: "Target a specific project",
|
|
1065
1133
|
verbose: "Enable verbose output"
|
|
1066
1134
|
};
|
|
1067
|
-
buddy.command("install", descriptions.install).option("-v, --verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1135
|
+
buddy.command("install", descriptions.install).option("-p, --project", descriptions.project, { default: false }).option("-v, --verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1068
1136
|
await runCommand6("bun install", {
|
|
1069
1137
|
...options,
|
|
1070
1138
|
cwd: p3.projectPath()
|
|
@@ -1084,16 +1152,17 @@ import {runAction as runAction11} from "@stacksjs/actions";
|
|
|
1084
1152
|
function key(buddy) {
|
|
1085
1153
|
const descriptions = {
|
|
1086
1154
|
command: "Generate & set the application key.",
|
|
1155
|
+
project: "Target a specific project",
|
|
1087
1156
|
verbose: "Enable verbose output"
|
|
1088
1157
|
};
|
|
1089
|
-
buddy.command("key:generate", descriptions.command).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1090
|
-
|
|
1158
|
+
buddy.command("key:generate", descriptions.command).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1159
|
+
await intro12("buddy key:generate");
|
|
1091
1160
|
const result = await runAction11(Action11.KeyGenerate, options);
|
|
1092
1161
|
if (result.isErr()) {
|
|
1093
1162
|
log9.error("Failed to set random application key.", result.error);
|
|
1094
1163
|
process19.exit();
|
|
1095
1164
|
}
|
|
1096
|
-
await outro12("Random application key set."
|
|
1165
|
+
await outro12("Random application key set.");
|
|
1097
1166
|
});
|
|
1098
1167
|
buddy.on("key:*", () => {
|
|
1099
1168
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
@@ -1131,9 +1200,10 @@ function make(buddy) {
|
|
|
1131
1200
|
notification: "Create a new notification",
|
|
1132
1201
|
stack: "Create a new new stack",
|
|
1133
1202
|
select: "What are you trying to make?",
|
|
1203
|
+
project: "Target a specific project",
|
|
1134
1204
|
verbose: "Enable verbose output"
|
|
1135
1205
|
};
|
|
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) => {
|
|
1206
|
+
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
1207
|
const name = buddy.args[0];
|
|
1138
1208
|
if (!name) {
|
|
1139
1209
|
log10.error("You need to specify a name. Read more about the documentation here.");
|
|
@@ -1162,7 +1232,7 @@ function make(buddy) {
|
|
|
1162
1232
|
await invoke(options);
|
|
1163
1233
|
process20.exit(ExitCode16.Success);
|
|
1164
1234
|
});
|
|
1165
|
-
buddy.command("make:component", descriptions.component).option("-n, --name", "The name of the component").option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1235
|
+
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
1236
|
const name = buddy.args[0] || options.name;
|
|
1167
1237
|
options.name = name;
|
|
1168
1238
|
if (!name) {
|
|
@@ -1171,7 +1241,7 @@ function make(buddy) {
|
|
|
1171
1241
|
}
|
|
1172
1242
|
await makeComponent(options);
|
|
1173
1243
|
});
|
|
1174
|
-
buddy.command("make:database", descriptions.database).option("-n, --name", "The name of the database").option("--verbose", descriptions.verbose, { default: false }).action((options) => {
|
|
1244
|
+
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
1245
|
const name = buddy.args[0] || options.name;
|
|
1176
1246
|
options.name = name;
|
|
1177
1247
|
if (!name) {
|
|
@@ -1180,7 +1250,7 @@ function make(buddy) {
|
|
|
1180
1250
|
}
|
|
1181
1251
|
makeDatabase(options);
|
|
1182
1252
|
});
|
|
1183
|
-
buddy.command("make:factory", descriptions.factory).option("-n, --name", "The name of the factory").option("--verbose", descriptions.verbose, { default: false }).action((options) => {
|
|
1253
|
+
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
1254
|
const name = buddy.args[0] || options.name;
|
|
1185
1255
|
options.name = name;
|
|
1186
1256
|
if (!name) {
|
|
@@ -1188,7 +1258,7 @@ function make(buddy) {
|
|
|
1188
1258
|
process20.exit();
|
|
1189
1259
|
}
|
|
1190
1260
|
});
|
|
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) => {
|
|
1261
|
+
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
1262
|
const name = buddy.args[0] || options.name;
|
|
1193
1263
|
options.name = name;
|
|
1194
1264
|
if (!name) {
|
|
@@ -1197,10 +1267,10 @@ function make(buddy) {
|
|
|
1197
1267
|
}
|
|
1198
1268
|
await makePage(options);
|
|
1199
1269
|
});
|
|
1200
|
-
buddy.command("make:function", descriptions.function).option("-n, --name", "The name of the function").option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1270
|
+
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
1271
|
await makeFunction(options);
|
|
1202
1272
|
});
|
|
1203
|
-
buddy.command("make:lang", descriptions.language).option("-n, --name", "The name of the language").option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1273
|
+
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
1274
|
const name = buddy.args[0] || options.name;
|
|
1205
1275
|
options.name = name;
|
|
1206
1276
|
if (!name) {
|
|
@@ -1209,7 +1279,7 @@ function make(buddy) {
|
|
|
1209
1279
|
}
|
|
1210
1280
|
await makeLanguage(options);
|
|
1211
1281
|
});
|
|
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) => {
|
|
1282
|
+
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
1283
|
const perf = await intro13("buddy make:notification");
|
|
1214
1284
|
const name = buddy.args[0] || options.name;
|
|
1215
1285
|
options.name = name;
|
|
@@ -1225,7 +1295,7 @@ function make(buddy) {
|
|
|
1225
1295
|
await outro13(`Created your ${italic4(name)} notification.`, { startTime: perf, useSeconds: true });
|
|
1226
1296
|
process20.exit(ExitCode16.Success);
|
|
1227
1297
|
});
|
|
1228
|
-
buddy.command("make:stack", descriptions.stack).option("-n, --name", "The name of the stack").option("--verbose", descriptions.verbose, { default: false }).action((options) => {
|
|
1298
|
+
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
1299
|
const name = buddy.args[0] || options.name;
|
|
1230
1300
|
options.name = name;
|
|
1231
1301
|
if (!name) {
|
|
@@ -1258,7 +1328,7 @@ function make(buddy) {
|
|
|
1258
1328
|
});
|
|
1259
1329
|
}
|
|
1260
1330
|
var hasNoOptions3 = function(options) {
|
|
1261
|
-
return !options.component && !options.page && !options.function && !options.language && !options.database && !options.migration && !options.
|
|
1331
|
+
return !options.component && !options.page && !options.function && !options.language && !options.database && !options.migration && !options.notification && !options.stack;
|
|
1262
1332
|
};
|
|
1263
1333
|
|
|
1264
1334
|
// src/commands/migrate.ts
|
|
@@ -1271,9 +1341,10 @@ function migrate(buddy) {
|
|
|
1271
1341
|
const descriptions = {
|
|
1272
1342
|
migrate: "Migrates your database",
|
|
1273
1343
|
dns: "Writes the DNS records for a domain to ./config/dns.ts",
|
|
1344
|
+
project: "Target a specific project",
|
|
1274
1345
|
verbose: "Enable verbose output"
|
|
1275
1346
|
};
|
|
1276
|
-
buddy.command("migrate", descriptions.migrate).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1347
|
+
buddy.command("migrate", descriptions.migrate).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1277
1348
|
const perf = await intro14("buddy migrate");
|
|
1278
1349
|
const result = await runAction12(Action12.Migrate, { ...options });
|
|
1279
1350
|
if (result.isErr()) {
|
|
@@ -1284,7 +1355,7 @@ function migrate(buddy) {
|
|
|
1284
1355
|
await outro14(`Migrated your ${APP_ENV} database.`, { startTime: perf, useSeconds: true });
|
|
1285
1356
|
process21.exit(ExitCode17.Success);
|
|
1286
1357
|
});
|
|
1287
|
-
buddy.command("migrate:dns", descriptions.migrate).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1358
|
+
buddy.command("migrate:dns", descriptions.migrate).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1288
1359
|
const perf = await intro14("buddy migrate");
|
|
1289
1360
|
const result = await runAction12(Action12.MigrateDns, { ...options });
|
|
1290
1361
|
if (result.isErr()) {
|
|
@@ -1308,9 +1379,10 @@ import {runAction as runAction13} from "@stacksjs/actions";
|
|
|
1308
1379
|
function prepublish(buddy) {
|
|
1309
1380
|
const descriptions = {
|
|
1310
1381
|
command: "Run your prepublish script",
|
|
1382
|
+
project: "Target a specific project",
|
|
1311
1383
|
verbose: "Enable verbose output"
|
|
1312
1384
|
};
|
|
1313
|
-
buddy.command("prepublish", descriptions.command).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1385
|
+
buddy.command("prepublish", descriptions.command).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1314
1386
|
await runAction13(Action13.Prepublish, options);
|
|
1315
1387
|
});
|
|
1316
1388
|
buddy.on("prepublish:*", () => {
|
|
@@ -1326,7 +1398,7 @@ import {ExitCode as ExitCode18} from "@stacksjs/types";
|
|
|
1326
1398
|
import {intro as intro15, log as log11, outro as outro15} from "@stacksjs/cli";
|
|
1327
1399
|
import {runAction as runAction14} from "@stacksjs/actions";
|
|
1328
1400
|
function release(buddy) {
|
|
1329
|
-
buddy.command("release", descriptions.release).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1401
|
+
buddy.command("release", descriptions.release).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1330
1402
|
const startTime = await intro15("buddy release");
|
|
1331
1403
|
const result = await runAction14(Action14.Release, { ...options, stdin: "inherit" });
|
|
1332
1404
|
if (result.isErr()) {
|
|
@@ -1342,6 +1414,7 @@ function release(buddy) {
|
|
|
1342
1414
|
}
|
|
1343
1415
|
var descriptions = {
|
|
1344
1416
|
release: "Release a new version of your libraries/packages",
|
|
1417
|
+
project: "Target a specific project",
|
|
1345
1418
|
verbose: "Enable verbose output"
|
|
1346
1419
|
};
|
|
1347
1420
|
|
|
@@ -1354,9 +1427,10 @@ import {Action as Action15} from "@stacksjs/enums";
|
|
|
1354
1427
|
function seed(buddy) {
|
|
1355
1428
|
const descriptions2 = {
|
|
1356
1429
|
seed: "Seed your database",
|
|
1430
|
+
project: "Target a specific project",
|
|
1357
1431
|
verbose: "Enable verbose output"
|
|
1358
1432
|
};
|
|
1359
|
-
buddy.command("seed", descriptions2.seed).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1433
|
+
buddy.command("seed", descriptions2.seed).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1360
1434
|
const perf = await intro16("buddy seed");
|
|
1361
1435
|
const result = await runAction15(Action15.Seed, options);
|
|
1362
1436
|
if (result.isErr()) {
|
|
@@ -1377,19 +1451,19 @@ function seed(buddy) {
|
|
|
1377
1451
|
import process25 from "process";
|
|
1378
1452
|
import {path as p4} from "@stacksjs/path";
|
|
1379
1453
|
import {handleError} from "@stacksjs/error-handling";
|
|
1454
|
+
import {storage as storage3} from "@stacksjs/storage";
|
|
1380
1455
|
import {log as log12, runCommand as runCommand7} from "@stacksjs/cli";
|
|
1381
1456
|
import {ExitCode as ExitCode20} from "@stacksjs/types";
|
|
1382
1457
|
function setup(buddy) {
|
|
1383
1458
|
const descriptions2 = {
|
|
1384
|
-
|
|
1385
|
-
|
|
1459
|
+
setup: "This command ensures your project is setup correctly",
|
|
1460
|
+
project: "Target a specific project",
|
|
1386
1461
|
verbose: "Enable verbose output"
|
|
1387
1462
|
};
|
|
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
|
|
1463
|
+
buddy.command("setup", descriptions2.setup).alias("ensure").option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1464
|
+
if (!await isPkgxInstalled())
|
|
1392
1465
|
await installPkgx();
|
|
1466
|
+
await optimizePkgxDeps();
|
|
1393
1467
|
await initializeProject(options);
|
|
1394
1468
|
});
|
|
1395
1469
|
buddy.on("setup:*", () => {
|
|
@@ -1397,22 +1471,21 @@ function setup(buddy) {
|
|
|
1397
1471
|
process25.exit(ExitCode20.FatalError);
|
|
1398
1472
|
});
|
|
1399
1473
|
}
|
|
1400
|
-
async function
|
|
1474
|
+
async function isPkgxInstalled() {
|
|
1401
1475
|
const result = await runCommand7("pkgx --version", { silent: true });
|
|
1402
1476
|
if (result.isOk())
|
|
1403
1477
|
return true;
|
|
1404
1478
|
return false;
|
|
1405
1479
|
}
|
|
1406
1480
|
async function installPkgx() {
|
|
1407
|
-
const result = await runCommand7("
|
|
1481
|
+
const result = await runCommand7(p4.frameworkPath("scripts/pkgx-install"));
|
|
1408
1482
|
if (result.isOk())
|
|
1409
1483
|
return;
|
|
1410
1484
|
handleError(result.error);
|
|
1411
1485
|
process25.exit(ExitCode20.FatalError);
|
|
1412
1486
|
}
|
|
1413
1487
|
async function initializeProject(options) {
|
|
1414
|
-
log12.info("
|
|
1415
|
-
await new Promise((resolve2) => setTimeout(resolve2, 1500));
|
|
1488
|
+
log12.info("Installing dependencies...");
|
|
1416
1489
|
const result = await runCommand7("bun install", {
|
|
1417
1490
|
cwd: options.cwd || p4.projectPath()
|
|
1418
1491
|
});
|
|
@@ -1421,16 +1494,19 @@ async function initializeProject(options) {
|
|
|
1421
1494
|
process25.exit(ExitCode20.FatalError);
|
|
1422
1495
|
}
|
|
1423
1496
|
log12.success("Installed node_modules");
|
|
1424
|
-
log12.info("
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1497
|
+
log12.info("Ensuring .env exists...");
|
|
1498
|
+
if (storage3.doesNotExist(p4.projectPath(".env"))) {
|
|
1499
|
+
const envResult = await runCommand7("cp .env.example .env", {
|
|
1500
|
+
cwd: options.cwd || p4.projectPath()
|
|
1501
|
+
});
|
|
1502
|
+
if (envResult.isErr()) {
|
|
1503
|
+
handleError(envResult.error);
|
|
1504
|
+
process25.exit(ExitCode20.FatalError);
|
|
1505
|
+
}
|
|
1506
|
+
log12.success(".env created");
|
|
1507
|
+
} else {
|
|
1508
|
+
log12.success(".env existed");
|
|
1431
1509
|
}
|
|
1432
|
-
log12.success(".env exists");
|
|
1433
|
-
log12.info("\u23F3 Generating application key...");
|
|
1434
1510
|
const keyResult = await runCommand7("buddy key:generate", {
|
|
1435
1511
|
cwd: options.cwd || p4.projectPath()
|
|
1436
1512
|
});
|
|
@@ -1438,20 +1514,10 @@ async function initializeProject(options) {
|
|
|
1438
1514
|
handleError(keyResult.error);
|
|
1439
1515
|
process25.exit(ExitCode20.FatalError);
|
|
1440
1516
|
}
|
|
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
|
-
}
|
|
1517
|
+
log12.info("Ensuring AWS is connected...");
|
|
1450
1518
|
log12.success("Configured AWS");
|
|
1451
|
-
await new Promise((resolve2) => setTimeout(resolve2, 300));
|
|
1452
1519
|
log12.success("Project is setup");
|
|
1453
|
-
|
|
1454
|
-
log12.info("\uD83C\uDF89 Happy coding!");
|
|
1520
|
+
log12.info("Happy coding! \uD83D\uDC99");
|
|
1455
1521
|
}
|
|
1456
1522
|
async function optimizePkgxDeps() {
|
|
1457
1523
|
return new Promise((resolve2) => setTimeout(resolve2, 300));
|
|
@@ -1472,9 +1538,10 @@ function test(buddy) {
|
|
|
1472
1538
|
unit: "Runs your unit tests",
|
|
1473
1539
|
feature: "Runs your feature tests",
|
|
1474
1540
|
showReport: "Show the test report",
|
|
1541
|
+
project: "Target a specific project",
|
|
1475
1542
|
verbose: "Enable verbose output"
|
|
1476
1543
|
};
|
|
1477
|
-
buddy.command("test", descriptions2.command).option("--ui", descriptions2.ui, { default: false }).option("--verbose", descriptions2.verbose, { default: true }).action(async (options) => {
|
|
1544
|
+
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
1545
|
const perf = await intro17("buddy test");
|
|
1479
1546
|
const result = await runAction16(Action16.Test, { ...options, cwd: projectPath() });
|
|
1480
1547
|
if (result.isErr()) {
|
|
@@ -1548,9 +1615,10 @@ import {Action as Action17} from "@stacksjs/enums";
|
|
|
1548
1615
|
function tinker(buddy) {
|
|
1549
1616
|
const descriptions2 = {
|
|
1550
1617
|
tinker: "Tinker with your code",
|
|
1618
|
+
project: "Target a specific project",
|
|
1551
1619
|
verbose: "Enable verbose output"
|
|
1552
1620
|
};
|
|
1553
|
-
buddy.command("tinker", descriptions2.tinker).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1621
|
+
buddy.command("tinker", descriptions2.tinker).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1554
1622
|
const perf = await intro18("buddy tinker");
|
|
1555
1623
|
const result = await runAction17(Action17.Tinker, options);
|
|
1556
1624
|
if (result.isErr()) {
|
|
@@ -1573,12 +1641,13 @@ function types22(buddy) {
|
|
|
1573
1641
|
const descriptions2 = {
|
|
1574
1642
|
generate: "Generate the types of & for your library/libraries",
|
|
1575
1643
|
fix: "wip",
|
|
1644
|
+
project: "Target a specific project",
|
|
1576
1645
|
verbose: "Enable verbose output"
|
|
1577
1646
|
};
|
|
1578
|
-
buddy.command("types:generate", descriptions2.generate).option("--verbose", descriptions2.verbose, { default: false }).action(async () => {
|
|
1647
|
+
buddy.command("types:generate", descriptions2.generate).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async () => {
|
|
1579
1648
|
await generateTypes2();
|
|
1580
1649
|
});
|
|
1581
|
-
buddy.command("types:fix", descriptions2.fix).option("--verbose", descriptions2.verbose, { default: false }).action(async () => {
|
|
1650
|
+
buddy.command("types:fix", descriptions2.fix).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async () => {
|
|
1582
1651
|
});
|
|
1583
1652
|
buddy.on("types:*", () => {
|
|
1584
1653
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
@@ -1597,14 +1666,15 @@ function upgrade(buddy) {
|
|
|
1597
1666
|
const descriptions2 = {
|
|
1598
1667
|
command: "Upgrade dependencies, framework, package manager, JS/TS runtime",
|
|
1599
1668
|
framework: "Upgrade the Stacks framework",
|
|
1600
|
-
dependencies: "Upgrade your dependencies",
|
|
1669
|
+
dependencies: "Upgrade your dependencies (pkgx.yaml & package.json)",
|
|
1601
1670
|
bun: "Upgrade Bun to the latest version",
|
|
1602
1671
|
all: "Upgrade Node, package manager, project dependencies, and framework",
|
|
1603
1672
|
force: "Overwrite possible local updates with remote framework updates",
|
|
1604
1673
|
select: "What are you trying to upgrade?",
|
|
1674
|
+
project: "Target a specific project",
|
|
1605
1675
|
verbose: "Enable verbose output"
|
|
1606
1676
|
};
|
|
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) => {
|
|
1677
|
+
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
1678
|
const perf = await intro19("buddy upgrade");
|
|
1609
1679
|
if (hasNoOptions4(options)) {
|
|
1610
1680
|
let answers = await prompt5.require().multiselect(descriptions2.select, {
|
|
@@ -1621,7 +1691,7 @@ function upgrade(buddy) {
|
|
|
1621
1691
|
answers = [answers];
|
|
1622
1692
|
options = answers.reduce((a, v) => ({ ...a, [v]: true }), {});
|
|
1623
1693
|
}
|
|
1624
|
-
const result = await runAction18(Action18.Upgrade,
|
|
1694
|
+
const result = await runAction18(Action18.Upgrade, options);
|
|
1625
1695
|
if (result.isErr()) {
|
|
1626
1696
|
await outro19("While running the buddy:upgrade command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1627
1697
|
process29.exit();
|
|
@@ -1629,13 +1699,13 @@ function upgrade(buddy) {
|
|
|
1629
1699
|
await outro19("Upgrade complete.", { startTime: perf, useSeconds: true });
|
|
1630
1700
|
process29.exit();
|
|
1631
1701
|
});
|
|
1632
|
-
buddy.command("upgrade:framework", descriptions2.framework).option("--verbose", descriptions2.verbose, { default: false }).example("buddy upgrade:framework --verbose").action(async (options) => {
|
|
1702
|
+
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
1703
|
await runAction18(Action18.Upgrade, options);
|
|
1634
1704
|
});
|
|
1635
|
-
buddy.command("upgrade:dependencies", descriptions2.dependencies).option("--verbose", descriptions2.verbose, { default: false }).alias("upgrade:deps").example("buddy upgrade:dependencies --verbose").action(async (options) => {
|
|
1705
|
+
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
1706
|
await runAction18(Action18.Upgrade, options);
|
|
1637
1707
|
});
|
|
1638
|
-
buddy.command("upgrade:bun", descriptions2.bun).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1708
|
+
buddy.command("upgrade:bun", descriptions2.bun).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1639
1709
|
const perf = await intro19("buddy upgrade:bun");
|
|
1640
1710
|
const result = await runAction18(Action18.UpgradeBun, options);
|
|
1641
1711
|
if (result.isErr()) {
|
|
@@ -1644,7 +1714,7 @@ function upgrade(buddy) {
|
|
|
1644
1714
|
}
|
|
1645
1715
|
process29.exit(ExitCode22.Success);
|
|
1646
1716
|
});
|
|
1647
|
-
buddy.command("upgrade:all", descriptions2.all).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1717
|
+
buddy.command("upgrade:all", descriptions2.all).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1648
1718
|
await runAction18(Action18.Upgrade, options);
|
|
1649
1719
|
});
|
|
1650
1720
|
}
|
|
@@ -1654,14 +1724,14 @@ var hasNoOptions4 = function(options) {
|
|
|
1654
1724
|
|
|
1655
1725
|
// src/commands/version.ts
|
|
1656
1726
|
import {bold as bold3, dim as dim2, green, intro as intro20, log as log13} from "@stacksjs/cli";
|
|
1657
|
-
import {storage as
|
|
1727
|
+
import {storage as storage5} from "@stacksjs/storage";
|
|
1658
1728
|
function version(buddy) {
|
|
1659
1729
|
const descriptions2 = {
|
|
1660
1730
|
version: "Retrieving Stacks build version"
|
|
1661
1731
|
};
|
|
1662
1732
|
buddy.command("version", descriptions2.version).action(async () => {
|
|
1663
1733
|
await intro20("buddy version");
|
|
1664
|
-
const pkg = await
|
|
1734
|
+
const pkg = await storage5.readPackageJson("./package.json");
|
|
1665
1735
|
const bunVersion = "wip";
|
|
1666
1736
|
const stacksVersion = pkg.version;
|
|
1667
1737
|
log13.info(green(bold3("@stacksjs/ ")) + dim2(` ${stacksVersion}`));
|
package/dist/cli.js
CHANGED
|
@@ -14,10 +14,12 @@ generate,
|
|
|
14
14
|
http,
|
|
15
15
|
install,
|
|
16
16
|
key,
|
|
17
|
+
lint,
|
|
17
18
|
release,
|
|
18
|
-
setup
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
setup,
|
|
20
|
+
upgrade
|
|
21
|
+
} from "./chunk-b32089b9556f373c.js";
|
|
22
|
+
import"./chunk-0455e53fab4244b1.js";
|
|
21
23
|
|
|
22
24
|
// src/cli.ts
|
|
23
25
|
import process from "process";
|
|
@@ -42,8 +44,10 @@ async function main() {
|
|
|
42
44
|
generate(buddy);
|
|
43
45
|
http(buddy);
|
|
44
46
|
install(buddy);
|
|
47
|
+
lint(buddy);
|
|
45
48
|
release(buddy);
|
|
46
49
|
setup(buddy);
|
|
50
|
+
upgrade(buddy);
|
|
47
51
|
buddy.parse();
|
|
48
52
|
}
|
|
49
53
|
process.on("uncaughtException", handleError);
|
package/dist/index.js
CHANGED