@stacksjs/buddy 0.70.87 → 0.70.88
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/package.json +2 -2
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -165
- package/dist/commands/about.d.ts +0 -2
- package/dist/commands/about.js +0 -35
- package/dist/commands/add.d.ts +0 -2
- package/dist/commands/add.js +0 -33
- package/dist/commands/auth.d.ts +0 -2
- package/dist/commands/auth.js +0 -68
- package/dist/commands/build.d.ts +0 -2
- package/dist/commands/build.js +0 -153
- package/dist/commands/cd.d.ts +0 -20
- package/dist/commands/cd.js +0 -39
- package/dist/commands/changelog.d.ts +0 -2
- package/dist/commands/changelog.js +0 -32
- package/dist/commands/clean.d.ts +0 -2
- package/dist/commands/clean.js +0 -37
- package/dist/commands/cloud.d.ts +0 -2
- package/dist/commands/cloud.js +0 -503
- package/dist/commands/commit.d.ts +0 -2
- package/dist/commands/commit.js +0 -16
- package/dist/commands/completion.d.ts +0 -2
- package/dist/commands/completion.js +0 -143
- package/dist/commands/config-migrate.d.ts +0 -26
- package/dist/commands/config-migrate.js +0 -94
- package/dist/commands/configure.d.ts +0 -2
- package/dist/commands/configure.js +0 -48
- package/dist/commands/create.d.ts +0 -2
- package/dist/commands/create.js +0 -141
- package/dist/commands/deploy.d.ts +0 -107
- package/dist/commands/deploy.js +0 -1439
- package/dist/commands/dev.d.ts +0 -10
- package/dist/commands/dev.js +0 -907
- package/dist/commands/dns.d.ts +0 -2
- package/dist/commands/dns.js +0 -102
- package/dist/commands/doctor.d.ts +0 -2
- package/dist/commands/doctor.js +0 -285
- package/dist/commands/domains.d.ts +0 -2
- package/dist/commands/domains.js +0 -159
- package/dist/commands/email.d.ts +0 -2
- package/dist/commands/email.js +0 -524
- package/dist/commands/env.d.ts +0 -2
- package/dist/commands/env.js +0 -246
- package/dist/commands/extension.d.ts +0 -8
- package/dist/commands/extension.js +0 -78
- package/dist/commands/features.d.ts +0 -180
- package/dist/commands/features.js +0 -422
- package/dist/commands/fresh.d.ts +0 -2
- package/dist/commands/fresh.js +0 -39
- package/dist/commands/generate.d.ts +0 -2
- package/dist/commands/generate.js +0 -104
- package/dist/commands/http.d.ts +0 -2
- package/dist/commands/http.js +0 -33
- package/dist/commands/index.d.ts +0 -53
- package/dist/commands/index.js +0 -53
- package/dist/commands/install.d.ts +0 -2
- package/dist/commands/install.js +0 -22
- package/dist/commands/key.d.ts +0 -2
- package/dist/commands/key.js +0 -23
- package/dist/commands/lint.d.ts +0 -2
- package/dist/commands/lint.js +0 -46
- package/dist/commands/list.d.ts +0 -2
- package/dist/commands/list.js +0 -108
- package/dist/commands/mail.d.ts +0 -2
- package/dist/commands/mail.js +0 -693
- package/dist/commands/maintenance.d.ts +0 -2
- package/dist/commands/maintenance.js +0 -141
- package/dist/commands/make.d.ts +0 -2
- package/dist/commands/make.js +0 -375
- package/dist/commands/migrate-project.d.ts +0 -2
- package/dist/commands/migrate-project.js +0 -49
- package/dist/commands/migrate.d.ts +0 -4
- package/dist/commands/migrate.js +0 -455
- package/dist/commands/outdated.d.ts +0 -2
- package/dist/commands/outdated.js +0 -19
- package/dist/commands/package.d.ts +0 -2
- package/dist/commands/package.js +0 -17
- package/dist/commands/phone.d.ts +0 -2
- package/dist/commands/phone.js +0 -188
- package/dist/commands/ports.d.ts +0 -2
- package/dist/commands/ports.js +0 -118
- package/dist/commands/prepublish.d.ts +0 -2
- package/dist/commands/prepublish.js +0 -17
- package/dist/commands/projects.d.ts +0 -2
- package/dist/commands/projects.js +0 -29
- package/dist/commands/publish.d.ts +0 -2
- package/dist/commands/publish.js +0 -172
- package/dist/commands/queue.d.ts +0 -2
- package/dist/commands/queue.js +0 -248
- package/dist/commands/release.d.ts +0 -2
- package/dist/commands/release.js +0 -30
- package/dist/commands/route.d.ts +0 -2
- package/dist/commands/route.js +0 -21
- package/dist/commands/saas.d.ts +0 -2
- package/dist/commands/saas.js +0 -25
- package/dist/commands/schedule.d.ts +0 -2
- package/dist/commands/schedule.js +0 -61
- package/dist/commands/search.d.ts +0 -2
- package/dist/commands/search.js +0 -84
- package/dist/commands/seed.d.ts +0 -2
- package/dist/commands/seed.js +0 -71
- package/dist/commands/serve.d.ts +0 -25
- package/dist/commands/serve.js +0 -182
- package/dist/commands/setup.d.ts +0 -12
- package/dist/commands/setup.js +0 -215
- package/dist/commands/share.d.ts +0 -2
- package/dist/commands/share.js +0 -214
- package/dist/commands/sms.d.ts +0 -2
- package/dist/commands/sms.js +0 -328
- package/dist/commands/stacks.d.ts +0 -2
- package/dist/commands/stacks.js +0 -69
- package/dist/commands/telemetry.d.ts +0 -2
- package/dist/commands/telemetry.js +0 -74
- package/dist/commands/test.d.ts +0 -2
- package/dist/commands/test.js +0 -130
- package/dist/commands/tinker.d.ts +0 -2
- package/dist/commands/tinker.js +0 -37
- package/dist/commands/types.d.ts +0 -2
- package/dist/commands/types.js +0 -18
- package/dist/commands/upgrade.d.ts +0 -2
- package/dist/commands/upgrade.js +0 -98
- package/dist/commands/version.d.ts +0 -2
- package/dist/commands/version.js +0 -16
- package/dist/config.d.ts +0 -43
- package/dist/config.js +0 -223
- package/dist/custom-cli.d.ts +0 -1
- package/dist/custom-cli.js +0 -23
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/lazy-commands.d.ts +0 -61
- package/dist/lazy-commands.js +0 -188
- package/dist/migrators/index.d.ts +0 -9
- package/dist/migrators/index.js +0 -62
- package/dist/migrators/laravel/index.d.ts +0 -2
- package/dist/migrators/laravel/index.js +0 -148
- package/dist/migrators/laravel/migrations.d.ts +0 -52
- package/dist/migrators/laravel/migrations.js +0 -232
- package/dist/migrators/laravel/models.d.ts +0 -34
- package/dist/migrators/laravel/models.js +0 -134
- package/dist/migrators/rails/index.d.ts +0 -2
- package/dist/migrators/rails/index.js +0 -11
- package/dist/migrators/types.d.ts +0 -44
- package/dist/migrators/types.js +0 -0
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import process from "node:process";
|
|
2
|
-
import { intro, log, outro } from "@stacksjs/cli";
|
|
3
|
-
import { ExitCode } from "@stacksjs/types";
|
|
4
|
-
export function maintenance(buddy) {
|
|
5
|
-
buddy.command("coming-soon", "Put the application into coming soon mode").option("--message [message]", "The message to display", { default: !1 }).option("--secret [token]", "The secret phrase to bypass coming soon mode", { default: !1 }).option("--allow [ip...]", "IP addresses allowed to access the application", { default: !1 }).option("--status [code]", "The HTTP status code to return", { default: "200" }).option("--verbose", "Enable verbose output", { default: !1 }).example("buddy coming-soon").example("buddy coming-soon --secret=trailhead").example('buddy coming-soon --message="Opening soon"').action(async (options) => {
|
|
6
|
-
const perf = await intro("buddy coming-soon");
|
|
7
|
-
try {
|
|
8
|
-
const { comingSoon } = await import("@stacksjs/server");
|
|
9
|
-
await comingSoon({
|
|
10
|
-
message: options.message || void 0,
|
|
11
|
-
secret: options.secret || void 0,
|
|
12
|
-
allowed: Array.isArray(options.allow) ? options.allow : options.allow ? [options.allow] : void 0,
|
|
13
|
-
status: options.status ? Number.parseInt(options.status, 10) : 200
|
|
14
|
-
});
|
|
15
|
-
if (options.secret) {
|
|
16
|
-
log.info("");
|
|
17
|
-
log.info(`Preview URL: your-app.com/${options.secret}`);
|
|
18
|
-
}
|
|
19
|
-
await outro("Application is now in coming soon mode", {
|
|
20
|
-
startTime: perf,
|
|
21
|
-
useSeconds: !0
|
|
22
|
-
});
|
|
23
|
-
} catch (error) {
|
|
24
|
-
log.error("Failed to enable coming soon mode:", error);
|
|
25
|
-
process.exit(ExitCode.FatalError);
|
|
26
|
-
}
|
|
27
|
-
process.exit(ExitCode.Success);
|
|
28
|
-
});
|
|
29
|
-
buddy.command("launch", "Bring the application out of coming soon mode").alias("coming-soon:off").option("--verbose", "Enable verbose output", { default: !1 }).example("buddy launch").action(async () => {
|
|
30
|
-
const perf = await intro("buddy launch");
|
|
31
|
-
try {
|
|
32
|
-
const { isComingSoon, launch } = await import("@stacksjs/server");
|
|
33
|
-
if (!await isComingSoon()) {
|
|
34
|
-
log.info("Application is not in coming soon mode.");
|
|
35
|
-
process.exit(ExitCode.Success);
|
|
36
|
-
}
|
|
37
|
-
await launch();
|
|
38
|
-
await outro("Application is now launched", {
|
|
39
|
-
startTime: perf,
|
|
40
|
-
useSeconds: !0
|
|
41
|
-
});
|
|
42
|
-
} catch (error) {
|
|
43
|
-
log.error("Failed to disable coming soon mode:", error);
|
|
44
|
-
process.exit(ExitCode.FatalError);
|
|
45
|
-
}
|
|
46
|
-
process.exit(ExitCode.Success);
|
|
47
|
-
});
|
|
48
|
-
buddy.command("coming-soon:status", "Check if the application is in coming soon mode").option("--verbose", "Enable verbose output", { default: !1 }).action(async () => {
|
|
49
|
-
try {
|
|
50
|
-
const { comingSoonPayload, isComingSoon } = await import("@stacksjs/server");
|
|
51
|
-
if (await isComingSoon()) {
|
|
52
|
-
const payload = await comingSoonPayload();
|
|
53
|
-
log.warn("Application is in coming soon mode");
|
|
54
|
-
if (payload) {
|
|
55
|
-
if (payload.message)
|
|
56
|
-
log.info(`Message: ${payload.message}`);
|
|
57
|
-
if (payload.secret)
|
|
58
|
-
log.info(`Secret: ${payload.secret}`);
|
|
59
|
-
if (payload.allowed?.length)
|
|
60
|
-
log.info(`Allowed IPs: ${payload.allowed.join(", ")}`);
|
|
61
|
-
if (payload.time)
|
|
62
|
-
log.info(`Started: ${new Date(payload.time).toLocaleString()}`);
|
|
63
|
-
}
|
|
64
|
-
} else
|
|
65
|
-
log.success("Application is launched");
|
|
66
|
-
} catch (error) {
|
|
67
|
-
log.error("Failed to check coming soon status:", error);
|
|
68
|
-
process.exit(ExitCode.FatalError);
|
|
69
|
-
}
|
|
70
|
-
process.exit(ExitCode.Success);
|
|
71
|
-
});
|
|
72
|
-
buddy.command("down", "Put the application into maintenance mode").option("--message [message]", "The message to display", { default: !1 }).option("--retry [seconds]", "The number of seconds after which the request may be retried", { default: !1 }).option("--secret [token]", "The secret phrase to bypass maintenance mode", { default: !1 }).option("--allow [ip...]", "IP addresses allowed to access the application", { default: !1 }).option("--redirect [url]", "Redirect all requests to a given URL", { default: !1 }).option("--status [code]", "The HTTP status code to return", { default: !1 }).option("--verbose", "Enable verbose output", { default: !1 }).example("buddy down").example('buddy down --message="Upgrading database"').example("buddy down --secret=my-secret-token").example("buddy down --retry=60").example("buddy down --allow=192.168.1.1 --allow=192.168.1.2").action(async (options) => {
|
|
73
|
-
const perf = await intro("buddy down");
|
|
74
|
-
try {
|
|
75
|
-
const { down } = await import("@stacksjs/server");
|
|
76
|
-
await down({
|
|
77
|
-
message: options.message || void 0,
|
|
78
|
-
retry: options.retry ? Number.parseInt(options.retry, 10) : void 0,
|
|
79
|
-
secret: options.secret || void 0,
|
|
80
|
-
allowed: Array.isArray(options.allow) ? options.allow : options.allow ? [options.allow] : void 0,
|
|
81
|
-
redirect: options.redirect || void 0,
|
|
82
|
-
status: options.status ? Number.parseInt(options.status, 10) : 503
|
|
83
|
-
});
|
|
84
|
-
if (options.secret) {
|
|
85
|
-
log.info("");
|
|
86
|
-
log.info(`Bypass URL: your-app.com/${options.secret}`);
|
|
87
|
-
}
|
|
88
|
-
await outro("Application is now in maintenance mode", {
|
|
89
|
-
startTime: perf,
|
|
90
|
-
useSeconds: !0
|
|
91
|
-
});
|
|
92
|
-
} catch (error) {
|
|
93
|
-
log.error("Failed to enable maintenance mode:", error);
|
|
94
|
-
process.exit(ExitCode.FatalError);
|
|
95
|
-
}
|
|
96
|
-
process.exit(ExitCode.Success);
|
|
97
|
-
});
|
|
98
|
-
buddy.command("up", "Bring the application out of maintenance mode").option("--verbose", "Enable verbose output", { default: !1 }).example("buddy up").action(async () => {
|
|
99
|
-
const perf = await intro("buddy up");
|
|
100
|
-
try {
|
|
101
|
-
const { up, isDownForMaintenance } = await import("@stacksjs/server");
|
|
102
|
-
if (!await isDownForMaintenance()) {
|
|
103
|
-
log.info("Application is already live.");
|
|
104
|
-
process.exit(ExitCode.Success);
|
|
105
|
-
}
|
|
106
|
-
await up();
|
|
107
|
-
await outro("Application is now live", {
|
|
108
|
-
startTime: perf,
|
|
109
|
-
useSeconds: !0
|
|
110
|
-
});
|
|
111
|
-
} catch (error) {
|
|
112
|
-
log.error("Failed to bring application up:", error);
|
|
113
|
-
process.exit(ExitCode.FatalError);
|
|
114
|
-
}
|
|
115
|
-
process.exit(ExitCode.Success);
|
|
116
|
-
});
|
|
117
|
-
buddy.command("status", "Check whether the application is in maintenance or coming-soon mode").alias("maintenance:status").option("--verbose", "Enable verbose output", { default: !1 }).action(async () => {
|
|
118
|
-
try {
|
|
119
|
-
const { activeSiteModePayload } = await import("@stacksjs/server"), payload = await activeSiteModePayload();
|
|
120
|
-
if (payload) {
|
|
121
|
-
const mode = payload.mode ?? "maintenance";
|
|
122
|
-
log.warn(`Application is in ${mode} mode`);
|
|
123
|
-
if (payload.message)
|
|
124
|
-
log.info(`Message: ${payload.message}`);
|
|
125
|
-
if (payload.retry)
|
|
126
|
-
log.info(`Retry-After: ${payload.retry} seconds`);
|
|
127
|
-
if (payload.secret)
|
|
128
|
-
log.info(`Secret: ${payload.secret}`);
|
|
129
|
-
if (payload.allowed?.length)
|
|
130
|
-
log.info(`Allowed IPs: ${payload.allowed.join(", ")}`);
|
|
131
|
-
if (payload.time)
|
|
132
|
-
log.info(`Started: ${new Date(payload.time).toLocaleString()}`);
|
|
133
|
-
} else
|
|
134
|
-
log.success("Application is live");
|
|
135
|
-
} catch (error) {
|
|
136
|
-
log.error("Failed to check site-mode status:", error);
|
|
137
|
-
process.exit(ExitCode.FatalError);
|
|
138
|
-
}
|
|
139
|
-
process.exit(ExitCode.Success);
|
|
140
|
-
});
|
|
141
|
-
}
|
package/dist/commands/make.d.ts
DELETED
package/dist/commands/make.js
DELETED
|
@@ -1,375 +0,0 @@
|
|
|
1
|
-
import process from "node:process";
|
|
2
|
-
import {
|
|
3
|
-
createMiddleware,
|
|
4
|
-
createMigration,
|
|
5
|
-
createModel,
|
|
6
|
-
createNotification,
|
|
7
|
-
createPage,
|
|
8
|
-
invoke,
|
|
9
|
-
makeAction,
|
|
10
|
-
makeCertificate,
|
|
11
|
-
makeCommand,
|
|
12
|
-
makeComponent,
|
|
13
|
-
makeDatabase,
|
|
14
|
-
makeFunction,
|
|
15
|
-
makeJob,
|
|
16
|
-
makeLanguage,
|
|
17
|
-
makeMail,
|
|
18
|
-
makePage,
|
|
19
|
-
makePolicy,
|
|
20
|
-
makeQueueTable,
|
|
21
|
-
makeResource,
|
|
22
|
-
makeStack,
|
|
23
|
-
setDryRun
|
|
24
|
-
} from "@stacksjs/actions";
|
|
25
|
-
import { intro, italic, onUnknownSubcommand, outro } from "@stacksjs/cli";
|
|
26
|
-
import { log } from "@stacksjs/logging";
|
|
27
|
-
import { ExitCode } from "@stacksjs/types";
|
|
28
|
-
export function make(buddy) {
|
|
29
|
-
const descriptions = {
|
|
30
|
-
action: "Create a new action",
|
|
31
|
-
command: "Create a new CLI command",
|
|
32
|
-
model: "Create a new model",
|
|
33
|
-
middleware: "Create a new middleware",
|
|
34
|
-
component: "Create a new component",
|
|
35
|
-
page: "Create a new page",
|
|
36
|
-
function: "Create a new function",
|
|
37
|
-
job: "Create a new job",
|
|
38
|
-
language: "Create a new language",
|
|
39
|
-
database: "Create a new database",
|
|
40
|
-
migration: "Create a new migration",
|
|
41
|
-
factory: "Create a new factory",
|
|
42
|
-
notification: "Create a new notification",
|
|
43
|
-
mail: "Create a new Mailable + companion stx template",
|
|
44
|
-
policy: "Create a new authorization policy",
|
|
45
|
-
resource: "Create a new API resource",
|
|
46
|
-
name: "The name of the action",
|
|
47
|
-
queue: "Make queue migration",
|
|
48
|
-
stack: "Create a new stack",
|
|
49
|
-
certificate: "Create a new SSL Certificate",
|
|
50
|
-
select: "What are you trying to make?",
|
|
51
|
-
project: "Target a specific project",
|
|
52
|
-
verbose: "Enable verbose output"
|
|
53
|
-
};
|
|
54
|
-
buddy.command("make [make]", "The make command").option("-a, --action [action]", descriptions.action, { default: !1 }).option("-c, --component [component]", descriptions.component, { default: !1 }).option("-d, --database [database]", descriptions.database, { default: !1 }).option("-f, --factory [factory]", descriptions.factory, { default: !1 }).option("-f, --function [function]", descriptions.function, { default: !1 }).option("-l, --language [language]", descriptions.language, { default: !1 }).option("-m, --model [model]", descriptions.model, { default: !1 }).option("-mw, --middleware [middleware]", descriptions.middleware, { default: !1 }).option("-p, --page [page]", descriptions.page, { default: !1 }).option("-m, --migration [migration]", descriptions.migration, { default: !1 }).option("-n, --notification [notification]", descriptions.notification, { default: !1 }).option("-qt, --queue-table", descriptions.queue, { default: !1 }).option("-s, --stack [stack]", descriptions.stack, { default: !1 }).option("--dry-run", "Preview the files that would be generated without writing", { default: !1 }).option("--with-validation", "Include a validation rules block in the generated stub", { default: !1 }).option("--with-auth", "Include auth-aware boilerplate in the generated stub", { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (make, options) => {
|
|
55
|
-
log.debug("Running `buddy make` ...", options);
|
|
56
|
-
if (!buddy.args[0]) {
|
|
57
|
-
log.error("You need to specify a name. Read more about the documentation here.");
|
|
58
|
-
process.exit(ExitCode.FatalError);
|
|
59
|
-
}
|
|
60
|
-
setDryRun(Boolean(options.dryRun || options["dry-run"]));
|
|
61
|
-
if (make) {
|
|
62
|
-
options.name = buddy.args[1] ?? make;
|
|
63
|
-
switch (make) {
|
|
64
|
-
case "action":
|
|
65
|
-
await makeAction(options);
|
|
66
|
-
break;
|
|
67
|
-
case "certificate":
|
|
68
|
-
await makeCertificate();
|
|
69
|
-
break;
|
|
70
|
-
case "command":
|
|
71
|
-
await makeCommand(options);
|
|
72
|
-
break;
|
|
73
|
-
case "component":
|
|
74
|
-
await makeComponent(options);
|
|
75
|
-
break;
|
|
76
|
-
case "database":
|
|
77
|
-
makeDatabase(options);
|
|
78
|
-
break;
|
|
79
|
-
case "function":
|
|
80
|
-
await makeFunction(options);
|
|
81
|
-
break;
|
|
82
|
-
case "job":
|
|
83
|
-
await makeJob(options);
|
|
84
|
-
break;
|
|
85
|
-
case "language":
|
|
86
|
-
await makeLanguage(options);
|
|
87
|
-
break;
|
|
88
|
-
case "mail":
|
|
89
|
-
await makeMail(options);
|
|
90
|
-
break;
|
|
91
|
-
case "migration":
|
|
92
|
-
await createMigration(options);
|
|
93
|
-
break;
|
|
94
|
-
case "middleware":
|
|
95
|
-
await createMiddleware(options);
|
|
96
|
-
break;
|
|
97
|
-
case "model":
|
|
98
|
-
await createModel(options);
|
|
99
|
-
break;
|
|
100
|
-
case "page":
|
|
101
|
-
await createPage(options);
|
|
102
|
-
break;
|
|
103
|
-
case "notification":
|
|
104
|
-
await createNotification(options);
|
|
105
|
-
break;
|
|
106
|
-
case "policy":
|
|
107
|
-
await makePolicy(options);
|
|
108
|
-
break;
|
|
109
|
-
case "resource":
|
|
110
|
-
await makeResource(options);
|
|
111
|
-
break;
|
|
112
|
-
case "queue-table":
|
|
113
|
-
await makeQueueTable();
|
|
114
|
-
break;
|
|
115
|
-
case "stack":
|
|
116
|
-
await makeStack(options);
|
|
117
|
-
break;
|
|
118
|
-
default:
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
await invoke(options);
|
|
122
|
-
process.exit(ExitCode.Success);
|
|
123
|
-
});
|
|
124
|
-
buddy.command("make:action [name]", descriptions.action).option("-n, --name [name]", descriptions.name, { default: !1 }).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--dry-run", "Preview the file without writing", { default: !1 }).option("--with-validation", "Generate a stub that calls validate()", { default: !1 }).option("--with-auth", "Generate a stub that requires an authenticated user", { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (name, options) => {
|
|
125
|
-
log.info("Running `buddy make:action` ...");
|
|
126
|
-
log.debug("Running `buddy make:action` ...", name, options);
|
|
127
|
-
name = name ?? options.name;
|
|
128
|
-
options.name = name;
|
|
129
|
-
if (!name) {
|
|
130
|
-
log.error("You need to specify a name. Read more about the documentation here.");
|
|
131
|
-
process.exit(ExitCode.FatalError);
|
|
132
|
-
}
|
|
133
|
-
setDryRun(Boolean(options.dryRun || options["dry-run"]));
|
|
134
|
-
await makeAction(options);
|
|
135
|
-
});
|
|
136
|
-
buddy.command("make:certificate", descriptions.certificate).alias("make:cert").example("buddy make:certificate").action(async (options) => {
|
|
137
|
-
log.debug("Running `buddy make:certificate` ...", options);
|
|
138
|
-
await makeCertificate();
|
|
139
|
-
});
|
|
140
|
-
buddy.command("scaffold:crud [name]", "Generate model, migration, and CRUD actions").alias("make:crud").alias("make:scaffold").option("-n, --name [name]", "Resource name (PascalCase)", { default: !1 }).option("-f, --fields [fields]", "Comma-separated field list, e.g. title:string,body:text,published:boolean", { default: "" }).option("--dry-run", "Preview the generated files without writing", { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).example("buddy scaffold:crud Post --fields=title:string,body:text,published:boolean").action(async (name, options) => {
|
|
141
|
-
name = name ?? options.name;
|
|
142
|
-
if (!name) {
|
|
143
|
-
log.error("scaffold:crud requires a resource name. Example: buddy scaffold:crud Post --fields=title:string,body:text");
|
|
144
|
-
process.exit(ExitCode.FatalError);
|
|
145
|
-
}
|
|
146
|
-
const { scaffoldCrud } = await import("@stacksjs/actions");
|
|
147
|
-
setDryRun(Boolean(options.dryRun || options["dry-run"]));
|
|
148
|
-
try {
|
|
149
|
-
await scaffoldCrud(name, options);
|
|
150
|
-
} catch (err) {
|
|
151
|
-
log.error("scaffold:crud failed:", err);
|
|
152
|
-
process.exit(ExitCode.FatalError);
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
buddy.command("make:command [name]", descriptions.command).option("-n, --name [name]", descriptions.name, { default: !1 }).option("-s, --signature [signature]", "The command signature (CLI name)", { default: !1 }).option("-d, --description [description]", "The command description", { default: !1 }).option("--no-register", "Do not register in Commands.ts").option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).example("buddy make:command SendEmails").example("buddy make:command SendEmails --signature=send-emails").action(async (name, options) => {
|
|
156
|
-
log.debug("Running `buddy make:command` ...", options);
|
|
157
|
-
const perf = await intro("buddy make:command");
|
|
158
|
-
name = name ?? options.name;
|
|
159
|
-
options.name = name;
|
|
160
|
-
if (!name) {
|
|
161
|
-
log.error("You need to specify a command name.");
|
|
162
|
-
log.info("Example: buddy make:command SendEmails");
|
|
163
|
-
process.exit(ExitCode.FatalError);
|
|
164
|
-
}
|
|
165
|
-
if (!await makeCommand(options)) {
|
|
166
|
-
await outro("While running the make:command command, there was an issue", {
|
|
167
|
-
startTime: perf,
|
|
168
|
-
useSeconds: !0
|
|
169
|
-
});
|
|
170
|
-
process.exit(ExitCode.FatalError);
|
|
171
|
-
}
|
|
172
|
-
await outro(`Created your ${italic(name)} command.`, {
|
|
173
|
-
startTime: perf,
|
|
174
|
-
useSeconds: !0
|
|
175
|
-
});
|
|
176
|
-
process.exit(ExitCode.Success);
|
|
177
|
-
});
|
|
178
|
-
buddy.command("make:component [name]", descriptions.component).option("-n, --name [name]", descriptions.name, { default: !1 }).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (name, options) => {
|
|
179
|
-
log.debug("Running `buddy make:component` ...", options);
|
|
180
|
-
name = name ?? options.name;
|
|
181
|
-
options.name = name;
|
|
182
|
-
if (!name) {
|
|
183
|
-
log.error("You need to specify a name. Read more about the documentation here.");
|
|
184
|
-
process.exit(ExitCode.FatalError);
|
|
185
|
-
}
|
|
186
|
-
await makeComponent(options);
|
|
187
|
-
});
|
|
188
|
-
buddy.command("make:database [name]", descriptions.database).option("-n, --name [name]", descriptions.name, { default: !1 }).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action((name, options) => {
|
|
189
|
-
log.debug("Running `buddy make:database` ...", options);
|
|
190
|
-
name = name ?? options.name;
|
|
191
|
-
options.name = name;
|
|
192
|
-
if (!name) {
|
|
193
|
-
log.error("You need to specify a database name via the `--name` option, or as the command\u2019s argument.");
|
|
194
|
-
log.info("Example: `buddy make:database my-cool-database`");
|
|
195
|
-
log.info("Or: `buddy make:database --name=my-cool-database`");
|
|
196
|
-
log.info("Read more about the documentation here: https://stacksjs.com/docs/make/database");
|
|
197
|
-
process.exit(ExitCode.FatalError);
|
|
198
|
-
}
|
|
199
|
-
makeDatabase(options);
|
|
200
|
-
});
|
|
201
|
-
buddy.command("make:factory [name]", descriptions.factory).option("-n, --name [name]", descriptions.name, { default: !1 }).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action((name, options) => {
|
|
202
|
-
log.debug("Running `buddy make:factory` ...", options);
|
|
203
|
-
name = name ?? options.name;
|
|
204
|
-
options.name = name;
|
|
205
|
-
if (!name) {
|
|
206
|
-
log.error("You need to specify a name. Read more about the documentation here.");
|
|
207
|
-
process.exit(ExitCode.FatalError);
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
buddy.command("make:function [name]", descriptions.function).option("-n, --name [name]", descriptions.name, { default: !1 }).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (options) => {
|
|
211
|
-
log.debug("Running `buddy make:function` ...", options);
|
|
212
|
-
await makeFunction(options);
|
|
213
|
-
});
|
|
214
|
-
buddy.command("make:lang [name]", descriptions.language).option("-n, --name [name]", descriptions.name, { default: !1 }).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (name, options) => {
|
|
215
|
-
log.debug("Running `buddy make:lang` ...", options);
|
|
216
|
-
name = name ?? options.name;
|
|
217
|
-
options.name = name;
|
|
218
|
-
if (!name) {
|
|
219
|
-
log.error("You need to specify a name. Read more about the documentation here.");
|
|
220
|
-
process.exit(ExitCode.FatalError);
|
|
221
|
-
}
|
|
222
|
-
await makeLanguage(options);
|
|
223
|
-
});
|
|
224
|
-
buddy.command("make:migration [name]", descriptions.migration).option("-n, --name [name]", descriptions.name, { default: !1 }).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action((name, options) => {
|
|
225
|
-
log.debug("Running `buddy make:migration` ...", options);
|
|
226
|
-
name = name ?? options.name;
|
|
227
|
-
options.name = name;
|
|
228
|
-
if (!name) {
|
|
229
|
-
log.error("You need to specify a migration name");
|
|
230
|
-
process.exit(ExitCode.FatalError);
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
buddy.command("make:model [name]", descriptions.model).option("-n, --name [name]", descriptions.name, { default: !1 }).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (name, options) => {
|
|
234
|
-
log.debug("Running `buddy make:model` ...", options);
|
|
235
|
-
name = name ?? options.name;
|
|
236
|
-
options.name = name;
|
|
237
|
-
if (!name) {
|
|
238
|
-
log.error("You need to specify a model name");
|
|
239
|
-
process.exit(ExitCode.FatalError);
|
|
240
|
-
}
|
|
241
|
-
await createModel(options);
|
|
242
|
-
});
|
|
243
|
-
buddy.command("make:mail [name]", descriptions.mail).option("-n, --name [name]", descriptions.name, { default: !1 }).option("-f, --force", "Overwrite existing files", { default: !1 }).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).example("buddy make:mail OrderShipped").example("buddy make:mail welcome-back // PascalCases to WelcomeBack, kebab-cases to welcome-back").example("buddy make:mail Welcome --force // overwrite existing files").action(async (name, options) => {
|
|
244
|
-
log.debug("Running `buddy make:mail` ...", options);
|
|
245
|
-
const perf = await intro("buddy make:mail");
|
|
246
|
-
name = name ?? options.name;
|
|
247
|
-
options.name = name;
|
|
248
|
-
if (!name) {
|
|
249
|
-
log.error("You need to specify a name (e.g. `buddy make:mail OrderShipped`).");
|
|
250
|
-
process.exit(ExitCode.FatalError);
|
|
251
|
-
}
|
|
252
|
-
await makeMail(options);
|
|
253
|
-
await outro(`Created your ${italic(name)} mailable.`, {
|
|
254
|
-
startTime: perf,
|
|
255
|
-
useSeconds: !0
|
|
256
|
-
});
|
|
257
|
-
process.exit(ExitCode.Success);
|
|
258
|
-
});
|
|
259
|
-
buddy.command("make:notification [name]", descriptions.notification).option("-n, --name [name]", descriptions.name, { default: !1 }).option("-e, --email", "Is it an email notification?", { default: !0 }).option("-c, --chat", "Is it a chat notification?", { default: !1 }).option("-s, --sms", "Is it a SMS notification?", { default: !1 }).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (name, options) => {
|
|
260
|
-
log.debug("Running `buddy make:notification` ...", options);
|
|
261
|
-
const perf = await intro("buddy make:notification");
|
|
262
|
-
name = name ?? options.name;
|
|
263
|
-
options.name = name;
|
|
264
|
-
if (!name) {
|
|
265
|
-
log.error("You need to specify a name. Read more about the documentation here.");
|
|
266
|
-
process.exit(ExitCode.FatalError);
|
|
267
|
-
}
|
|
268
|
-
if (!await createNotification(options)) {
|
|
269
|
-
await outro("While running the make:notification command, there was an issue", {
|
|
270
|
-
startTime: perf,
|
|
271
|
-
useSeconds: !0
|
|
272
|
-
});
|
|
273
|
-
process.exit(ExitCode.FatalError);
|
|
274
|
-
}
|
|
275
|
-
await outro(`Created your ${italic(name)} notification.`, {
|
|
276
|
-
startTime: perf,
|
|
277
|
-
useSeconds: !0
|
|
278
|
-
});
|
|
279
|
-
process.exit(ExitCode.Success);
|
|
280
|
-
});
|
|
281
|
-
buddy.command("make:policy [name]", descriptions.policy).option("-n, --name [name]", descriptions.name, { default: !1 }).option("-m, --model [model]", "The model this policy is for", { default: !1 }).option("--no-register", "Do not register in Gates.ts", { default: !1 }).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).example("buddy make:policy PostPolicy").example("buddy make:policy CommentPolicy --model=Comment").action(async (name, options) => {
|
|
282
|
-
log.debug("Running `buddy make:policy` ...", options);
|
|
283
|
-
const perf = await intro("buddy make:policy");
|
|
284
|
-
name = name ?? options.name;
|
|
285
|
-
options.name = name;
|
|
286
|
-
if (!name) {
|
|
287
|
-
log.error("You need to specify a policy name.");
|
|
288
|
-
log.info("Example: buddy make:policy PostPolicy");
|
|
289
|
-
process.exit(ExitCode.FatalError);
|
|
290
|
-
}
|
|
291
|
-
if (!await makePolicy(options)) {
|
|
292
|
-
await outro("While running the make:policy command, there was an issue", {
|
|
293
|
-
startTime: perf,
|
|
294
|
-
useSeconds: !0
|
|
295
|
-
});
|
|
296
|
-
process.exit(ExitCode.FatalError);
|
|
297
|
-
}
|
|
298
|
-
await outro(`Created your ${italic(name)} policy.`, {
|
|
299
|
-
startTime: perf,
|
|
300
|
-
useSeconds: !0
|
|
301
|
-
});
|
|
302
|
-
process.exit(ExitCode.Success);
|
|
303
|
-
});
|
|
304
|
-
buddy.command("make:resource [name]", descriptions.resource).option("-n, --name [name]", descriptions.name, { default: !1 }).option("-m, --model [model]", "The model this resource is for", { default: !1 }).option("-c, --collection", "Create a collection resource", { default: !1 }).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).example("buddy make:resource UserResource").example("buddy make:resource PostResource --model=Post").example("buddy make:resource PostCollection --collection").action(async (name, options) => {
|
|
305
|
-
log.debug("Running `buddy make:resource` ...", options);
|
|
306
|
-
const perf = await intro("buddy make:resource");
|
|
307
|
-
name = name ?? options.name;
|
|
308
|
-
options.name = name;
|
|
309
|
-
if (!name) {
|
|
310
|
-
log.error("You need to specify a resource name.");
|
|
311
|
-
log.info("Example: buddy make:resource UserResource");
|
|
312
|
-
process.exit(ExitCode.FatalError);
|
|
313
|
-
}
|
|
314
|
-
if (!await makeResource(options)) {
|
|
315
|
-
await outro("While running the make:resource command, there was an issue", {
|
|
316
|
-
startTime: perf,
|
|
317
|
-
useSeconds: !0
|
|
318
|
-
});
|
|
319
|
-
process.exit(ExitCode.FatalError);
|
|
320
|
-
}
|
|
321
|
-
await outro(`Created your ${italic(name)} resource.`, {
|
|
322
|
-
startTime: perf,
|
|
323
|
-
useSeconds: !0
|
|
324
|
-
});
|
|
325
|
-
process.exit(ExitCode.Success);
|
|
326
|
-
});
|
|
327
|
-
buddy.command("make:queue-table", descriptions.migration).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (options) => {
|
|
328
|
-
log.debug("Running `buddy make queue:table` ...", options);
|
|
329
|
-
await makeQueueTable();
|
|
330
|
-
});
|
|
331
|
-
buddy.command("make:stack [name]", descriptions.stack).option("-n, --name [name]", descriptions.name, { default: !1 }).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (name, options) => {
|
|
332
|
-
log.debug("Running `buddy make:stack` ...", options);
|
|
333
|
-
name = name ?? options.name;
|
|
334
|
-
options.name = name;
|
|
335
|
-
if (!name) {
|
|
336
|
-
log.error("You need to specify a name. Read more about the documentation here.");
|
|
337
|
-
process.exit(ExitCode.FatalError);
|
|
338
|
-
}
|
|
339
|
-
await makeStack(options);
|
|
340
|
-
});
|
|
341
|
-
buddy.command("make:view [name]", descriptions.page).alias("make:page [name]").option("-n, --name [name]", descriptions.name, { default: !1 }).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (name, options) => {
|
|
342
|
-
log.debug("Running `buddy make:view` ...", options);
|
|
343
|
-
name = name ?? options.name;
|
|
344
|
-
options.name = name;
|
|
345
|
-
if (!name) {
|
|
346
|
-
log.error("You need to specify a name. Read more about the documentation here.");
|
|
347
|
-
process.exit(ExitCode.FatalError);
|
|
348
|
-
}
|
|
349
|
-
await makePage(options);
|
|
350
|
-
});
|
|
351
|
-
buddy.command("make:job [name]", descriptions.job).option("-n, --name [name]", descriptions.name, { default: !1 }).option("-q, --queue [queue]", "The queue to dispatch to", { default: "default" }).option("-c, --class", "Create a class-based job", { default: !1 }).option("-t, --tries [tries]", "Number of retry attempts", { default: 3 }).option("-b, --backoff [backoff]", "Backoff delay in seconds", { default: 3 }).option("-p, --project [project]", descriptions.project, { default: !1 }).option("--verbose", descriptions.verbose, { default: !1 }).action(async (name, options) => {
|
|
352
|
-
log.debug("Running `buddy make:job` ...", options);
|
|
353
|
-
const perf = await intro("buddy make:job");
|
|
354
|
-
name = name ?? options.name;
|
|
355
|
-
options.name = name;
|
|
356
|
-
if (!name) {
|
|
357
|
-
log.error("You need to specify a job name.");
|
|
358
|
-
log.info("Example: buddy make:job SendWelcomeEmail");
|
|
359
|
-
process.exit(ExitCode.FatalError);
|
|
360
|
-
}
|
|
361
|
-
if (!await makeJob(options)) {
|
|
362
|
-
await outro("While running the make:job command, there was an issue", {
|
|
363
|
-
startTime: perf,
|
|
364
|
-
useSeconds: !0
|
|
365
|
-
});
|
|
366
|
-
process.exit(ExitCode.FatalError);
|
|
367
|
-
}
|
|
368
|
-
await outro(`Created your ${italic(name)} job.`, {
|
|
369
|
-
startTime: perf,
|
|
370
|
-
useSeconds: !0
|
|
371
|
-
});
|
|
372
|
-
process.exit(ExitCode.Success);
|
|
373
|
-
});
|
|
374
|
-
onUnknownSubcommand(buddy, "make");
|
|
375
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { writeFile } from "node:fs/promises";
|
|
3
|
-
import { join, resolve } from "node:path";
|
|
4
|
-
import process from "node:process";
|
|
5
|
-
import { log, onUnknownSubcommand } from "@stacksjs/cli";
|
|
6
|
-
import { ExitCode } from "@stacksjs/types";
|
|
7
|
-
import { DRIVERS, renderReport, runMigrator } from "../migrators";
|
|
8
|
-
export function migrateProject(buddy) {
|
|
9
|
-
buddy.command("migrate:project [target]", "Port an existing project (Laravel, Rails) into a Stacks project.").option("--from <framework>", `Source framework \u2014 one of: ${Object.keys(DRIVERS).join(", ")}`, { default: "laravel" }).option("--source <path>", "Path to the existing source project. Defaults to the current working directory.", { default: !1 }).option("--dry-run", "Show what would be translated without writing files.", { default: !1 }).option("--verbose", "Print the per-entry table after the summary.", { default: !1 }).action(async (target, options) => {
|
|
10
|
-
const from = options.from ?? "laravel";
|
|
11
|
-
if (!(from in DRIVERS)) {
|
|
12
|
-
log.error(`Unknown source framework: '${from}'. Supported: ${Object.keys(DRIVERS).join(", ")}.`);
|
|
13
|
-
process.exit(ExitCode.FatalError);
|
|
14
|
-
}
|
|
15
|
-
const sourcePath = options.source ? resolve(process.cwd(), String(options.source)) : process.cwd();
|
|
16
|
-
if (!existsSync(sourcePath)) {
|
|
17
|
-
log.error(`Source project not found: ${sourcePath}`);
|
|
18
|
-
process.exit(ExitCode.FatalError);
|
|
19
|
-
}
|
|
20
|
-
const targetPath = target ? resolve(process.cwd(), target) : process.cwd();
|
|
21
|
-
log.info(`Migrating ${from} project: ${sourcePath} \u2192 ${targetPath}`);
|
|
22
|
-
if (options.dryRun)
|
|
23
|
-
log.info("(dry run \u2014 no files will be written)");
|
|
24
|
-
try {
|
|
25
|
-
const report = await runMigrator({
|
|
26
|
-
source: sourcePath,
|
|
27
|
-
target: targetPath,
|
|
28
|
-
from,
|
|
29
|
-
dryRun: options.dryRun === !0
|
|
30
|
-
}), translated = report.entries.filter((e) => e.status === "translated").length, copied = report.entries.filter((e) => e.status === "copied").length, skipped = report.entries.filter((e) => e.status === "skipped").length, failed = report.entries.filter((e) => e.status === "failed").length;
|
|
31
|
-
log.info(`Translated: ${translated} | Copied: ${copied} | Skipped: ${skipped} | Failed: ${failed}`);
|
|
32
|
-
if (options.verbose)
|
|
33
|
-
for (const e of report.entries) {
|
|
34
|
-
const arrow = e.target ? ` \u2192 ${e.target}` : "", note = e.note ? ` \u2014 ${e.note}` : "";
|
|
35
|
-
log.info(` [${e.status}] ${e.source}${arrow}${note}`);
|
|
36
|
-
}
|
|
37
|
-
if (!options.dryRun) {
|
|
38
|
-
const reportPath = join(targetPath, "MIGRATION_REPORT.md");
|
|
39
|
-
await writeFile(reportPath, renderReport(report));
|
|
40
|
-
log.success(`Report written to ${reportPath}`);
|
|
41
|
-
}
|
|
42
|
-
process.exit(ExitCode.Success);
|
|
43
|
-
} catch (err) {
|
|
44
|
-
log.error(`Migration failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
45
|
-
process.exit(ExitCode.FatalError);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
onUnknownSubcommand(buddy, "migrate:project");
|
|
49
|
-
}
|