syncast-cli 0.1.0
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 +48 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +80 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +57 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# syncast-cli
|
|
2
|
+
|
|
3
|
+
Syncast CLI tool.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 两个包名都可以使用
|
|
9
|
+
npm install -g syncast-cli
|
|
10
|
+
npm install -g @syncast/cli
|
|
11
|
+
|
|
12
|
+
# or with pnpm
|
|
13
|
+
pnpm add -g syncast-cli
|
|
14
|
+
pnpm add -g @syncast/cli
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Start the server
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx syncast-cli start
|
|
23
|
+
# or with options
|
|
24
|
+
npx syncast-cli start --port 3456 --host localhost
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Check status
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx syncast-cli status
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Development
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Install dependencies
|
|
37
|
+
pnpm install
|
|
38
|
+
|
|
39
|
+
# Build
|
|
40
|
+
pnpm build
|
|
41
|
+
|
|
42
|
+
# Watch mode
|
|
43
|
+
pnpm dev
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## License
|
|
47
|
+
|
|
48
|
+
MIT
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
const program = new Command();
|
|
4
|
+
program.name("syncast-cli").description("Syncast CLI tool").version("0.1.0");
|
|
5
|
+
program.command("start").description("Start the Syncast server").option("-p, --port <port>", "Port to listen on", "3456").option("-h, --host <host>", "Host to bind to", "localhost").action(async (options)=>{
|
|
6
|
+
const port = Number.parseInt(options.port, 10);
|
|
7
|
+
const host = options.host;
|
|
8
|
+
console.log("🔧 Syncast CLI");
|
|
9
|
+
console.log(" Version: 0.1.0");
|
|
10
|
+
console.log(` Port: ${port}`);
|
|
11
|
+
console.log(` Host: ${host}`);
|
|
12
|
+
console.log("");
|
|
13
|
+
const server = await createServer({
|
|
14
|
+
port,
|
|
15
|
+
host
|
|
16
|
+
});
|
|
17
|
+
await server.start();
|
|
18
|
+
process.on("SIGINT", async ()=>{
|
|
19
|
+
console.log("\n");
|
|
20
|
+
await server.stop();
|
|
21
|
+
process.exit(0);
|
|
22
|
+
});
|
|
23
|
+
process.on("SIGTERM", async ()=>{
|
|
24
|
+
await server.stop();
|
|
25
|
+
process.exit(0);
|
|
26
|
+
});
|
|
27
|
+
await new Promise(()=>{});
|
|
28
|
+
});
|
|
29
|
+
program.command("status").description("Check the status of Syncast server").action(()=>{
|
|
30
|
+
console.log("📊 Checking Syncast server status...");
|
|
31
|
+
});
|
|
32
|
+
async function runCli(args = process.argv) {
|
|
33
|
+
await program.parseAsync(args);
|
|
34
|
+
}
|
|
35
|
+
runCli();
|
|
36
|
+
async function createServer(options = {}) {
|
|
37
|
+
const { port = 3456, host = "localhost" } = options;
|
|
38
|
+
return {
|
|
39
|
+
async start () {
|
|
40
|
+
console.log(`🚀 Syncast server starting on ${host}:${port}`);
|
|
41
|
+
},
|
|
42
|
+
async stop () {
|
|
43
|
+
console.log("🛑 Syncast server stopped");
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const cli_program = new Command();
|
|
48
|
+
cli_program.name("syncast-cli").description("Syncast CLI tool").version("0.1.0");
|
|
49
|
+
cli_program.command("start").description("Start the Syncast server").option("-p, --port <port>", "Port to listen on", "3456").option("-h, --host <host>", "Host to bind to", "localhost").action(async (options)=>{
|
|
50
|
+
const port = Number.parseInt(options.port, 10);
|
|
51
|
+
const host = options.host;
|
|
52
|
+
console.log("🔧 Syncast CLI");
|
|
53
|
+
console.log(" Version: 0.1.0");
|
|
54
|
+
console.log(` Port: ${port}`);
|
|
55
|
+
console.log(` Host: ${host}`);
|
|
56
|
+
console.log("");
|
|
57
|
+
const server = await createServer({
|
|
58
|
+
port,
|
|
59
|
+
host
|
|
60
|
+
});
|
|
61
|
+
await server.start();
|
|
62
|
+
process.on("SIGINT", async ()=>{
|
|
63
|
+
console.log("\n");
|
|
64
|
+
await server.stop();
|
|
65
|
+
process.exit(0);
|
|
66
|
+
});
|
|
67
|
+
process.on("SIGTERM", async ()=>{
|
|
68
|
+
await server.stop();
|
|
69
|
+
process.exit(0);
|
|
70
|
+
});
|
|
71
|
+
await new Promise(()=>{});
|
|
72
|
+
});
|
|
73
|
+
cli_program.command("status").description("Check the status of Syncast server").action(()=>{
|
|
74
|
+
console.log("📊 Checking Syncast server status...");
|
|
75
|
+
});
|
|
76
|
+
async function cli_runCli(args = process.argv) {
|
|
77
|
+
await cli_program.parseAsync(args);
|
|
78
|
+
}
|
|
79
|
+
cli_runCli();
|
|
80
|
+
export { cli_runCli as runCli };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Syncast CLI - Main library exports
|
|
3
|
+
*/
|
|
4
|
+
export interface ServerOptions {
|
|
5
|
+
port?: number;
|
|
6
|
+
host?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface Server {
|
|
9
|
+
start(): Promise<void>;
|
|
10
|
+
stop(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare function createServer(options?: ServerOptions): Promise<Server>;
|
|
13
|
+
export { runCli } from "./cli.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
async function createServer(options = {}) {
|
|
3
|
+
const { port = 3456, host = "localhost" } = options;
|
|
4
|
+
return {
|
|
5
|
+
async start () {
|
|
6
|
+
console.log(`🚀 Syncast server starting on ${host}:${port}`);
|
|
7
|
+
},
|
|
8
|
+
async stop () {
|
|
9
|
+
console.log("🛑 Syncast server stopped");
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const program = new Command();
|
|
14
|
+
program.name("syncast-cli").description("Syncast CLI tool").version("0.1.0");
|
|
15
|
+
program.command("start").description("Start the Syncast server").option("-p, --port <port>", "Port to listen on", "3456").option("-h, --host <host>", "Host to bind to", "localhost").action(async (options)=>{
|
|
16
|
+
const port = Number.parseInt(options.port, 10);
|
|
17
|
+
const host = options.host;
|
|
18
|
+
console.log("🔧 Syncast CLI");
|
|
19
|
+
console.log(" Version: 0.1.0");
|
|
20
|
+
console.log(` Port: ${port}`);
|
|
21
|
+
console.log(` Host: ${host}`);
|
|
22
|
+
console.log("");
|
|
23
|
+
const server = await createServer({
|
|
24
|
+
port,
|
|
25
|
+
host
|
|
26
|
+
});
|
|
27
|
+
await server.start();
|
|
28
|
+
process.on("SIGINT", async ()=>{
|
|
29
|
+
console.log("\n");
|
|
30
|
+
await server.stop();
|
|
31
|
+
process.exit(0);
|
|
32
|
+
});
|
|
33
|
+
process.on("SIGTERM", async ()=>{
|
|
34
|
+
await server.stop();
|
|
35
|
+
process.exit(0);
|
|
36
|
+
});
|
|
37
|
+
await new Promise(()=>{});
|
|
38
|
+
});
|
|
39
|
+
program.command("status").description("Check the status of Syncast server").action(()=>{
|
|
40
|
+
console.log("📊 Checking Syncast server status...");
|
|
41
|
+
});
|
|
42
|
+
async function runCli(args = process.argv) {
|
|
43
|
+
await program.parseAsync(args);
|
|
44
|
+
}
|
|
45
|
+
runCli();
|
|
46
|
+
async function src_createServer(options = {}) {
|
|
47
|
+
const { port = 3456, host = "localhost" } = options;
|
|
48
|
+
return {
|
|
49
|
+
async start () {
|
|
50
|
+
console.log(`🚀 Syncast server starting on ${host}:${port}`);
|
|
51
|
+
},
|
|
52
|
+
async stop () {
|
|
53
|
+
console.log("🛑 Syncast server stopped");
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export { src_createServer as createServer, runCli };
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "syncast-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Syncast CLI tool",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"bin": {
|
|
10
|
+
"syncast-cli": "./dist/cli.js"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "rslib build",
|
|
23
|
+
"dev": "rslib build --watch",
|
|
24
|
+
"check": "biome check --write",
|
|
25
|
+
"format": "biome format --write",
|
|
26
|
+
"prepublishOnly": "pnpm build"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"syncast",
|
|
30
|
+
"cli"
|
|
31
|
+
],
|
|
32
|
+
"author": "",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"commander": "^13.1.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@biomejs/biome": "2.3.2",
|
|
39
|
+
"@rslib/core": "^0.15.0",
|
|
40
|
+
"@types/node": "^22.18.6",
|
|
41
|
+
"typescript": "^5.9.2"
|
|
42
|
+
}
|
|
43
|
+
}
|