@stacksjs/buddy 0.59.11 → 0.61.1
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 +0 -1
- package/dist/chunk-b0df37cbea681adc.js +2223 -0
- package/dist/{chunk-d2428b387d843985.js → chunk-eb51d49adb5b5f07.js} +478 -247
- package/dist/cli.js +13 -4
- package/dist/index.js +1 -1
- package/dist/stacks +0 -0
- package/package.json +1 -1
- package/src/cli.ts +17 -13
- package/src/commands/add.ts +5 -6
- package/src/commands/build.ts +55 -34
- package/src/commands/changelog.ts +13 -6
- package/src/commands/clean.ts +13 -5
- package/src/commands/cloud.ts +91 -30
- package/src/commands/commit.ts +2 -2
- package/src/commands/configure.ts +7 -7
- package/src/commands/create.ts +14 -10
- package/src/commands/deploy.ts +15 -10
- package/src/commands/dev.ts +53 -53
- package/src/commands/dns.ts +5 -5
- package/src/commands/domains.ts +132 -41
- package/src/commands/fresh.ts +16 -6
- package/src/commands/generate.ts +14 -16
- package/src/commands/http.ts +2 -2
- package/src/commands/install.ts +2 -2
- package/src/commands/key.ts +3 -3
- package/src/commands/lint.ts +4 -4
- package/src/commands/list.ts +3 -4
- package/src/commands/make.ts +101 -65
- package/src/commands/migrate.ts +52 -9
- package/src/commands/ports.ts +35 -37
- package/src/commands/prepublish.ts +3 -3
- package/src/commands/projects.ts +5 -11
- package/src/commands/release.ts +8 -6
- package/src/commands/seed.ts +12 -5
- package/src/commands/setup.ts +10 -11
- package/src/commands/test.ts +97 -30
- package/src/commands/tinker.ts +10 -6
- package/src/commands/types.ts +3 -3
- package/src/commands/upgrade.ts +49 -29
- package/src/commands/version.ts +11 -13
- package/src/custom-cli.ts +5 -7
- package/dist/cli.d.ts +0 -1
- package/dist/commands/build.d.ts +0 -2
- package/dist/commands/changelog.d.ts +0 -2
- package/dist/commands/clean.d.ts +0 -2
- package/dist/commands/cloud.d.ts +0 -2
- package/dist/commands/commit.d.ts +0 -2
- package/dist/commands/configure.d.ts +0 -2
- package/dist/commands/create.d.ts +0 -2
- package/dist/commands/deploy.d.ts +0 -2
- package/dist/commands/dev.d.ts +0 -3
- package/dist/commands/dns.d.ts +0 -2
- package/dist/commands/domains.d.ts +0 -2
- package/dist/commands/fresh.d.ts +0 -2
- package/dist/commands/generate.d.ts +0 -2
- package/dist/commands/http.d.ts +0 -2
- package/dist/commands/index.d.ts +0 -31
- package/dist/commands/install.d.ts +0 -2
- package/dist/commands/key.d.ts +0 -2
- package/dist/commands/lint.d.ts +0 -2
- package/dist/commands/list.d.ts +0 -2
- package/dist/commands/make.d.ts +0 -2
- package/dist/commands/migrate.d.ts +0 -2
- package/dist/commands/ports.d.ts +0 -2
- package/dist/commands/prepublish.d.ts +0 -2
- package/dist/commands/projects.d.ts +0 -2
- package/dist/commands/release.d.ts +0 -2
- package/dist/commands/seed.d.ts +0 -2
- package/dist/commands/setup.d.ts +0 -4
- package/dist/commands/test.d.ts +0 -2
- package/dist/commands/tinker.d.ts +0 -2
- package/dist/commands/types.d.ts +0 -2
- package/dist/commands/upgrade.d.ts +0 -2
- package/dist/commands/version.d.ts +0 -2
- package/dist/index.d.ts +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// src/commands/build.ts
|
|
2
2
|
import process from "process";
|
|
3
|
-
import {runAction
|
|
3
|
+
import {runAction} from "@stacksjs/actions";
|
|
4
4
|
import {intro, log, outro} from "@stacksjs/cli";
|
|
5
|
-
import {ExitCode} from "@stacksjs/types";
|
|
6
5
|
import {Action} from "@stacksjs/enums";
|
|
6
|
+
import {ExitCode} from "@stacksjs/types";
|
|
7
|
+
import {isString} from "@stacksjs/validation";
|
|
7
8
|
function build(buddy) {
|
|
8
9
|
const descriptions = {
|
|
9
10
|
build: "Build any of your libraries (packages) for production use",
|
|
@@ -23,7 +24,7 @@ function build(buddy) {
|
|
|
23
24
|
project: "Target a specific project",
|
|
24
25
|
verbose: "Enable verbose output"
|
|
25
26
|
};
|
|
26
|
-
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("--server", descriptions.server, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (server, options) => {
|
|
27
|
+
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 [project]", descriptions.project, { default: false }).option("--server", descriptions.server, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (server, options) => {
|
|
27
28
|
log.debug("Running `buddy build` ...", options);
|
|
28
29
|
switch (server) {
|
|
29
30
|
case "components":
|
|
@@ -73,53 +74,63 @@ function build(buddy) {
|
|
|
73
74
|
process.exit(ExitCode.InvalidArgument);
|
|
74
75
|
if (isString(answers))
|
|
75
76
|
answers = [answers];
|
|
76
|
-
options = answers.reduce((a, v) =>
|
|
77
|
+
options = answers.reduce((a, v) => {
|
|
78
|
+
a[v] = true;
|
|
79
|
+
return a;
|
|
80
|
+
}, {});
|
|
77
81
|
}
|
|
78
|
-
await
|
|
82
|
+
await runAction(Action.BuildStacks, options);
|
|
79
83
|
process.exit(ExitCode.Success);
|
|
80
84
|
});
|
|
81
|
-
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) => {
|
|
85
|
+
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 [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
82
86
|
log.debug("Running `buddy build:components` ...", options);
|
|
83
|
-
await
|
|
87
|
+
await runAction(Action.BuildComponentLibs, options);
|
|
84
88
|
});
|
|
85
|
-
buddy.command("build:cli", descriptions.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) => {
|
|
89
|
+
buddy.command("build:cli", descriptions.cli).alias("prod:cli").option("-b, --buddy", descriptions.buddy, { default: true }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
86
90
|
log.debug("Running `buddy build:cli` ...", options);
|
|
87
|
-
await
|
|
91
|
+
await runAction(Action.BuildCli, options);
|
|
88
92
|
});
|
|
89
|
-
buddy.command("build:server", descriptions.server).alias("prod:server").alias("build:docker").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
93
|
+
buddy.command("build:server", descriptions.server).alias("prod:server").alias("build:docker").option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
90
94
|
log.debug("Running `buddy build:server` ...", options);
|
|
91
|
-
await
|
|
95
|
+
await runAction(Action.BuildServer, options);
|
|
92
96
|
});
|
|
93
|
-
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) => {
|
|
97
|
+
buddy.command("build:functions", "Automagically build function library for npm/CDN distribution").option("-f, --functions", descriptions.functions, { default: true }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
94
98
|
log.debug("Running `buddy `build:functions` ...", options);
|
|
95
|
-
await
|
|
99
|
+
await runAction(Action.BuildFunctionLib, options);
|
|
96
100
|
});
|
|
97
|
-
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, {
|
|
101
|
+
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, {
|
|
102
|
+
default: true
|
|
103
|
+
}).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).alias("build:vue").action(async (options) => {
|
|
98
104
|
log.debug("Running `buddy build:vue-components` ...", options);
|
|
99
|
-
await
|
|
105
|
+
await runAction(Action.BuildVueComponentLib, options);
|
|
100
106
|
});
|
|
101
|
-
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, {
|
|
107
|
+
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, {
|
|
108
|
+
default: true
|
|
109
|
+
}).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
102
110
|
log.debug("Running `buddy build:web-components` ...", options);
|
|
103
|
-
await
|
|
111
|
+
await runAction(Action.BuildWebComponentLib, options);
|
|
104
112
|
});
|
|
105
|
-
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) => {
|
|
113
|
+
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 [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
106
114
|
log.debug("Running `buddy build:docs` ...", options);
|
|
107
|
-
await
|
|
115
|
+
await runAction(Action.BuildDocs, options);
|
|
108
116
|
});
|
|
109
|
-
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) => {
|
|
117
|
+
buddy.command("build:core", "Automagically build the Stacks core.").option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
110
118
|
log.debug("Running `buddy build:core` ...", options);
|
|
111
119
|
const startTime = await intro("buddy build:core");
|
|
112
|
-
const result = await
|
|
120
|
+
const result = await runAction(Action.BuildCore, options);
|
|
113
121
|
if (result.isErr()) {
|
|
114
122
|
log.error("Failed to build the Stacks core.", result.error);
|
|
115
123
|
process.exit();
|
|
116
124
|
}
|
|
117
|
-
await outro("Core packages built successfully", {
|
|
125
|
+
await outro("Core packages built successfully", {
|
|
126
|
+
startTime,
|
|
127
|
+
useSeconds: true
|
|
128
|
+
});
|
|
118
129
|
});
|
|
119
|
-
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) => {
|
|
130
|
+
buddy.command("build:desktop", descriptions.desktop).alias("prod:desktop").option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
120
131
|
log.debug("Running `buddy build:desktop` ...", options);
|
|
121
132
|
const perf = await intro("buddy build:desktop");
|
|
122
|
-
const result = await
|
|
133
|
+
const result = await runAction(Action.BuildDesktop, options);
|
|
123
134
|
if (result.isErr()) {
|
|
124
135
|
await outro("While running the build:desktop command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
125
136
|
process.exit();
|
|
@@ -128,10 +139,10 @@ function build(buddy) {
|
|
|
128
139
|
await outro("Exited", { startTime: perf, useSeconds: true });
|
|
129
140
|
process.exit(ExitCode.Success);
|
|
130
141
|
});
|
|
131
|
-
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) => {
|
|
142
|
+
buddy.command("build:stacks", "Build the Stacks framework.").option("-s, --stacks", descriptions.framework, { default: true }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
132
143
|
log.debug("Running `buddy build:stacks` ...", options);
|
|
133
144
|
const startTime = await intro("buddy build:stacks");
|
|
134
|
-
const result = await
|
|
145
|
+
const result = await runAction(Action.BuildStacks, options);
|
|
135
146
|
if (result.isErr()) {
|
|
136
147
|
log.error("Failed to build Stacks.", result.error);
|
|
137
148
|
process.exit();
|
|
@@ -149,7 +160,7 @@ var hasNoOptions = function(options) {
|
|
|
149
160
|
|
|
150
161
|
// src/commands/changelog.ts
|
|
151
162
|
import process2 from "process";
|
|
152
|
-
import {runAction as
|
|
163
|
+
import {runAction as runAction2} from "@stacksjs/actions";
|
|
153
164
|
import {intro as intro2, log as log2, outro as outro2} from "@stacksjs/cli";
|
|
154
165
|
import {Action as Action2} from "@stacksjs/enums";
|
|
155
166
|
function changelog(buddy) {
|
|
@@ -160,15 +171,20 @@ function changelog(buddy) {
|
|
|
160
171
|
project: "Target a specific project",
|
|
161
172
|
verbose: "Enable verbose output"
|
|
162
173
|
};
|
|
163
|
-
buddy.command("changelog", descriptions.changelog).option("-q, --quiet", descriptions.quiet, { default: false }).option("-d, --dry-run", descriptions.dryRun, { default: false }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
174
|
+
buddy.command("changelog", descriptions.changelog).option("-q, --quiet", descriptions.quiet, { default: false }).option("-d, --dry-run", descriptions.dryRun, { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
164
175
|
log2.debug("Running `buddy changelog` ...", options);
|
|
165
176
|
const perf = await intro2("buddy changelog");
|
|
166
|
-
const result = await
|
|
177
|
+
const result = await runAction2(Action2.Changelog, options);
|
|
167
178
|
if (result.isErr()) {
|
|
168
179
|
await outro2("While running the changelog command, there was an issue", { ...options, startTime: perf, useSeconds: true }, result.error);
|
|
169
180
|
process2.exit();
|
|
170
181
|
}
|
|
171
|
-
await outro2("Generated CHANGELOG.md", {
|
|
182
|
+
await outro2("Generated CHANGELOG.md", {
|
|
183
|
+
...options,
|
|
184
|
+
startTime: perf,
|
|
185
|
+
useSeconds: true,
|
|
186
|
+
type: "success"
|
|
187
|
+
});
|
|
172
188
|
});
|
|
173
189
|
buddy.on("changelog:*", () => {
|
|
174
190
|
console.log("Invalid command: %s", buddy.args.join(" "));
|
|
@@ -179,25 +195,29 @@ function changelog(buddy) {
|
|
|
179
195
|
|
|
180
196
|
// src/commands/clean.ts
|
|
181
197
|
import process3 from "process";
|
|
182
|
-
import {
|
|
183
|
-
import {runAction as runAction4} from "@stacksjs/actions";
|
|
198
|
+
import {runAction as runAction3} from "@stacksjs/actions";
|
|
184
199
|
import {intro as intro3, log as log3, outro as outro3} from "@stacksjs/cli";
|
|
185
200
|
import {Action as Action3} from "@stacksjs/enums";
|
|
201
|
+
import {ExitCode as ExitCode2} from "@stacksjs/types";
|
|
186
202
|
function clean(buddy) {
|
|
187
203
|
const descriptions = {
|
|
188
204
|
clean: "Removes all node_modules & lock files",
|
|
189
205
|
project: "Target a specific project",
|
|
190
206
|
verbose: "Enable verbose output"
|
|
191
207
|
};
|
|
192
|
-
buddy.command("clean", descriptions.clean).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
208
|
+
buddy.command("clean", descriptions.clean).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
193
209
|
log3.debug("Running `buddy clean` ...", options);
|
|
194
210
|
const perf = await intro3("buddy clean");
|
|
195
|
-
const result = await
|
|
211
|
+
const result = await runAction3(Action3.Clean, options);
|
|
196
212
|
if (result.isErr()) {
|
|
197
213
|
await outro3("While running the clean command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
198
214
|
process3.exit(ExitCode2.FatalError);
|
|
199
215
|
}
|
|
200
|
-
await outro3("Cleaned up", {
|
|
216
|
+
await outro3("Cleaned up", {
|
|
217
|
+
startTime: perf,
|
|
218
|
+
useSeconds: true,
|
|
219
|
+
message: "Cleaned up"
|
|
220
|
+
});
|
|
201
221
|
process3.exit(ExitCode2.Success);
|
|
202
222
|
});
|
|
203
223
|
buddy.on("clean:*", () => {
|
|
@@ -209,7 +229,17 @@ function clean(buddy) {
|
|
|
209
229
|
// src/commands/cloud.ts
|
|
210
230
|
import process4 from "process";
|
|
211
231
|
import {intro as intro4, italic, log as log4, outro as outro4, prompts, runCommand, runCommandSync, underline} from "@stacksjs/cli";
|
|
212
|
-
import {
|
|
232
|
+
import {
|
|
233
|
+
addJumpBox,
|
|
234
|
+
deleteCdkRemnants,
|
|
235
|
+
deleteIamUsers,
|
|
236
|
+
deleteJumpBox,
|
|
237
|
+
deleteLogGroups,
|
|
238
|
+
deleteParameterStore,
|
|
239
|
+
deleteStacksBuckets,
|
|
240
|
+
deleteStacksFunctions,
|
|
241
|
+
getJumpBoxInstanceId
|
|
242
|
+
} from "@stacksjs/cloud";
|
|
213
243
|
import {path as p} from "@stacksjs/path";
|
|
214
244
|
import {ExitCode as ExitCode3} from "@stacksjs/types";
|
|
215
245
|
import {loop} from "@stacksjs/utils";
|
|
@@ -224,7 +254,7 @@ function cloud2(buddy) {
|
|
|
224
254
|
project: "Target a specific project",
|
|
225
255
|
verbose: "Enable verbose output"
|
|
226
256
|
};
|
|
227
|
-
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) => {
|
|
257
|
+
buddy.command("cloud", descriptions.cloud).option("--ssh", descriptions.ssh, { default: false }).option("--connect", descriptions.ssh, { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
228
258
|
log4.debug("Running `buddy cloud` ...", options);
|
|
229
259
|
if (options.ssh || options.connect) {
|
|
230
260
|
const startTime = performance.now();
|
|
@@ -244,7 +274,7 @@ function cloud2(buddy) {
|
|
|
244
274
|
log4.info("Not implemented yet. Please use the --ssh (or --connect) flag to connect to the Stacks Cloud.");
|
|
245
275
|
process4.exit(ExitCode3.Success);
|
|
246
276
|
});
|
|
247
|
-
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) => {
|
|
277
|
+
buddy.command("cloud:add", descriptions.add).option("--jump-box", "Remove the jump-box", { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
248
278
|
log4.debug("Running `buddy cloud:add` ...", options);
|
|
249
279
|
const startTime = await intro4("buddy cloud:add");
|
|
250
280
|
if (options.jumpBox) {
|
|
@@ -269,13 +299,16 @@ function cloud2(buddy) {
|
|
|
269
299
|
log4.info(underline("https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#Instances:instanceState=running"));
|
|
270
300
|
log4.info(italic("Once it finished initializing, you may SSH into it:"));
|
|
271
301
|
log4.info(underline("buddy cloud --ssh"));
|
|
272
|
-
await outro4("Your jump-box was added.", {
|
|
302
|
+
await outro4("Your jump-box was added.", {
|
|
303
|
+
startTime,
|
|
304
|
+
useSeconds: true
|
|
305
|
+
});
|
|
273
306
|
process4.exit(ExitCode3.Success);
|
|
274
307
|
}
|
|
275
308
|
log4.info("This functionality is not yet implemented.");
|
|
276
309
|
process4.exit(ExitCode3.Success);
|
|
277
310
|
});
|
|
278
|
-
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) => {
|
|
311
|
+
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 [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
279
312
|
log4.debug("Running `buddy cloud:remove` ...", options);
|
|
280
313
|
const startTime = await intro4("buddy cloud:remove");
|
|
281
314
|
if (options.jumpBox) {
|
|
@@ -293,7 +326,10 @@ function cloud2(buddy) {
|
|
|
293
326
|
await outro4("While removing your jump-box, there was an issue", { startTime, useSeconds: true }, result2.error);
|
|
294
327
|
process4.exit(ExitCode3.FatalError);
|
|
295
328
|
}
|
|
296
|
-
await outro4("Your jump-box was removed.", {
|
|
329
|
+
await outro4("Your jump-box was removed.", {
|
|
330
|
+
startTime,
|
|
331
|
+
useSeconds: true
|
|
332
|
+
});
|
|
297
333
|
process4.exit(ExitCode3.Success);
|
|
298
334
|
}
|
|
299
335
|
console.log(` ${italic("\u2139\uFE0F Removing your cloud resources takes a while to complete.")}`);
|
|
@@ -324,14 +360,17 @@ function cloud2(buddy) {
|
|
|
324
360
|
stdout: "ignore"
|
|
325
361
|
});
|
|
326
362
|
});
|
|
327
|
-
await outro4("Your cloud has been removed", {
|
|
363
|
+
await outro4("Your cloud has been removed", {
|
|
364
|
+
startTime,
|
|
365
|
+
useSeconds: true
|
|
366
|
+
});
|
|
328
367
|
process4.exit(ExitCode3.Success);
|
|
329
368
|
} catch (error) {
|
|
330
369
|
await outro4("While cleaning up the cloud, there was an issue", { startTime, useSeconds: true }, error);
|
|
331
370
|
process4.exit(ExitCode3.FatalError);
|
|
332
371
|
}
|
|
333
372
|
});
|
|
334
|
-
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) => {
|
|
373
|
+
buddy.command("cloud:optimize-cost", descriptions.optimizeCost).option("--jump-box", "Remove the jump-box", { default: true }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
335
374
|
log4.debug("Running `buddy cloud:optimize-cost` ...", options);
|
|
336
375
|
const startTime = await intro4("buddy cloud:optimize-cost");
|
|
337
376
|
if (options.jumpBox) {
|
|
@@ -348,10 +387,13 @@ function cloud2(buddy) {
|
|
|
348
387
|
await outro4("Your jump-box was removed & cost optimizations are applied.", { startTime, useSeconds: true });
|
|
349
388
|
process4.exit(ExitCode3.Success);
|
|
350
389
|
}
|
|
351
|
-
await outro4("No cost optimization was applied", {
|
|
390
|
+
await outro4("No cost optimization was applied", {
|
|
391
|
+
startTime,
|
|
392
|
+
useSeconds: true
|
|
393
|
+
});
|
|
352
394
|
process4.exit(ExitCode3.Success);
|
|
353
395
|
});
|
|
354
|
-
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 (options) => {
|
|
396
|
+
buddy.command("cloud:cleanup", descriptions.cleanUp).alias("cloud:clean-up").option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
355
397
|
log4.debug("Running `buddy cloud:cleanup` ...", options);
|
|
356
398
|
const startTime = await intro4("buddy cloud:cleanup");
|
|
357
399
|
log4.info(`Cleaning up your cloud resources will take a while to complete. Please be patient.`);
|
|
@@ -402,7 +444,10 @@ function cloud2(buddy) {
|
|
|
402
444
|
await outro4("While deleting the Stacks log groups, there was an issue", { startTime, useSeconds: true }, result8.error);
|
|
403
445
|
process4.exit(ExitCode3.FatalError);
|
|
404
446
|
}
|
|
405
|
-
await outro4("AWS resources have been removed", {
|
|
447
|
+
await outro4("AWS resources have been removed", {
|
|
448
|
+
startTime,
|
|
449
|
+
useSeconds: true
|
|
450
|
+
});
|
|
406
451
|
process4.exit(ExitCode3.Success);
|
|
407
452
|
});
|
|
408
453
|
buddy.on("cloud:*", () => {
|
|
@@ -421,7 +466,7 @@ function commit(buddy) {
|
|
|
421
466
|
project: "Target a specific project",
|
|
422
467
|
verbose: "Enable verbose output"
|
|
423
468
|
};
|
|
424
|
-
buddy.command("commit", descriptions.commit).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
469
|
+
buddy.command("commit", descriptions.commit).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
425
470
|
log5.debug("Running `buddy commit` ...", options);
|
|
426
471
|
await runCommit(options);
|
|
427
472
|
});
|
|
@@ -444,7 +489,7 @@ function configure(buddy) {
|
|
|
444
489
|
profile: "The AWS profile to use",
|
|
445
490
|
verbose: "Enable verbose output"
|
|
446
491
|
};
|
|
447
|
-
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) => {
|
|
492
|
+
buddy.command("configure", descriptions.configure).option("--aws", descriptions.aws, { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
448
493
|
log6.debug("Running `buddy configure` ...", options);
|
|
449
494
|
if (options?.aws) {
|
|
450
495
|
await configureAws(options);
|
|
@@ -453,7 +498,9 @@ function configure(buddy) {
|
|
|
453
498
|
log6.info("Not implemented yet. Please use the --aws flag to configure AWS.");
|
|
454
499
|
process6.exit(ExitCode4.Success);
|
|
455
500
|
});
|
|
456
|
-
buddy.command("configure:aws", descriptions.aws).option("-p, --project", descriptions.project, { default: false }).option("--profile", descriptions.profile, {
|
|
501
|
+
buddy.command("configure:aws", descriptions.aws).option("-p, --project [project]", descriptions.project, { default: false }).option("--profile", descriptions.profile, {
|
|
502
|
+
default: process6.env.AWS_PROFILE
|
|
503
|
+
}).option("--verbose", descriptions.verbose, { default: false }).option("--access-key-id", "The AWS access key").option("--secret-access-key", "The AWS secret access key").option("--region", "The AWS region").option("--output", "The AWS output format").option("--quiet", "Suppress output").action(async (options) => {
|
|
457
504
|
log6.debug("Running `buddy configure:aws` ...", options);
|
|
458
505
|
await configureAws(options);
|
|
459
506
|
process6.exit(ExitCode4.Success);
|
|
@@ -472,7 +519,6 @@ async function configureAws(options) {
|
|
|
472
519
|
const command = `aws configure --profile ${options?.profile ?? process6.env.AWS_PROFILE}`;
|
|
473
520
|
const input = `${awsAccessKeyId}\n${awsSecretAccessKey}\n${defaultRegion}\n${defaultOutputFormat}\n`;
|
|
474
521
|
const result = await runCommand2(command, {
|
|
475
|
-
...options,
|
|
476
522
|
cwd: p2.projectPath(),
|
|
477
523
|
stdin: "pipe",
|
|
478
524
|
input
|
|
@@ -488,15 +534,16 @@ async function configureAws(options) {
|
|
|
488
534
|
|
|
489
535
|
// src/commands/create.ts
|
|
490
536
|
import process7 from "process";
|
|
491
|
-
import {
|
|
537
|
+
import {runAction as runAction4} from "@stacksjs/actions";
|
|
492
538
|
import {bold, cyan, dim, intro as intro5, log as log7, runCommand as runCommand3} from "@stacksjs/cli";
|
|
493
|
-
import {useOnline} from "@stacksjs/utils";
|
|
494
|
-
import {isFolder} from "@stacksjs/storage";
|
|
495
|
-
import {resolve} from "@stacksjs/path";
|
|
496
539
|
import {Action as Action4} from "@stacksjs/enums";
|
|
497
|
-
import {
|
|
540
|
+
import {resolve} from "@stacksjs/path";
|
|
541
|
+
import {isFolder} from "@stacksjs/storage";
|
|
542
|
+
import {ExitCode as ExitCode5} from "@stacksjs/types";
|
|
543
|
+
import {useOnline} from "@stacksjs/utils";
|
|
498
544
|
function create(buddy) {
|
|
499
545
|
const descriptions = {
|
|
546
|
+
name: "The name of the project",
|
|
500
547
|
command: "Create a new Stacks project",
|
|
501
548
|
ui: "Are you building a UI?",
|
|
502
549
|
components: "Are you building UI components?",
|
|
@@ -512,20 +559,20 @@ function create(buddy) {
|
|
|
512
559
|
project: "Target a specific project",
|
|
513
560
|
verbose: "Enable verbose output"
|
|
514
561
|
};
|
|
515
|
-
buddy.command("new
|
|
562
|
+
buddy.command("new [name]", descriptions.command).alias("create [name]").option("-n, --name [name]", descriptions.name, { default: false }).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("-ca, --cache", descriptions.cache, { default: false }).option("-e, --email", descriptions.email, { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (name, options) => {
|
|
516
563
|
log7.debug("Running `buddy new <name>` ...", options);
|
|
517
564
|
const startTime = await intro5("stacks new");
|
|
518
|
-
|
|
519
|
-
const
|
|
520
|
-
isFolderCheck(
|
|
565
|
+
name = name ?? options.name;
|
|
566
|
+
const path4 = resolve(process7.cwd(), name);
|
|
567
|
+
isFolderCheck(path4);
|
|
521
568
|
onlineCheck();
|
|
522
|
-
const result = await download(name,
|
|
569
|
+
const result = await download(name, path4, options);
|
|
523
570
|
if (result.isErr()) {
|
|
524
571
|
log7.error(result.error);
|
|
525
572
|
process7.exit(ExitCode5.FatalError);
|
|
526
573
|
}
|
|
527
|
-
await ensureEnv(
|
|
528
|
-
await install(
|
|
574
|
+
await ensureEnv(path4, options);
|
|
575
|
+
await install(path4, options);
|
|
529
576
|
if (startTime) {
|
|
530
577
|
const time = performance.now() - startTime;
|
|
531
578
|
log7.success(dim(`[${time.toFixed(2)}ms] Completed`));
|
|
@@ -539,9 +586,9 @@ function create(buddy) {
|
|
|
539
586
|
process7.exit(1);
|
|
540
587
|
});
|
|
541
588
|
}
|
|
542
|
-
var isFolderCheck = function(
|
|
543
|
-
if (isFolder(
|
|
544
|
-
log7.error(`Path ${
|
|
589
|
+
var isFolderCheck = function(path4) {
|
|
590
|
+
if (isFolder(path4)) {
|
|
591
|
+
log7.error(`Path ${path4} already exists`);
|
|
545
592
|
process7.exit(ExitCode5.FatalError);
|
|
546
593
|
}
|
|
547
594
|
};
|
|
@@ -554,31 +601,31 @@ var onlineCheck = function() {
|
|
|
554
601
|
process7.exit(ExitCode5.FatalError);
|
|
555
602
|
}
|
|
556
603
|
};
|
|
557
|
-
async function download(name,
|
|
604
|
+
async function download(name, path4, options) {
|
|
558
605
|
log7.info("Setting up your stack.");
|
|
559
606
|
const result = await runCommand3(`bunx giget stacks ${name}`, options);
|
|
560
|
-
log7.success(`Successfully scaffolded your project at ${cyan(
|
|
607
|
+
log7.success(`Successfully scaffolded your project at ${cyan(path4)}`);
|
|
561
608
|
return result;
|
|
562
609
|
}
|
|
563
|
-
async function ensureEnv(
|
|
610
|
+
async function ensureEnv(path4, options) {
|
|
564
611
|
log7.info("Ensuring your environment is ready...");
|
|
565
|
-
await runCommand3("pkgx --update ", { ...options, cwd:
|
|
612
|
+
await runCommand3("pkgx --update ", { ...options, cwd: path4 });
|
|
566
613
|
log7.success("Environment is ready");
|
|
567
614
|
}
|
|
568
|
-
async function install(
|
|
615
|
+
async function install(path4, options) {
|
|
569
616
|
log7.info("Installing & setting up Stacks");
|
|
570
|
-
let result = await runCommand3("bun install", { ...options, cwd:
|
|
617
|
+
let result = await runCommand3("bun install", { ...options, cwd: path4 });
|
|
571
618
|
if (result?.isErr()) {
|
|
572
619
|
log7.error(result.error);
|
|
573
620
|
process7.exit();
|
|
574
621
|
}
|
|
575
|
-
result = await runCommand3("cp .env.example .env", { ...options, cwd:
|
|
622
|
+
result = await runCommand3("cp .env.example .env", { ...options, cwd: path4 });
|
|
576
623
|
if (result?.isErr()) {
|
|
577
624
|
log7.error(result.error);
|
|
578
625
|
process7.exit(ExitCode5.FatalError);
|
|
579
626
|
}
|
|
580
|
-
await
|
|
581
|
-
result = await runCommand3("git init", { ...options, cwd:
|
|
627
|
+
await runAction4(Action4.KeyGenerate, { ...options, cwd: path4 });
|
|
628
|
+
result = await runCommand3("git init", { ...options, cwd: path4 });
|
|
582
629
|
if (result.isErr()) {
|
|
583
630
|
log7.error(result.error);
|
|
584
631
|
process7.exit(ExitCode5.FatalError);
|
|
@@ -588,19 +635,19 @@ async function install(path5, options) {
|
|
|
588
635
|
|
|
589
636
|
// src/commands/deploy.ts
|
|
590
637
|
import process8 from "process";
|
|
591
|
-
import {
|
|
592
|
-
import {runAction as runAction6} from "@stacksjs/actions";
|
|
638
|
+
import {runAction as runAction5} from "@stacksjs/actions";
|
|
593
639
|
import {intro as intro6, italic as italic2, log as log8, outro as outro6, runCommand as runCommand4} from "@stacksjs/cli";
|
|
594
|
-
import {Action as Action5} from "@stacksjs/enums";
|
|
595
640
|
import {app} from "@stacksjs/config";
|
|
596
641
|
import {addDomain, hasUserDomainBeenAddedToCloud} from "@stacksjs/dns";
|
|
642
|
+
import {Action as Action5} from "@stacksjs/enums";
|
|
643
|
+
import {ExitCode as ExitCode6} from "@stacksjs/types";
|
|
597
644
|
function deploy(buddy) {
|
|
598
645
|
const descriptions = {
|
|
599
646
|
deploy: "Re-installs your npm dependencies",
|
|
600
647
|
project: "Target a specific project",
|
|
601
648
|
verbose: "Enable verbose output"
|
|
602
649
|
};
|
|
603
|
-
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) => {
|
|
650
|
+
buddy.command("deploy", descriptions.deploy).option("--domain", "Specify a domain to deploy to", { default: undefined }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
604
651
|
log8.debug("Running `buddy deploy` ...", options);
|
|
605
652
|
const startTime = await intro6("buddy deploy");
|
|
606
653
|
const domain = options.domain || app.url;
|
|
@@ -610,9 +657,10 @@ function deploy(buddy) {
|
|
|
610
657
|
log8.info("For more info, check out the docs or join our Discord.");
|
|
611
658
|
process8.exit(ExitCode6.FatalError);
|
|
612
659
|
}
|
|
660
|
+
log8.info(`Deploying to ${italic2(domain)}`);
|
|
613
661
|
await checkIfAwsIsConfigured();
|
|
614
662
|
options.domain = await configureDomain(domain, options, startTime);
|
|
615
|
-
const result = await
|
|
663
|
+
const result = await runAction5(Action5.Deploy, options);
|
|
616
664
|
if (result.isErr()) {
|
|
617
665
|
await outro6("While running the `buddy deploy`, there was an issue", { startTime, useSeconds: true }, result.error);
|
|
618
666
|
process8.exit(ExitCode6.FatalError);
|
|
@@ -627,8 +675,7 @@ function deploy(buddy) {
|
|
|
627
675
|
async function configureDomain(domain, options, startTime) {
|
|
628
676
|
if (!domain) {
|
|
629
677
|
log8.info("We could not identify a domain to deploy to.");
|
|
630
|
-
log8.
|
|
631
|
-
console.log("");
|
|
678
|
+
log8.warn("Please set your .env or ./config/app.ts properly.");
|
|
632
679
|
log8.info("Alternatively, specify a domain to deploy via the `--domain` flag.");
|
|
633
680
|
console.log("");
|
|
634
681
|
log8.info(" \u27A1\uFE0F Example: `buddy deploy --domain example.com`");
|
|
@@ -637,8 +684,7 @@ async function configureDomain(domain, options, startTime) {
|
|
|
637
684
|
}
|
|
638
685
|
if (domain.includes("localhost")) {
|
|
639
686
|
log8.info("You are deploying to a local environment.");
|
|
640
|
-
log8.
|
|
641
|
-
console.log("");
|
|
687
|
+
log8.warn("Please set your .env or ./config/app.ts properly. The domain we are deploying cannot be a `localhost` domain.");
|
|
642
688
|
log8.info("Alternatively, specify a domain to deploy via the `--domain` flag.");
|
|
643
689
|
console.log("");
|
|
644
690
|
log8.info(" \u27A1\uFE0F Example: `buddy deploy --domain example.com`");
|
|
@@ -684,9 +730,8 @@ async function checkIfAwsIsConfigured() {
|
|
|
684
730
|
|
|
685
731
|
// src/commands/dev.ts
|
|
686
732
|
import process9 from "process";
|
|
687
|
-
import {Action as Action6} from "@stacksjs/enums";
|
|
688
733
|
import {
|
|
689
|
-
runAction as
|
|
734
|
+
runAction as runAction6,
|
|
690
735
|
runApiDevServer,
|
|
691
736
|
runComponentsDevServer,
|
|
692
737
|
runDashboardDevServer,
|
|
@@ -695,9 +740,10 @@ runDocsDevServer,
|
|
|
695
740
|
runFrontendDevServer,
|
|
696
741
|
runSystemTrayDevServer
|
|
697
742
|
} from "@stacksjs/actions";
|
|
698
|
-
import {ExitCode as ExitCode7} from "@stacksjs/types";
|
|
699
743
|
import {intro as intro7, log as log9, outro as outro7, runCommand as runCommand5} from "@stacksjs/cli";
|
|
744
|
+
import {Action as Action6} from "@stacksjs/enums";
|
|
700
745
|
import {libsPath} from "@stacksjs/path";
|
|
746
|
+
import {ExitCode as ExitCode7} from "@stacksjs/types";
|
|
701
747
|
function dev(buddy) {
|
|
702
748
|
const descriptions = {
|
|
703
749
|
dev: "Starts development server",
|
|
@@ -715,7 +761,9 @@ function dev(buddy) {
|
|
|
715
761
|
project: "Target a specific project",
|
|
716
762
|
verbose: "Enable verbose output"
|
|
717
763
|
};
|
|
718
|
-
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, {
|
|
764
|
+
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, {
|
|
765
|
+
default: false
|
|
766
|
+
}).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (server, options) => {
|
|
719
767
|
log9.debug("Running `buddy dev [server]` ...", options);
|
|
720
768
|
const perf = await intro7("buddy dev");
|
|
721
769
|
switch (server) {
|
|
@@ -779,7 +827,7 @@ function dev(buddy) {
|
|
|
779
827
|
outro7("Exited", { startTime: perf, useSeconds: true });
|
|
780
828
|
process9.exit(ExitCode7.Success);
|
|
781
829
|
});
|
|
782
|
-
buddy.command("dev:components", descriptions.components).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
830
|
+
buddy.command("dev:components", descriptions.components).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
783
831
|
log9.debug("Running `buddy dev:components` ...", options);
|
|
784
832
|
const perf = await intro7("buddy dev:components");
|
|
785
833
|
const result = await runCommand5("bun run dev", {
|
|
@@ -795,10 +843,10 @@ function dev(buddy) {
|
|
|
795
843
|
await outro7("Exited", { startTime: perf, useSeconds: true });
|
|
796
844
|
process9.exit(ExitCode7.Success);
|
|
797
845
|
});
|
|
798
|
-
buddy.command("dev:docs", descriptions.docs).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
846
|
+
buddy.command("dev:docs", descriptions.docs).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
799
847
|
log9.debug("Running `buddy dev:docs` ...", options);
|
|
800
848
|
const perf = await intro7("buddy dev:docs");
|
|
801
|
-
const result = await
|
|
849
|
+
const result = await runAction6(Action6.DevDocs, options);
|
|
802
850
|
if (result.isErr()) {
|
|
803
851
|
await outro7("While running the dev:docs command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
804
852
|
process9.exit();
|
|
@@ -807,10 +855,10 @@ function dev(buddy) {
|
|
|
807
855
|
await outro7("Exited", { startTime: perf, useSeconds: true });
|
|
808
856
|
process9.exit(ExitCode7.Success);
|
|
809
857
|
});
|
|
810
|
-
buddy.command("dev:desktop", descriptions.desktop).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
858
|
+
buddy.command("dev:desktop", descriptions.desktop).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
811
859
|
log9.debug("Running `buddy dev:desktop` ...", options);
|
|
812
860
|
const perf = await intro7("buddy dev:desktop");
|
|
813
|
-
const result = await
|
|
861
|
+
const result = await runAction6(Action6.DevDesktop, options);
|
|
814
862
|
if (result.isErr()) {
|
|
815
863
|
await outro7("While running the dev:desktop command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
816
864
|
process9.exit();
|
|
@@ -819,19 +867,19 @@ function dev(buddy) {
|
|
|
819
867
|
await outro7("Exited", { startTime: perf, useSeconds: true });
|
|
820
868
|
process9.exit(ExitCode7.Success);
|
|
821
869
|
});
|
|
822
|
-
buddy.command("dev:api", descriptions.api).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
870
|
+
buddy.command("dev:api", descriptions.api).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
823
871
|
log9.debug("Running `buddy dev:api` ...", options);
|
|
824
872
|
await runApiDevServer(options);
|
|
825
873
|
});
|
|
826
|
-
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) => {
|
|
874
|
+
buddy.command("dev:frontend", descriptions.frontend).alias("dev:pages").alias("dev:views").option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
827
875
|
log9.debug("Running `buddy dev:frontend` ...", options);
|
|
828
876
|
await runFrontendDevServer(options);
|
|
829
877
|
});
|
|
830
|
-
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) => {
|
|
878
|
+
buddy.command("dev:dashboard", descriptions.dashboard).alias("dev:admin").option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
831
879
|
log9.debug("Running `buddy dev:dashboard` ...", options);
|
|
832
880
|
await runDashboardDevServer(options);
|
|
833
881
|
});
|
|
834
|
-
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) => {
|
|
882
|
+
buddy.command("dev:system-tray", descriptions.systemTray).alias("dev:tray").option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
835
883
|
log9.debug("Running `buddy dev:system-tray` ...", options);
|
|
836
884
|
await runSystemTrayDevServer(options);
|
|
837
885
|
});
|
|
@@ -841,7 +889,7 @@ function dev(buddy) {
|
|
|
841
889
|
});
|
|
842
890
|
}
|
|
843
891
|
async function startDevelopmentServer(options) {
|
|
844
|
-
const result = await
|
|
892
|
+
const result = await runAction6(Action6.Dev, options);
|
|
845
893
|
if (result.isErr()) {
|
|
846
894
|
log9.error("While running the dev command, there was an issue", result.error);
|
|
847
895
|
process9.exit(ExitCode7.InvalidArgument);
|
|
@@ -853,12 +901,12 @@ var wantsInteractive = function(options) {
|
|
|
853
901
|
|
|
854
902
|
// src/commands/domains.ts
|
|
855
903
|
import process10 from "process";
|
|
856
|
-
import {runAction as
|
|
904
|
+
import {runAction as runAction7} from "@stacksjs/actions";
|
|
857
905
|
import {bgCyan, bold as bold2, intro as intro8, italic as italic3, log as log10, outro as outro8, prompts as prompts2} from "@stacksjs/cli";
|
|
858
906
|
import {config as config3} from "@stacksjs/config";
|
|
859
907
|
import {addDomain as addDomain2} from "@stacksjs/dns";
|
|
860
|
-
import {ExitCode as ExitCode8} from "@stacksjs/types";
|
|
861
908
|
import {Action as Action7} from "@stacksjs/enums";
|
|
909
|
+
import {ExitCode as ExitCode8} from "@stacksjs/types";
|
|
862
910
|
function domains(buddy) {
|
|
863
911
|
const descriptions = {
|
|
864
912
|
purchase: "Purchase a domain",
|
|
@@ -869,11 +917,73 @@ function domains(buddy) {
|
|
|
869
917
|
verbose: "Enable verbose output"
|
|
870
918
|
};
|
|
871
919
|
const c = config3.dns.contactInfo;
|
|
872
|
-
buddy.command("domains:purchase <domain>", descriptions.purchase).option("--years <years>", "Number of years to purchase the domain for", {
|
|
920
|
+
buddy.command("domains:purchase <domain>", descriptions.purchase).option("--years <years>", "Number of years to purchase the domain for", {
|
|
921
|
+
default: 1
|
|
922
|
+
}).option("--privacy", "Enable privacy protection", { default: true }).option("--auto-renew", "Enable auto-renew", { default: true }).option("--first-name <firstName>", "Registrant first name", {
|
|
923
|
+
default: c?.firstName
|
|
924
|
+
}).option("--last-name <lastName>", "Registrant last name", {
|
|
925
|
+
default: c?.lastName
|
|
926
|
+
}).option("--organization <organization>", "Registrant organization name", {
|
|
927
|
+
default: c?.organizationName
|
|
928
|
+
}).option("--address-line1 <address>", "Registrant address line 1", {
|
|
929
|
+
default: c?.addressLine1
|
|
930
|
+
}).option("--address-line2 <address>", "Registrant address line 2", {
|
|
931
|
+
default: c?.addressLine2
|
|
932
|
+
}).option("--city <city>", "Registrant city", { default: c?.city }).option("--state <state>", "Registrant state", { default: c?.state }).option("--country <country>", "Registrant country code", {
|
|
933
|
+
default: c?.countryCode
|
|
934
|
+
}).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", {
|
|
935
|
+
default: c?.admin?.firstName || c?.firstName
|
|
936
|
+
}).option("--admin-last-name <lastName>", "Admin last name", {
|
|
937
|
+
default: c?.admin?.lastName || c?.lastName
|
|
938
|
+
}).option("--admin-organization <organization>", "Admin organization", {
|
|
939
|
+
default: c?.admin?.organizationName || c?.organizationName
|
|
940
|
+
}).option("--admin-address-line1 <address>", "Admin address line 1", {
|
|
941
|
+
default: c?.admin?.addressLine1 || c?.addressLine1
|
|
942
|
+
}).option("--admin-address-line2 <address>", "Admin address line 2", {
|
|
943
|
+
default: c?.admin?.addressLine2 || c?.addressLine2
|
|
944
|
+
}).option("--admin-city <city>", "Admin city", {
|
|
945
|
+
default: c?.admin?.city || c?.city
|
|
946
|
+
}).option("--admin-state <state>", "Admin state", {
|
|
947
|
+
default: c?.admin?.state || c?.state
|
|
948
|
+
}).option("--admin-country <country>", "Admin country code", {
|
|
949
|
+
default: c?.admin?.countryCode || c?.countryCode
|
|
950
|
+
}).option("--admin-zip <zip>", "Admin zip", {
|
|
951
|
+
default: c?.admin?.zip || c?.zip
|
|
952
|
+
}).option("--admin-phone <phone>", "Admin phone number", {
|
|
953
|
+
default: c?.admin?.phoneNumber || c?.phoneNumber
|
|
954
|
+
}).option("--admin-email <email>", "Admin email", {
|
|
955
|
+
default: c?.admin?.email || c?.email
|
|
956
|
+
}).option("--tech-first-name <firstName>", "Tech first name", {
|
|
957
|
+
default: c?.tech?.firstName || c?.firstName
|
|
958
|
+
}).option("--tech-last-name <lastName>", "Tech last name", {
|
|
959
|
+
default: c?.tech?.lastName || c?.lastName
|
|
960
|
+
}).option("--tech-organization <organization>", "Tech organization name", {
|
|
961
|
+
default: c?.tech?.organizationName || c?.organizationName
|
|
962
|
+
}).option("--tech-address-line1 <address>", "Tech address line 1", {
|
|
963
|
+
default: c?.tech?.addressLine1 || c?.addressLine1
|
|
964
|
+
}).option("--tech-address-line2 <address>", "Tech address line 2", {
|
|
965
|
+
default: c?.tech?.addressLine2 || c?.addressLine2
|
|
966
|
+
}).option("--tech-city <city>", "Tech city", {
|
|
967
|
+
default: c?.tech?.city || c?.city
|
|
968
|
+
}).option("--tech-state <state>", "Tech state", {
|
|
969
|
+
default: c?.tech?.state || c?.state
|
|
970
|
+
}).option("--tech-country <country>", "Tech country", {
|
|
971
|
+
default: c?.tech?.countryCode || c?.countryCode
|
|
972
|
+
}).option("--tech-zip <zip>", "Tech zip", { default: c?.tech?.zip || c?.zip }).option("--tech-phone <phone>", "Tech phone", {
|
|
973
|
+
default: c?.tech?.phoneNumber || c?.phoneNumber
|
|
974
|
+
}).option("--tech-email <email>", "Tech email", {
|
|
975
|
+
default: c?.tech?.email || c?.email
|
|
976
|
+
}).option("--privacy-admin", "Enable privacy protection for admin", {
|
|
977
|
+
default: c?.privacyAdmin || c?.privacy || true
|
|
978
|
+
}).option("--privacy-tech", "Enable privacy protection for tech", {
|
|
979
|
+
default: c?.privacyTech || c?.privacy || true
|
|
980
|
+
}).option("--privacy-registrant", "Enable privacy protection for registrant", {
|
|
981
|
+
default: c?.privacyRegistrant || c?.privacy || true
|
|
982
|
+
}).option("--contact-type <type>", "Contact type", { default: "person" }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (domain, options) => {
|
|
873
983
|
log10.debug("Running `buddy domains:purchase <domain>` ...", options);
|
|
874
984
|
options.domain = domain;
|
|
875
985
|
const startTime = await intro8("buddy domains:purchase");
|
|
876
|
-
const result = await
|
|
986
|
+
const result = await runAction7(Action7.DomainsPurchase, options);
|
|
877
987
|
if (result.isErr()) {
|
|
878
988
|
await outro8("While running the domains:purchase command, there was an issue", { startTime, useSeconds: true }, result.error);
|
|
879
989
|
process10.exit(ExitCode8.FatalError);
|
|
@@ -884,11 +994,15 @@ function domains(buddy) {
|
|
|
884
994
|
message: `Would you like to set ${domain} as your APP_URL?`
|
|
885
995
|
});
|
|
886
996
|
if (!confirm) {
|
|
887
|
-
await outro8(`Alrighty! ${italic3(domain)} was added to your account.`, {
|
|
997
|
+
await outro8(`Alrighty! ${italic3(domain)} was added to your account.`, {
|
|
998
|
+
startTime,
|
|
999
|
+
useSeconds: true,
|
|
1000
|
+
type: "success"
|
|
1001
|
+
});
|
|
888
1002
|
log10.info(`Please note, you may need to validate your email address. Check your ${italic3(options.registrantEmail)} inbox.`);
|
|
889
1003
|
process10.exit(ExitCode8.Success);
|
|
890
1004
|
}
|
|
891
|
-
const { writeEnv } = await import("
|
|
1005
|
+
const { writeEnv } = await import("./chunk-b0df37cbea681adc.js");
|
|
892
1006
|
writeEnv("APP_URL", domain);
|
|
893
1007
|
let message = `Great! ${italic3(domain)} was added to your account.`;
|
|
894
1008
|
message += `\n\nAnd your APP_URL has been set to ${italic3(domain)}.
|
|
@@ -924,16 +1038,23 @@ function domains(buddy) {
|
|
|
924
1038
|
message: `Are you sure you want to remove ${domain}?`
|
|
925
1039
|
});
|
|
926
1040
|
if (!confirm) {
|
|
927
|
-
await outro8("Cancelled the domains:remove command", {
|
|
1041
|
+
await outro8("Cancelled the domains:remove command", {
|
|
1042
|
+
startTime,
|
|
1043
|
+
useSeconds: true,
|
|
1044
|
+
type: "info"
|
|
1045
|
+
});
|
|
928
1046
|
process10.exit(ExitCode8.Success);
|
|
929
1047
|
}
|
|
930
1048
|
}
|
|
931
|
-
const result = await
|
|
1049
|
+
const result = await runAction7(Action7.DomainsRemove, opts);
|
|
932
1050
|
if (result.isErr()) {
|
|
933
1051
|
await outro8("While running the domains:remove command, there was an issue", { startTime, useSeconds: true }, result.error);
|
|
934
1052
|
process10.exit(ExitCode8.FatalError);
|
|
935
1053
|
}
|
|
936
|
-
await outro8("Removed your domain DNS records.", {
|
|
1054
|
+
await outro8("Removed your domain DNS records.", {
|
|
1055
|
+
startTime,
|
|
1056
|
+
useSeconds: true
|
|
1057
|
+
});
|
|
937
1058
|
process10.exit(ExitCode8.Success);
|
|
938
1059
|
});
|
|
939
1060
|
buddy.on("domains:*", () => {
|
|
@@ -944,9 +1065,9 @@ function domains(buddy) {
|
|
|
944
1065
|
|
|
945
1066
|
// src/commands/dns.ts
|
|
946
1067
|
import process11 from "process";
|
|
947
|
-
import {ExitCode as ExitCode9} from "@stacksjs/types";
|
|
948
|
-
import {config as config5} from "@stacksjs/config";
|
|
949
1068
|
import {log as log11, runCommand as runCommand6} from "@stacksjs/cli";
|
|
1069
|
+
import {config as config5} from "@stacksjs/config";
|
|
1070
|
+
import {ExitCode as ExitCode9} from "@stacksjs/types";
|
|
950
1071
|
function dns3(buddy) {
|
|
951
1072
|
const descriptions = {
|
|
952
1073
|
dns: "Lists the DNS records for a domain",
|
|
@@ -964,10 +1085,10 @@ function dns3(buddy) {
|
|
|
964
1085
|
project: "Target a specific project",
|
|
965
1086
|
verbose: "Enable verbose output"
|
|
966
1087
|
};
|
|
967
|
-
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) => {
|
|
1088
|
+
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 [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (domain, options) => {
|
|
968
1089
|
log11.debug("Running `buddy dns [domain]` ...", options);
|
|
969
|
-
|
|
970
|
-
|
|
1090
|
+
options.pretty = undefined;
|
|
1091
|
+
options.p = undefined;
|
|
971
1092
|
const optionsString = Object.entries(options).filter(([key, value]) => key !== "--" && key.length > 1 && value !== false).map(([key, value]) => `--${key} ${value}`).join(" ");
|
|
972
1093
|
await runCommand6(`dog ${domain || config5.app.url} ${optionsString}`);
|
|
973
1094
|
process11.exit(ExitCode9.Success);
|
|
@@ -980,25 +1101,31 @@ function dns3(buddy) {
|
|
|
980
1101
|
|
|
981
1102
|
// src/commands/fresh.ts
|
|
982
1103
|
import process12 from "process";
|
|
983
|
-
import {
|
|
984
|
-
import {runAction as runAction9} from "@stacksjs/actions";
|
|
1104
|
+
import {runAction as runAction8} from "@stacksjs/actions";
|
|
985
1105
|
import {intro as intro9, log as log12, outro as outro9} from "@stacksjs/cli";
|
|
986
1106
|
import {Action as Action8} from "@stacksjs/enums";
|
|
1107
|
+
import {ExitCode as ExitCode10} from "@stacksjs/types";
|
|
987
1108
|
function fresh(buddy) {
|
|
988
1109
|
const descriptions = {
|
|
989
1110
|
fresh: "Re-installs your npm dependencies",
|
|
990
1111
|
project: "Target a specific project",
|
|
991
1112
|
verbose: "Enable verbose output"
|
|
992
1113
|
};
|
|
993
|
-
buddy.command("fresh", descriptions.fresh).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1114
|
+
buddy.command("fresh", descriptions.fresh).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
994
1115
|
log12.debug("Running `buddy fresh` ...", options);
|
|
995
1116
|
const perf = await intro9("buddy fresh");
|
|
996
|
-
const result = await
|
|
1117
|
+
const result = await runAction8(Action8.Fresh, {
|
|
1118
|
+
...options,
|
|
1119
|
+
stdout: "inherit"
|
|
1120
|
+
});
|
|
997
1121
|
if (result.isErr()) {
|
|
998
1122
|
await outro9("While running `buddy fresh`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
999
1123
|
process12.exit(ExitCode10.FatalError);
|
|
1000
1124
|
}
|
|
1001
|
-
await outro9("Freshly reinstalled your dependencies", {
|
|
1125
|
+
await outro9("Freshly reinstalled your dependencies", {
|
|
1126
|
+
startTime: perf,
|
|
1127
|
+
useSeconds: true
|
|
1128
|
+
});
|
|
1002
1129
|
process12.exit(ExitCode10.Success);
|
|
1003
1130
|
});
|
|
1004
1131
|
buddy.on("fresh:*", () => {
|
|
@@ -1014,7 +1141,6 @@ generateComponentMeta,
|
|
|
1014
1141
|
generateCoreSymlink,
|
|
1015
1142
|
generateIdeHelpers,
|
|
1016
1143
|
generateLibEntries,
|
|
1017
|
-
generateMigrations,
|
|
1018
1144
|
generatePkgxConfig,
|
|
1019
1145
|
generateTypes,
|
|
1020
1146
|
generateVsCodeCustomData,
|
|
@@ -1038,42 +1164,41 @@ function generate(buddy) {
|
|
|
1038
1164
|
project: "Target a specific project",
|
|
1039
1165
|
verbose: "Enable verbose output"
|
|
1040
1166
|
};
|
|
1041
|
-
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("--core-symlink", descriptions.coreSymlink).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1167
|
+
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 [project]", descriptions.project, { default: false }).option("--core-symlink", descriptions.coreSymlink).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1042
1168
|
log13.debug("Running `buddy generate` ...", options);
|
|
1043
1169
|
await startGenerationProcess(options);
|
|
1044
1170
|
process13.exit(ExitCode11.Success);
|
|
1045
1171
|
});
|
|
1046
|
-
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) => {
|
|
1172
|
+
buddy.command("generate:types", descriptions.types).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).alias("types:generate").action(async (options) => {
|
|
1047
1173
|
log13.debug("Running `buddy generate:types` ...", options);
|
|
1048
1174
|
await generateTypes(options);
|
|
1049
1175
|
});
|
|
1050
|
-
buddy.command("generate:entries", descriptions.entries).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1176
|
+
buddy.command("generate:entries", descriptions.entries).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1051
1177
|
log13.debug("Running `buddy generate:entries` ...", options);
|
|
1052
1178
|
await generateLibEntries(options);
|
|
1053
1179
|
});
|
|
1054
|
-
buddy.command("generate:web-types", descriptions.webTypes).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1180
|
+
buddy.command("generate:web-types", descriptions.webTypes).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1055
1181
|
log13.debug("Running `buddy generate:web-types` ...", options);
|
|
1056
1182
|
await generateWebTypes(options);
|
|
1057
1183
|
});
|
|
1058
|
-
buddy.command("generate:vscode-custom-data", descriptions.customData).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1184
|
+
buddy.command("generate:vscode-custom-data", descriptions.customData).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1059
1185
|
log13.debug("Running `buddy generate:vscode-custom-data` ...", options);
|
|
1060
1186
|
await generateVsCodeCustomData(options);
|
|
1061
1187
|
});
|
|
1062
|
-
buddy.command("generate:ide-helpers", descriptions.ideHelpers).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1188
|
+
buddy.command("generate:ide-helpers", descriptions.ideHelpers).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1063
1189
|
log13.debug("Running `buddy generate:ide-helpers` ...", options);
|
|
1064
1190
|
await generateIdeHelpers(options);
|
|
1065
1191
|
});
|
|
1066
|
-
buddy.command("generate:component-meta", descriptions.componentMeta).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1192
|
+
buddy.command("generate:component-meta", descriptions.componentMeta).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1067
1193
|
log13.debug("Running `buddy generate:component-meta` ...", options);
|
|
1068
1194
|
await generateComponentMeta(options);
|
|
1069
1195
|
});
|
|
1070
|
-
buddy.command("generate:pkgx-config", descriptions.pkgx).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action((options) => {
|
|
1196
|
+
buddy.command("generate:pkgx-config", descriptions.pkgx).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action((options) => {
|
|
1071
1197
|
log13.debug("Running `buddy generate:pkgx-config` ...", options);
|
|
1072
1198
|
generatePkgxConfig();
|
|
1073
1199
|
});
|
|
1074
1200
|
buddy.command("generate:migrations", "Generate Migrations").action((options) => {
|
|
1075
1201
|
log13.debug("Running `buddy generate:migrations` ...", options);
|
|
1076
|
-
generateMigrations();
|
|
1077
1202
|
});
|
|
1078
1203
|
buddy.command("generate:core-symlink", "Generate core symlink. A shortcut for core developers.").action(async (options) => {
|
|
1079
1204
|
log13.debug("Running `buddy core-symlink` ...", options);
|
|
@@ -1087,8 +1212,8 @@ function generate(buddy) {
|
|
|
1087
1212
|
|
|
1088
1213
|
// src/commands/http.ts
|
|
1089
1214
|
import process14 from "process";
|
|
1090
|
-
import {ExitCode as ExitCode12} from "@stacksjs/types";
|
|
1091
1215
|
import {config as config7} from "@stacksjs/config";
|
|
1216
|
+
import {ExitCode as ExitCode12} from "@stacksjs/types";
|
|
1092
1217
|
import {log as log14, runCommandSync as runCommandSync2} from "@stacksjs/cli";
|
|
1093
1218
|
function http(buddy) {
|
|
1094
1219
|
const descriptions = {
|
|
@@ -1096,7 +1221,7 @@ function http(buddy) {
|
|
|
1096
1221
|
project: "Target a specific project",
|
|
1097
1222
|
verbose: "Enable verbose output"
|
|
1098
1223
|
};
|
|
1099
|
-
buddy.command("http [domain]", descriptions.http).option("-p, --project", descriptions.project, { default: false }).action(async (domain, options) => {
|
|
1224
|
+
buddy.command("http [domain]", descriptions.http).option("-p, --project [project]", descriptions.project, { default: false }).action(async (domain, options) => {
|
|
1100
1225
|
log14.debug("Running `buddy http [domain]` ...", options);
|
|
1101
1226
|
const optionsString = Object.entries(options).filter(([key, value]) => key !== "--" && key.length > 1 && value !== false).map(([key, value]) => `--${key} ${value}`).join(" ");
|
|
1102
1227
|
const command = `http GET ${domain || config7.app.url} ${optionsString}`;
|
|
@@ -1108,9 +1233,9 @@ function http(buddy) {
|
|
|
1108
1233
|
|
|
1109
1234
|
// src/commands/lint.ts
|
|
1110
1235
|
import process15 from "process";
|
|
1236
|
+
import {runAction as runAction9} from "@stacksjs/actions";
|
|
1111
1237
|
import {intro as intro10, log as log15, outro as outro10} from "@stacksjs/cli";
|
|
1112
1238
|
import {Action as Action9} from "@stacksjs/enums";
|
|
1113
|
-
import {runAction as runAction10} from "@stacksjs/actions";
|
|
1114
1239
|
function lint(buddy) {
|
|
1115
1240
|
const descriptions = {
|
|
1116
1241
|
lint: "Automagically lints your project codebase",
|
|
@@ -1118,20 +1243,20 @@ function lint(buddy) {
|
|
|
1118
1243
|
project: "Target a specific project",
|
|
1119
1244
|
verbose: "Enable verbose output"
|
|
1120
1245
|
};
|
|
1121
|
-
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) => {
|
|
1246
|
+
buddy.command("lint", descriptions.lint).option("-f, --fix", descriptions.lintFix, { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1122
1247
|
log15.debug("Running `buddy lint` ...", options);
|
|
1123
1248
|
const startTime = await intro10("buddy lint");
|
|
1124
|
-
const result = await
|
|
1249
|
+
const result = await runAction9(Action9.Lint, options);
|
|
1125
1250
|
if (result.isErr()) {
|
|
1126
1251
|
await outro10("While running `buddy lint`, there was an issue", { startTime, useSeconds: true }, result.error);
|
|
1127
1252
|
process15.exit();
|
|
1128
1253
|
}
|
|
1129
1254
|
await outro10("Linted your project", { startTime, useSeconds: true });
|
|
1130
1255
|
});
|
|
1131
|
-
buddy.command("lint:fix", descriptions.lintFix).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1256
|
+
buddy.command("lint:fix", descriptions.lintFix).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1132
1257
|
log15.debug("Running `buddy lint:fix` ...", options);
|
|
1133
1258
|
log15.info("Fixing lint errors...");
|
|
1134
|
-
const result = await
|
|
1259
|
+
const result = await runAction9(Action9.LintFix, { ...options });
|
|
1135
1260
|
if (result.isErr()) {
|
|
1136
1261
|
log15.error("There was an error lint fixing your code.", result.error);
|
|
1137
1262
|
process15.exit();
|
|
@@ -1146,16 +1271,16 @@ function lint(buddy) {
|
|
|
1146
1271
|
|
|
1147
1272
|
// src/commands/list.ts
|
|
1148
1273
|
import process16 from "process";
|
|
1149
|
-
var {$ } = globalThis.Bun;
|
|
1150
|
-
import {projectPath} from "@stacksjs/path";
|
|
1151
1274
|
import {log as log16} from "@stacksjs/logging";
|
|
1275
|
+
import {projectPath} from "@stacksjs/path";
|
|
1276
|
+
var {$ } = globalThis.Bun;
|
|
1152
1277
|
function list(buddy) {
|
|
1153
1278
|
const descriptions = {
|
|
1154
1279
|
list: "List all of the project-specific Buddy commands",
|
|
1155
1280
|
project: "Target a specific project",
|
|
1156
1281
|
verbose: "Enable verbose output"
|
|
1157
1282
|
};
|
|
1158
|
-
buddy.command("list", descriptions.list).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1283
|
+
buddy.command("list", descriptions.list).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1159
1284
|
log16.debug("Running `buddy list` ...", options);
|
|
1160
1285
|
$.cwd(projectPath());
|
|
1161
1286
|
const test = await $`buddy --help`.text();
|
|
@@ -1183,7 +1308,7 @@ function install2(buddy) {
|
|
|
1183
1308
|
project: "Target a specific project",
|
|
1184
1309
|
verbose: "Enable verbose output"
|
|
1185
1310
|
};
|
|
1186
|
-
buddy.command("install", descriptions.install).option("-p, --project", descriptions.project, { default: false }).option("-v, --verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1311
|
+
buddy.command("install", descriptions.install).option("-p, --project [project]", descriptions.project, { default: false }).option("-v, --verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1187
1312
|
log17.debug("Running `buddy install` ...", options);
|
|
1188
1313
|
await runCommand7("bun install", {
|
|
1189
1314
|
...options,
|
|
@@ -1198,8 +1323,8 @@ function install2(buddy) {
|
|
|
1198
1323
|
|
|
1199
1324
|
// src/commands/key.ts
|
|
1200
1325
|
import process18 from "process";
|
|
1326
|
+
import {runAction as runAction10} from "@stacksjs/actions";
|
|
1201
1327
|
import {intro as intro11, log as log18, outro as outro11} from "@stacksjs/cli";
|
|
1202
|
-
import {runAction as runAction11} from "@stacksjs/actions";
|
|
1203
1328
|
import {Action as Action10} from "@stacksjs/enums";
|
|
1204
1329
|
function key(buddy) {
|
|
1205
1330
|
const descriptions = {
|
|
@@ -1207,10 +1332,10 @@ function key(buddy) {
|
|
|
1207
1332
|
project: "Target a specific project",
|
|
1208
1333
|
verbose: "Enable verbose output"
|
|
1209
1334
|
};
|
|
1210
|
-
buddy.command("key:generate", descriptions.command).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1335
|
+
buddy.command("key:generate", descriptions.command).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1211
1336
|
log18.debug("Running `buddy key:generate` ...", options);
|
|
1212
1337
|
await intro11("buddy key:generate");
|
|
1213
|
-
const result = await
|
|
1338
|
+
const result = await runAction10(Action10.KeyGenerate, options);
|
|
1214
1339
|
if (result.isErr()) {
|
|
1215
1340
|
log18.error("Failed to set random application key.", result.error);
|
|
1216
1341
|
process18.exit();
|
|
@@ -1229,6 +1354,7 @@ import {
|
|
|
1229
1354
|
createModel,
|
|
1230
1355
|
createNotification,
|
|
1231
1356
|
invoke,
|
|
1357
|
+
makeAction,
|
|
1232
1358
|
makeComponent,
|
|
1233
1359
|
makeDatabase,
|
|
1234
1360
|
makeFunction,
|
|
@@ -1238,11 +1364,12 @@ makeStack
|
|
|
1238
1364
|
} from "@stacksjs/actions";
|
|
1239
1365
|
import {intro as intro12, italic as italic4, outro as outro12, runCommand as runCommand8} from "@stacksjs/cli";
|
|
1240
1366
|
import {localUrl} from "@stacksjs/config";
|
|
1241
|
-
import {path as p4} from "@stacksjs/path";
|
|
1242
1367
|
import {log as log19} from "@stacksjs/logging";
|
|
1368
|
+
import {path as p4} from "@stacksjs/path";
|
|
1243
1369
|
import {ExitCode as ExitCode13} from "@stacksjs/types";
|
|
1244
1370
|
function make(buddy) {
|
|
1245
1371
|
const descriptions = {
|
|
1372
|
+
action: "Create a new action",
|
|
1246
1373
|
model: "Create a new model",
|
|
1247
1374
|
component: "Create a new component",
|
|
1248
1375
|
page: "Create a new page",
|
|
@@ -1252,13 +1379,14 @@ function make(buddy) {
|
|
|
1252
1379
|
migration: "Create a new migration",
|
|
1253
1380
|
factory: "Create a new factory",
|
|
1254
1381
|
notification: "Create a new notification",
|
|
1382
|
+
name: "The name of the action",
|
|
1255
1383
|
stack: "Create a new stack",
|
|
1256
1384
|
certificate: "Create a new SSL Certificate",
|
|
1257
1385
|
select: "What are you trying to make?",
|
|
1258
1386
|
project: "Target a specific project",
|
|
1259
1387
|
verbose: "Enable verbose output"
|
|
1260
1388
|
};
|
|
1261
|
-
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
|
|
1389
|
+
buddy.command("make", "The make command").option("-a, --action [action]", descriptions.action, { default: false }).option("-m, --model [model]", descriptions.model, { default: false }).option("-c, --component [component]", descriptions.component, { default: false }).option("-p, --page [page]", descriptions.page, { default: false }).option("-f, --function [function]", descriptions.function, { default: false }).option("-l, --language [language]", descriptions.language, { default: false }).option("-d, --database [database]", descriptions.database, { default: false }).option("-m, --migration [migration]", descriptions.migration, { default: false }).option("-f, --factory [factory]", descriptions.factory, { default: false }).option("-n, --notification [notification]", descriptions.notification, { default: false }).option("-s, --stack [stack]", descriptions.stack, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1262
1390
|
log19.debug("Running `buddy make` ...", options);
|
|
1263
1391
|
const name = buddy.args[0];
|
|
1264
1392
|
if (!name) {
|
|
@@ -1268,9 +1396,9 @@ function make(buddy) {
|
|
|
1268
1396
|
await invoke(options);
|
|
1269
1397
|
process19.exit(ExitCode13.Success);
|
|
1270
1398
|
});
|
|
1271
|
-
buddy.command("make:component", descriptions.component).option("-n, --name",
|
|
1399
|
+
buddy.command("make:component [name]", descriptions.component).option("-n, --name [name]", descriptions.name, { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (name, options) => {
|
|
1272
1400
|
log19.debug("Running `buddy make:component` ...", options);
|
|
1273
|
-
|
|
1401
|
+
name = name ?? options.name;
|
|
1274
1402
|
options.name = name;
|
|
1275
1403
|
if (!name) {
|
|
1276
1404
|
log19.error("You need to specify a name. Read more about the documentation here.");
|
|
@@ -1278,28 +1406,31 @@ function make(buddy) {
|
|
|
1278
1406
|
}
|
|
1279
1407
|
await makeComponent(options);
|
|
1280
1408
|
});
|
|
1281
|
-
buddy.command("make:database", descriptions.database).option("-n, --name",
|
|
1409
|
+
buddy.command("make:database [name]", descriptions.database).option("-n, --name [name]", descriptions.name, { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action((name, options) => {
|
|
1282
1410
|
log19.debug("Running `buddy make:database` ...", options);
|
|
1283
|
-
|
|
1411
|
+
name = name ?? options.name;
|
|
1284
1412
|
options.name = name;
|
|
1285
1413
|
if (!name) {
|
|
1286
|
-
log19.error("You need to specify a name
|
|
1414
|
+
log19.error("You need to specify a database name via the `--name` option, or as the command\u2019s argument.");
|
|
1415
|
+
log19.info("Example: `buddy make:database my-cool-database`");
|
|
1416
|
+
log19.info("Or: `buddy make:database --name=my-cool-database`");
|
|
1417
|
+
log19.info("Read more about the documentation here: https://stacksjs.org/docs/make/database");
|
|
1287
1418
|
process19.exit();
|
|
1288
1419
|
}
|
|
1289
1420
|
makeDatabase(options);
|
|
1290
1421
|
});
|
|
1291
|
-
buddy.command("make:factory", descriptions.factory).option("-n, --name",
|
|
1422
|
+
buddy.command("make:factory [name]", descriptions.factory).option("-n, --name [name]", descriptions.name, { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action((name, options) => {
|
|
1292
1423
|
log19.debug("Running `buddy make:factory` ...", options);
|
|
1293
|
-
|
|
1424
|
+
name = name ?? options.name;
|
|
1294
1425
|
options.name = name;
|
|
1295
1426
|
if (!name) {
|
|
1296
1427
|
log19.error("You need to specify a name. Read more about the documentation here.");
|
|
1297
1428
|
process19.exit();
|
|
1298
1429
|
}
|
|
1299
1430
|
});
|
|
1300
|
-
buddy.command("make:view", descriptions.page).alias("make:page").option("-n, --name",
|
|
1431
|
+
buddy.command("make:view [name]", descriptions.page).alias("make:page [name]").option("-n, --name [name]", descriptions.name, { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (name, options) => {
|
|
1301
1432
|
log19.debug("Running `buddy make:view` ...", options);
|
|
1302
|
-
|
|
1433
|
+
name = name ?? options.name;
|
|
1303
1434
|
options.name = name;
|
|
1304
1435
|
if (!name) {
|
|
1305
1436
|
log19.error("You need to specify a name. Read more about the documentation here.");
|
|
@@ -1307,13 +1438,13 @@ function make(buddy) {
|
|
|
1307
1438
|
}
|
|
1308
1439
|
await makePage(options);
|
|
1309
1440
|
});
|
|
1310
|
-
buddy.command("make:function", descriptions.function).option("-n, --name",
|
|
1441
|
+
buddy.command("make:function [name]", descriptions.function).option("-n, --name [name]", descriptions.name, { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1311
1442
|
log19.debug("Running `buddy make:function` ...", options);
|
|
1312
1443
|
await makeFunction(options);
|
|
1313
1444
|
});
|
|
1314
|
-
buddy.command("make:lang", descriptions.language).option("-n, --name",
|
|
1445
|
+
buddy.command("make:lang [name]", descriptions.language).option("-n, --name [name]", descriptions.name, { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (name, options) => {
|
|
1315
1446
|
log19.debug("Running `buddy make:lang` ...", options);
|
|
1316
|
-
|
|
1447
|
+
name = name ?? options.name;
|
|
1317
1448
|
options.name = name;
|
|
1318
1449
|
if (!name) {
|
|
1319
1450
|
log19.error("You need to specify a name. Read more about the documentation here.");
|
|
@@ -1321,10 +1452,10 @@ function make(buddy) {
|
|
|
1321
1452
|
}
|
|
1322
1453
|
await makeLanguage(options);
|
|
1323
1454
|
});
|
|
1324
|
-
buddy.command("make:notification", descriptions.notification).option("-n, --name",
|
|
1455
|
+
buddy.command("make:notification [name]", descriptions.notification).option("-n, --name [name]", descriptions.name, { default: false }).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 [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (name, options) => {
|
|
1325
1456
|
log19.debug("Running `buddy make:notification` ...", options);
|
|
1326
1457
|
const perf = await intro12("buddy make:notification");
|
|
1327
|
-
|
|
1458
|
+
name = name ?? options.name;
|
|
1328
1459
|
options.name = name;
|
|
1329
1460
|
if (!name) {
|
|
1330
1461
|
log19.error("You need to specify a name. Read more about the documentation here.");
|
|
@@ -1332,15 +1463,21 @@ function make(buddy) {
|
|
|
1332
1463
|
}
|
|
1333
1464
|
const result = await createNotification(options);
|
|
1334
1465
|
if (!result) {
|
|
1335
|
-
await outro12("While running the make:notification command, there was an issue", {
|
|
1466
|
+
await outro12("While running the make:notification command, there was an issue", {
|
|
1467
|
+
startTime: perf,
|
|
1468
|
+
useSeconds: true
|
|
1469
|
+
});
|
|
1336
1470
|
process19.exit();
|
|
1337
1471
|
}
|
|
1338
|
-
await outro12(`Created your ${italic4(name)} notification.`, {
|
|
1472
|
+
await outro12(`Created your ${italic4(name)} notification.`, {
|
|
1473
|
+
startTime: perf,
|
|
1474
|
+
useSeconds: true
|
|
1475
|
+
});
|
|
1339
1476
|
process19.exit(ExitCode13.Success);
|
|
1340
1477
|
});
|
|
1341
|
-
buddy.command("make:stack", descriptions.stack).option("-n, --name",
|
|
1478
|
+
buddy.command("make:stack [name]", descriptions.stack).option("-n, --name [name]", descriptions.name, { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action((name, options) => {
|
|
1342
1479
|
log19.debug("Running `buddy make:stack` ...", options);
|
|
1343
|
-
|
|
1480
|
+
name = name ?? options.name;
|
|
1344
1481
|
options.name = name;
|
|
1345
1482
|
if (!name) {
|
|
1346
1483
|
log19.error("You need to specify a name. Read more about the documentation here.");
|
|
@@ -1348,9 +1485,20 @@ function make(buddy) {
|
|
|
1348
1485
|
}
|
|
1349
1486
|
makeStack(options);
|
|
1350
1487
|
});
|
|
1351
|
-
buddy.command("make:
|
|
1488
|
+
buddy.command("make:action [name]", descriptions.action).option("-n, --name [name]", descriptions.name, { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (name, options) => {
|
|
1489
|
+
log19.info("Running `buddy make:action` ...");
|
|
1490
|
+
log19.debug("Running `buddy make:action` ...", name, options);
|
|
1491
|
+
name = name ?? options.name;
|
|
1492
|
+
options.name = name;
|
|
1493
|
+
if (!name) {
|
|
1494
|
+
log19.error("You need to specify a name. Read more about the documentation here.");
|
|
1495
|
+
process19.exit();
|
|
1496
|
+
}
|
|
1497
|
+
await makeAction(options);
|
|
1498
|
+
});
|
|
1499
|
+
buddy.command("make:model [name]", descriptions.model).option("-n, --name [name]", descriptions.name, { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (name, options) => {
|
|
1352
1500
|
log19.debug("Running `buddy make:model` ...", options);
|
|
1353
|
-
|
|
1501
|
+
name = name ?? options.name;
|
|
1354
1502
|
options.name = name;
|
|
1355
1503
|
if (!name) {
|
|
1356
1504
|
log19.error("You need to specify a model name");
|
|
@@ -1358,26 +1506,25 @@ function make(buddy) {
|
|
|
1358
1506
|
}
|
|
1359
1507
|
await createModel(options);
|
|
1360
1508
|
});
|
|
1361
|
-
buddy.command("make:migration", descriptions.migration).option("-n, --name",
|
|
1509
|
+
buddy.command("make:migration [name]", descriptions.migration).option("-n, --name [name]", descriptions.name, { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action((name, options) => {
|
|
1362
1510
|
log19.debug("Running `buddy make:migration` ...", options);
|
|
1363
|
-
|
|
1511
|
+
name = name ?? options.name;
|
|
1364
1512
|
options.name = name;
|
|
1365
1513
|
if (!name) {
|
|
1366
1514
|
log19.error("You need to specify a migration name");
|
|
1367
1515
|
process19.exit();
|
|
1368
1516
|
}
|
|
1369
|
-
log19.info(path, name);
|
|
1370
1517
|
});
|
|
1371
1518
|
buddy.command("make:certificate", descriptions.certificate).alias("make:cert").example("buddy make:certificate").action(async (options) => {
|
|
1372
1519
|
log19.debug("Running `buddy make:certificate` ...", options);
|
|
1373
1520
|
const domain = await localUrl();
|
|
1374
1521
|
log19.info(`Creating SSL certificate...`);
|
|
1375
|
-
await runCommand8(`
|
|
1522
|
+
await runCommand8(`tlsx ${domain}`, {
|
|
1376
1523
|
cwd: p4.projectStoragePath("keys")
|
|
1377
1524
|
});
|
|
1378
1525
|
log19.success("Certificate created");
|
|
1379
1526
|
log19.info(`Installing SSL certificate...`);
|
|
1380
|
-
await runCommand8(`
|
|
1527
|
+
await runCommand8(`tlsx -install`, {
|
|
1381
1528
|
cwd: p4.projectStoragePath("keys")
|
|
1382
1529
|
});
|
|
1383
1530
|
log19.success("Certificate installed");
|
|
@@ -1390,10 +1537,10 @@ function make(buddy) {
|
|
|
1390
1537
|
|
|
1391
1538
|
// src/commands/migrate.ts
|
|
1392
1539
|
import process20 from "process";
|
|
1393
|
-
import {
|
|
1394
|
-
import {runAction as runAction12} from "@stacksjs/actions";
|
|
1540
|
+
import {runAction as runAction11} from "@stacksjs/actions";
|
|
1395
1541
|
import {intro as intro13, log as log20, outro as outro13} from "@stacksjs/cli";
|
|
1396
1542
|
import {Action as Action11} from "@stacksjs/enums";
|
|
1543
|
+
import {ExitCode as ExitCode14} from "@stacksjs/types";
|
|
1397
1544
|
function migrate(buddy) {
|
|
1398
1545
|
const descriptions = {
|
|
1399
1546
|
migrate: "Migrates your database",
|
|
@@ -1401,28 +1548,48 @@ function migrate(buddy) {
|
|
|
1401
1548
|
project: "Target a specific project",
|
|
1402
1549
|
verbose: "Enable verbose output"
|
|
1403
1550
|
};
|
|
1404
|
-
buddy.command("migrate", descriptions.migrate).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1551
|
+
buddy.command("migrate", descriptions.migrate).option("-d, --diff", "Show the SQL that would be run", { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1405
1552
|
log20.debug("Running `buddy migrate` ...", options);
|
|
1406
1553
|
const perf = await intro13("buddy migrate");
|
|
1407
|
-
const result = await
|
|
1554
|
+
const result = await runAction11(Action11.Migrate, options);
|
|
1408
1555
|
if (result.isErr()) {
|
|
1409
1556
|
await outro13("While running the migrate command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1410
1557
|
process20.exit();
|
|
1411
1558
|
}
|
|
1412
1559
|
const APP_ENV = process20.env.APP_ENV || "local";
|
|
1413
|
-
await outro13(`Migrated your ${APP_ENV} database.`, {
|
|
1560
|
+
await outro13(`Migrated your ${APP_ENV} database.`, {
|
|
1561
|
+
startTime: perf,
|
|
1562
|
+
useSeconds: true
|
|
1563
|
+
});
|
|
1414
1564
|
process20.exit(ExitCode14.Success);
|
|
1415
1565
|
});
|
|
1416
|
-
buddy.command("migrate:
|
|
1566
|
+
buddy.command("migrate:fresh", descriptions.migrate).option("-d, --diff", "Show the SQL that would be run", { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1567
|
+
log20.debug("Running `buddy migrate:fresh` ...", options);
|
|
1568
|
+
const perf = await intro13("buddy migrate:fresh");
|
|
1569
|
+
const result = await runAction11(Action11.MigrateFresh, options);
|
|
1570
|
+
if (result.isErr()) {
|
|
1571
|
+
await outro13("While running the migrate:fresh command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1572
|
+
process20.exit();
|
|
1573
|
+
}
|
|
1574
|
+
await outro13(`All tables dropped successfully`, {
|
|
1575
|
+
startTime: perf,
|
|
1576
|
+
useSeconds: true
|
|
1577
|
+
});
|
|
1578
|
+
process20.exit(ExitCode14.Success);
|
|
1579
|
+
});
|
|
1580
|
+
buddy.command("migrate:dns", descriptions.migrate).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1417
1581
|
log20.debug("Running `buddy migrate:dns` ...", options);
|
|
1418
1582
|
const perf = await intro13("buddy migrate:dns");
|
|
1419
|
-
const result = await
|
|
1583
|
+
const result = await runAction11(Action11.MigrateDns, { ...options });
|
|
1420
1584
|
if (result.isErr()) {
|
|
1421
1585
|
await outro13("While running the migrate:dns command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1422
1586
|
process20.exit();
|
|
1423
1587
|
}
|
|
1424
1588
|
const APP_URL = process20.env.APP_URL || "undefined";
|
|
1425
|
-
await outro13(`Migrated your ${APP_URL} DNS.`, {
|
|
1589
|
+
await outro13(`Migrated your ${APP_URL} DNS.`, {
|
|
1590
|
+
startTime: perf,
|
|
1591
|
+
useSeconds: true
|
|
1592
|
+
});
|
|
1426
1593
|
process20.exit(ExitCode14.Success);
|
|
1427
1594
|
});
|
|
1428
1595
|
buddy.on("migrate:*", () => {
|
|
@@ -1433,13 +1600,13 @@ function migrate(buddy) {
|
|
|
1433
1600
|
|
|
1434
1601
|
// src/commands/ports.ts
|
|
1435
1602
|
import process21 from "process";
|
|
1436
|
-
import {
|
|
1603
|
+
import {intro as intro14, italic as italic5, outro as outro14} from "@stacksjs/cli";
|
|
1437
1604
|
import {ports as projectPorts} from "@stacksjs/config";
|
|
1438
1605
|
import {log as log21} from "@stacksjs/logging";
|
|
1439
1606
|
import {findProjectPath, path as p5, projectPath as projectPath2} from "@stacksjs/path";
|
|
1440
|
-
|
|
1441
|
-
import {intro as intro14, italic as italic5, outro as outro14} from "@stacksjs/cli";
|
|
1607
|
+
import {ExitCode as ExitCode15} from "@stacksjs/types";
|
|
1442
1608
|
import {findStacksProjects} from "@stacksjs/utils";
|
|
1609
|
+
var {$: $2 } = globalThis.Bun;
|
|
1443
1610
|
function ports(buddy) {
|
|
1444
1611
|
const descriptions = {
|
|
1445
1612
|
command: "Let buddy check your project for potential issues and misconfigurations",
|
|
@@ -1447,15 +1614,19 @@ function ports(buddy) {
|
|
|
1447
1614
|
project: "Target a specific project",
|
|
1448
1615
|
verbose: "Enable verbose output"
|
|
1449
1616
|
};
|
|
1450
|
-
buddy.command("ports", descriptions.command).option("-l, --list", "List the used ports", { default: true }).option("-c, --check", "Check if the ports are available", {
|
|
1617
|
+
buddy.command("ports", descriptions.command).option("-l, --list", "List the used ports", { default: true }).option("-c, --check", "Check if the ports are available", {
|
|
1618
|
+
default: false
|
|
1619
|
+
}).option("-p, --project [name]", descriptions.project, {
|
|
1620
|
+
default: undefined
|
|
1621
|
+
}).option("-q, --quiet", "Use minimal output", { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1451
1622
|
log21.debug("Running `buddy ports` ...", options);
|
|
1452
1623
|
let perf;
|
|
1453
1624
|
if (!options.quiet)
|
|
1454
1625
|
perf = await intro14("buddy ports");
|
|
1455
1626
|
if (options.project) {
|
|
1456
|
-
const
|
|
1457
|
-
log21.debug(`Path: ${
|
|
1458
|
-
const ports2 = await getPortsForProjectPath(
|
|
1627
|
+
const path9 = await findProjectPath(options.project);
|
|
1628
|
+
log21.debug(`Path: ${path9}`);
|
|
1629
|
+
const ports2 = await getPortsForProjectPath(path9, options);
|
|
1459
1630
|
log21.debug(`./buddy ports --quiet response for ${projectPath2}`, ports2);
|
|
1460
1631
|
outputPorts(ports2, options);
|
|
1461
1632
|
} else {
|
|
@@ -1465,7 +1636,9 @@ function ports(buddy) {
|
|
|
1465
1636
|
await outro14("Exited", { startTime: perf, useSeconds: false });
|
|
1466
1637
|
process21.exit(ExitCode15.Success);
|
|
1467
1638
|
});
|
|
1468
|
-
buddy.command("ports:list", descriptions.ports).option("-p, --project [name]", descriptions.project, {
|
|
1639
|
+
buddy.command("ports:list", descriptions.ports).option("-p, --project [name]", descriptions.project, {
|
|
1640
|
+
default: undefined
|
|
1641
|
+
}).option("-q, --quiet", "Use minimal output", { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1469
1642
|
log21.debug("Running `buddy ports:list` ...", options);
|
|
1470
1643
|
let perf;
|
|
1471
1644
|
if (!options.quiet)
|
|
@@ -1473,9 +1646,9 @@ function ports(buddy) {
|
|
|
1473
1646
|
if (options.project) {
|
|
1474
1647
|
if (!options.quiet)
|
|
1475
1648
|
log21.info(`Listing ports for project: ${italic5(options.project)}`);
|
|
1476
|
-
const
|
|
1477
|
-
log21.debug(`Path: ${
|
|
1478
|
-
const ports2 = await getPortsForProjectPath(
|
|
1649
|
+
const path9 = await findProjectPath(options.project);
|
|
1650
|
+
log21.debug(`Path: ${path9}`);
|
|
1651
|
+
const ports2 = await getPortsForProjectPath(path9, options);
|
|
1479
1652
|
outputPorts(ports2, options);
|
|
1480
1653
|
} else {
|
|
1481
1654
|
outputPorts(projectPorts, options);
|
|
@@ -1484,7 +1657,9 @@ function ports(buddy) {
|
|
|
1484
1657
|
await outro14("Exited", { startTime: perf, useSeconds: false });
|
|
1485
1658
|
process21.exit(ExitCode15.Success);
|
|
1486
1659
|
});
|
|
1487
|
-
buddy.command("ports:check", descriptions.ports).option("-p, --project [name]", descriptions.project, {
|
|
1660
|
+
buddy.command("ports:check", descriptions.ports).option("-p, --project [name]", descriptions.project, {
|
|
1661
|
+
default: projectPath2()
|
|
1662
|
+
}).option("-q, --quiet", "Use minimal output", { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1488
1663
|
log21.debug("Running `buddy ports:check` ...", options);
|
|
1489
1664
|
let perf;
|
|
1490
1665
|
if (!options.quiet)
|
|
@@ -1506,11 +1681,11 @@ function ports(buddy) {
|
|
|
1506
1681
|
process21.exit(1);
|
|
1507
1682
|
});
|
|
1508
1683
|
}
|
|
1509
|
-
async function getPortsForProjectPath(
|
|
1684
|
+
async function getPortsForProjectPath(path9, options) {
|
|
1510
1685
|
if (!options.quiet)
|
|
1511
|
-
log21.info(`Checking ports for project: ${italic5(
|
|
1512
|
-
$2.cwd(
|
|
1513
|
-
$2.env(await import(`${
|
|
1686
|
+
log21.info(`Checking ports for project: ${italic5(path9)}`);
|
|
1687
|
+
$2.cwd(path9);
|
|
1688
|
+
$2.env(await import(`${path9}/.env`));
|
|
1514
1689
|
const projectList = await $2`./buddy projects:list --quiet`.text();
|
|
1515
1690
|
log21.debug("ProjectListResponse", projectList);
|
|
1516
1691
|
const projects = projectList.split("\n").filter((line) => line.startsWith(" - ")).map((line) => line.trim().substring(4));
|
|
@@ -1539,8 +1714,8 @@ var outputPorts = function(ports2, options) {
|
|
|
1539
1714
|
|
|
1540
1715
|
// src/commands/prepublish.ts
|
|
1541
1716
|
import process22 from "process";
|
|
1717
|
+
import {runAction as runAction12} from "@stacksjs/actions";
|
|
1542
1718
|
import {Action as Action12} from "@stacksjs/enums";
|
|
1543
|
-
import {runAction as runAction13} from "@stacksjs/actions";
|
|
1544
1719
|
import {log as log22} from "@stacksjs/logging";
|
|
1545
1720
|
function prepublish(buddy) {
|
|
1546
1721
|
const descriptions = {
|
|
@@ -1548,9 +1723,9 @@ function prepublish(buddy) {
|
|
|
1548
1723
|
project: "Target a specific project",
|
|
1549
1724
|
verbose: "Enable verbose output"
|
|
1550
1725
|
};
|
|
1551
|
-
buddy.command("prepublish", descriptions.command).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1726
|
+
buddy.command("prepublish", descriptions.command).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1552
1727
|
log22.debug("Running `buddy prepublish` ...", options);
|
|
1553
|
-
await
|
|
1728
|
+
await runAction12(Action12.Prepublish, options);
|
|
1554
1729
|
});
|
|
1555
1730
|
buddy.on("prepublish:*", () => {
|
|
1556
1731
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
@@ -1560,8 +1735,8 @@ function prepublish(buddy) {
|
|
|
1560
1735
|
|
|
1561
1736
|
// src/commands/projects.ts
|
|
1562
1737
|
import process23 from "process";
|
|
1563
|
-
import {ExitCode as ExitCode16} from "@stacksjs/types";
|
|
1564
1738
|
import {intro as intro15, log as log23} from "@stacksjs/cli";
|
|
1739
|
+
import {ExitCode as ExitCode16} from "@stacksjs/types";
|
|
1565
1740
|
import {findStacksProjects as findStacksProjects2} from "@stacksjs/utils";
|
|
1566
1741
|
function projects(buddy) {
|
|
1567
1742
|
const descriptions = {
|
|
@@ -1594,17 +1769,17 @@ function projects(buddy) {
|
|
|
1594
1769
|
|
|
1595
1770
|
// src/commands/release.ts
|
|
1596
1771
|
import process24 from "process";
|
|
1772
|
+
import {runAction as runAction13} from "@stacksjs/actions";
|
|
1773
|
+
import {intro as intro16, log as log24, outro as outro15} from "@stacksjs/cli";
|
|
1597
1774
|
import {Action as Action13} from "@stacksjs/enums";
|
|
1598
1775
|
import {ExitCode as ExitCode17} from "@stacksjs/types";
|
|
1599
|
-
import {intro as intro16, log as log24, outro as outro15} from "@stacksjs/cli";
|
|
1600
|
-
import {runAction as runAction14} from "@stacksjs/actions";
|
|
1601
1776
|
function release(buddy) {
|
|
1602
|
-
buddy.command("release", descriptions.release).option("--dry-run", descriptions.dryRun, { default: false }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1777
|
+
buddy.command("release", descriptions.release).option("--dry-run", descriptions.dryRun, { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1603
1778
|
log24.debug("Running `buddy release` ...", options);
|
|
1604
1779
|
if (options.dryRun)
|
|
1605
1780
|
log24.warn("Dry run enabled. No changes will be made or committed.");
|
|
1606
1781
|
const startTime = await intro16("buddy release");
|
|
1607
|
-
const result = await
|
|
1782
|
+
const result = await runAction13(Action13.Release, {
|
|
1608
1783
|
stdin: "inherit",
|
|
1609
1784
|
...options
|
|
1610
1785
|
});
|
|
@@ -1612,7 +1787,10 @@ function release(buddy) {
|
|
|
1612
1787
|
log24.error("Failed to release", result.error);
|
|
1613
1788
|
process24.exit(ExitCode17.FatalError);
|
|
1614
1789
|
}
|
|
1615
|
-
await outro15("Triggered CI/CD Release Workflow", {
|
|
1790
|
+
await outro15("Triggered CI/CD Release Workflow", {
|
|
1791
|
+
startTime,
|
|
1792
|
+
useSeconds: true
|
|
1793
|
+
});
|
|
1616
1794
|
});
|
|
1617
1795
|
buddy.on("release:*", () => {
|
|
1618
1796
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
@@ -1628,26 +1806,29 @@ var descriptions = {
|
|
|
1628
1806
|
|
|
1629
1807
|
// src/commands/seed.ts
|
|
1630
1808
|
import process25 from "process";
|
|
1631
|
-
import {
|
|
1632
|
-
import {runAction as runAction15} from "@stacksjs/actions";
|
|
1809
|
+
import {runAction as runAction14} from "@stacksjs/actions";
|
|
1633
1810
|
import {intro as intro17, log as log25, outro as outro16} from "@stacksjs/cli";
|
|
1634
1811
|
import {Action as Action14} from "@stacksjs/enums";
|
|
1812
|
+
import {ExitCode as ExitCode18} from "@stacksjs/types";
|
|
1635
1813
|
function seed(buddy) {
|
|
1636
1814
|
const descriptions2 = {
|
|
1637
1815
|
seed: "Seed your database",
|
|
1638
1816
|
project: "Target a specific project",
|
|
1639
1817
|
verbose: "Enable verbose output"
|
|
1640
1818
|
};
|
|
1641
|
-
buddy.command("seed", descriptions2.seed).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1819
|
+
buddy.command("seed", descriptions2.seed).option("-p, --project [project]", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1642
1820
|
log25.debug("Running `buddy seed` ...", options);
|
|
1643
1821
|
const perf = await intro17("buddy seed");
|
|
1644
|
-
const result = await
|
|
1822
|
+
const result = await runAction14(Action14.Seed, options);
|
|
1645
1823
|
if (result.isErr()) {
|
|
1646
1824
|
await outro16("While running the seed command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1647
1825
|
process25.exit(ExitCode18.FatalError);
|
|
1648
1826
|
}
|
|
1649
1827
|
const APP_ENV = process25.env.APP_ENV || "local";
|
|
1650
|
-
await outro16(`Seeded your ${APP_ENV} database.`, {
|
|
1828
|
+
await outro16(`Seeded your ${APP_ENV} database.`, {
|
|
1829
|
+
startTime: perf,
|
|
1830
|
+
useSeconds: true
|
|
1831
|
+
});
|
|
1651
1832
|
process25.exit(ExitCode18.Success);
|
|
1652
1833
|
});
|
|
1653
1834
|
buddy.on("seed:*", () => {
|
|
@@ -1658,11 +1839,12 @@ function seed(buddy) {
|
|
|
1658
1839
|
|
|
1659
1840
|
// src/commands/setup.ts
|
|
1660
1841
|
import process26 from "process";
|
|
1661
|
-
import {
|
|
1842
|
+
import {runAction as runAction15} from "@stacksjs/actions";
|
|
1843
|
+
import {log as log26, runCommand as runCommand9} from "@stacksjs/cli";
|
|
1662
1844
|
import {Action as Action15} from "@stacksjs/enums";
|
|
1663
1845
|
import {handleError} from "@stacksjs/error-handling";
|
|
1846
|
+
import {path as p6} from "@stacksjs/path";
|
|
1664
1847
|
import {storage as storage3} from "@stacksjs/storage";
|
|
1665
|
-
import {log as log26, runCommand as runCommand9} from "@stacksjs/cli";
|
|
1666
1848
|
import {ExitCode as ExitCode19} from "@stacksjs/types";
|
|
1667
1849
|
function setup(buddy) {
|
|
1668
1850
|
const descriptions2 = {
|
|
@@ -1672,7 +1854,7 @@ function setup(buddy) {
|
|
|
1672
1854
|
project: "Target a specific project",
|
|
1673
1855
|
verbose: "Enable verbose output"
|
|
1674
1856
|
};
|
|
1675
|
-
buddy.command("setup", descriptions2.setup).alias("ensure").option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1857
|
+
buddy.command("setup", descriptions2.setup).alias("ensure").option("-p, --project [project]", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1676
1858
|
log26.debug("Running `buddy setup` ...", options);
|
|
1677
1859
|
if (!await isPkgxInstalled())
|
|
1678
1860
|
await installPkgx();
|
|
@@ -1681,7 +1863,7 @@ function setup(buddy) {
|
|
|
1681
1863
|
});
|
|
1682
1864
|
buddy.command("setup:oh-my-zsh", descriptions2.ohMyZsh).alias("upgrade:oh-my-zsh").option("--verbose", descriptions2.verbose, { default: false }).action(async (_options) => {
|
|
1683
1865
|
log26.debug("Running `buddy setup:oh-my-zsh` ...", _options);
|
|
1684
|
-
const result = await
|
|
1866
|
+
const result = await runAction15(Action15.UpgradeShell);
|
|
1685
1867
|
if (result.isErr()) {
|
|
1686
1868
|
log26.error(result.error);
|
|
1687
1869
|
process26.exit(ExitCode19.FatalError);
|
|
@@ -1758,8 +1940,8 @@ async function ensureEnvIsSet(options) {
|
|
|
1758
1940
|
import process27 from "process";
|
|
1759
1941
|
import {runAction as runAction16} from "@stacksjs/actions";
|
|
1760
1942
|
import {intro as intro18, outro as outro17} from "@stacksjs/cli";
|
|
1761
|
-
import {projectPath as projectPath3} from "@stacksjs/path";
|
|
1762
1943
|
import {Action as Action16} from "@stacksjs/enums";
|
|
1944
|
+
import {projectPath as projectPath3} from "@stacksjs/path";
|
|
1763
1945
|
function test(buddy) {
|
|
1764
1946
|
const descriptions2 = {
|
|
1765
1947
|
command: "Runs your test suite",
|
|
@@ -1772,63 +1954,108 @@ function test(buddy) {
|
|
|
1772
1954
|
project: "Target a specific project",
|
|
1773
1955
|
verbose: "Enable verbose output"
|
|
1774
1956
|
};
|
|
1775
|
-
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) => {
|
|
1957
|
+
buddy.command("test", descriptions2.command).option("--ui", descriptions2.ui, { default: false }).option("-p, --project [project]", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: true }).action(async (options) => {
|
|
1776
1958
|
const perf = await intro18("buddy test");
|
|
1777
|
-
const result = await runAction16(Action16.Test, {
|
|
1959
|
+
const result = await runAction16(Action16.Test, {
|
|
1960
|
+
...options,
|
|
1961
|
+
cwd: projectPath3()
|
|
1962
|
+
});
|
|
1778
1963
|
if (result.isErr()) {
|
|
1779
1964
|
await outro17("While running `buddy test`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1780
1965
|
process27.exit();
|
|
1781
1966
|
}
|
|
1782
|
-
await outro17("Finished running tests", {
|
|
1967
|
+
await outro17("Finished running tests", {
|
|
1968
|
+
startTime: perf,
|
|
1969
|
+
useSeconds: true
|
|
1970
|
+
});
|
|
1783
1971
|
});
|
|
1784
1972
|
buddy.command("test:unit", descriptions2.unit).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1785
1973
|
const perf = await intro18("buddy test:unit");
|
|
1786
|
-
const result = await runAction16(Action16.TestUnit, {
|
|
1974
|
+
const result = await runAction16(Action16.TestUnit, {
|
|
1975
|
+
...options,
|
|
1976
|
+
verbose: true,
|
|
1977
|
+
cwd: projectPath3()
|
|
1978
|
+
});
|
|
1787
1979
|
if (result.isErr()) {
|
|
1788
1980
|
await outro17("While running `buddy test:unit`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1789
1981
|
process27.exit();
|
|
1790
1982
|
}
|
|
1791
|
-
await outro17("Finished running unit tests", {
|
|
1983
|
+
await outro17("Finished running unit tests", {
|
|
1984
|
+
startTime: perf,
|
|
1985
|
+
useSeconds: true
|
|
1986
|
+
});
|
|
1792
1987
|
});
|
|
1793
1988
|
buddy.command("test:feature", descriptions2.feature).option("--show-report", descriptions2.showReport, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1794
1989
|
const perf = await intro18("buddy test:feature");
|
|
1795
1990
|
let result;
|
|
1796
1991
|
if (options.showReport)
|
|
1797
|
-
result = await runAction16(Action16.ShowFeatureTestReport, {
|
|
1992
|
+
result = await runAction16(Action16.ShowFeatureTestReport, {
|
|
1993
|
+
...options,
|
|
1994
|
+
verbose: true,
|
|
1995
|
+
cwd: projectPath3()
|
|
1996
|
+
});
|
|
1798
1997
|
else
|
|
1799
|
-
result = await runAction16(Action16.TestFeature, {
|
|
1998
|
+
result = await runAction16(Action16.TestFeature, {
|
|
1999
|
+
...options,
|
|
2000
|
+
verbose: true,
|
|
2001
|
+
cwd: projectPath3()
|
|
2002
|
+
});
|
|
1800
2003
|
if (result.isErr()) {
|
|
1801
2004
|
await outro17("While running `buddy test:feature`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1802
2005
|
process27.exit();
|
|
1803
2006
|
}
|
|
1804
|
-
await outro17("Finished running feature tests", {
|
|
2007
|
+
await outro17("Finished running feature tests", {
|
|
2008
|
+
startTime: perf,
|
|
2009
|
+
useSeconds: true
|
|
2010
|
+
});
|
|
1805
2011
|
});
|
|
1806
2012
|
buddy.command("test:ui", descriptions2.command).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1807
2013
|
const perf = await intro18("buddy test:ui");
|
|
1808
|
-
const result = await runAction16(Action16.TestUi, {
|
|
2014
|
+
const result = await runAction16(Action16.TestUi, {
|
|
2015
|
+
...options,
|
|
2016
|
+
verbose: true,
|
|
2017
|
+
cwd: projectPath3()
|
|
2018
|
+
});
|
|
1809
2019
|
if (result.isErr()) {
|
|
1810
2020
|
await outro17("While running `buddy test:ui`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1811
2021
|
process27.exit();
|
|
1812
2022
|
}
|
|
1813
|
-
await outro17("Finished running tests in the browser", {
|
|
2023
|
+
await outro17("Finished running tests in the browser", {
|
|
2024
|
+
startTime: perf,
|
|
2025
|
+
useSeconds: true
|
|
2026
|
+
});
|
|
1814
2027
|
});
|
|
1815
2028
|
buddy.command("test:types", descriptions2.types).alias("typecheck").option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1816
2029
|
const perf = await intro18("buddy test:types");
|
|
1817
|
-
const result = await runAction16(Action16.Typecheck, {
|
|
2030
|
+
const result = await runAction16(Action16.Typecheck, {
|
|
2031
|
+
...options,
|
|
2032
|
+
verbose: true,
|
|
2033
|
+
cwd: projectPath3()
|
|
2034
|
+
});
|
|
1818
2035
|
if (result.isErr()) {
|
|
1819
2036
|
await outro17("While running `buddy test:types`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1820
2037
|
process27.exit();
|
|
1821
2038
|
}
|
|
1822
|
-
await outro17("Finished running typecheck", {
|
|
2039
|
+
await outro17("Finished running typecheck", {
|
|
2040
|
+
startTime: perf,
|
|
2041
|
+
useSeconds: true
|
|
2042
|
+
});
|
|
1823
2043
|
});
|
|
1824
2044
|
buddy.command("test:coverage", descriptions2.coverage).action(async (options) => {
|
|
1825
2045
|
const perf = await intro18("buddy test:coverage");
|
|
1826
|
-
const result = await runAction16(Action16.TestCoverage, {
|
|
2046
|
+
const result = await runAction16(Action16.TestCoverage, {
|
|
2047
|
+
...options,
|
|
2048
|
+
cwd: projectPath3(),
|
|
2049
|
+
verbose: true
|
|
2050
|
+
});
|
|
1827
2051
|
if (result.isErr()) {
|
|
1828
2052
|
await outro17("While running `buddy test:coverage`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1829
2053
|
process27.exit();
|
|
1830
2054
|
}
|
|
1831
|
-
await outro17("Generated the test coverage report", {
|
|
2055
|
+
await outro17("Generated the test coverage report", {
|
|
2056
|
+
startTime: perf,
|
|
2057
|
+
useSeconds: true
|
|
2058
|
+
});
|
|
1832
2059
|
process27.exit();
|
|
1833
2060
|
});
|
|
1834
2061
|
buddy.on("test:*", () => {
|
|
@@ -1839,20 +2066,20 @@ function test(buddy) {
|
|
|
1839
2066
|
|
|
1840
2067
|
// src/commands/tinker.ts
|
|
1841
2068
|
import process28 from "process";
|
|
2069
|
+
import {intro as intro19, log as log27, outro as outro18, runCommand as runCommand10} from "@stacksjs/cli";
|
|
1842
2070
|
import {ExitCode as ExitCode20} from "@stacksjs/types";
|
|
1843
|
-
import {runAction as runAction17} from "@stacksjs/actions";
|
|
1844
|
-
import {intro as intro19, log as log27, outro as outro18} from "@stacksjs/cli";
|
|
1845
|
-
import {Action as Action17} from "@stacksjs/enums";
|
|
1846
2071
|
function tinker(buddy) {
|
|
1847
2072
|
const descriptions2 = {
|
|
1848
2073
|
tinker: "Tinker with your code",
|
|
1849
2074
|
project: "Target a specific project",
|
|
1850
2075
|
verbose: "Enable verbose output"
|
|
1851
2076
|
};
|
|
1852
|
-
buddy.command("tinker", descriptions2.tinker).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
2077
|
+
buddy.command("tinker", descriptions2.tinker).option("-p, --project [project]", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1853
2078
|
log27.debug("Running `buddy tinker` ...", options);
|
|
1854
2079
|
const perf = await intro19("buddy tinker");
|
|
1855
|
-
const result = await
|
|
2080
|
+
const result = await runCommand10("bun repl", {
|
|
2081
|
+
stdin: "inherit"
|
|
2082
|
+
});
|
|
1856
2083
|
if (result.isErr()) {
|
|
1857
2084
|
await outro18("While running the tinker command, there was an issue", { startTime: perf, useSeconds: true }, result.error || undefined);
|
|
1858
2085
|
process28.exit();
|
|
@@ -1877,11 +2104,11 @@ function types21(buddy) {
|
|
|
1877
2104
|
project: "Target a specific project",
|
|
1878
2105
|
verbose: "Enable verbose output"
|
|
1879
2106
|
};
|
|
1880
|
-
buddy.command("types:generate", descriptions2.generate).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
2107
|
+
buddy.command("types:generate", descriptions2.generate).option("-p, --project [project]", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1881
2108
|
log28.debug("Running `buddy types:generate` ...", options);
|
|
1882
2109
|
await generateTypes2();
|
|
1883
2110
|
});
|
|
1884
|
-
buddy.command("types:fix", descriptions2.fix).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async () => {
|
|
2111
|
+
buddy.command("types:fix", descriptions2.fix).option("-p, --project [project]", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async () => {
|
|
1885
2112
|
});
|
|
1886
2113
|
buddy.on("types:*", () => {
|
|
1887
2114
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
@@ -1891,10 +2118,11 @@ function types21(buddy) {
|
|
|
1891
2118
|
|
|
1892
2119
|
// src/commands/upgrade.ts
|
|
1893
2120
|
import process30 from "process";
|
|
1894
|
-
import {runAction as
|
|
2121
|
+
import {runAction as runAction17} from "@stacksjs/actions";
|
|
1895
2122
|
import {intro as intro20, log as log29, outro as outro19} from "@stacksjs/cli";
|
|
2123
|
+
import {Action as Action17} from "@stacksjs/enums";
|
|
1896
2124
|
import {ExitCode as ExitCode21} from "@stacksjs/types";
|
|
1897
|
-
import {
|
|
2125
|
+
import {isString as isString2} from "@stacksjs/validation";
|
|
1898
2126
|
function upgrade(buddy) {
|
|
1899
2127
|
const descriptions2 = {
|
|
1900
2128
|
command: "Upgrade dependencies, framework, package manager, JS/TS runtime",
|
|
@@ -1909,7 +2137,7 @@ function upgrade(buddy) {
|
|
|
1909
2137
|
project: "Target a specific project",
|
|
1910
2138
|
verbose: "Enable verbose output"
|
|
1911
2139
|
};
|
|
1912
|
-
buddy.command("upgrade", descriptions2.command).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("--framework", descriptions2.framework, { default: false }).option("-p, --project", descriptions2.project, { default: false }).option("-s, --shell", descriptions2.shell, { default: false }).option("-b, --binary", descriptions2.binary, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).alias("update").example("buddy upgrade -a --verbose").action(async (options) => {
|
|
2140
|
+
buddy.command("upgrade", descriptions2.command).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("--framework", descriptions2.framework, { default: false }).option("-p, --project [project]", descriptions2.project, { default: false }).option("-s, --shell", descriptions2.shell, { default: false }).option("-b, --binary", descriptions2.binary, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).alias("update").example("buddy upgrade -a --verbose").action(async (options) => {
|
|
1913
2141
|
log29.debug("Running `buddy upgrade` ...", options);
|
|
1914
2142
|
const perf = await intro20("buddy upgrade");
|
|
1915
2143
|
if (hasNoOptions2(options)) {
|
|
@@ -1924,11 +2152,14 @@ function upgrade(buddy) {
|
|
|
1924
2152
|
});
|
|
1925
2153
|
if (answers !== null)
|
|
1926
2154
|
process30.exit(ExitCode21.InvalidArgument);
|
|
1927
|
-
if (
|
|
2155
|
+
if (isString2(answers))
|
|
1928
2156
|
answers = [answers];
|
|
1929
|
-
options = answers.reduce((a, v) =>
|
|
2157
|
+
options = answers.reduce((a, v) => {
|
|
2158
|
+
a[v] = true;
|
|
2159
|
+
return a;
|
|
2160
|
+
}, {});
|
|
1930
2161
|
}
|
|
1931
|
-
const result = await
|
|
2162
|
+
const result = await runAction17(Action17.Upgrade, options);
|
|
1932
2163
|
if (result.isErr()) {
|
|
1933
2164
|
await outro19("While running the buddy:upgrade command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1934
2165
|
process30.exit();
|
|
@@ -1936,32 +2167,32 @@ function upgrade(buddy) {
|
|
|
1936
2167
|
await outro19("Upgrade complete.", { startTime: perf, useSeconds: true });
|
|
1937
2168
|
process30.exit();
|
|
1938
2169
|
});
|
|
1939
|
-
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) => {
|
|
2170
|
+
buddy.command("upgrade:framework", descriptions2.framework).option("-p, --project [project]", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).example("buddy upgrade:framework --verbose").action(async (options) => {
|
|
1940
2171
|
log29.debug("Running `buddy upgrade:framework` ...", options);
|
|
1941
|
-
await
|
|
2172
|
+
await runAction17(Action17.Upgrade, options);
|
|
1942
2173
|
});
|
|
1943
|
-
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) => {
|
|
2174
|
+
buddy.command("upgrade:dependencies", descriptions2.dependencies).option("-p, --project [project]", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).alias("upgrade:deps").example("buddy upgrade:dependencies --verbose").action(async (options) => {
|
|
1944
2175
|
log29.debug("Running `buddy upgrade:dependencies` ...", options);
|
|
1945
|
-
await
|
|
2176
|
+
await runAction17(Action17.Upgrade, options);
|
|
1946
2177
|
});
|
|
1947
|
-
buddy.command("upgrade:bun", descriptions2.bun).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
2178
|
+
buddy.command("upgrade:bun", descriptions2.bun).option("-p, --project [project]", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1948
2179
|
log29.debug("Running `buddy upgrade:bun` ...", options);
|
|
1949
2180
|
const perf = await intro20("buddy upgrade:bun");
|
|
1950
|
-
const result = await
|
|
2181
|
+
const result = await runAction17(Action17.UpgradeBun, options);
|
|
1951
2182
|
if (result.isErr()) {
|
|
1952
2183
|
await outro19("While running the buddy upgrade:bun command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1953
2184
|
process30.exit();
|
|
1954
2185
|
}
|
|
1955
2186
|
process30.exit(ExitCode21.Success);
|
|
1956
2187
|
});
|
|
1957
|
-
buddy.command("upgrade:all", descriptions2.all).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
2188
|
+
buddy.command("upgrade:all", descriptions2.all).option("-p, --project [project]", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1958
2189
|
log29.debug("Running `buddy upgrade:all` ...", options);
|
|
1959
|
-
await
|
|
2190
|
+
await runAction17(Action17.Upgrade, options);
|
|
1960
2191
|
});
|
|
1961
2192
|
buddy.command("upgrade:shell", descriptions2.shell).option("--verbose", descriptions2.verbose, { default: false }).example("buddy upgrade:shell").action(async (options) => {
|
|
1962
2193
|
log29.debug("Running `buddy upgrade:shell` ...", options);
|
|
1963
2194
|
const perf = await intro20("buddy upgrade:shell");
|
|
1964
|
-
const result = await
|
|
2195
|
+
const result = await runAction17(Action17.UpgradeShell, options);
|
|
1965
2196
|
if (result.isErr()) {
|
|
1966
2197
|
await outro19("While running the buddy upgrade:shell command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1967
2198
|
process30.exit();
|
|
@@ -1975,7 +2206,7 @@ function upgrade(buddy) {
|
|
|
1975
2206
|
}
|
|
1976
2207
|
log29.debug("Running `buddy upgrade:binary` ...", options);
|
|
1977
2208
|
const perf = await intro20("buddy upgrade:binary");
|
|
1978
|
-
const result = await
|
|
2209
|
+
const result = await runAction17(Action17.UpgradeBinary, options);
|
|
1979
2210
|
if (result.isErr()) {
|
|
1980
2211
|
await outro19("While running the buddy upgrade:binary command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1981
2212
|
process30.exit();
|