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