@syedar/seedar-cli 1.2.0-test.11 → 1.2.0-test.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -19
- package/dist/cli.d.ts +21 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +123 -42
- package/dist/cli.js.map +1 -1
- package/dist/commands/logs.d.ts +1 -0
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +7 -4
- package/dist/commands/logs.js.map +1 -1
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
- package/dist/commands/help.d.ts +0 -2
- package/dist/commands/help.d.ts.map +0 -1
- package/dist/commands/help.js +0 -17
- package/dist/commands/help.js.map +0 -1
- package/dist/shared/args.d.ts +0 -8
- package/dist/shared/args.d.ts.map +0 -1
- package/dist/shared/args.js +0 -40
- package/dist/shared/args.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,39 +1,37 @@
|
|
|
1
1
|
# @syedar/seedar-cli
|
|
2
2
|
|
|
3
|
-
Seedar
|
|
3
|
+
Seedar 生产部署 CLI。
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 安装
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npx @syedar/seedar-cli@latest install
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
或者全局安装:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
npm install -g @syedar/seedar-cli
|
|
15
|
-
seedar
|
|
15
|
+
seedar --help
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## 常用命令
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
|
|
22
|
-
seedar
|
|
23
|
-
|
|
24
|
-
# ?? / ??????
|
|
21
|
+
seedar install [version] [-y]
|
|
22
|
+
seedar update [version]
|
|
25
23
|
seedar start
|
|
26
24
|
seedar stop
|
|
27
|
-
|
|
28
|
-
# ???????
|
|
29
25
|
seedar status
|
|
30
|
-
seedar logs
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
seedar uninstall --remove-data --force
|
|
34
|
-
|
|
35
|
-
# ?????????????? CLI
|
|
36
|
-
seedar uninstall --all --force
|
|
37
|
-
# ?
|
|
26
|
+
seedar logs [service] [-f]
|
|
27
|
+
seedar doctor
|
|
28
|
+
seedar uninstall [--remove-data] [--all] [--force]
|
|
38
29
|
seedar remove --force
|
|
30
|
+
seedar purge --force
|
|
39
31
|
```
|
|
32
|
+
|
|
33
|
+
## 说明
|
|
34
|
+
|
|
35
|
+
- `service` 可选值:`mysql`、`server`、`web`、`migrate`
|
|
36
|
+
- `--help` 和 `help` 都可查看帮助
|
|
37
|
+
- 全局 flag 也可以放在命令前面,例如 `seedar -y install`
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,2 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { doctorCommand } from "./commands/doctor.js";
|
|
3
|
+
import { installCommand } from "./commands/install.js";
|
|
4
|
+
import { logsCommand } from "./commands/logs.js";
|
|
5
|
+
import { purgeCommand, removeAllCommand, uninstallCommand } from "./commands/uninstall.js";
|
|
6
|
+
import { startCommand, stopCommand, updateCommand } from "./commands/lifecycle.js";
|
|
7
|
+
import { statusCommand } from "./commands/status.js";
|
|
8
|
+
export interface CliHandlers {
|
|
9
|
+
install: typeof installCommand;
|
|
10
|
+
start: typeof startCommand;
|
|
11
|
+
stop: typeof stopCommand;
|
|
12
|
+
update: typeof updateCommand;
|
|
13
|
+
uninstall: typeof uninstallCommand;
|
|
14
|
+
removeAll: typeof removeAllCommand;
|
|
15
|
+
purge: typeof purgeCommand;
|
|
16
|
+
status: typeof statusCommand;
|
|
17
|
+
logs: typeof logsCommand;
|
|
18
|
+
doctor: typeof doctorCommand;
|
|
19
|
+
}
|
|
20
|
+
export declare function createProgram(overrides?: Partial<CliHandlers>): Command;
|
|
21
|
+
export declare function main(rawArgs?: string[]): Promise<void>;
|
|
2
22
|
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAqBrD,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,cAAc,CAAC;IAC/B,KAAK,EAAE,OAAO,YAAY,CAAC;IAC3B,IAAI,EAAE,OAAO,WAAW,CAAC;IACzB,MAAM,EAAE,OAAO,aAAa,CAAC;IAC7B,SAAS,EAAE,OAAO,gBAAgB,CAAC;IACnC,SAAS,EAAE,OAAO,gBAAgB,CAAC;IACnC,KAAK,EAAE,OAAO,YAAY,CAAC;IAC3B,MAAM,EAAE,OAAO,aAAa,CAAC;IAC7B,IAAI,EAAE,OAAO,WAAW,CAAC;IACzB,MAAM,EAAE,OAAO,aAAa,CAAC;CAC9B;AA+FD,wBAAgB,aAAa,CAAC,SAAS,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,OAAO,CAgC3E;AAED,wBAAsB,IAAI,CAAC,OAAO,GAAE,MAAM,EAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB1E"}
|
package/dist/cli.js
CHANGED
|
@@ -1,51 +1,132 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { Command, CommanderError } from "commander";
|
|
2
3
|
import { doctorCommand } from "./commands/doctor.js";
|
|
3
|
-
import { printHelp } from "./commands/help.js";
|
|
4
4
|
import { installCommand } from "./commands/install.js";
|
|
5
|
-
import { startCommand, stopCommand, updateCommand } from "./commands/lifecycle.js";
|
|
6
5
|
import { logsCommand } from "./commands/logs.js";
|
|
7
6
|
import { purgeCommand, removeAllCommand, uninstallCommand } from "./commands/uninstall.js";
|
|
7
|
+
import { startCommand, stopCommand, updateCommand } from "./commands/lifecycle.js";
|
|
8
8
|
import { statusCommand } from "./commands/status.js";
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
9
|
+
function readPackageVersion() {
|
|
10
|
+
const packageJsonUrl = new URL("../package.json", import.meta.url);
|
|
11
|
+
const packageJson = JSON.parse(readFileSync(packageJsonUrl, "utf8"));
|
|
12
|
+
return packageJson.version ?? "0.0.0";
|
|
13
|
+
}
|
|
14
|
+
function createDefaultHandlers() {
|
|
15
|
+
return {
|
|
16
|
+
install: installCommand,
|
|
17
|
+
start: startCommand,
|
|
18
|
+
stop: stopCommand,
|
|
19
|
+
update: updateCommand,
|
|
20
|
+
uninstall: uninstallCommand,
|
|
21
|
+
removeAll: removeAllCommand,
|
|
22
|
+
purge: purgeCommand,
|
|
23
|
+
status: statusCommand,
|
|
24
|
+
logs: logsCommand,
|
|
25
|
+
doctor: doctorCommand,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function toCliFlags(options) {
|
|
29
|
+
return {
|
|
30
|
+
yes: Boolean(options.yes),
|
|
31
|
+
force: Boolean(options.force),
|
|
32
|
+
follow: Boolean(options.follow),
|
|
33
|
+
removeData: Boolean(options.removeData),
|
|
34
|
+
all: Boolean(options.all),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function registerCommands(program, handlers) {
|
|
38
|
+
program
|
|
39
|
+
.command("install [version]")
|
|
40
|
+
.description("Install Seedar")
|
|
41
|
+
.action(async function (version) {
|
|
42
|
+
await handlers.install(version, toCliFlags(this.optsWithGlobals()));
|
|
43
|
+
});
|
|
44
|
+
program.command("start").description("Start Seedar services").action(async () => {
|
|
45
|
+
await handlers.start();
|
|
46
|
+
});
|
|
47
|
+
program.command("stop").description("Stop Seedar services").action(async () => {
|
|
48
|
+
await handlers.stop();
|
|
49
|
+
});
|
|
50
|
+
program
|
|
51
|
+
.command("update [version]")
|
|
52
|
+
.description("Update Seedar to a target version")
|
|
53
|
+
.action(async function (version) {
|
|
54
|
+
await handlers.update(version);
|
|
55
|
+
});
|
|
56
|
+
program
|
|
57
|
+
.command("uninstall")
|
|
58
|
+
.description("Uninstall the current Seedar installation")
|
|
59
|
+
.action(async function () {
|
|
60
|
+
await handlers.uninstall(toCliFlags(this.optsWithGlobals()));
|
|
61
|
+
});
|
|
62
|
+
program
|
|
63
|
+
.command("remove")
|
|
64
|
+
.description("Remove the installation and self-uninstall the CLI")
|
|
65
|
+
.action(async function () {
|
|
66
|
+
await handlers.removeAll(toCliFlags(this.optsWithGlobals()));
|
|
67
|
+
});
|
|
68
|
+
program
|
|
69
|
+
.command("purge")
|
|
70
|
+
.description("Purge the installation directory and all data")
|
|
71
|
+
.action(async function () {
|
|
72
|
+
await handlers.purge(toCliFlags(this.optsWithGlobals()));
|
|
73
|
+
});
|
|
74
|
+
program.command("status").description("Show the current installation status").action(async () => {
|
|
75
|
+
await handlers.status();
|
|
76
|
+
});
|
|
77
|
+
program
|
|
78
|
+
.command("logs [service]")
|
|
79
|
+
.description("Show service logs")
|
|
80
|
+
.action(async function (service) {
|
|
81
|
+
await handlers.logs(service, toCliFlags(this.optsWithGlobals()));
|
|
82
|
+
});
|
|
83
|
+
program.command("doctor").description("Run environment health checks").action(async () => {
|
|
84
|
+
await handlers.doctor();
|
|
85
|
+
});
|
|
86
|
+
return program;
|
|
87
|
+
}
|
|
88
|
+
export function createProgram(overrides = {}) {
|
|
89
|
+
const handlers = {
|
|
90
|
+
...createDefaultHandlers(),
|
|
91
|
+
...overrides,
|
|
92
|
+
};
|
|
93
|
+
const program = new Command();
|
|
94
|
+
program
|
|
95
|
+
.name("seedar")
|
|
96
|
+
.description("Seedar deployment CLI")
|
|
97
|
+
.option("-y, --yes", "Use default answers without prompting")
|
|
98
|
+
.option("-f, --follow", "Follow log output")
|
|
99
|
+
.option("--force", "Skip confirmation prompts")
|
|
100
|
+
.option("--remove-data", "Remove local data directory")
|
|
101
|
+
.option("--all", "Remove the installation and self-uninstall the CLI")
|
|
102
|
+
.version(readPackageVersion())
|
|
103
|
+
.addHelpCommand(true)
|
|
104
|
+
.showHelpAfterError("(use --help for usage)")
|
|
105
|
+
.exitOverride();
|
|
106
|
+
program.addHelpText("afterAll", `
|
|
107
|
+
Examples:
|
|
108
|
+
seedar install
|
|
109
|
+
seedar install 1.2.3 -y
|
|
110
|
+
seedar logs server --follow
|
|
111
|
+
seedar uninstall --remove-data --force
|
|
112
|
+
`);
|
|
113
|
+
return registerCommands(program, handlers);
|
|
114
|
+
}
|
|
115
|
+
export async function main(rawArgs = process.argv) {
|
|
116
|
+
const program = createProgram();
|
|
117
|
+
try {
|
|
118
|
+
await program.parseAsync(rawArgs);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
if (error instanceof CommanderError) {
|
|
122
|
+
if (error.code !== "commander.helpDisplayed" && error.code !== "commander.version") {
|
|
123
|
+
process.exitCode = 1;
|
|
124
|
+
}
|
|
46
125
|
return;
|
|
47
|
-
|
|
48
|
-
|
|
126
|
+
}
|
|
127
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
128
|
+
console.error(message);
|
|
129
|
+
process.exitCode = 1;
|
|
49
130
|
}
|
|
50
131
|
}
|
|
51
132
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAkCrD,SAAS,kBAAkB;IACzB,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnE,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CA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AAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAEhC,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,cAAc,EAAE,CAAC;YACpC,IAAI,KAAK,CAAC,IAAI,KAAK,yBAAyB,IAAI,KAAK,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;gBACnF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACvB,CAAC;YACD,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACvB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
|
package/dist/commands/logs.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { CliFlags } from "../shared/types.js";
|
|
2
|
+
export declare function assertValidLogService(serviceArg: string | undefined): void;
|
|
2
3
|
export declare function logsCommand(serviceArg: string | undefined, flags: CliFlags): Promise<void>;
|
|
3
4
|
//# sourceMappingURL=logs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../src/commands/logs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAInD,wBAAsB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../src/commands/logs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAInD,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAI1E;AAED,wBAAsB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAchG"}
|
package/dist/commands/logs.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { VALID_SERVICES } from "../shared/constants.js";
|
|
2
1
|
import { runDockerComposeOrThrow } from "../docker/process.js";
|
|
2
|
+
import { VALID_SERVICES } from "../shared/constants.js";
|
|
3
3
|
import { getRuntimeLayout } from "../runtime/index.js";
|
|
4
4
|
import { requireRuntimeConfig } from "../runtime/guards.js";
|
|
5
|
-
export
|
|
6
|
-
const layout = getRuntimeLayout();
|
|
7
|
-
await requireRuntimeConfig(layout);
|
|
5
|
+
export function assertValidLogService(serviceArg) {
|
|
8
6
|
if (serviceArg && !VALID_SERVICES.includes(serviceArg)) {
|
|
9
7
|
throw new Error(`未知服务 ${serviceArg},可选值: ${VALID_SERVICES.join(", ")}`);
|
|
10
8
|
}
|
|
9
|
+
}
|
|
10
|
+
export async function logsCommand(serviceArg, flags) {
|
|
11
|
+
const layout = getRuntimeLayout();
|
|
12
|
+
assertValidLogService(serviceArg);
|
|
13
|
+
await requireRuntimeConfig(layout);
|
|
11
14
|
const args = ["logs", "--tail", "200"];
|
|
12
15
|
if (flags.follow) {
|
|
13
16
|
args.push("--follow");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../src/commands/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../src/commands/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,UAAU,qBAAqB,CAAC,UAA8B;IAClE,IAAI,UAAU,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,UAA6C,CAAC,EAAE,CAAC;QAC1F,MAAM,IAAI,KAAK,CAAC,QAAQ,UAAU,SAAS,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,UAA8B,EAAE,KAAe;IAC/E,MAAM,MAAM,GAAG,gBAAgB,EAAE,CAAC;IAClC,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAClC,MAAM,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAEnC,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IACvC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACxB,CAAC;IACD,IAAI,UAAU,EAAE,CAAC;QACf,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACxB,CAAC;IAED,MAAM,uBAAuB,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;AACpE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { main } from "./cli.js";
|
|
3
|
-
main(process.argv
|
|
4
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
5
|
-
console.error(message);
|
|
6
|
-
process.exitCode = 1;
|
|
7
|
-
});
|
|
3
|
+
void main(process.argv);
|
|
8
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syedar/seedar-cli",
|
|
3
|
-
"version": "1.2.0-test.
|
|
3
|
+
"version": "1.2.0-test.13",
|
|
4
4
|
"description": "Seedar deployment CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@inquirer/prompts": "^7.10.1",
|
|
18
18
|
"chalk": "^5.6.2",
|
|
19
|
+
"commander": "^13.1.0",
|
|
19
20
|
"ora": "^8.2.0"
|
|
20
21
|
},
|
|
21
22
|
"engines": {
|
|
@@ -24,6 +25,7 @@
|
|
|
24
25
|
"license": "MIT",
|
|
25
26
|
"scripts": {
|
|
26
27
|
"build": "tsc -p tsconfig.json",
|
|
28
|
+
"test": "pnpm run build && node --test test/cli.test.mjs",
|
|
27
29
|
"type-check": "tsc --noEmit -p tsconfig.json"
|
|
28
30
|
}
|
|
29
31
|
}
|
package/dist/commands/help.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,IAAI,IAAI,CAehC"}
|
package/dist/commands/help.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export function printHelp() {
|
|
2
|
-
console.log(`Seedar CLI
|
|
3
|
-
|
|
4
|
-
??:
|
|
5
|
-
seedar install [version]
|
|
6
|
-
seedar start
|
|
7
|
-
seedar stop
|
|
8
|
-
seedar update [version]
|
|
9
|
-
seedar uninstall [--remove-data] [--all] [--force]
|
|
10
|
-
seedar remove --force
|
|
11
|
-
seedar purge --force
|
|
12
|
-
seedar status
|
|
13
|
-
seedar logs [mysql|server|web|migrate] [--follow]
|
|
14
|
-
seedar doctor
|
|
15
|
-
`);
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=help.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,SAAS;IACvB,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;CAab,CAAC,CAAC;AACH,CAAC"}
|
package/dist/shared/args.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/shared/args.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,QAAQ,CAAC;CACjB;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,aAAa,CAyC1D"}
|
package/dist/shared/args.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export function parseArgs(rawArgs) {
|
|
2
|
-
const flags = {
|
|
3
|
-
yes: false,
|
|
4
|
-
force: false,
|
|
5
|
-
follow: false,
|
|
6
|
-
removeData: false,
|
|
7
|
-
all: false,
|
|
8
|
-
};
|
|
9
|
-
const positional = [];
|
|
10
|
-
for (const arg of rawArgs) {
|
|
11
|
-
if (arg === "--yes" || arg === "-y") {
|
|
12
|
-
flags.yes = true;
|
|
13
|
-
continue;
|
|
14
|
-
}
|
|
15
|
-
if (arg === "--force") {
|
|
16
|
-
flags.force = true;
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
|
-
if (arg === "--follow" || arg === "-f") {
|
|
20
|
-
flags.follow = true;
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
if (arg === "--remove-data") {
|
|
24
|
-
flags.removeData = true;
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
if (arg === "--all") {
|
|
28
|
-
flags.all = true;
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
positional.push(arg);
|
|
32
|
-
}
|
|
33
|
-
const [command = "help", ...rest] = positional;
|
|
34
|
-
return {
|
|
35
|
-
command,
|
|
36
|
-
positional: rest,
|
|
37
|
-
flags,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=args.js.map
|
package/dist/shared/args.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/shared/args.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,SAAS,CAAC,OAAiB;IACzC,MAAM,KAAK,GAAa;QACtB,GAAG,EAAE,KAAK;QACV,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,KAAK;QACjB,GAAG,EAAE,KAAK;KACX,CAAC;IACF,MAAM,UAAU,GAAa,EAAE,CAAC;IAEhC,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACpC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC;YACjB,SAAS;QACX,CAAC;QACD,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC;YACnB,SAAS;QACX,CAAC;QACD,IAAI,GAAG,KAAK,UAAU,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACvC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;YACpB,SAAS;QACX,CAAC;QACD,IAAI,GAAG,KAAK,eAAe,EAAE,CAAC;YAC5B,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC;YACxB,SAAS;QACX,CAAC;QACD,IAAI,GAAG,KAAK,OAAO,EAAE,CAAC;YACpB,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC;YACjB,SAAS;QACX,CAAC;QAED,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IAED,MAAM,CAAC,OAAO,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,UAAU,CAAC;IAC/C,OAAO;QACL,OAAO;QACP,UAAU,EAAE,IAAI;QAChB,KAAK;KACN,CAAC;AACJ,CAAC"}
|