@stacksjs/buddy 0.58.58 → 0.58.60
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/dist/chunk-59a9de11428ba763.js +993 -0
- package/dist/{chunk-e9c0ec1a3b7be088.js → chunk-6658b07ce4c24cac.js} +604 -512
- package/dist/cli.js +3916 -19
- package/dist/index.js +2 -5
- package/package.json +1 -1
- package/src/cli.ts +91 -17
- package/src/commands/add.ts +3 -0
- package/src/commands/build.ts +18 -3
- package/src/commands/changelog.ts +13 -6
- package/src/commands/clean.ts +3 -1
- package/src/commands/cloud.ts +14 -2
- package/src/commands/commit.ts +2 -0
- package/src/commands/configure.ts +6 -3
- package/src/commands/create.ts +3 -1
- package/src/commands/deploy.ts +4 -2
- package/src/commands/dev.ts +17 -4
- package/src/commands/dns.ts +7 -1
- package/src/commands/domains.ts +7 -1
- package/src/commands/fresh.ts +4 -2
- package/src/commands/generate.ts +36 -26
- package/src/commands/http.ts +6 -4
- package/src/commands/index.ts +0 -2
- package/src/commands/install.ts +3 -1
- package/src/commands/key.ts +2 -0
- package/src/commands/lint.ts +4 -0
- package/src/commands/list.ts +6 -2
- package/src/commands/make.ts +52 -30
- package/src/commands/migrate.ts +6 -2
- package/src/commands/prepublish.ts +3 -0
- package/src/commands/release.ts +12 -2
- package/src/commands/seed.ts +3 -1
- package/src/commands/setup.ts +16 -8
- package/src/commands/tinker.ts +3 -1
- package/src/commands/types.ts +4 -2
- package/src/commands/upgrade.ts +14 -3
- package/src/commands/version.ts +7 -0
- package/src/commands/example.ts +0 -66
- package/src/commands/inspire.ts +0 -24
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createConsola
|
|
3
|
+
} from "./chunk-59a9de11428ba763.js";
|
|
4
|
+
|
|
1
5
|
// src/commands/build.ts
|
|
2
6
|
import process from "process";
|
|
3
7
|
import {runAction} from "@stacksjs/actions";
|
|
4
|
-
import {intro, log
|
|
8
|
+
import {intro, log, outro} from "@stacksjs/cli";
|
|
5
9
|
import {ExitCode} from "@stacksjs/types";
|
|
6
10
|
import {Action} from "@stacksjs/enums";
|
|
7
|
-
import {isString} from "@stacksjs/validation";
|
|
8
11
|
function build(buddy) {
|
|
9
12
|
const descriptions = {
|
|
10
13
|
build: "Build any of your libraries (packages) for production use",
|
|
@@ -25,6 +28,7 @@ function build(buddy) {
|
|
|
25
28
|
verbose: "Enable verbose output"
|
|
26
29
|
};
|
|
27
30
|
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) => {
|
|
31
|
+
log.debug("Running `buddy build` ...", options);
|
|
28
32
|
switch (server) {
|
|
29
33
|
case "components":
|
|
30
34
|
options.components = true;
|
|
@@ -60,7 +64,7 @@ function build(buddy) {
|
|
|
60
64
|
break;
|
|
61
65
|
}
|
|
62
66
|
if (hasNoOptions(options)) {
|
|
63
|
-
let answers = await prompt.require().multiselect(descriptions.select, {
|
|
67
|
+
let answers = await log.prompt.require().multiselect(descriptions.select, {
|
|
64
68
|
options: [
|
|
65
69
|
{ label: "Components", value: "components" },
|
|
66
70
|
{ label: "Web Components", value: "web-components" },
|
|
@@ -79,36 +83,45 @@ function build(buddy) {
|
|
|
79
83
|
process.exit(ExitCode.Success);
|
|
80
84
|
});
|
|
81
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", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
86
|
+
log.debug("Running `buddy build:components` ...", options);
|
|
82
87
|
await runAction(Action.BuildComponentLibs, options);
|
|
83
88
|
});
|
|
84
89
|
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) => {
|
|
90
|
+
log.debug("Running `buddy build:cli` ...", options);
|
|
85
91
|
await runAction(Action.BuildCli, options);
|
|
86
92
|
});
|
|
87
93
|
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) => {
|
|
94
|
+
log.debug("Running `buddy build:server` ...", options);
|
|
88
95
|
await runAction(Action.BuildServer, options);
|
|
89
96
|
});
|
|
90
97
|
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) => {
|
|
98
|
+
log.debug("Running `buddy `build:functions` ...", options);
|
|
91
99
|
await runAction(Action.BuildFunctionLib, options);
|
|
92
100
|
});
|
|
93
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, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).alias("build:vue").action(async (options) => {
|
|
102
|
+
log.debug("Running `buddy build:vue-components` ...", options);
|
|
94
103
|
await runAction(Action.BuildVueComponentLib, options);
|
|
95
104
|
});
|
|
96
105
|
buddy.command("build:web-components", "Automagically build Web Component library for npm/CDN distribution").alias("build:wc").alias("prod:web-components").alias("prod:wc").option("-w, --web-components", descriptions.webComponents, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
106
|
+
log.debug("Running `buddy build:web-components` ...", options);
|
|
97
107
|
await runAction(Action.BuildWebComponentLib, options);
|
|
98
108
|
});
|
|
99
109
|
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) => {
|
|
110
|
+
log.debug("Running `buddy build:docs` ...", options);
|
|
100
111
|
await runAction(Action.BuildDocs, options);
|
|
101
112
|
});
|
|
102
113
|
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) => {
|
|
114
|
+
log.debug("Running `buddy build:core` ...", options);
|
|
103
115
|
const startTime = await intro("buddy build:core");
|
|
104
116
|
const result = await runAction(Action.BuildCore, options);
|
|
105
117
|
if (result.isErr()) {
|
|
106
|
-
|
|
118
|
+
log.error("Failed to build the Stacks core.", result.error);
|
|
107
119
|
process.exit();
|
|
108
120
|
}
|
|
109
121
|
await outro("Core packages built successfully", { startTime, useSeconds: true });
|
|
110
122
|
});
|
|
111
123
|
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) => {
|
|
124
|
+
log.debug("Running `buddy build:desktop` ...", options);
|
|
112
125
|
const perf = await intro("buddy build:desktop");
|
|
113
126
|
const result = await runAction(Action.BuildDesktop, options);
|
|
114
127
|
if (result.isErr()) {
|
|
@@ -120,10 +133,11 @@ function build(buddy) {
|
|
|
120
133
|
process.exit(ExitCode.Success);
|
|
121
134
|
});
|
|
122
135
|
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) => {
|
|
136
|
+
log.debug("Running `buddy build:stacks` ...", options);
|
|
123
137
|
const startTime = await intro("buddy build:stacks");
|
|
124
138
|
const result = await runAction(Action.BuildStacks, options);
|
|
125
139
|
if (result.isErr()) {
|
|
126
|
-
|
|
140
|
+
log.error("Failed to build Stacks.", result.error);
|
|
127
141
|
process.exit();
|
|
128
142
|
}
|
|
129
143
|
await outro("Stacks built successfully", { startTime, useSeconds: true });
|
|
@@ -139,38 +153,39 @@ var hasNoOptions = function(options) {
|
|
|
139
153
|
|
|
140
154
|
// src/commands/changelog.ts
|
|
141
155
|
import process2 from "process";
|
|
142
|
-
import {ExitCode as ExitCode2} from "@stacksjs/types";
|
|
143
156
|
import {runAction as runAction2} from "@stacksjs/actions";
|
|
144
|
-
import {intro as intro2, outro as outro2} from "@stacksjs/cli";
|
|
157
|
+
import {intro as intro2, log as log2, outro as outro2} from "@stacksjs/cli";
|
|
145
158
|
import {Action as Action2} from "@stacksjs/enums";
|
|
146
159
|
function changelog(buddy) {
|
|
147
160
|
const descriptions = {
|
|
148
161
|
changelog: "Create a CHANGELOG.md file",
|
|
149
162
|
quiet: "Minimal output",
|
|
163
|
+
dryRun: "Do not write the file, just output the changes",
|
|
150
164
|
project: "Target a specific project",
|
|
151
165
|
verbose: "Enable verbose output"
|
|
152
166
|
};
|
|
153
|
-
buddy.command("changelog", descriptions.changelog).option("--quiet", descriptions.quiet, { default: false }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
167
|
+
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) => {
|
|
168
|
+
log2.debug("Running `buddy changelog` ...", options);
|
|
154
169
|
const perf = await intro2("buddy changelog");
|
|
155
170
|
const result = await runAction2(Action2.Changelog, options);
|
|
156
171
|
if (result.isErr()) {
|
|
157
172
|
await outro2("While running the changelog command, there was an issue", { ...options, startTime: perf, useSeconds: true }, result.error);
|
|
158
173
|
process2.exit();
|
|
159
174
|
}
|
|
160
|
-
await outro2("Generated
|
|
161
|
-
process2.exit(ExitCode2.Success);
|
|
175
|
+
await outro2("Generated CHANGELOG.md", { ...options, startTime: perf, useSeconds: true, type: "success" });
|
|
162
176
|
});
|
|
163
177
|
buddy.on("changelog:*", () => {
|
|
164
|
-
console.
|
|
178
|
+
console.log("Invalid command: %s", buddy.args.join(" "));
|
|
179
|
+
console.log("See --help for a list of available commands.");
|
|
165
180
|
process2.exit(1);
|
|
166
181
|
});
|
|
167
182
|
}
|
|
168
183
|
|
|
169
184
|
// src/commands/clean.ts
|
|
170
185
|
import process3 from "process";
|
|
171
|
-
import {ExitCode as
|
|
186
|
+
import {ExitCode as ExitCode2} from "@stacksjs/types";
|
|
172
187
|
import {runAction as runAction3} from "@stacksjs/actions";
|
|
173
|
-
import {intro as intro3, outro as outro3} from "@stacksjs/cli";
|
|
188
|
+
import {intro as intro3, log as log3, outro as outro3} from "@stacksjs/cli";
|
|
174
189
|
import {Action as Action3} from "@stacksjs/enums";
|
|
175
190
|
function clean(buddy) {
|
|
176
191
|
const descriptions = {
|
|
@@ -179,14 +194,15 @@ function clean(buddy) {
|
|
|
179
194
|
verbose: "Enable verbose output"
|
|
180
195
|
};
|
|
181
196
|
buddy.command("clean", descriptions.clean).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
197
|
+
log3.debug("Running `buddy clean` ...", options);
|
|
182
198
|
const perf = await intro3("buddy clean");
|
|
183
199
|
const result = await runAction3(Action3.Clean, options);
|
|
184
200
|
if (result.isErr()) {
|
|
185
201
|
await outro3("While running the clean command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
186
|
-
process3.exit(
|
|
202
|
+
process3.exit(ExitCode2.FatalError);
|
|
187
203
|
}
|
|
188
204
|
await outro3("Cleaned up", { startTime: perf, useSeconds: true, message: "Cleaned up" });
|
|
189
|
-
process3.exit(
|
|
205
|
+
process3.exit(ExitCode2.Success);
|
|
190
206
|
});
|
|
191
207
|
buddy.on("clean:*", () => {
|
|
192
208
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
@@ -196,10 +212,10 @@ function clean(buddy) {
|
|
|
196
212
|
|
|
197
213
|
// src/commands/cloud.ts
|
|
198
214
|
import process4 from "process";
|
|
199
|
-
import {intro as intro4, italic, log as
|
|
215
|
+
import {intro as intro4, italic, log as log4, outro as outro4, prompts, runCommand, runCommandSync, underline} from "@stacksjs/cli";
|
|
200
216
|
import {addJumpBox, deleteCdkRemnants, deleteIamUsers, deleteJumpBox, deleteLogGroups, deleteParameterStore, deleteStacksBuckets, deleteStacksFunctions, getJumpBoxInstanceId} from "@stacksjs/cloud";
|
|
201
217
|
import {path as p} from "@stacksjs/path";
|
|
202
|
-
import {ExitCode as
|
|
218
|
+
import {ExitCode as ExitCode3} from "@stacksjs/types";
|
|
203
219
|
import {loop} from "@stacksjs/utils";
|
|
204
220
|
function cloud2(buddy) {
|
|
205
221
|
const descriptions = {
|
|
@@ -213,6 +229,7 @@ function cloud2(buddy) {
|
|
|
213
229
|
verbose: "Enable verbose output"
|
|
214
230
|
};
|
|
215
231
|
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) => {
|
|
232
|
+
log4.debug("Running `buddy cloud` ...", options);
|
|
216
233
|
if (options.ssh || options.connect) {
|
|
217
234
|
const startTime = performance.now();
|
|
218
235
|
const jumpBoxId = await getJumpBoxInstanceId();
|
|
@@ -223,15 +240,16 @@ function cloud2(buddy) {
|
|
|
223
240
|
});
|
|
224
241
|
if (result.isErr()) {
|
|
225
242
|
await outro4("While running the cloud command, there was an issue", { startTime, useSeconds: true }, result.error);
|
|
226
|
-
process4.exit(
|
|
243
|
+
process4.exit(ExitCode3.FatalError);
|
|
227
244
|
}
|
|
228
245
|
await outro4("Exited", { startTime, useSeconds: true });
|
|
229
|
-
process4.exit(
|
|
246
|
+
process4.exit(ExitCode3.Success);
|
|
230
247
|
}
|
|
231
|
-
|
|
232
|
-
process4.exit(
|
|
248
|
+
log4.info("Not implemented yet. Please use the --ssh (or --connect) flag to connect to the Stacks Cloud.");
|
|
249
|
+
process4.exit(ExitCode3.Success);
|
|
233
250
|
});
|
|
234
251
|
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) => {
|
|
252
|
+
log4.debug("Running `buddy cloud:add` ...", options);
|
|
235
253
|
const startTime = await intro4("buddy cloud:add");
|
|
236
254
|
if (options.jumpBox) {
|
|
237
255
|
const { confirm } = await prompts({
|
|
@@ -241,27 +259,28 @@ function cloud2(buddy) {
|
|
|
241
259
|
});
|
|
242
260
|
if (!confirm) {
|
|
243
261
|
await outro4("Exited", { startTime, useSeconds: true });
|
|
244
|
-
process4.exit(
|
|
262
|
+
process4.exit(ExitCode3.Success);
|
|
245
263
|
}
|
|
246
|
-
|
|
247
|
-
|
|
264
|
+
log4.info("The jump-box is getting added to your cloud resources...");
|
|
265
|
+
log4.info("This takes a few moments, please be patient.");
|
|
248
266
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
249
267
|
const result = await addJumpBox();
|
|
250
268
|
if (result.isErr()) {
|
|
251
269
|
await outro4("While running the cloud:add command, there was an issue", { startTime, useSeconds: true }, result.error);
|
|
252
|
-
process4.exit(
|
|
270
|
+
process4.exit(ExitCode3.FatalError);
|
|
253
271
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
272
|
+
log4.info(italic("View the jump-box in the AWS console:"));
|
|
273
|
+
log4.info(underline("https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#Instances:instanceState=running"));
|
|
274
|
+
log4.info(italic("Once it finished initializing, you may SSH into it:"));
|
|
275
|
+
log4.info(underline("buddy cloud --ssh"));
|
|
258
276
|
await outro4("Your jump-box was added.", { startTime, useSeconds: true });
|
|
259
|
-
process4.exit(
|
|
277
|
+
process4.exit(ExitCode3.Success);
|
|
260
278
|
}
|
|
261
|
-
|
|
262
|
-
process4.exit(
|
|
279
|
+
log4.info("This functionality is not yet implemented.");
|
|
280
|
+
process4.exit(ExitCode3.Success);
|
|
263
281
|
});
|
|
264
282
|
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) => {
|
|
283
|
+
log4.debug("Running `buddy cloud:remove` ...", options);
|
|
265
284
|
const startTime = await intro4("buddy cloud:remove");
|
|
266
285
|
if (options.jumpBox) {
|
|
267
286
|
const { confirm } = await prompts({
|
|
@@ -271,15 +290,15 @@ function cloud2(buddy) {
|
|
|
271
290
|
});
|
|
272
291
|
if (!confirm) {
|
|
273
292
|
await outro4("Exited", { startTime, useSeconds: true });
|
|
274
|
-
process4.exit(
|
|
293
|
+
process4.exit(ExitCode3.Success);
|
|
275
294
|
}
|
|
276
295
|
const result2 = await deleteJumpBox();
|
|
277
296
|
if (result2.isErr()) {
|
|
278
297
|
await outro4("While removing your jump-box, there was an issue", { startTime, useSeconds: true }, result2.error);
|
|
279
|
-
process4.exit(
|
|
298
|
+
process4.exit(ExitCode3.FatalError);
|
|
280
299
|
}
|
|
281
300
|
await outro4("Your jump-box was removed.", { startTime, useSeconds: true });
|
|
282
|
-
process4.exit(
|
|
301
|
+
process4.exit(ExitCode3.Success);
|
|
283
302
|
}
|
|
284
303
|
console.log(` ${italic("\u2139\uFE0F Removing your cloud resources takes a while to complete.")}`);
|
|
285
304
|
console.log(` ${italic("Please note, your backups will not yet be deleted. Though,")}`);
|
|
@@ -292,7 +311,7 @@ function cloud2(buddy) {
|
|
|
292
311
|
});
|
|
293
312
|
if (result.isErr()) {
|
|
294
313
|
await outro4('While running the cloud:remove ("undeploy") command, there was an issue', { startTime, useSeconds: true }, result.error);
|
|
295
|
-
process4.exit(
|
|
314
|
+
process4.exit(ExitCode3.FatalError);
|
|
296
315
|
}
|
|
297
316
|
await runCommand("buddy cloud:cleanup", {
|
|
298
317
|
...options,
|
|
@@ -300,8 +319,8 @@ function cloud2(buddy) {
|
|
|
300
319
|
stdin: "inherit"
|
|
301
320
|
});
|
|
302
321
|
try {
|
|
303
|
-
|
|
304
|
-
|
|
322
|
+
log4.info("Finalizing the removal of your cloud resources.");
|
|
323
|
+
log4.info("This will take a few moments...");
|
|
305
324
|
loop(7, () => {
|
|
306
325
|
runCommandSync("buddy cloud:cleanup", {
|
|
307
326
|
...options,
|
|
@@ -310,14 +329,15 @@ function cloud2(buddy) {
|
|
|
310
329
|
});
|
|
311
330
|
});
|
|
312
331
|
await outro4("Your cloud has been removed", { startTime, useSeconds: true });
|
|
313
|
-
process4.exit(
|
|
332
|
+
process4.exit(ExitCode3.Success);
|
|
314
333
|
} catch (error) {
|
|
315
334
|
await outro4("While cleaning up the cloud, there was an issue", { startTime, useSeconds: true }, error);
|
|
316
|
-
process4.exit(
|
|
335
|
+
process4.exit(ExitCode3.FatalError);
|
|
317
336
|
}
|
|
318
337
|
});
|
|
319
338
|
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) => {
|
|
320
|
-
|
|
339
|
+
log4.debug("Running `buddy cloud:optimize-cost` ...", options);
|
|
340
|
+
const startTime = await intro4("buddy cloud:optimize-cost");
|
|
321
341
|
if (options.jumpBox) {
|
|
322
342
|
const { confirm } = await prompts({
|
|
323
343
|
name: "confirm",
|
|
@@ -326,67 +346,68 @@ function cloud2(buddy) {
|
|
|
326
346
|
});
|
|
327
347
|
if (!confirm) {
|
|
328
348
|
await outro4("Exited", { startTime, useSeconds: true });
|
|
329
|
-
process4.exit(
|
|
349
|
+
process4.exit(ExitCode3.Success);
|
|
330
350
|
}
|
|
331
351
|
await deleteJumpBox();
|
|
332
352
|
await outro4("Your jump-box was removed & cost optimizations are applied.", { startTime, useSeconds: true });
|
|
333
|
-
process4.exit(
|
|
353
|
+
process4.exit(ExitCode3.Success);
|
|
334
354
|
}
|
|
335
355
|
await outro4("No cost optimization was applied", { startTime, useSeconds: true });
|
|
336
|
-
process4.exit(
|
|
356
|
+
process4.exit(ExitCode3.Success);
|
|
337
357
|
});
|
|
338
|
-
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 () => {
|
|
358
|
+
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) => {
|
|
359
|
+
log4.debug("Running `buddy cloud:cleanup` ...", options);
|
|
339
360
|
const startTime = await intro4("buddy cloud:cleanup");
|
|
340
|
-
|
|
361
|
+
log4.info(`Cleaning up your cloud resources will take a while to complete. Please be patient.`);
|
|
341
362
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
342
|
-
|
|
363
|
+
log4.info("Removing any jump-boxes...");
|
|
343
364
|
const result = await deleteJumpBox();
|
|
344
365
|
if (result.isErr()) {
|
|
345
366
|
if (result.error !== "Jump-box not found") {
|
|
346
367
|
await outro4("While removing your jump-box, there was an issue", { startTime, useSeconds: true }, result.error);
|
|
347
|
-
process4.exit(
|
|
368
|
+
process4.exit(ExitCode3.FatalError);
|
|
348
369
|
}
|
|
349
370
|
}
|
|
350
|
-
|
|
371
|
+
log4.info("Removing any retained S3 buckets...");
|
|
351
372
|
const result2 = await deleteStacksBuckets();
|
|
352
373
|
if (result2.isErr()) {
|
|
353
374
|
await outro4("While deleting the retained S3 buckets, there was an issue", { startTime, useSeconds: true }, result2.error);
|
|
354
|
-
process4.exit(
|
|
375
|
+
process4.exit(ExitCode3.FatalError);
|
|
355
376
|
}
|
|
356
|
-
|
|
377
|
+
log4.info("Removing any retained Lambda functions...");
|
|
357
378
|
const result3 = await deleteStacksFunctions();
|
|
358
379
|
if (result3.isErr()) {
|
|
359
380
|
if (result3.error !== "No stacks functions found")
|
|
360
381
|
await outro4("While deleting the Origin Request Lambda function, there was an issue", { startTime, useSeconds: true }, result3.error);
|
|
361
|
-
process4.exit(
|
|
382
|
+
process4.exit(ExitCode3.FatalError);
|
|
362
383
|
}
|
|
363
|
-
|
|
364
|
-
|
|
384
|
+
log4.info(result3.value);
|
|
385
|
+
log4.info("Removing any remaining Stacks logs...");
|
|
365
386
|
const result4 = await deleteLogGroups();
|
|
366
387
|
if (result4.isErr()) {
|
|
367
388
|
await outro4("While deleting the Stacks log groups, there was an issue", { startTime, useSeconds: true }, result4.error);
|
|
368
|
-
process4.exit(
|
|
389
|
+
process4.exit(ExitCode3.FatalError);
|
|
369
390
|
}
|
|
370
|
-
|
|
391
|
+
log4.info("Removing any stored parameters...");
|
|
371
392
|
const result7 = await deleteParameterStore();
|
|
372
393
|
if (result7.isErr()) {
|
|
373
394
|
await outro4("While deleting the Stacks log groups, there was an issue", { startTime, useSeconds: true }, result7.error);
|
|
374
|
-
process4.exit(
|
|
395
|
+
process4.exit(ExitCode3.FatalError);
|
|
375
396
|
}
|
|
376
|
-
|
|
397
|
+
log4.info("Removing any CDK remnants...");
|
|
377
398
|
const result6 = await deleteCdkRemnants();
|
|
378
399
|
if (result6.isErr()) {
|
|
379
400
|
await outro4("While deleting the Stacks log groups, there was an issue", { startTime, useSeconds: true }, result6.error);
|
|
380
|
-
process4.exit(
|
|
401
|
+
process4.exit(ExitCode3.FatalError);
|
|
381
402
|
}
|
|
382
|
-
|
|
403
|
+
log4.info("Removing any IAM users...");
|
|
383
404
|
const result8 = await deleteIamUsers();
|
|
384
405
|
if (result8.isErr()) {
|
|
385
406
|
await outro4("While deleting the Stacks log groups, there was an issue", { startTime, useSeconds: true }, result8.error);
|
|
386
|
-
process4.exit(
|
|
407
|
+
process4.exit(ExitCode3.FatalError);
|
|
387
408
|
}
|
|
388
409
|
await outro4("AWS resources have been removed", { startTime, useSeconds: true });
|
|
389
|
-
process4.exit(
|
|
410
|
+
process4.exit(ExitCode3.Success);
|
|
390
411
|
});
|
|
391
412
|
buddy.on("cloud:*", () => {
|
|
392
413
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
@@ -395,8 +416,88 @@ function cloud2(buddy) {
|
|
|
395
416
|
}
|
|
396
417
|
|
|
397
418
|
// src/commands/commit.ts
|
|
398
|
-
import
|
|
419
|
+
import process6 from "process";
|
|
399
420
|
import {runCommit} from "@stacksjs/actions";
|
|
421
|
+
|
|
422
|
+
// /home/runner/work/stacks/stacks/storage/framework/core/logging/src/index.ts
|
|
423
|
+
import process5 from "process";
|
|
424
|
+
import {ExitCode as ExitCode4} from "@stacksjs/types";
|
|
425
|
+
import {logger as logConfig} from "@stacksjs/config";
|
|
426
|
+
import {logsPath} from "@stacksjs/path";
|
|
427
|
+
import {buddyOptions, prompt as getPrompt} from "@stacksjs/cli";
|
|
428
|
+
function logLevel() {
|
|
429
|
+
const verboseRegex = /--verbose(?!(\s*=\s*false|\s+false))(\s+|=true)?($|\s)/;
|
|
430
|
+
if (verboseRegex.test(buddyOptions().trim()))
|
|
431
|
+
return 4;
|
|
432
|
+
return logConfig.level;
|
|
433
|
+
}
|
|
434
|
+
async function writeToLogFile(message) {
|
|
435
|
+
const formattedMessage = `[${new Date().toISOString()}] ${message}\n`;
|
|
436
|
+
try {
|
|
437
|
+
const file = Bun.file(logFilePath);
|
|
438
|
+
const writer = file.writer();
|
|
439
|
+
const text = await file.text();
|
|
440
|
+
writer.write(`${text}\n`);
|
|
441
|
+
writer.write(`${formattedMessage}\n`);
|
|
442
|
+
await writer.end();
|
|
443
|
+
} catch (error) {
|
|
444
|
+
const file = Bun.file(logFilePath);
|
|
445
|
+
const writer = file.writer();
|
|
446
|
+
writer.write(`${formattedMessage}\n`);
|
|
447
|
+
await writer.end();
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
function dump(...args) {
|
|
451
|
+
args.forEach((arg) => log5.debug(arg));
|
|
452
|
+
}
|
|
453
|
+
function dd(...args) {
|
|
454
|
+
args.forEach((arg) => log5.debug(arg));
|
|
455
|
+
process5.exit(ExitCode4.FatalError);
|
|
456
|
+
}
|
|
457
|
+
function echo(...args) {
|
|
458
|
+
console.log(...args);
|
|
459
|
+
}
|
|
460
|
+
var logger = createConsola({
|
|
461
|
+
level: logLevel()
|
|
462
|
+
});
|
|
463
|
+
var logFilePath = logsPath("console.log");
|
|
464
|
+
var log5 = {
|
|
465
|
+
async info(...arg) {
|
|
466
|
+
logger.info(...arg);
|
|
467
|
+
await writeToLogFile(`INFO: ${arg}`);
|
|
468
|
+
},
|
|
469
|
+
async success(msg) {
|
|
470
|
+
logger.success(msg);
|
|
471
|
+
await writeToLogFile(`SUCCESS: ${msg}`);
|
|
472
|
+
},
|
|
473
|
+
async error(err, options) {
|
|
474
|
+
handleError(err, options);
|
|
475
|
+
await writeToLogFile(`ERROR: ${err}`);
|
|
476
|
+
},
|
|
477
|
+
async warn(arg) {
|
|
478
|
+
logger.warn(arg);
|
|
479
|
+
await writeToLogFile(`WARN: ${arg}`);
|
|
480
|
+
},
|
|
481
|
+
async debug(...arg) {
|
|
482
|
+
if (process5.env.APP_ENV === "production" || process5.env.APP_ENV === "prod")
|
|
483
|
+
return await writeToLogFile(`DEBUG: ${arg}`);
|
|
484
|
+
logger.debug(arg);
|
|
485
|
+
await writeToLogFile(`DEBUG: ${arg}`);
|
|
486
|
+
},
|
|
487
|
+
async start(...arg) {
|
|
488
|
+
logger.start(arg);
|
|
489
|
+
await writeToLogFile(`START: ${arg}`);
|
|
490
|
+
},
|
|
491
|
+
box: logger.box,
|
|
492
|
+
get prompt() {
|
|
493
|
+
return getPrompt();
|
|
494
|
+
},
|
|
495
|
+
dump,
|
|
496
|
+
dd,
|
|
497
|
+
echo
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
// src/commands/commit.ts
|
|
400
501
|
function commit(buddy) {
|
|
401
502
|
const descriptions = {
|
|
402
503
|
commit: "Commit your stashed changes",
|
|
@@ -404,17 +505,18 @@ function commit(buddy) {
|
|
|
404
505
|
verbose: "Enable verbose output"
|
|
405
506
|
};
|
|
406
507
|
buddy.command("commit", descriptions.commit).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
508
|
+
log5.debug("Running `buddy commit` ...", options);
|
|
407
509
|
await runCommit(options);
|
|
408
510
|
});
|
|
409
511
|
buddy.on("commit:*", () => {
|
|
410
512
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
411
|
-
|
|
513
|
+
process6.exit(1);
|
|
412
514
|
});
|
|
413
515
|
}
|
|
414
516
|
|
|
415
517
|
// src/commands/configure.ts
|
|
416
|
-
import
|
|
417
|
-
import {log as
|
|
518
|
+
import process7 from "process";
|
|
519
|
+
import {log as log6, outro as outro5, runCommand as runCommand2} from "@stacksjs/cli";
|
|
418
520
|
import {path as p2} from "@stacksjs/path";
|
|
419
521
|
import {ExitCode as ExitCode5} from "@stacksjs/types";
|
|
420
522
|
function configure(buddy) {
|
|
@@ -426,29 +528,31 @@ function configure(buddy) {
|
|
|
426
528
|
verbose: "Enable verbose output"
|
|
427
529
|
};
|
|
428
530
|
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) => {
|
|
531
|
+
log6.debug("Running `buddy configure` ...", options);
|
|
429
532
|
if (options?.aws) {
|
|
430
533
|
await configureAws(options);
|
|
431
|
-
|
|
534
|
+
process7.exit(ExitCode5.Success);
|
|
432
535
|
}
|
|
433
|
-
|
|
434
|
-
|
|
536
|
+
log6.info("Not implemented yet. Please use the --aws flag to configure AWS.");
|
|
537
|
+
process7.exit(ExitCode5.Success);
|
|
435
538
|
});
|
|
436
|
-
buddy.command("configure:aws", descriptions.aws).option("-p, --project", descriptions.project, { default: false }).option("--profile", descriptions.profile, { default:
|
|
539
|
+
buddy.command("configure:aws", descriptions.aws).option("-p, --project", descriptions.project, { default: false }).option("--profile", descriptions.profile, { default: process7.env.AWS_PROFILE }).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) => {
|
|
540
|
+
log6.debug("Running `buddy configure:aws` ...", options);
|
|
437
541
|
await configureAws(options);
|
|
438
|
-
|
|
542
|
+
process7.exit(ExitCode5.Success);
|
|
439
543
|
});
|
|
440
544
|
buddy.on("configure:*", () => {
|
|
441
545
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
442
|
-
|
|
546
|
+
process7.exit(ExitCode5.FatalError);
|
|
443
547
|
});
|
|
444
548
|
}
|
|
445
549
|
async function configureAws(options) {
|
|
446
550
|
const startTime = performance.now();
|
|
447
|
-
const awsAccessKeyId = options?.accessKeyId ??
|
|
448
|
-
const awsSecretAccessKey = options?.secretAccessKey ??
|
|
551
|
+
const awsAccessKeyId = options?.accessKeyId ?? process7.env.AWS_ACCESS_KEY_ID;
|
|
552
|
+
const awsSecretAccessKey = options?.secretAccessKey ?? process7.env.AWS_SECRET_ACCESS_KEY;
|
|
449
553
|
const defaultRegion = "us-east-1";
|
|
450
554
|
const defaultOutputFormat = options?.output ?? "json";
|
|
451
|
-
const command = `aws configure --profile ${options
|
|
555
|
+
const command = `aws configure --profile ${options?.profile ?? process7.env.AWS_PROFILE}`;
|
|
452
556
|
const input = `${awsAccessKeyId}\n${awsSecretAccessKey}\n${defaultRegion}\n${defaultOutputFormat}\n`;
|
|
453
557
|
const result = await runCommand2(command, {
|
|
454
558
|
...options,
|
|
@@ -458,17 +562,17 @@ async function configureAws(options) {
|
|
|
458
562
|
});
|
|
459
563
|
if (result.isErr()) {
|
|
460
564
|
await outro5("While running the cloud command, there was an issue", { startTime, useSeconds: true }, result.error);
|
|
461
|
-
|
|
565
|
+
process7.exit(ExitCode5.FatalError);
|
|
462
566
|
}
|
|
463
|
-
if (options
|
|
567
|
+
if (options?.quiet)
|
|
464
568
|
return;
|
|
465
569
|
await outro5("Exited", { startTime, useSeconds: true });
|
|
466
570
|
}
|
|
467
571
|
|
|
468
572
|
// src/commands/create.ts
|
|
469
|
-
import
|
|
573
|
+
import process8 from "process";
|
|
470
574
|
import {ExitCode as ExitCode6} from "@stacksjs/types";
|
|
471
|
-
import {bold, cyan, dim, intro as intro5, log as
|
|
575
|
+
import {bold, cyan, dim, intro as intro5, log as log7, runCommand as runCommand3} from "@stacksjs/cli";
|
|
472
576
|
import {useOnline} from "@stacksjs/utils";
|
|
473
577
|
import {isFolder} from "@stacksjs/storage";
|
|
474
578
|
import {resolve} from "@stacksjs/path";
|
|
@@ -489,147 +593,149 @@ function create(buddy) {
|
|
|
489
593
|
verbose: "Enable verbose output"
|
|
490
594
|
};
|
|
491
595
|
buddy.command("new <name>", descriptions.command).option("-u, --ui", descriptions.ui, { default: true }).option("-c, --components", descriptions.components, { default: true }).option("-w, --web-components", descriptions.webComponents, { default: true }).option("-v, --vue", descriptions.vue, { default: true }).option("-p, --views", descriptions.views, { default: true }).option("-f, --functions", descriptions.functions, { default: true }).option("-a, --api", descriptions.api, { default: true }).option("-d, --database", descriptions.database, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
596
|
+
log7.debug("Running `buddy new <name>` ...", options);
|
|
492
597
|
const startTime = await intro5("stacks new");
|
|
493
598
|
const name = options.name;
|
|
494
|
-
const
|
|
495
|
-
isFolderCheck(
|
|
599
|
+
const path6 = resolve(process8.cwd(), name);
|
|
600
|
+
isFolderCheck(path6);
|
|
496
601
|
onlineCheck();
|
|
497
|
-
const result = await download(name,
|
|
498
|
-
if (result
|
|
499
|
-
|
|
500
|
-
|
|
602
|
+
const result = await download(name, path6, options);
|
|
603
|
+
if (result.isErr()) {
|
|
604
|
+
log7.error(result.error);
|
|
605
|
+
process8.exit(ExitCode6.FatalError);
|
|
501
606
|
}
|
|
502
|
-
await ensureEnv(
|
|
503
|
-
await install(
|
|
607
|
+
await ensureEnv(path6, options);
|
|
608
|
+
await install(path6, options);
|
|
504
609
|
if (startTime) {
|
|
505
610
|
const time = performance.now() - startTime;
|
|
506
|
-
|
|
611
|
+
log7.success(dim(`[${time.toFixed(2)}ms] Completed`));
|
|
507
612
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
613
|
+
log7.info(bold("Welcome to the Stacks Framework! \u269B\uFE0F"));
|
|
614
|
+
log7.info("To learn more, visit https://stacksjs.org");
|
|
615
|
+
process8.exit(ExitCode6.Success);
|
|
511
616
|
});
|
|
512
617
|
buddy.on("new:*", () => {
|
|
513
618
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
514
|
-
|
|
619
|
+
process8.exit(1);
|
|
515
620
|
});
|
|
516
621
|
}
|
|
517
|
-
var isFolderCheck = function(
|
|
518
|
-
if (isFolder(
|
|
519
|
-
|
|
520
|
-
|
|
622
|
+
var isFolderCheck = function(path6) {
|
|
623
|
+
if (isFolder(path6)) {
|
|
624
|
+
log7.error(`Path ${path6} already exists`);
|
|
625
|
+
process8.exit(ExitCode6.FatalError);
|
|
521
626
|
}
|
|
522
627
|
};
|
|
523
628
|
var onlineCheck = function() {
|
|
524
629
|
const online = useOnline();
|
|
525
630
|
if (!online) {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
631
|
+
log7.info("It appears you are disconnected from the internet.");
|
|
632
|
+
log7.info("The Stacks setup requires a brief internet connection for setup.");
|
|
633
|
+
log7.info("For instance, it installs your dependencies from.");
|
|
634
|
+
process8.exit(ExitCode6.FatalError);
|
|
530
635
|
}
|
|
531
636
|
};
|
|
532
|
-
async function download(name,
|
|
533
|
-
|
|
637
|
+
async function download(name, path6, options) {
|
|
638
|
+
log7.info("Setting up your stack.");
|
|
534
639
|
const result = await runCommand3(`bunx giget stacks ${name}`, options);
|
|
535
|
-
|
|
640
|
+
log7.success(`Successfully scaffolded your project at ${cyan(path6)}`);
|
|
536
641
|
return result;
|
|
537
642
|
}
|
|
538
|
-
async function ensureEnv(
|
|
539
|
-
|
|
540
|
-
await runCommand3("pkgx --update ", { ...options, cwd:
|
|
541
|
-
|
|
643
|
+
async function ensureEnv(path6, options) {
|
|
644
|
+
log7.info("Ensuring your environment is ready...");
|
|
645
|
+
await runCommand3("pkgx --update ", { ...options, cwd: path6 });
|
|
646
|
+
log7.success("Environment is ready");
|
|
542
647
|
}
|
|
543
|
-
async function install(
|
|
544
|
-
|
|
545
|
-
let result = await runCommand3("bun install", { ...options, cwd:
|
|
648
|
+
async function install(path6, options) {
|
|
649
|
+
log7.info("Installing & setting up Stacks");
|
|
650
|
+
let result = await runCommand3("bun install", { ...options, cwd: path6 });
|
|
546
651
|
if (result?.isErr()) {
|
|
547
|
-
|
|
548
|
-
|
|
652
|
+
log7.error(result.error);
|
|
653
|
+
process8.exit();
|
|
549
654
|
}
|
|
550
|
-
result = await runCommand3("cp .env.example .env", { ...options, cwd:
|
|
655
|
+
result = await runCommand3("cp .env.example .env", { ...options, cwd: path6 });
|
|
551
656
|
if (result?.isErr()) {
|
|
552
|
-
|
|
553
|
-
|
|
657
|
+
log7.error(result.error);
|
|
658
|
+
process8.exit(ExitCode6.FatalError);
|
|
554
659
|
}
|
|
555
|
-
await runAction4(Action4.KeyGenerate, { ...options, cwd:
|
|
556
|
-
result = await runCommand3("git init", { ...options, cwd:
|
|
660
|
+
await runAction4(Action4.KeyGenerate, { ...options, cwd: path6 });
|
|
661
|
+
result = await runCommand3("git init", { ...options, cwd: path6 });
|
|
557
662
|
if (result.isErr()) {
|
|
558
|
-
|
|
559
|
-
|
|
663
|
+
log7.error(result.error);
|
|
664
|
+
process8.exit(ExitCode6.FatalError);
|
|
560
665
|
}
|
|
561
|
-
|
|
666
|
+
log7.success("Installed & set-up \uD83D\uDE80");
|
|
562
667
|
}
|
|
563
668
|
|
|
564
669
|
// src/commands/deploy.ts
|
|
565
|
-
import
|
|
670
|
+
import process9 from "process";
|
|
566
671
|
import {ExitCode as ExitCode7} from "@stacksjs/types";
|
|
567
672
|
import {runAction as runAction5} from "@stacksjs/actions";
|
|
568
|
-
import {intro as intro6, italic as italic2, log as
|
|
673
|
+
import {intro as intro6, italic as italic2, log as log8, outro as outro6, runCommand as runCommand4} from "@stacksjs/cli";
|
|
569
674
|
import {Action as Action5} from "@stacksjs/enums";
|
|
570
675
|
import {app} from "@stacksjs/config";
|
|
571
676
|
import {addDomain, hasUserDomainBeenAddedToCloud} from "@stacksjs/dns";
|
|
572
677
|
function deploy(buddy) {
|
|
573
678
|
const descriptions = {
|
|
574
|
-
deploy: "
|
|
679
|
+
deploy: "Re-installs your npm dependencies",
|
|
575
680
|
project: "Target a specific project",
|
|
576
681
|
verbose: "Enable verbose output"
|
|
577
682
|
};
|
|
578
683
|
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) => {
|
|
684
|
+
log8.debug("Running `buddy deploy` ...", options);
|
|
579
685
|
const startTime = await intro6("buddy deploy");
|
|
580
686
|
const domain = options.domain || app.url;
|
|
581
687
|
if (!domain) {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
688
|
+
log8.info("No domain found in your .env or ./config/app.ts");
|
|
689
|
+
log8.info("Please ensure your domain is properly configured.");
|
|
690
|
+
log8.info("For more info, check out the docs or join our Discord.");
|
|
691
|
+
process9.exit(ExitCode7.FatalError);
|
|
586
692
|
}
|
|
587
693
|
await checkIfAwsIsConfigured();
|
|
588
694
|
options.domain = await configureDomain(domain, options, startTime);
|
|
589
695
|
const result = await runAction5(Action5.Deploy, options);
|
|
590
696
|
if (result.isErr()) {
|
|
591
697
|
await outro6("While running the `buddy deploy`, there was an issue", { startTime, useSeconds: true }, result.error);
|
|
592
|
-
|
|
698
|
+
process9.exit(ExitCode7.FatalError);
|
|
593
699
|
}
|
|
594
700
|
await outro6("Project deployed.", { startTime, useSeconds: true });
|
|
595
701
|
});
|
|
596
702
|
buddy.on("deploy:*", () => {
|
|
597
|
-
|
|
598
|
-
|
|
703
|
+
log8.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
704
|
+
process9.exit(1);
|
|
599
705
|
});
|
|
600
706
|
}
|
|
601
707
|
async function configureDomain(domain, options, startTime) {
|
|
602
708
|
if (!domain) {
|
|
603
|
-
|
|
604
|
-
|
|
709
|
+
log8.info("We could not identify a domain to deploy to.");
|
|
710
|
+
log8.info("Please set your .env or ./config/app.ts properly.");
|
|
605
711
|
console.log("");
|
|
606
|
-
|
|
712
|
+
log8.info("Alternatively, specify a domain to deploy via the `--domain` flag.");
|
|
607
713
|
console.log("");
|
|
608
|
-
|
|
714
|
+
log8.info(" \u27A1\uFE0F Example: `buddy deploy --domain example.com`");
|
|
609
715
|
console.log("");
|
|
610
|
-
|
|
716
|
+
process9.exit(ExitCode7.FatalError);
|
|
611
717
|
}
|
|
612
718
|
if (domain.includes("localhost")) {
|
|
613
|
-
|
|
614
|
-
|
|
719
|
+
log8.info("You are deploying to a local environment.");
|
|
720
|
+
log8.info("Please set your .env or ./config/app.ts properly.");
|
|
615
721
|
console.log("");
|
|
616
|
-
|
|
722
|
+
log8.info("Alternatively, specify a domain to deploy via the `--domain` flag.");
|
|
617
723
|
console.log("");
|
|
618
|
-
|
|
724
|
+
log8.info(" \u27A1\uFE0F Example: `buddy deploy --domain example.com`");
|
|
619
725
|
console.log("");
|
|
620
|
-
|
|
726
|
+
process9.exit(ExitCode7.FatalError);
|
|
621
727
|
}
|
|
622
728
|
if (await hasUserDomainBeenAddedToCloud(domain)) {
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
729
|
+
log8.info("Domain is properly configured");
|
|
730
|
+
log8.info("Your cloud is deploying...");
|
|
731
|
+
log8.info(`${italic2("This may take a while...")}`);
|
|
626
732
|
return domain;
|
|
627
733
|
}
|
|
628
734
|
console.log("");
|
|
629
|
-
|
|
735
|
+
log8.info(` \uD83D\uDC4B It appears to be your first ${italic2(domain)} deployment.`);
|
|
630
736
|
console.log("");
|
|
631
|
-
|
|
632
|
-
|
|
737
|
+
log8.info(italic2("Let\u2019s ensure it is all connected properly."));
|
|
738
|
+
log8.info(italic2("One moment..."));
|
|
633
739
|
console.log("");
|
|
634
740
|
const result = await addDomain({
|
|
635
741
|
...options,
|
|
@@ -638,26 +744,26 @@ async function configureDomain(domain, options, startTime) {
|
|
|
638
744
|
});
|
|
639
745
|
if (result.isErr()) {
|
|
640
746
|
await outro6("While running the `buddy deploy`, there was an issue", { startTime, useSeconds: true }, result.error);
|
|
641
|
-
|
|
747
|
+
process9.exit(ExitCode7.FatalError);
|
|
642
748
|
}
|
|
643
749
|
await outro6("Added your domain.", { startTime, useSeconds: true });
|
|
644
|
-
|
|
750
|
+
process9.exit(ExitCode7.Success);
|
|
645
751
|
}
|
|
646
752
|
async function checkIfAwsIsConfigured() {
|
|
647
|
-
|
|
648
|
-
const result = await runCommand4("buddy configure:aws
|
|
753
|
+
log8.info("Ensuring AWS is configured...");
|
|
754
|
+
const result = await runCommand4("buddy configure:aws", {
|
|
649
755
|
silent: true
|
|
650
756
|
});
|
|
651
757
|
if (result.isErr()) {
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
758
|
+
log8.error("AWS is not configured properly.");
|
|
759
|
+
log8.error("Please run `buddy configure:aws` to set up your AWS credentials.");
|
|
760
|
+
process9.exit(ExitCode7.FatalError);
|
|
655
761
|
}
|
|
656
|
-
|
|
762
|
+
log8.success("AWS is configured");
|
|
657
763
|
}
|
|
658
764
|
|
|
659
765
|
// src/commands/dev.ts
|
|
660
|
-
import
|
|
766
|
+
import process10 from "process";
|
|
661
767
|
import {Action as Action6} from "@stacksjs/enums";
|
|
662
768
|
import {
|
|
663
769
|
runAction as runAction6,
|
|
@@ -670,7 +776,7 @@ runFrontendDevServer,
|
|
|
670
776
|
runSystemTrayDevServer
|
|
671
777
|
} from "@stacksjs/actions";
|
|
672
778
|
import {ExitCode as ExitCode8} from "@stacksjs/types";
|
|
673
|
-
import {intro as intro7, log as
|
|
779
|
+
import {intro as intro7, log as log9, outro as outro7, runCommand as runCommand5} from "@stacksjs/cli";
|
|
674
780
|
import {libsPath} from "@stacksjs/path";
|
|
675
781
|
function dev(buddy) {
|
|
676
782
|
const descriptions = {
|
|
@@ -690,6 +796,7 @@ function dev(buddy) {
|
|
|
690
796
|
verbose: "Enable verbose output"
|
|
691
797
|
};
|
|
692
798
|
buddy.command("dev [server]", descriptions.dev).option("-f, --frontend", descriptions.frontend).option("-a, --api", descriptions.api).option("-e, --email", descriptions.email).option("-c, --components", descriptions.components).option("-d, --dashboard", descriptions.dashboard).option("-t, --desktop", descriptions.desktop).option("-d, --docs", descriptions.docs).option("-t, --system-tray", descriptions.systemTray).option("-i, --interactive", descriptions.interactive, { default: false }).option("-l, --with-localhost", descriptions.withLocalhost, { default: false }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (server, options) => {
|
|
799
|
+
log9.debug("Running `buddy dev [server]` ...", options);
|
|
693
800
|
const perf = await intro7("buddy dev");
|
|
694
801
|
switch (server) {
|
|
695
802
|
case "frontend":
|
|
@@ -716,7 +823,7 @@ function dev(buddy) {
|
|
|
716
823
|
default:
|
|
717
824
|
}
|
|
718
825
|
if (wantsInteractive(options)) {
|
|
719
|
-
const answer = await
|
|
826
|
+
const answer = await log9.prompt.require().select(descriptions.select, {
|
|
720
827
|
options: [
|
|
721
828
|
{ value: "all", label: "All" },
|
|
722
829
|
{ value: "frontend", label: "Frontend" },
|
|
@@ -737,8 +844,8 @@ function dev(buddy) {
|
|
|
737
844
|
} else if (answer === "docs") {
|
|
738
845
|
await runDocsDevServer(options);
|
|
739
846
|
} else {
|
|
740
|
-
|
|
741
|
-
|
|
847
|
+
log9.error("Invalid option during interactive mode");
|
|
848
|
+
process10.exit(ExitCode8.InvalidArgument);
|
|
742
849
|
}
|
|
743
850
|
} else {
|
|
744
851
|
if (options.components)
|
|
@@ -750,67 +857,74 @@ function dev(buddy) {
|
|
|
750
857
|
}
|
|
751
858
|
await startDevelopmentServer(options);
|
|
752
859
|
outro7("Exited", { startTime: perf, useSeconds: true });
|
|
753
|
-
|
|
860
|
+
process10.exit(ExitCode8.Success);
|
|
754
861
|
});
|
|
755
862
|
buddy.command("dev:components", descriptions.components).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
863
|
+
log9.debug("Running `buddy dev:components` ...", options);
|
|
756
864
|
const perf = await intro7("buddy dev:components");
|
|
757
865
|
const result = await runCommand5("bun run dev", {
|
|
758
866
|
cwd: libsPath("components/vue")
|
|
759
867
|
});
|
|
760
868
|
if (options.verbose)
|
|
761
|
-
|
|
869
|
+
log9.info("buddy dev:components result", result);
|
|
762
870
|
if (result.isErr()) {
|
|
763
871
|
await outro7("While running the dev:components command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
764
|
-
|
|
872
|
+
process10.exit();
|
|
765
873
|
}
|
|
766
874
|
console.log("");
|
|
767
875
|
await outro7("Exited", { startTime: perf, useSeconds: true });
|
|
768
|
-
|
|
876
|
+
process10.exit(ExitCode8.Success);
|
|
769
877
|
});
|
|
770
878
|
buddy.command("dev:docs", descriptions.docs).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
879
|
+
log9.debug("Running `buddy dev:docs` ...", options);
|
|
771
880
|
const perf = await intro7("buddy dev:docs");
|
|
772
881
|
const result = await runAction6(Action6.DevDocs, options);
|
|
773
882
|
if (result.isErr()) {
|
|
774
883
|
await outro7("While running the dev:docs command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
775
|
-
|
|
884
|
+
process10.exit();
|
|
776
885
|
}
|
|
777
886
|
console.log("");
|
|
778
887
|
await outro7("Exited", { startTime: perf, useSeconds: true });
|
|
779
|
-
|
|
888
|
+
process10.exit(ExitCode8.Success);
|
|
780
889
|
});
|
|
781
890
|
buddy.command("dev:desktop", descriptions.desktop).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
891
|
+
log9.debug("Running `buddy dev:desktop` ...", options);
|
|
782
892
|
const perf = await intro7("buddy dev:desktop");
|
|
783
893
|
const result = await runAction6(Action6.DevDesktop, options);
|
|
784
894
|
if (result.isErr()) {
|
|
785
895
|
await outro7("While running the dev:desktop command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
786
|
-
|
|
896
|
+
process10.exit();
|
|
787
897
|
}
|
|
788
898
|
console.log("");
|
|
789
899
|
await outro7("Exited", { startTime: perf, useSeconds: true });
|
|
790
|
-
|
|
900
|
+
process10.exit(ExitCode8.Success);
|
|
791
901
|
});
|
|
792
902
|
buddy.command("dev:api", descriptions.api).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
903
|
+
log9.debug("Running `buddy dev:api` ...", options);
|
|
793
904
|
await runApiDevServer(options);
|
|
794
|
-
})
|
|
905
|
+
});
|
|
795
906
|
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) => {
|
|
907
|
+
log9.debug("Running `buddy dev:frontend` ...", options);
|
|
796
908
|
await runFrontendDevServer(options);
|
|
797
909
|
});
|
|
798
910
|
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) => {
|
|
911
|
+
log9.debug("Running `buddy dev:dashboard` ...", options);
|
|
799
912
|
await runDashboardDevServer(options);
|
|
800
913
|
});
|
|
801
914
|
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) => {
|
|
915
|
+
log9.debug("Running `buddy dev:system-tray` ...", options);
|
|
802
916
|
await runSystemTrayDevServer(options);
|
|
803
917
|
});
|
|
804
918
|
buddy.on("dev:*", () => {
|
|
805
919
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
806
|
-
|
|
920
|
+
process10.exit(1);
|
|
807
921
|
});
|
|
808
922
|
}
|
|
809
923
|
async function startDevelopmentServer(options) {
|
|
810
924
|
const result = await runAction6(Action6.Dev, options);
|
|
811
925
|
if (result.isErr()) {
|
|
812
|
-
|
|
813
|
-
|
|
926
|
+
log9.error("While running the dev command, there was an issue", result.error);
|
|
927
|
+
process10.exit(ExitCode8.InvalidArgument);
|
|
814
928
|
}
|
|
815
929
|
}
|
|
816
930
|
var wantsInteractive = function(options) {
|
|
@@ -818,10 +932,10 @@ var wantsInteractive = function(options) {
|
|
|
818
932
|
};
|
|
819
933
|
|
|
820
934
|
// src/commands/domains.ts
|
|
821
|
-
import
|
|
935
|
+
import process11 from "process";
|
|
822
936
|
import {runAction as runAction7} from "@stacksjs/actions";
|
|
823
|
-
import {bgCyan, bold as bold2, intro as intro8, italic as italic3, outro as outro8, prompts as prompts2} from "@stacksjs/cli";
|
|
824
|
-
import {config as
|
|
937
|
+
import {bgCyan, bold as bold2, intro as intro8, italic as italic3, log as log10, outro as outro8, prompts as prompts2} from "@stacksjs/cli";
|
|
938
|
+
import {config as config4} from "@stacksjs/config";
|
|
825
939
|
import {addDomain as addDomain2} from "@stacksjs/dns";
|
|
826
940
|
import {ExitCode as ExitCode9} from "@stacksjs/types";
|
|
827
941
|
import {Action as Action7} from "@stacksjs/enums";
|
|
@@ -834,14 +948,15 @@ function domains(buddy) {
|
|
|
834
948
|
project: "Target a specific project",
|
|
835
949
|
verbose: "Enable verbose output"
|
|
836
950
|
};
|
|
837
|
-
const c =
|
|
951
|
+
const c = config4.dns.contactInfo;
|
|
838
952
|
buddy.command("domains:purchase <domain>", descriptions.purchase).option("--years <years>", "Number of years to purchase the domain for", { default: 1 }).option("--privacy", "Enable privacy protection", { default: true }).option("--auto-renew", "Enable auto-renew", { default: true }).option("--first-name <firstName>", "Registrant first name", { default: c?.firstName }).option("--last-name <lastName>", "Registrant last name", { default: c?.lastName }).option("--organization <organization>", "Registrant organization name", { default: c?.organizationName }).option("--address-line1 <address>", "Registrant address line 1", { default: c?.addressLine1 }).option("--address-line2 <address>", "Registrant address line 2", { default: c?.addressLine2 }).option("--city <city>", "Registrant city", { default: c?.city }).option("--state <state>", "Registrant state", { default: c?.state }).option("--country <country>", "Registrant country code", { default: c?.countryCode }).option("--zip <zip>", "Registrant zip", { default: c?.zip }).option("--phone <phone>", "Registrant phone", { default: c?.phoneNumber }).option("--email <email>", "Registrant email", { default: c?.email }).option("--admin-first-name <firstName>", "Admin first name", { default: c?.admin?.firstName || c?.firstName }).option("--admin-last-name <lastName>", "Admin last name", { default: c?.admin?.lastName || c?.lastName }).option("--admin-organization <organization>", "Admin organization", { default: c?.admin?.organizationName || c?.organizationName }).option("--admin-address-line1 <address>", "Admin address line 1", { default: c?.admin?.addressLine1 || c?.addressLine1 }).option("--admin-address-line2 <address>", "Admin address line 2", { default: c?.admin?.addressLine2 || c?.addressLine2 }).option("--admin-city <city>", "Admin city", { default: c?.admin?.city || c?.city }).option("--admin-state <state>", "Admin state", { default: c?.admin?.state || c?.state }).option("--admin-country <country>", "Admin country code", { default: c?.admin?.countryCode || c?.countryCode }).option("--admin-zip <zip>", "Admin zip", { default: c?.admin?.zip || c?.zip }).option("--admin-phone <phone>", "Admin phone number", { default: c?.admin?.phoneNumber || c?.phoneNumber }).option("--admin-email <email>", "Admin email", { default: c?.admin?.email || c?.email }).option("--tech-first-name <firstName>", "Tech first name", { default: c?.tech?.firstName || c?.firstName }).option("--tech-last-name <lastName>", "Tech last name", { default: c?.tech?.lastName || c?.lastName }).option("--tech-organization <organization>", "Tech organization name", { default: c?.tech?.organizationName || c?.organizationName }).option("--tech-address-line1 <address>", "Tech address line 1", { default: c?.tech?.addressLine1 || c?.addressLine1 }).option("--tech-address-line2 <address>", "Tech address line 2", { default: c?.tech?.addressLine2 || c?.addressLine2 }).option("--tech-city <city>", "Tech city", { default: c?.tech?.city || c?.city }).option("--tech-state <state>", "Tech state", { default: c?.tech?.state || c?.state }).option("--tech-country <country>", "Tech country", { default: c?.tech?.countryCode || c?.countryCode }).option("--tech-zip <zip>", "Tech zip", { default: c?.tech?.zip || c?.zip }).option("--tech-phone <phone>", "Tech phone", { default: c?.tech?.phoneNumber || c?.phoneNumber }).option("--tech-email <email>", "Tech email", { default: c?.tech?.email || c?.email }).option("--privacy-admin", "Enable privacy protection for admin", { default: c?.privacyAdmin || c?.privacy || true }).option("--privacy-tech", "Enable privacy protection for tech", { default: c?.privacyTech || c?.privacy || true }).option("--privacy-registrant", "Enable privacy protection for registrant", { default: c?.privacyRegistrant || c?.privacy || true }).option("--contact-type <type>", "Contact type", { default: "person" }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (domain, options) => {
|
|
953
|
+
log10.debug("Running `buddy domains:purchase <domain>` ...", options);
|
|
839
954
|
options.domain = domain;
|
|
840
955
|
const startTime = await intro8("buddy domains:purchase");
|
|
841
956
|
const result = await runAction7(Action7.DomainsPurchase, options);
|
|
842
957
|
if (result.isErr()) {
|
|
843
958
|
await outro8("While running the domains:purchase command, there was an issue", { startTime, useSeconds: true }, result.error);
|
|
844
|
-
|
|
959
|
+
process11.exit(ExitCode9.FatalError);
|
|
845
960
|
}
|
|
846
961
|
const { confirm } = await prompts2({
|
|
847
962
|
name: "confirm",
|
|
@@ -850,8 +965,8 @@ function domains(buddy) {
|
|
|
850
965
|
});
|
|
851
966
|
if (!confirm) {
|
|
852
967
|
await outro8(`Alrighty! ${italic3(domain)} was added to your account.`, { startTime, useSeconds: true, type: "success" });
|
|
853
|
-
|
|
854
|
-
|
|
968
|
+
log10.info(`Please note, you may need to validate your email address. Check your ${italic3(options.registrantEmail)} inbox.`);
|
|
969
|
+
process11.exit(ExitCode9.Success);
|
|
855
970
|
}
|
|
856
971
|
const { writeEnv } = await import("../../env/src/index.js");
|
|
857
972
|
writeEnv("APP_URL", domain);
|
|
@@ -861,9 +976,10 @@ function domains(buddy) {
|
|
|
861
976
|
\nThe next time you run ${bgCyan(italic3(bold2(" buddy deploy ")))}, your app will deploy to ${italic3(domain)}.
|
|
862
977
|
\n${italic3("You may need to deploy 2-3 times for the changes to take effect. Issue tracked here: https://github.com/stacksjs/stacks/issues/685")}`;
|
|
863
978
|
await outro8(message, { startTime, useSeconds: true, type: "info" });
|
|
864
|
-
|
|
979
|
+
process11.exit(ExitCode9.Success);
|
|
865
980
|
});
|
|
866
981
|
buddy.command("domains:add <domain>", descriptions.add).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
982
|
+
log10.debug("Running `buddy domains:add <domain>` ...", options);
|
|
867
983
|
const startTime = await intro8("buddy domains:add");
|
|
868
984
|
const result = await addDomain2({
|
|
869
985
|
...options,
|
|
@@ -871,13 +987,14 @@ function domains(buddy) {
|
|
|
871
987
|
});
|
|
872
988
|
if (result.isErr()) {
|
|
873
989
|
await outro8("While running the `buddy deploy`, there was an issue", { startTime, useSeconds: true }, result.error);
|
|
874
|
-
|
|
990
|
+
process11.exit(ExitCode9.FatalError);
|
|
875
991
|
}
|
|
876
992
|
await outro8("Added your domain.", { startTime, useSeconds: true });
|
|
877
|
-
|
|
993
|
+
process11.exit(ExitCode9.Success);
|
|
878
994
|
});
|
|
879
995
|
buddy.command("domains:remove <domain>", descriptions.remove).option("--yes", descriptions.skip, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
880
|
-
|
|
996
|
+
log10.debug("Running `buddy domains:remove <domain>` ...", options);
|
|
997
|
+
const domain = options.domain || config4.app.url;
|
|
881
998
|
const opts = { ...options, domain };
|
|
882
999
|
const startTime = await intro8("buddy domains:remove");
|
|
883
1000
|
if (!opts.yes) {
|
|
@@ -888,28 +1005,28 @@ function domains(buddy) {
|
|
|
888
1005
|
});
|
|
889
1006
|
if (!confirm) {
|
|
890
1007
|
await outro8("Cancelled the domains:remove command", { startTime, useSeconds: true, type: "info" });
|
|
891
|
-
|
|
1008
|
+
process11.exit(ExitCode9.Success);
|
|
892
1009
|
}
|
|
893
1010
|
}
|
|
894
1011
|
const result = await runAction7(Action7.DomainsRemove, opts);
|
|
895
1012
|
if (result.isErr()) {
|
|
896
1013
|
await outro8("While running the domains:remove command, there was an issue", { startTime, useSeconds: true }, result.error);
|
|
897
|
-
|
|
1014
|
+
process11.exit(ExitCode9.FatalError);
|
|
898
1015
|
}
|
|
899
1016
|
await outro8("Removed your domain DNS records.", { startTime, useSeconds: true });
|
|
900
|
-
|
|
1017
|
+
process11.exit(ExitCode9.Success);
|
|
901
1018
|
});
|
|
902
1019
|
buddy.on("domains:*", () => {
|
|
903
1020
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
904
|
-
|
|
1021
|
+
process11.exit(1);
|
|
905
1022
|
});
|
|
906
1023
|
}
|
|
907
1024
|
|
|
908
1025
|
// src/commands/dns.ts
|
|
909
|
-
import
|
|
1026
|
+
import process12 from "process";
|
|
910
1027
|
import {ExitCode as ExitCode10} from "@stacksjs/types";
|
|
911
|
-
import {config as
|
|
912
|
-
import {runCommand as runCommand6} from "@stacksjs/cli";
|
|
1028
|
+
import {config as config6} from "@stacksjs/config";
|
|
1029
|
+
import {log as log11, runCommand as runCommand6} from "@stacksjs/cli";
|
|
913
1030
|
function dns3(buddy) {
|
|
914
1031
|
const descriptions = {
|
|
915
1032
|
dns: "Lists the DNS records for a domain",
|
|
@@ -928,39 +1045,14 @@ function dns3(buddy) {
|
|
|
928
1045
|
verbose: "Enable verbose output"
|
|
929
1046
|
};
|
|
930
1047
|
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) => {
|
|
1048
|
+
log11.debug("Running `buddy dns [domain]` ...", options);
|
|
931
1049
|
delete options.pretty;
|
|
932
1050
|
delete options.p;
|
|
933
1051
|
const optionsString = Object.entries(options).filter(([key, value]) => key !== "--" && key.length > 1 && value !== false).map(([key, value]) => `--${key} ${value}`).join(" ");
|
|
934
|
-
await runCommand6(`dog ${domain ||
|
|
935
|
-
|
|
936
|
-
});
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
// src/commands/example.ts
|
|
940
|
-
import process12 from "process";
|
|
941
|
-
import {ExitCode as ExitCode11} from "@stacksjs/types";
|
|
942
|
-
import {runExample} from "@stacksjs/actions";
|
|
943
|
-
function example(buddy) {
|
|
944
|
-
const descriptions = {
|
|
945
|
-
example: "Which example do you want to see?",
|
|
946
|
-
components: "Test your libraries against your built bundle",
|
|
947
|
-
vue: "Test your Vue component library",
|
|
948
|
-
webComponents: "Test your web component library",
|
|
949
|
-
select: "Which example are you trying to view?",
|
|
950
|
-
project: "Target a specific project",
|
|
951
|
-
verbose: "Enable verbose output"
|
|
952
|
-
};
|
|
953
|
-
buddy.command("example", descriptions.example).option("-c, --components", descriptions.components).option("-v, --vue", descriptions.vue).option("-w, --web-components", descriptions.webComponents).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
954
|
-
await runExample(options);
|
|
955
|
-
process12.exit(ExitCode11.Success);
|
|
956
|
-
});
|
|
957
|
-
buddy.command("example:vue", descriptions.vue).option("-v, --vue", descriptions.verbose, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).alias("example:components").action(async (options) => {
|
|
958
|
-
await runExample(options);
|
|
959
|
-
});
|
|
960
|
-
buddy.command("example:web-components", "Test your Web Component library.").option("-w, --web-components", descriptions.verbose, { default: true }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
961
|
-
await runExample(options);
|
|
1052
|
+
await runCommand6(`dog ${domain || config6.app.url} ${optionsString}`);
|
|
1053
|
+
process12.exit(ExitCode10.Success);
|
|
962
1054
|
});
|
|
963
|
-
buddy.on("
|
|
1055
|
+
buddy.on("dns:*", () => {
|
|
964
1056
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
965
1057
|
process12.exit(1);
|
|
966
1058
|
});
|
|
@@ -968,25 +1060,26 @@ function example(buddy) {
|
|
|
968
1060
|
|
|
969
1061
|
// src/commands/fresh.ts
|
|
970
1062
|
import process13 from "process";
|
|
971
|
-
import {ExitCode as
|
|
1063
|
+
import {ExitCode as ExitCode11} from "@stacksjs/types";
|
|
972
1064
|
import {runAction as runAction8} from "@stacksjs/actions";
|
|
973
|
-
import {intro as intro9, outro as outro9} from "@stacksjs/cli";
|
|
1065
|
+
import {intro as intro9, log as log12, outro as outro9} from "@stacksjs/cli";
|
|
974
1066
|
import {Action as Action8} from "@stacksjs/enums";
|
|
975
1067
|
function fresh(buddy) {
|
|
976
1068
|
const descriptions = {
|
|
977
|
-
fresh: "
|
|
1069
|
+
fresh: "Re-installs your npm dependencies",
|
|
978
1070
|
project: "Target a specific project",
|
|
979
1071
|
verbose: "Enable verbose output"
|
|
980
1072
|
};
|
|
981
1073
|
buddy.command("fresh", descriptions.fresh).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1074
|
+
log12.debug("Running `buddy fresh` ...", options);
|
|
982
1075
|
const perf = await intro9("buddy fresh");
|
|
983
1076
|
const result = await runAction8(Action8.Fresh, { ...options, stdout: "inherit" });
|
|
984
1077
|
if (result.isErr()) {
|
|
985
1078
|
await outro9("While running `buddy fresh`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
986
|
-
process13.exit(
|
|
1079
|
+
process13.exit(ExitCode11.FatalError);
|
|
987
1080
|
}
|
|
988
1081
|
await outro9("Freshly reinstalled your dependencies", { startTime: perf, useSeconds: true });
|
|
989
|
-
process13.exit(
|
|
1082
|
+
process13.exit(ExitCode11.Success);
|
|
990
1083
|
});
|
|
991
1084
|
buddy.on("fresh:*", () => {
|
|
992
1085
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
@@ -1007,9 +1100,8 @@ generateVsCodeCustomData,
|
|
|
1007
1100
|
generateWebTypes,
|
|
1008
1101
|
invoke as startGenerationProcess
|
|
1009
1102
|
} from "@stacksjs/actions";
|
|
1010
|
-
import {
|
|
1011
|
-
import {ExitCode as
|
|
1012
|
-
import {isString as isString2} from "@stacksjs/validation";
|
|
1103
|
+
import {log as log13} from "@stacksjs/cli";
|
|
1104
|
+
import {ExitCode as ExitCode12} from "@stacksjs/types";
|
|
1013
1105
|
function generate(buddy) {
|
|
1014
1106
|
const descriptions = {
|
|
1015
1107
|
command: "Automagically build any of your libraries/packages for production use. Select any of the following packages",
|
|
@@ -1025,46 +1117,40 @@ function generate(buddy) {
|
|
|
1025
1117
|
verbose: "Enable verbose output"
|
|
1026
1118
|
};
|
|
1027
1119
|
buddy.command("generate", descriptions.command).option("-t, --types", descriptions.types).option("-e, --entries", descriptions.entries).option("-w, --web-types", descriptions.webTypes).option("-c, --custom-data", descriptions.customData).option("-i, --ide-helpers", descriptions.ideHelpers).option("-c, --component-meta", descriptions.componentMeta).option("-p, --pkgx", descriptions.pkgx).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1028
|
-
|
|
1029
|
-
let answers = await prompt3.require().multiselect(descriptions.select, {
|
|
1030
|
-
options: [
|
|
1031
|
-
{ label: "1.) TypeScript Types", value: "types" },
|
|
1032
|
-
{ label: "2.) Library Entry Points", value: "entries" },
|
|
1033
|
-
{ label: "3.) Web Types", value: "web-types" },
|
|
1034
|
-
{ label: "4.) VS Code Custom Data", value: "custom-data" },
|
|
1035
|
-
{ label: "5.) IDE Helpers", value: "ide-helpers" },
|
|
1036
|
-
{ label: "6.) Component Meta", value: "component-meta" }
|
|
1037
|
-
]
|
|
1038
|
-
});
|
|
1039
|
-
if (isString2(answers))
|
|
1040
|
-
answers = [answers];
|
|
1041
|
-
options = answers.reduce((a, v) => ({ ...a, [v]: true }), {});
|
|
1042
|
-
}
|
|
1120
|
+
log13.debug("Running `buddy generate` ...", options);
|
|
1043
1121
|
await startGenerationProcess(options);
|
|
1044
|
-
process14.exit(
|
|
1122
|
+
process14.exit(ExitCode12.Success);
|
|
1045
1123
|
});
|
|
1046
1124
|
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) => {
|
|
1125
|
+
log13.debug("Running `buddy generate:types` ...", options);
|
|
1047
1126
|
await generateTypes(options);
|
|
1048
1127
|
});
|
|
1049
1128
|
buddy.command("generate:entries", descriptions.entries).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1129
|
+
log13.debug("Running `buddy generate:entries` ...", options);
|
|
1050
1130
|
await generateLibEntries(options);
|
|
1051
1131
|
});
|
|
1052
1132
|
buddy.command("generate:web-types", descriptions.webTypes).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1133
|
+
log13.debug("Running `buddy generate:web-types` ...", options);
|
|
1053
1134
|
await generateWebTypes(options);
|
|
1054
1135
|
});
|
|
1055
1136
|
buddy.command("generate:vscode-custom-data", descriptions.customData).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1137
|
+
log13.debug("Running `buddy generate:vscode-custom-data` ...", options);
|
|
1056
1138
|
await generateVsCodeCustomData(options);
|
|
1057
1139
|
});
|
|
1058
1140
|
buddy.command("generate:ide-helpers", descriptions.ideHelpers).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1141
|
+
log13.debug("Running `buddy generate:ide-helpers` ...", options);
|
|
1059
1142
|
await generateIdeHelpers(options);
|
|
1060
1143
|
});
|
|
1061
1144
|
buddy.command("generate:component-meta", descriptions.componentMeta).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1145
|
+
log13.debug("Running `buddy generate:component-meta` ...", options);
|
|
1062
1146
|
await generateComponentMeta(options);
|
|
1063
1147
|
});
|
|
1064
|
-
buddy.command("generate:pkgx-config", descriptions.pkgx).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(() => {
|
|
1148
|
+
buddy.command("generate:pkgx-config", descriptions.pkgx).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action((options) => {
|
|
1149
|
+
log13.debug("Running `buddy generate:pkgx-config` ...", options);
|
|
1065
1150
|
generatePkgxConfig();
|
|
1066
1151
|
});
|
|
1067
|
-
buddy.command("generate:migrations", "Generate Migrations").action(() => {
|
|
1152
|
+
buddy.command("generate:migrations", "Generate Migrations").action((options) => {
|
|
1153
|
+
log13.debug("Running `buddy generate:migrations` ...", options);
|
|
1068
1154
|
generateMigrations();
|
|
1069
1155
|
});
|
|
1070
1156
|
buddy.on("generate:*", () => {
|
|
@@ -1072,15 +1158,12 @@ function generate(buddy) {
|
|
|
1072
1158
|
process14.exit(1);
|
|
1073
1159
|
});
|
|
1074
1160
|
}
|
|
1075
|
-
var hasNoOptions2 = function(options) {
|
|
1076
|
-
return !options.types && !options.entries && !options.webTypes && !options.customData && !options.ideHelpers && !options.componentMeta;
|
|
1077
|
-
};
|
|
1078
1161
|
|
|
1079
1162
|
// src/commands/http.ts
|
|
1080
1163
|
import process15 from "process";
|
|
1081
|
-
import {ExitCode as
|
|
1082
|
-
import {config as
|
|
1083
|
-
import {runCommandSync as runCommandSync2} from "@stacksjs/cli";
|
|
1164
|
+
import {ExitCode as ExitCode13} from "@stacksjs/types";
|
|
1165
|
+
import {config as config8} from "@stacksjs/config";
|
|
1166
|
+
import {log as log14, runCommandSync as runCommandSync2} from "@stacksjs/cli";
|
|
1084
1167
|
function http(buddy) {
|
|
1085
1168
|
const descriptions = {
|
|
1086
1169
|
http: "Send an HTTP request to a domain",
|
|
@@ -1088,17 +1171,18 @@ function http(buddy) {
|
|
|
1088
1171
|
verbose: "Enable verbose output"
|
|
1089
1172
|
};
|
|
1090
1173
|
buddy.command("http [domain]", descriptions.http).option("-p, --project", descriptions.project, { default: false }).action(async (domain, options) => {
|
|
1174
|
+
log14.debug("Running `buddy http [domain]` ...", options);
|
|
1091
1175
|
const optionsString = Object.entries(options).filter(([key, value]) => key !== "--" && key.length > 1 && value !== false).map(([key, value]) => `--${key} ${value}`).join(" ");
|
|
1092
|
-
const command = `http GET ${domain ||
|
|
1093
|
-
|
|
1094
|
-
runCommandSync2(command);
|
|
1095
|
-
process15.exit(
|
|
1176
|
+
const command = `http GET ${domain || config8.app.url} ${optionsString}`;
|
|
1177
|
+
log14.info(`Running command: ${command}`);
|
|
1178
|
+
await runCommandSync2(command);
|
|
1179
|
+
process15.exit(ExitCode13.Success);
|
|
1096
1180
|
});
|
|
1097
1181
|
}
|
|
1098
1182
|
|
|
1099
1183
|
// src/commands/lint.ts
|
|
1100
1184
|
import process16 from "process";
|
|
1101
|
-
import {intro as intro10, log as
|
|
1185
|
+
import {intro as intro10, log as log15, outro as outro10} from "@stacksjs/cli";
|
|
1102
1186
|
import {Action as Action9} from "@stacksjs/enums";
|
|
1103
1187
|
import {runAction as runAction9} from "@stacksjs/actions";
|
|
1104
1188
|
function lint(buddy) {
|
|
@@ -1109,6 +1193,7 @@ function lint(buddy) {
|
|
|
1109
1193
|
verbose: "Enable verbose output"
|
|
1110
1194
|
};
|
|
1111
1195
|
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) => {
|
|
1196
|
+
log15.debug("Running `buddy lint` ...", options);
|
|
1112
1197
|
const startTime = await intro10("buddy lint");
|
|
1113
1198
|
const result = await runAction9(Action9.Lint, options);
|
|
1114
1199
|
if (result.isErr()) {
|
|
@@ -1118,13 +1203,14 @@ function lint(buddy) {
|
|
|
1118
1203
|
await outro10("Linted your project", { startTime, useSeconds: true });
|
|
1119
1204
|
});
|
|
1120
1205
|
buddy.command("lint:fix", descriptions.lintFix).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1121
|
-
|
|
1206
|
+
log15.debug("Running `buddy lint:fix` ...", options);
|
|
1207
|
+
log15.info("Fixing lint errors...");
|
|
1122
1208
|
const result = await runAction9(Action9.LintFix, { ...options });
|
|
1123
1209
|
if (result.isErr()) {
|
|
1124
|
-
|
|
1210
|
+
log15.error("There was an error lint fixing your code.", result.error);
|
|
1125
1211
|
process16.exit();
|
|
1126
1212
|
}
|
|
1127
|
-
|
|
1213
|
+
log15.success("Fixed lint errors");
|
|
1128
1214
|
});
|
|
1129
1215
|
buddy.on("lint:*", () => {
|
|
1130
1216
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
@@ -1142,7 +1228,8 @@ function list(buddy) {
|
|
|
1142
1228
|
project: "Target a specific project",
|
|
1143
1229
|
verbose: "Enable verbose output"
|
|
1144
1230
|
};
|
|
1145
|
-
buddy.command("list", descriptions.list).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async () => {
|
|
1231
|
+
buddy.command("list", descriptions.list).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1232
|
+
log5.debug("Running `buddy list` ...", options);
|
|
1146
1233
|
$.cwd(projectPath());
|
|
1147
1234
|
const test = await $`buddy --help`.text();
|
|
1148
1235
|
const commandsSection = test.match(/Commands:.*?(?=For more info, run any command with the)/s)?.[0];
|
|
@@ -1159,28 +1246,9 @@ function list(buddy) {
|
|
|
1159
1246
|
});
|
|
1160
1247
|
}
|
|
1161
1248
|
|
|
1162
|
-
// src/commands/inspire.ts
|
|
1163
|
-
import process18 from "process";
|
|
1164
|
-
import {ExitCode as ExitCode15} from "@stacksjs/types";
|
|
1165
|
-
import {runAction as runAction10} from "@stacksjs/actions";
|
|
1166
|
-
import {intro as intro11, outro as outro11} from "@stacksjs/cli";
|
|
1167
|
-
import {Action as Action10} from "@stacksjs/enums";
|
|
1168
|
-
function inspire(buddy) {
|
|
1169
|
-
buddy.command("inspire", "Inspire yourself with a random quote").option("--two", "Show two quotes", { default: false }).action(async () => {
|
|
1170
|
-
const perf = await intro11("buddy inspire");
|
|
1171
|
-
const result = await runAction10(Action10.Inspire);
|
|
1172
|
-
if (result.isErr()) {
|
|
1173
|
-
await outro11("While running the inspire command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1174
|
-
process18.exit();
|
|
1175
|
-
}
|
|
1176
|
-
await outro11("Your quote is: ...", { startTime: perf, useSeconds: true });
|
|
1177
|
-
process18.exit(ExitCode15.Success);
|
|
1178
|
-
});
|
|
1179
|
-
}
|
|
1180
|
-
|
|
1181
1249
|
// src/commands/install.ts
|
|
1182
|
-
import
|
|
1183
|
-
import {runCommand as runCommand7} from "@stacksjs/cli";
|
|
1250
|
+
import process18 from "process";
|
|
1251
|
+
import {log as log16, runCommand as runCommand7} from "@stacksjs/cli";
|
|
1184
1252
|
import {path as p3} from "@stacksjs/path";
|
|
1185
1253
|
function install2(buddy) {
|
|
1186
1254
|
const descriptions = {
|
|
@@ -1189,6 +1257,7 @@ function install2(buddy) {
|
|
|
1189
1257
|
verbose: "Enable verbose output"
|
|
1190
1258
|
};
|
|
1191
1259
|
buddy.command("install", descriptions.install).option("-p, --project", descriptions.project, { default: false }).option("-v, --verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1260
|
+
log16.debug("Running `buddy install` ...", options);
|
|
1192
1261
|
await runCommand7("bun install", {
|
|
1193
1262
|
...options,
|
|
1194
1263
|
cwd: p3.projectPath()
|
|
@@ -1196,15 +1265,15 @@ function install2(buddy) {
|
|
|
1196
1265
|
});
|
|
1197
1266
|
buddy.on("install:*", () => {
|
|
1198
1267
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
1199
|
-
|
|
1268
|
+
process18.exit(1);
|
|
1200
1269
|
});
|
|
1201
1270
|
}
|
|
1202
1271
|
|
|
1203
1272
|
// src/commands/key.ts
|
|
1204
|
-
import
|
|
1205
|
-
import {intro as
|
|
1206
|
-
import {Action as
|
|
1207
|
-
import {runAction as
|
|
1273
|
+
import process19 from "process";
|
|
1274
|
+
import {intro as intro11, log as log17, outro as outro11} from "@stacksjs/cli";
|
|
1275
|
+
import {Action as Action10} from "@stacksjs/enums";
|
|
1276
|
+
import {runAction as runAction10} from "@stacksjs/actions";
|
|
1208
1277
|
function key(buddy) {
|
|
1209
1278
|
const descriptions = {
|
|
1210
1279
|
command: "Generate & set the application key.",
|
|
@@ -1212,22 +1281,23 @@ function key(buddy) {
|
|
|
1212
1281
|
verbose: "Enable verbose output"
|
|
1213
1282
|
};
|
|
1214
1283
|
buddy.command("key:generate", descriptions.command).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1215
|
-
|
|
1216
|
-
|
|
1284
|
+
log17.debug("Running `buddy key:generate` ...", options);
|
|
1285
|
+
await intro11("buddy key:generate");
|
|
1286
|
+
const result = await runAction10(Action10.KeyGenerate, options);
|
|
1217
1287
|
if (result.isErr()) {
|
|
1218
|
-
|
|
1219
|
-
|
|
1288
|
+
log17.error("Failed to set random application key.", result.error);
|
|
1289
|
+
process19.exit();
|
|
1220
1290
|
}
|
|
1221
|
-
await
|
|
1291
|
+
await outro11("Random application key set.");
|
|
1222
1292
|
});
|
|
1223
1293
|
buddy.on("key:*", () => {
|
|
1224
1294
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
1225
|
-
|
|
1295
|
+
process19.exit(1);
|
|
1226
1296
|
});
|
|
1227
1297
|
}
|
|
1228
1298
|
|
|
1229
1299
|
// src/commands/make.ts
|
|
1230
|
-
import
|
|
1300
|
+
import process20 from "process";
|
|
1231
1301
|
import {
|
|
1232
1302
|
createModel,
|
|
1233
1303
|
createNotification,
|
|
@@ -1239,10 +1309,9 @@ makeLanguage,
|
|
|
1239
1309
|
makePage,
|
|
1240
1310
|
makeStack
|
|
1241
1311
|
} from "@stacksjs/actions";
|
|
1242
|
-
import {intro as
|
|
1243
|
-
import {log as
|
|
1244
|
-
import {ExitCode as
|
|
1245
|
-
import {isString as isString3} from "@stacksjs/validation";
|
|
1312
|
+
import {intro as intro12, italic as italic4, outro as outro12} from "@stacksjs/cli";
|
|
1313
|
+
import {log as log18} from "@stacksjs/logging";
|
|
1314
|
+
import {ExitCode as ExitCode14} from "@stacksjs/types";
|
|
1246
1315
|
function make(buddy) {
|
|
1247
1316
|
const descriptions = {
|
|
1248
1317
|
model: "Create a new model",
|
|
@@ -1260,139 +1329,127 @@ function make(buddy) {
|
|
|
1260
1329
|
verbose: "Enable verbose output"
|
|
1261
1330
|
};
|
|
1262
1331
|
buddy.command("make", "The make command").option("-c, --component", descriptions.component, { default: false }).option("-p, --page", descriptions.page, { default: false }).option("-f, --function", descriptions.function, { default: false }).option("-l, --language", descriptions.language, { default: false }).option("-d, --database", descriptions.database, { default: false }).option("-m, --migration", descriptions.migration, { default: false }).option("-f, --factory", descriptions.factory, { default: false }).option("-n, --notification", descriptions.notification, { default: false }).option("-s, --stack", descriptions.stack, { default: false }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1332
|
+
log18.debug("Running `buddy make` ...", options);
|
|
1263
1333
|
const name = buddy.args[0];
|
|
1264
1334
|
if (!name) {
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
}
|
|
1268
|
-
if (hasNoOptions3(options)) {
|
|
1269
|
-
let answers = await prompt4.require().multiselect(descriptions.select, {
|
|
1270
|
-
options: [
|
|
1271
|
-
{ label: "Page", value: "page" },
|
|
1272
|
-
{ label: "Function", value: "function" },
|
|
1273
|
-
{ label: "Component", value: "component" },
|
|
1274
|
-
{ label: "Notification", value: "notification" },
|
|
1275
|
-
{ label: "Language", value: "language" },
|
|
1276
|
-
{ label: "Database", value: "database" },
|
|
1277
|
-
{ label: "Migration", value: "migration" },
|
|
1278
|
-
{ label: "Factory", value: "factory" },
|
|
1279
|
-
{ label: "Stack", value: "stack" }
|
|
1280
|
-
]
|
|
1281
|
-
});
|
|
1282
|
-
if (answers !== null)
|
|
1283
|
-
process21.exit(ExitCode16.InvalidArgument);
|
|
1284
|
-
if (isString3(answers))
|
|
1285
|
-
answers = [answers];
|
|
1286
|
-
options = answers.reduce((a, v) => ({ ...a, [v]: true }), {});
|
|
1335
|
+
log18.error("You need to specify a name. Read more about the documentation here.");
|
|
1336
|
+
process20.exit();
|
|
1287
1337
|
}
|
|
1288
1338
|
await invoke(options);
|
|
1289
|
-
|
|
1339
|
+
process20.exit(ExitCode14.Success);
|
|
1290
1340
|
});
|
|
1291
1341
|
buddy.command("make:component", descriptions.component).option("-n, --name", "The name of the component").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1342
|
+
log18.debug("Running `buddy make:component` ...", options);
|
|
1292
1343
|
const name = buddy.args[0] || options.name;
|
|
1293
1344
|
options.name = name;
|
|
1294
1345
|
if (!name) {
|
|
1295
|
-
|
|
1296
|
-
|
|
1346
|
+
log18.error("You need to specify a name. Read more about the documentation here.");
|
|
1347
|
+
process20.exit();
|
|
1297
1348
|
}
|
|
1298
1349
|
await makeComponent(options);
|
|
1299
1350
|
});
|
|
1300
1351
|
buddy.command("make:database", descriptions.database).option("-n, --name", "The name of the database").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action((options) => {
|
|
1352
|
+
log18.debug("Running `buddy make:database` ...", options);
|
|
1301
1353
|
const name = buddy.args[0] || options.name;
|
|
1302
1354
|
options.name = name;
|
|
1303
1355
|
if (!name) {
|
|
1304
|
-
|
|
1305
|
-
|
|
1356
|
+
log18.error("You need to specify a name. Read more about the documentation here.");
|
|
1357
|
+
process20.exit();
|
|
1306
1358
|
}
|
|
1307
1359
|
makeDatabase(options);
|
|
1308
1360
|
});
|
|
1309
1361
|
buddy.command("make:factory", descriptions.factory).option("-n, --name", "The name of the factory").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action((options) => {
|
|
1362
|
+
log18.debug("Running `buddy make:factory` ...", options);
|
|
1310
1363
|
const name = buddy.args[0] || options.name;
|
|
1311
1364
|
options.name = name;
|
|
1312
1365
|
if (!name) {
|
|
1313
|
-
|
|
1314
|
-
|
|
1366
|
+
log18.error("You need to specify a name. Read more about the documentation here.");
|
|
1367
|
+
process20.exit();
|
|
1315
1368
|
}
|
|
1316
1369
|
});
|
|
1317
1370
|
buddy.command("make:view", descriptions.page).alias("make:page").option("-n, --name", "The name of the page").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1371
|
+
log18.debug("Running `buddy make:view` ...", options);
|
|
1318
1372
|
const name = buddy.args[0] || options.name;
|
|
1319
1373
|
options.name = name;
|
|
1320
1374
|
if (!name) {
|
|
1321
|
-
|
|
1322
|
-
|
|
1375
|
+
log18.error("You need to specify a name. Read more about the documentation here.");
|
|
1376
|
+
process20.exit();
|
|
1323
1377
|
}
|
|
1324
1378
|
await makePage(options);
|
|
1325
1379
|
});
|
|
1326
1380
|
buddy.command("make:function", descriptions.function).option("-n, --name", "The name of the function").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1381
|
+
log18.debug("Running `buddy make:function` ...", options);
|
|
1327
1382
|
await makeFunction(options);
|
|
1328
1383
|
});
|
|
1329
1384
|
buddy.command("make:lang", descriptions.language).option("-n, --name", "The name of the language").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1385
|
+
log18.debug("Running `buddy make:lang` ...", options);
|
|
1330
1386
|
const name = buddy.args[0] || options.name;
|
|
1331
1387
|
options.name = name;
|
|
1332
1388
|
if (!name) {
|
|
1333
|
-
|
|
1334
|
-
|
|
1389
|
+
log18.error("You need to specify a name. Read more about the documentation here.");
|
|
1390
|
+
process20.exit();
|
|
1335
1391
|
}
|
|
1336
1392
|
await makeLanguage(options);
|
|
1337
1393
|
});
|
|
1338
1394
|
buddy.command("make:notification", descriptions.notification).option("-n, --name", "The name of the notification").option("-e, --email", "Is it an email notification?", { default: true }).option("-c, --chat", "Is it a chat notification?", { default: false }).option("-s, --sms", "Is it a SMS notification?", { default: false }).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1339
|
-
|
|
1395
|
+
log18.debug("Running `buddy make:notification` ...", options);
|
|
1396
|
+
const perf = await intro12("buddy make:notification");
|
|
1340
1397
|
const name = buddy.args[0] || options.name;
|
|
1341
1398
|
options.name = name;
|
|
1342
1399
|
if (!name) {
|
|
1343
|
-
|
|
1344
|
-
|
|
1400
|
+
log18.error("You need to specify a name. Read more about the documentation here.");
|
|
1401
|
+
process20.exit();
|
|
1345
1402
|
}
|
|
1346
1403
|
const result = await createNotification(options);
|
|
1347
1404
|
if (!result) {
|
|
1348
|
-
await
|
|
1349
|
-
|
|
1405
|
+
await outro12("While running the make:notification command, there was an issue", { startTime: perf, useSeconds: true });
|
|
1406
|
+
process20.exit();
|
|
1350
1407
|
}
|
|
1351
|
-
await
|
|
1352
|
-
|
|
1408
|
+
await outro12(`Created your ${italic4(name)} notification.`, { startTime: perf, useSeconds: true });
|
|
1409
|
+
process20.exit(ExitCode14.Success);
|
|
1353
1410
|
});
|
|
1354
1411
|
buddy.command("make:stack", descriptions.stack).option("-n, --name", "The name of the stack").option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action((options) => {
|
|
1412
|
+
log18.debug("Running `buddy make:stack` ...", options);
|
|
1355
1413
|
const name = buddy.args[0] || options.name;
|
|
1356
1414
|
options.name = name;
|
|
1357
1415
|
if (!name) {
|
|
1358
|
-
|
|
1359
|
-
|
|
1416
|
+
log18.error("You need to specify a name. Read more about the documentation here.");
|
|
1417
|
+
process20.exit();
|
|
1360
1418
|
}
|
|
1361
1419
|
makeStack(options);
|
|
1362
1420
|
});
|
|
1363
1421
|
buddy.command("make:model", descriptions.model).option("-n, --name", "The name of the model").action(async (options) => {
|
|
1422
|
+
log18.debug("Running `buddy make:model` ...", options);
|
|
1364
1423
|
const name = buddy.args[0] || options.name;
|
|
1365
1424
|
options.name = name;
|
|
1366
1425
|
if (!name) {
|
|
1367
|
-
|
|
1368
|
-
|
|
1426
|
+
log18.error("You need to specify a model name");
|
|
1427
|
+
process20.exit();
|
|
1369
1428
|
}
|
|
1370
1429
|
await createModel(options);
|
|
1371
1430
|
});
|
|
1372
1431
|
buddy.command("make:migration", descriptions.migration).option("-n, --name", "The name of the migration").option("-e, --env", "The environment to run the migration in", { default: "dev" }).action((options) => {
|
|
1432
|
+
log18.debug("Running `buddy make:migration` ...", options);
|
|
1373
1433
|
const name = buddy.args[0] || options.name;
|
|
1374
1434
|
options.name = name;
|
|
1375
1435
|
if (!name) {
|
|
1376
|
-
|
|
1377
|
-
|
|
1436
|
+
log18.error("You need to specify a migration name");
|
|
1437
|
+
process20.exit();
|
|
1378
1438
|
}
|
|
1379
|
-
|
|
1439
|
+
log18.info(path, name);
|
|
1380
1440
|
});
|
|
1381
1441
|
buddy.on("make:*", () => {
|
|
1382
1442
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
1383
|
-
|
|
1443
|
+
process20.exit(1);
|
|
1384
1444
|
});
|
|
1385
1445
|
}
|
|
1386
|
-
var hasNoOptions3 = function(options) {
|
|
1387
|
-
return !options.component && !options.page && !options.function && !options.language && !options.database && !options.migration && !options.notification && !options.stack;
|
|
1388
|
-
};
|
|
1389
1446
|
|
|
1390
1447
|
// src/commands/migrate.ts
|
|
1391
|
-
import
|
|
1392
|
-
import {ExitCode as
|
|
1393
|
-
import {runAction as
|
|
1394
|
-
import {intro as
|
|
1395
|
-
import {Action as
|
|
1448
|
+
import process21 from "process";
|
|
1449
|
+
import {ExitCode as ExitCode15} from "@stacksjs/types";
|
|
1450
|
+
import {runAction as runAction11} from "@stacksjs/actions";
|
|
1451
|
+
import {intro as intro13, log as log19, outro as outro13} from "@stacksjs/cli";
|
|
1452
|
+
import {Action as Action11} from "@stacksjs/enums";
|
|
1396
1453
|
function migrate(buddy) {
|
|
1397
1454
|
const descriptions = {
|
|
1398
1455
|
migrate: "Migrates your database",
|
|
@@ -1401,37 +1458,39 @@ function migrate(buddy) {
|
|
|
1401
1458
|
verbose: "Enable verbose output"
|
|
1402
1459
|
};
|
|
1403
1460
|
buddy.command("migrate", descriptions.migrate).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1404
|
-
|
|
1405
|
-
const
|
|
1461
|
+
log19.debug("Running `buddy migrate` ...", options);
|
|
1462
|
+
const perf = await intro13("buddy migrate");
|
|
1463
|
+
const result = await runAction11(Action11.Migrate, { ...options });
|
|
1406
1464
|
if (result.isErr()) {
|
|
1407
|
-
await
|
|
1408
|
-
|
|
1465
|
+
await outro13("While running the migrate command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1466
|
+
process21.exit();
|
|
1409
1467
|
}
|
|
1410
|
-
const APP_ENV =
|
|
1411
|
-
await
|
|
1412
|
-
|
|
1468
|
+
const APP_ENV = process21.env.APP_ENV || "local";
|
|
1469
|
+
await outro13(`Migrated your ${APP_ENV} database.`, { startTime: perf, useSeconds: true });
|
|
1470
|
+
process21.exit(ExitCode15.Success);
|
|
1413
1471
|
});
|
|
1414
1472
|
buddy.command("migrate:dns", descriptions.migrate).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1415
|
-
|
|
1416
|
-
const
|
|
1473
|
+
log19.debug("Running `buddy migrate:dns` ...", options);
|
|
1474
|
+
const perf = await intro13("buddy migrate:dns");
|
|
1475
|
+
const result = await runAction11(Action11.MigrateDns, { ...options });
|
|
1417
1476
|
if (result.isErr()) {
|
|
1418
|
-
await
|
|
1419
|
-
|
|
1477
|
+
await outro13("While running the migrate:dns command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1478
|
+
process21.exit();
|
|
1420
1479
|
}
|
|
1421
|
-
const APP_URL =
|
|
1422
|
-
await
|
|
1423
|
-
|
|
1480
|
+
const APP_URL = process21.env.APP_URL || "undefined";
|
|
1481
|
+
await outro13(`Migrated your ${APP_URL} DNS.`, { startTime: perf, useSeconds: true });
|
|
1482
|
+
process21.exit(ExitCode15.Success);
|
|
1424
1483
|
});
|
|
1425
1484
|
buddy.on("migrate:*", () => {
|
|
1426
1485
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
1427
|
-
|
|
1486
|
+
process21.exit(1);
|
|
1428
1487
|
});
|
|
1429
1488
|
}
|
|
1430
1489
|
|
|
1431
1490
|
// src/commands/prepublish.ts
|
|
1432
|
-
import
|
|
1433
|
-
import {Action as
|
|
1434
|
-
import {runAction as
|
|
1491
|
+
import process22 from "process";
|
|
1492
|
+
import {Action as Action12} from "@stacksjs/enums";
|
|
1493
|
+
import {runAction as runAction12} from "@stacksjs/actions";
|
|
1435
1494
|
function prepublish(buddy) {
|
|
1436
1495
|
const descriptions = {
|
|
1437
1496
|
command: "Run your prepublish script",
|
|
@@ -1439,47 +1498,55 @@ function prepublish(buddy) {
|
|
|
1439
1498
|
verbose: "Enable verbose output"
|
|
1440
1499
|
};
|
|
1441
1500
|
buddy.command("prepublish", descriptions.command).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1442
|
-
|
|
1501
|
+
log5.debug("Running `buddy prepublish` ...", options);
|
|
1502
|
+
await runAction12(Action12.Prepublish, options);
|
|
1443
1503
|
});
|
|
1444
1504
|
buddy.on("prepublish:*", () => {
|
|
1445
1505
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
1446
|
-
|
|
1506
|
+
process22.exit(1);
|
|
1447
1507
|
});
|
|
1448
1508
|
}
|
|
1449
1509
|
|
|
1450
1510
|
// src/commands/release.ts
|
|
1451
|
-
import
|
|
1452
|
-
import {Action as
|
|
1453
|
-
import {ExitCode as
|
|
1454
|
-
import {intro as
|
|
1455
|
-
import {runAction as
|
|
1511
|
+
import process23 from "process";
|
|
1512
|
+
import {Action as Action13} from "@stacksjs/enums";
|
|
1513
|
+
import {ExitCode as ExitCode16} from "@stacksjs/types";
|
|
1514
|
+
import {intro as intro14, log as log20, outro as outro14} from "@stacksjs/cli";
|
|
1515
|
+
import {runAction as runAction13} from "@stacksjs/actions";
|
|
1456
1516
|
function release(buddy) {
|
|
1457
|
-
buddy.command("release", descriptions.release).option("-p, --project", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1458
|
-
|
|
1459
|
-
|
|
1517
|
+
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) => {
|
|
1518
|
+
log20.debug("Running `buddy release` ...", options);
|
|
1519
|
+
if (options.dryRun)
|
|
1520
|
+
log20.warn("Dry run enabled. No changes will be made or committed.");
|
|
1521
|
+
const startTime = await intro14("buddy release");
|
|
1522
|
+
const result = await runAction13(Action13.Release, {
|
|
1523
|
+
stdin: "inherit",
|
|
1524
|
+
...options
|
|
1525
|
+
});
|
|
1460
1526
|
if (result.isErr()) {
|
|
1461
|
-
|
|
1462
|
-
|
|
1527
|
+
log20.error("Failed to release", result.error);
|
|
1528
|
+
process23.exit(ExitCode16.FatalError);
|
|
1463
1529
|
}
|
|
1464
|
-
await
|
|
1530
|
+
await outro14("Triggered CI/CD Release Workflow", { startTime, useSeconds: true });
|
|
1465
1531
|
});
|
|
1466
1532
|
buddy.on("release:*", () => {
|
|
1467
1533
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
1468
|
-
|
|
1534
|
+
process23.exit(1);
|
|
1469
1535
|
});
|
|
1470
1536
|
}
|
|
1471
1537
|
var descriptions = {
|
|
1472
1538
|
release: "Release a new version of your libraries/packages",
|
|
1473
1539
|
project: "Target a specific project",
|
|
1540
|
+
dryRun: "Run the release without actually releasing",
|
|
1474
1541
|
verbose: "Enable verbose output"
|
|
1475
1542
|
};
|
|
1476
1543
|
|
|
1477
1544
|
// src/commands/seed.ts
|
|
1478
|
-
import
|
|
1479
|
-
import {ExitCode as
|
|
1480
|
-
import {runAction as
|
|
1481
|
-
import {intro as
|
|
1482
|
-
import {Action as
|
|
1545
|
+
import process24 from "process";
|
|
1546
|
+
import {ExitCode as ExitCode17} from "@stacksjs/types";
|
|
1547
|
+
import {runAction as runAction14} from "@stacksjs/actions";
|
|
1548
|
+
import {intro as intro15, log as log21, outro as outro15} from "@stacksjs/cli";
|
|
1549
|
+
import {Action as Action14} from "@stacksjs/enums";
|
|
1483
1550
|
function seed(buddy) {
|
|
1484
1551
|
const descriptions2 = {
|
|
1485
1552
|
seed: "Seed your database",
|
|
@@ -1487,29 +1554,30 @@ function seed(buddy) {
|
|
|
1487
1554
|
verbose: "Enable verbose output"
|
|
1488
1555
|
};
|
|
1489
1556
|
buddy.command("seed", descriptions2.seed).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1490
|
-
|
|
1491
|
-
const
|
|
1557
|
+
log21.debug("Running `buddy seed` ...", options);
|
|
1558
|
+
const perf = await intro15("buddy seed");
|
|
1559
|
+
const result = await runAction14(Action14.Seed, options);
|
|
1492
1560
|
if (result.isErr()) {
|
|
1493
|
-
await
|
|
1494
|
-
|
|
1561
|
+
await outro15("While running the seed command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1562
|
+
process24.exit(ExitCode17.FatalError);
|
|
1495
1563
|
}
|
|
1496
|
-
const APP_ENV =
|
|
1497
|
-
await
|
|
1498
|
-
|
|
1564
|
+
const APP_ENV = process24.env.APP_ENV || "local";
|
|
1565
|
+
await outro15(`Seeded your ${APP_ENV} database.`, { startTime: perf, useSeconds: true });
|
|
1566
|
+
process24.exit(ExitCode17.Success);
|
|
1499
1567
|
});
|
|
1500
1568
|
buddy.on("seed:*", () => {
|
|
1501
1569
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
1502
|
-
|
|
1570
|
+
process24.exit(1);
|
|
1503
1571
|
});
|
|
1504
1572
|
}
|
|
1505
1573
|
|
|
1506
1574
|
// src/commands/setup.ts
|
|
1507
|
-
import
|
|
1575
|
+
import process25 from "process";
|
|
1508
1576
|
import {path as p4} from "@stacksjs/path";
|
|
1509
|
-
import {handleError} from "@stacksjs/error-handling";
|
|
1577
|
+
import {handleError as handleError2} from "@stacksjs/error-handling";
|
|
1510
1578
|
import {writeFile} from "@stacksjs/storage";
|
|
1511
|
-
import {log as
|
|
1512
|
-
import {ExitCode as
|
|
1579
|
+
import {log as log22, runCommand as runCommand8} from "@stacksjs/cli";
|
|
1580
|
+
import {ExitCode as ExitCode18} from "@stacksjs/types";
|
|
1513
1581
|
var {$: $2 } = globalThis.Bun;
|
|
1514
1582
|
function setup(buddy) {
|
|
1515
1583
|
const descriptions2 = {
|
|
@@ -1520,44 +1588,52 @@ function setup(buddy) {
|
|
|
1520
1588
|
verbose: "Enable verbose output"
|
|
1521
1589
|
};
|
|
1522
1590
|
buddy.command("setup", descriptions2.setup).alias("ensure").option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1591
|
+
log22.debug("Running `buddy setup` ...", options);
|
|
1523
1592
|
if (!await isPkgxInstalled())
|
|
1524
1593
|
await installPkgx();
|
|
1525
1594
|
await optimizePkgxDeps();
|
|
1526
1595
|
await initializeProject(options);
|
|
1527
1596
|
});
|
|
1528
1597
|
buddy.command("setup:oh-my-zsh", descriptions2.ohMyZsh).option("--verbose", descriptions2.verbose, { default: false }).action(async (_options) => {
|
|
1598
|
+
log22.debug("Running `buddy setup:oh-my-zsh` ...", _options);
|
|
1529
1599
|
const homePath = (await $2`echo $HOME`.text()).trim();
|
|
1530
1600
|
const zshrcPath = p4.join(homePath, ".zshrc");
|
|
1531
1601
|
const pluginPath = p4.frameworkPath("core/zsh-buddy/buddy.plugin.zsh");
|
|
1532
1602
|
const customPath = p4.join(homePath, ".oh-my-zsh/custom/plugins/buddy/");
|
|
1533
|
-
|
|
1603
|
+
log22.info(`Setting up Oh My Zsh via ${zshrcPath}...`);
|
|
1534
1604
|
$2.cwd(p4.dirname(zshrcPath));
|
|
1535
1605
|
let data = await $2`cat ${p4.basename(zshrcPath)}`.text();
|
|
1536
1606
|
const pluginLineRegex = /^(?!#).*plugins=\(([^)]+)\)/m;
|
|
1537
1607
|
const match = data.match(pluginLineRegex);
|
|
1538
1608
|
if (match) {
|
|
1539
|
-
const plugins = match[1]
|
|
1609
|
+
const plugins = match[1]?.split(" ");
|
|
1610
|
+
if (!plugins) {
|
|
1611
|
+
log22.error("Maybe the plugins line in your .zshrc file could not be found? If this continues being an issue, please reach out to us on Discord.");
|
|
1612
|
+
process25.exit(ExitCode18.FatalError);
|
|
1613
|
+
}
|
|
1540
1614
|
if (!plugins.includes("buddy")) {
|
|
1541
1615
|
plugins.push("buddy");
|
|
1542
1616
|
const newPluginLine = `plugins=(${plugins.join(" ")})`;
|
|
1543
1617
|
data = data.replace(pluginLineRegex, newPluginLine);
|
|
1544
1618
|
await writeFile(zshrcPath, data);
|
|
1545
|
-
|
|
1619
|
+
log22.info(`Copying buddy zsh plugin ${pluginPath} to ${customPath}...`);
|
|
1546
1620
|
await runCommand8(`mkdir -p ${customPath}`);
|
|
1547
1621
|
await runCommand8(`cp -rf ${pluginPath} ${customPath}`);
|
|
1548
|
-
|
|
1622
|
+
log22.success("Copied buddy zsh plugin");
|
|
1549
1623
|
} else {
|
|
1550
|
-
|
|
1624
|
+
log22.info("Buddy is already integrated in your shell, ensuring it is updated...");
|
|
1551
1625
|
await runCommand8(`cp -rf ${pluginPath} ${customPath}`);
|
|
1552
|
-
|
|
1626
|
+
log22.success("Updated buddy zsh plugin to latest version");
|
|
1553
1627
|
}
|
|
1554
1628
|
}
|
|
1555
|
-
|
|
1556
|
-
|
|
1629
|
+
log22.success("Oh My Zsh Setup Complete");
|
|
1630
|
+
log22.info("To see changes reflect, you may need to open a new terminal window");
|
|
1631
|
+
if (process25.env.TERM_PROGRAM === "vscode")
|
|
1632
|
+
log22.info("\u2318\u21E7P terminal.create.new.terminal");
|
|
1557
1633
|
});
|
|
1558
1634
|
buddy.on("setup:*", () => {
|
|
1559
1635
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
1560
|
-
|
|
1636
|
+
process25.exit(ExitCode18.FatalError);
|
|
1561
1637
|
});
|
|
1562
1638
|
}
|
|
1563
1639
|
async function isPkgxInstalled() {
|
|
@@ -1570,61 +1646,61 @@ async function installPkgx() {
|
|
|
1570
1646
|
const result = await runCommand8(p4.frameworkPath("scripts/pkgx-install"));
|
|
1571
1647
|
if (result.isOk())
|
|
1572
1648
|
return;
|
|
1573
|
-
|
|
1574
|
-
|
|
1649
|
+
handleError2(result.error);
|
|
1650
|
+
process25.exit(ExitCode18.FatalError);
|
|
1575
1651
|
}
|
|
1576
1652
|
async function initializeProject(options) {
|
|
1577
|
-
|
|
1653
|
+
log22.info("Installing dependencies...");
|
|
1578
1654
|
const result = await runCommand8("bun install", {
|
|
1579
1655
|
cwd: options.cwd || p4.projectPath()
|
|
1580
1656
|
});
|
|
1581
1657
|
if (result.isErr()) {
|
|
1582
|
-
|
|
1583
|
-
|
|
1658
|
+
handleError2(result.error);
|
|
1659
|
+
process25.exit(ExitCode18.FatalError);
|
|
1584
1660
|
}
|
|
1585
|
-
|
|
1586
|
-
|
|
1661
|
+
log22.success("Installed node_modules");
|
|
1662
|
+
log22.info("Ensuring .env exists...");
|
|
1587
1663
|
if (storage.doesNotExist(p4.projectPath(".env"))) {
|
|
1588
1664
|
const envResult = await runCommand8("cp .env.example .env", {
|
|
1589
1665
|
cwd: options.cwd || p4.projectPath()
|
|
1590
1666
|
});
|
|
1591
1667
|
if (envResult.isErr()) {
|
|
1592
|
-
|
|
1593
|
-
|
|
1668
|
+
handleError2(envResult.error);
|
|
1669
|
+
process25.exit(ExitCode18.FatalError);
|
|
1594
1670
|
}
|
|
1595
|
-
|
|
1671
|
+
log22.success(".env created");
|
|
1596
1672
|
} else {
|
|
1597
|
-
|
|
1673
|
+
log22.success(".env existed");
|
|
1598
1674
|
}
|
|
1599
1675
|
const keyResult = await runCommand8("buddy key:generate", {
|
|
1600
1676
|
cwd: options.cwd || p4.projectPath()
|
|
1601
1677
|
});
|
|
1602
1678
|
if (keyResult.isErr()) {
|
|
1603
|
-
|
|
1604
|
-
|
|
1679
|
+
handleError2(keyResult.error);
|
|
1680
|
+
process25.exit(ExitCode18.FatalError);
|
|
1605
1681
|
}
|
|
1606
|
-
|
|
1682
|
+
log22.info("Ensuring AWS is connected...");
|
|
1607
1683
|
const awsResult = await runCommand8("buddy configure:aws", {
|
|
1608
1684
|
cwd: options.cwd || p4.projectPath()
|
|
1609
1685
|
});
|
|
1610
1686
|
if (awsResult.isErr()) {
|
|
1611
|
-
|
|
1612
|
-
|
|
1687
|
+
handleError2(awsResult.error);
|
|
1688
|
+
process25.exit(ExitCode18.FatalError);
|
|
1613
1689
|
}
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1690
|
+
log22.success("Configured AWS");
|
|
1691
|
+
log22.success("Project is setup");
|
|
1692
|
+
log22.info("Happy coding! \uD83D\uDC99");
|
|
1617
1693
|
}
|
|
1618
1694
|
async function optimizePkgxDeps() {
|
|
1619
1695
|
return new Promise((resolve2) => setTimeout(resolve2, 300));
|
|
1620
1696
|
}
|
|
1621
1697
|
|
|
1622
1698
|
// src/commands/test.ts
|
|
1623
|
-
import
|
|
1624
|
-
import {runAction as
|
|
1625
|
-
import {intro as
|
|
1699
|
+
import process26 from "process";
|
|
1700
|
+
import {runAction as runAction15} from "@stacksjs/actions";
|
|
1701
|
+
import {intro as intro16, outro as outro16} from "@stacksjs/cli";
|
|
1626
1702
|
import {projectPath as projectPath2} from "@stacksjs/path";
|
|
1627
|
-
import {Action as
|
|
1703
|
+
import {Action as Action15} from "@stacksjs/enums";
|
|
1628
1704
|
function test(buddy) {
|
|
1629
1705
|
const descriptions2 = {
|
|
1630
1706
|
command: "Runs your test suite",
|
|
@@ -1638,76 +1714,76 @@ function test(buddy) {
|
|
|
1638
1714
|
verbose: "Enable verbose output"
|
|
1639
1715
|
};
|
|
1640
1716
|
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) => {
|
|
1641
|
-
const perf = await
|
|
1642
|
-
const result = await
|
|
1717
|
+
const perf = await intro16("buddy test");
|
|
1718
|
+
const result = await runAction15(Action15.Test, { ...options, cwd: projectPath2() });
|
|
1643
1719
|
if (result.isErr()) {
|
|
1644
|
-
await
|
|
1645
|
-
|
|
1720
|
+
await outro16("While running `buddy test`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1721
|
+
process26.exit();
|
|
1646
1722
|
}
|
|
1647
|
-
await
|
|
1723
|
+
await outro16("Finished running tests", { startTime: perf, useSeconds: true });
|
|
1648
1724
|
});
|
|
1649
1725
|
buddy.command("test:unit", descriptions2.unit).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1650
|
-
const perf = await
|
|
1651
|
-
const result = await
|
|
1726
|
+
const perf = await intro16("buddy test:unit");
|
|
1727
|
+
const result = await runAction15(Action15.TestUnit, { ...options, verbose: true, cwd: projectPath2() });
|
|
1652
1728
|
if (result.isErr()) {
|
|
1653
|
-
await
|
|
1654
|
-
|
|
1729
|
+
await outro16("While running `buddy test:unit`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1730
|
+
process26.exit();
|
|
1655
1731
|
}
|
|
1656
|
-
await
|
|
1732
|
+
await outro16("Finished running unit tests", { startTime: perf, useSeconds: true });
|
|
1657
1733
|
});
|
|
1658
1734
|
buddy.command("test:feature", descriptions2.feature).option("--show-report", descriptions2.showReport, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1659
|
-
const perf = await
|
|
1735
|
+
const perf = await intro16("buddy test:feature");
|
|
1660
1736
|
let result;
|
|
1661
1737
|
if (options.showReport)
|
|
1662
|
-
result = await
|
|
1738
|
+
result = await runAction15(Action15.ShowFeatureTestReport, { ...options, verbose: true, cwd: projectPath2() });
|
|
1663
1739
|
else
|
|
1664
|
-
result = await
|
|
1740
|
+
result = await runAction15(Action15.TestFeature, { ...options, verbose: true, cwd: projectPath2() });
|
|
1665
1741
|
if (result.isErr()) {
|
|
1666
|
-
await
|
|
1667
|
-
|
|
1742
|
+
await outro16("While running `buddy test:feature`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1743
|
+
process26.exit();
|
|
1668
1744
|
}
|
|
1669
|
-
await
|
|
1745
|
+
await outro16("Finished running feature tests", { startTime: perf, useSeconds: true });
|
|
1670
1746
|
});
|
|
1671
1747
|
buddy.command("test:ui", descriptions2.command).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1672
|
-
const perf = await
|
|
1673
|
-
const result = await
|
|
1748
|
+
const perf = await intro16("buddy test:ui");
|
|
1749
|
+
const result = await runAction15(Action15.TestUi, { ...options, verbose: true, cwd: projectPath2() });
|
|
1674
1750
|
if (result.isErr()) {
|
|
1675
|
-
await
|
|
1676
|
-
|
|
1751
|
+
await outro16("While running `buddy test:ui`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1752
|
+
process26.exit();
|
|
1677
1753
|
}
|
|
1678
|
-
await
|
|
1754
|
+
await outro16("Finished running tests in the browser", { startTime: perf, useSeconds: true });
|
|
1679
1755
|
});
|
|
1680
1756
|
buddy.command("test:types", descriptions2.types).alias("typecheck").option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1681
|
-
const perf = await
|
|
1682
|
-
const result = await
|
|
1757
|
+
const perf = await intro16("buddy test:types");
|
|
1758
|
+
const result = await runAction15(Action15.Typecheck, { ...options, verbose: true, cwd: projectPath2() });
|
|
1683
1759
|
if (result.isErr()) {
|
|
1684
|
-
await
|
|
1685
|
-
|
|
1760
|
+
await outro16("While running `buddy test:types`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1761
|
+
process26.exit();
|
|
1686
1762
|
}
|
|
1687
|
-
await
|
|
1763
|
+
await outro16("Finished running typecheck", { startTime: perf, useSeconds: true });
|
|
1688
1764
|
});
|
|
1689
1765
|
buddy.command("test:coverage", descriptions2.coverage).action(async (options) => {
|
|
1690
|
-
const perf = await
|
|
1691
|
-
const result = await
|
|
1766
|
+
const perf = await intro16("buddy test:coverage");
|
|
1767
|
+
const result = await runAction15(Action15.TestCoverage, { ...options, cwd: projectPath2(), verbose: true });
|
|
1692
1768
|
if (result.isErr()) {
|
|
1693
|
-
await
|
|
1694
|
-
|
|
1769
|
+
await outro16("While running `buddy test:coverage`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1770
|
+
process26.exit();
|
|
1695
1771
|
}
|
|
1696
|
-
await
|
|
1697
|
-
|
|
1772
|
+
await outro16("Generated the test coverage report", { startTime: perf, useSeconds: true });
|
|
1773
|
+
process26.exit();
|
|
1698
1774
|
});
|
|
1699
1775
|
buddy.on("test:*", () => {
|
|
1700
1776
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
1701
|
-
|
|
1777
|
+
process26.exit(1);
|
|
1702
1778
|
});
|
|
1703
1779
|
}
|
|
1704
1780
|
|
|
1705
1781
|
// src/commands/tinker.ts
|
|
1706
|
-
import
|
|
1707
|
-
import {ExitCode as
|
|
1708
|
-
import {runAction as
|
|
1709
|
-
import {intro as
|
|
1710
|
-
import {Action as
|
|
1782
|
+
import process27 from "process";
|
|
1783
|
+
import {ExitCode as ExitCode19} from "@stacksjs/types";
|
|
1784
|
+
import {runAction as runAction16} from "@stacksjs/actions";
|
|
1785
|
+
import {intro as intro17, log as log23, outro as outro17} from "@stacksjs/cli";
|
|
1786
|
+
import {Action as Action16} from "@stacksjs/enums";
|
|
1711
1787
|
function tinker(buddy) {
|
|
1712
1788
|
const descriptions2 = {
|
|
1713
1789
|
tinker: "Tinker with your code",
|
|
@@ -1715,49 +1791,50 @@ function tinker(buddy) {
|
|
|
1715
1791
|
verbose: "Enable verbose output"
|
|
1716
1792
|
};
|
|
1717
1793
|
buddy.command("tinker", descriptions2.tinker).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1718
|
-
|
|
1719
|
-
const
|
|
1794
|
+
log23.debug("Running `buddy tinker` ...", options);
|
|
1795
|
+
const perf = await intro17("buddy tinker");
|
|
1796
|
+
const result = await runAction16(Action16.Tinker, options);
|
|
1720
1797
|
if (result.isErr()) {
|
|
1721
|
-
await
|
|
1722
|
-
|
|
1798
|
+
await outro17("While running the tinker command, there was an issue", { startTime: perf, useSeconds: true }, result.error || undefined);
|
|
1799
|
+
process27.exit();
|
|
1723
1800
|
}
|
|
1724
|
-
await
|
|
1725
|
-
|
|
1801
|
+
await outro17("Tinker mode exited.", { startTime: perf, useSeconds: true });
|
|
1802
|
+
process27.exit(ExitCode19.Success);
|
|
1726
1803
|
});
|
|
1727
1804
|
buddy.on("tinker:*", () => {
|
|
1728
1805
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
1729
|
-
|
|
1806
|
+
process27.exit(1);
|
|
1730
1807
|
});
|
|
1731
1808
|
}
|
|
1732
1809
|
|
|
1733
1810
|
// src/commands/types.ts
|
|
1734
|
-
import
|
|
1811
|
+
import process28 from "process";
|
|
1735
1812
|
import {generateTypes as generateTypes2} from "@stacksjs/actions";
|
|
1736
|
-
function
|
|
1813
|
+
function types20(buddy) {
|
|
1737
1814
|
const descriptions2 = {
|
|
1738
1815
|
generate: "Generate the types of & for your library/libraries",
|
|
1739
1816
|
fix: "wip",
|
|
1740
1817
|
project: "Target a specific project",
|
|
1741
1818
|
verbose: "Enable verbose output"
|
|
1742
1819
|
};
|
|
1743
|
-
buddy.command("types:generate", descriptions2.generate).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async () => {
|
|
1820
|
+
buddy.command("types:generate", descriptions2.generate).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1821
|
+
log5.debug("Running `buddy types:generate` ...", options);
|
|
1744
1822
|
await generateTypes2();
|
|
1745
1823
|
});
|
|
1746
1824
|
buddy.command("types:fix", descriptions2.fix).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async () => {
|
|
1747
1825
|
});
|
|
1748
1826
|
buddy.on("types:*", () => {
|
|
1749
1827
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
1750
|
-
|
|
1828
|
+
process28.exit(1);
|
|
1751
1829
|
});
|
|
1752
1830
|
}
|
|
1753
1831
|
|
|
1754
1832
|
// src/commands/upgrade.ts
|
|
1755
|
-
import
|
|
1756
|
-
import {runAction as
|
|
1757
|
-
import {intro as
|
|
1758
|
-
import {ExitCode as
|
|
1759
|
-
import {Action as
|
|
1760
|
-
import {isString as isString4} from "@stacksjs/validation";
|
|
1833
|
+
import process29 from "process";
|
|
1834
|
+
import {runAction as runAction17} from "@stacksjs/actions";
|
|
1835
|
+
import {intro as intro18, log as log24, outro as outro18} from "@stacksjs/cli";
|
|
1836
|
+
import {ExitCode as ExitCode20} from "@stacksjs/types";
|
|
1837
|
+
import {Action as Action17} from "@stacksjs/enums";
|
|
1761
1838
|
function upgrade(buddy) {
|
|
1762
1839
|
const descriptions2 = {
|
|
1763
1840
|
command: "Upgrade dependencies, framework, package manager, JS/TS runtime",
|
|
@@ -1771,9 +1848,10 @@ function upgrade(buddy) {
|
|
|
1771
1848
|
verbose: "Enable verbose output"
|
|
1772
1849
|
};
|
|
1773
1850
|
buddy.command("upgrade", descriptions2.command).option("-c, --framework", descriptions2.framework, { default: false }).option("-d, --dependencies", descriptions2.dependencies, { default: false }).option("-b, --bun", descriptions2.bun, { default: false }).option("-a, --all", descriptions2.all, { default: false }).option("-f, --force", descriptions2.force, { default: false }).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).alias("update").example("buddy upgrade -a --verbose").action(async (options) => {
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1851
|
+
log24.debug("Running `buddy upgrade` ...", options);
|
|
1852
|
+
const perf = await intro18("buddy upgrade");
|
|
1853
|
+
if (hasNoOptions2(options)) {
|
|
1854
|
+
let answers = await log24.prompt.require().multiselect(descriptions2.select, {
|
|
1777
1855
|
options: [
|
|
1778
1856
|
{ value: "dependencies", label: "Dependencies" },
|
|
1779
1857
|
{ value: "framework", label: "Framework" },
|
|
@@ -1782,56 +1860,70 @@ function upgrade(buddy) {
|
|
|
1782
1860
|
]
|
|
1783
1861
|
});
|
|
1784
1862
|
if (answers !== null)
|
|
1785
|
-
|
|
1786
|
-
if (
|
|
1863
|
+
process29.exit(ExitCode20.InvalidArgument);
|
|
1864
|
+
if (isString(answers))
|
|
1787
1865
|
answers = [answers];
|
|
1788
1866
|
options = answers.reduce((a, v) => ({ ...a, [v]: true }), {});
|
|
1789
1867
|
}
|
|
1790
|
-
const result = await
|
|
1868
|
+
const result = await runAction17(Action17.Upgrade, options);
|
|
1791
1869
|
if (result.isErr()) {
|
|
1792
|
-
await
|
|
1793
|
-
|
|
1870
|
+
await outro18("While running the buddy:upgrade command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1871
|
+
process29.exit();
|
|
1794
1872
|
}
|
|
1795
|
-
await
|
|
1796
|
-
|
|
1873
|
+
await outro18("Upgrade complete.", { startTime: perf, useSeconds: true });
|
|
1874
|
+
process29.exit();
|
|
1797
1875
|
});
|
|
1798
1876
|
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) => {
|
|
1799
|
-
|
|
1877
|
+
log24.debug("Running `buddy upgrade:framework` ...", options);
|
|
1878
|
+
await runAction17(Action17.Upgrade, options);
|
|
1800
1879
|
});
|
|
1801
1880
|
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) => {
|
|
1802
|
-
|
|
1881
|
+
log24.debug("Running `buddy upgrade:dependencies` ...", options);
|
|
1882
|
+
await runAction17(Action17.Upgrade, options);
|
|
1803
1883
|
});
|
|
1804
1884
|
buddy.command("upgrade:bun", descriptions2.bun).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1805
|
-
|
|
1806
|
-
const
|
|
1885
|
+
log24.debug("Running `buddy upgrade:bun` ...", options);
|
|
1886
|
+
const perf = await intro18("buddy upgrade:bun");
|
|
1887
|
+
const result = await runAction17(Action17.UpgradeBun, options);
|
|
1807
1888
|
if (result.isErr()) {
|
|
1808
|
-
await
|
|
1809
|
-
|
|
1889
|
+
await outro18("While running the buddy upgrade:bun command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1890
|
+
process29.exit();
|
|
1810
1891
|
}
|
|
1811
|
-
|
|
1892
|
+
process29.exit(ExitCode20.Success);
|
|
1812
1893
|
});
|
|
1813
1894
|
buddy.command("upgrade:all", descriptions2.all).option("-p, --project", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1814
|
-
|
|
1895
|
+
log24.debug("Running `buddy upgrade:all` ...", options);
|
|
1896
|
+
await runAction17(Action17.Upgrade, options);
|
|
1897
|
+
});
|
|
1898
|
+
buddy.on("upgrade:*", () => {
|
|
1899
|
+
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
1900
|
+
process29.exit(1);
|
|
1815
1901
|
});
|
|
1816
1902
|
}
|
|
1817
|
-
var
|
|
1903
|
+
var hasNoOptions2 = function(options) {
|
|
1818
1904
|
return !options.framework && !options.dependencies && !options.packageManager && !options.node && !options.all;
|
|
1819
1905
|
};
|
|
1820
1906
|
|
|
1821
1907
|
// src/commands/version.ts
|
|
1822
|
-
import
|
|
1908
|
+
import process30 from "process";
|
|
1909
|
+
import {bold as bold3, dim as dim2, green, intro as intro19, log as log25} from "@stacksjs/cli";
|
|
1823
1910
|
import {storage as storage5} from "@stacksjs/storage";
|
|
1824
1911
|
function version(buddy) {
|
|
1825
1912
|
const descriptions2 = {
|
|
1826
1913
|
version: "Retrieving Stacks build version"
|
|
1827
1914
|
};
|
|
1828
1915
|
buddy.command("version", descriptions2.version).action(async () => {
|
|
1829
|
-
|
|
1916
|
+
log25.debug("Running `buddy version` ...");
|
|
1917
|
+
await intro19("buddy version");
|
|
1830
1918
|
const pkg = await storage5.readPackageJson("./package.json");
|
|
1831
1919
|
const bunVersion = "wip";
|
|
1832
1920
|
const stacksVersion = pkg.version;
|
|
1833
|
-
|
|
1834
|
-
|
|
1921
|
+
log25.info(green(bold3("@stacksjs/ ")) + dim2(` ${stacksVersion}`));
|
|
1922
|
+
log25.info(green(bold3("Bun: ")) + dim2(` ${bunVersion}`));
|
|
1923
|
+
});
|
|
1924
|
+
buddy.on("version:*", () => {
|
|
1925
|
+
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
1926
|
+
process30.exit(1);
|
|
1835
1927
|
});
|
|
1836
1928
|
}
|
|
1837
|
-
export { build, changelog, clean, cloud2 as cloud, commit, configure, create, deploy, dev, startDevelopmentServer, domains, dns3 as dns,
|
|
1929
|
+
export { build, changelog, clean, cloud2 as cloud, commit, configure, create, deploy, dev, startDevelopmentServer, domains, dns3 as dns, fresh, generate, http, lint, list, install2 as install, key, make, migrate, prepublish, release, seed, setup, optimizePkgxDeps, test, tinker, types20 as types, upgrade, version };
|