@tonk/cli 0.3.2 → 0.4.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 +15 -200
- package/bin/tonk.js +36 -1
- package/package.json +24 -86
- package/dist/commands/auth.d.ts +0 -3
- package/dist/commands/auth.d.ts.map +0 -1
- package/dist/commands/auth.js +0 -184
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/create.d.ts +0 -3
- package/dist/commands/create.d.ts.map +0 -1
- package/dist/commands/create.js +0 -55
- package/dist/commands/create.js.map +0 -1
- package/dist/commands/delete.d.ts +0 -3
- package/dist/commands/delete.d.ts.map +0 -1
- package/dist/commands/delete.js +0 -67
- package/dist/commands/delete.js.map +0 -1
- package/dist/commands/deploy.d.ts +0 -3
- package/dist/commands/deploy.d.ts.map +0 -1
- package/dist/commands/deploy.js +0 -336
- package/dist/commands/deploy.js.map +0 -1
- package/dist/commands/hello/index.d.ts +0 -3
- package/dist/commands/hello/index.d.ts.map +0 -1
- package/dist/commands/hello/index.js +0 -296
- package/dist/commands/hello/index.js.map +0 -1
- package/dist/commands/hello.d.ts +0 -3
- package/dist/commands/hello.d.ts.map +0 -1
- package/dist/commands/hello.js +0 -83
- package/dist/commands/hello.js.map +0 -1
- package/dist/commands/init.d.ts +0 -3
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -137
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/kill.d.ts +0 -3
- package/dist/commands/kill.d.ts.map +0 -1
- package/dist/commands/kill.js +0 -66
- package/dist/commands/kill.js.map +0 -1
- package/dist/commands/ls.d.ts +0 -3
- package/dist/commands/ls.d.ts.map +0 -1
- package/dist/commands/ls.js +0 -52
- package/dist/commands/ls.js.map +0 -1
- package/dist/commands/proxy.d.ts +0 -3
- package/dist/commands/proxy.d.ts.map +0 -1
- package/dist/commands/proxy.js +0 -86
- package/dist/commands/proxy.js.map +0 -1
- package/dist/commands/ps.d.ts +0 -3
- package/dist/commands/ps.d.ts.map +0 -1
- package/dist/commands/ps.js +0 -56
- package/dist/commands/ps.js.map +0 -1
- package/dist/commands/push.d.ts +0 -3
- package/dist/commands/push.d.ts.map +0 -1
- package/dist/commands/push.js +0 -238
- package/dist/commands/push.js.map +0 -1
- package/dist/commands/server.d.ts +0 -3
- package/dist/commands/server.d.ts.map +0 -1
- package/dist/commands/server.js +0 -619
- package/dist/commands/server.js.map +0 -1
- package/dist/commands/start.d.ts +0 -3
- package/dist/commands/start.d.ts.map +0 -1
- package/dist/commands/start.js +0 -82
- package/dist/commands/start.js.map +0 -1
- package/dist/commands/worker/commands.d.ts +0 -42
- package/dist/commands/worker/commands.d.ts.map +0 -1
- package/dist/commands/worker/commands.js +0 -968
- package/dist/commands/worker/commands.js.map +0 -1
- package/dist/commands/worker/index.d.ts +0 -7
- package/dist/commands/worker/index.d.ts.map +0 -1
- package/dist/commands/worker/index.js +0 -30
- package/dist/commands/worker/index.js.map +0 -1
- package/dist/commands/worker/utils/config.d.ts +0 -26
- package/dist/commands/worker/utils/config.d.ts.map +0 -1
- package/dist/commands/worker/utils/config.js +0 -197
- package/dist/commands/worker/utils/config.js.map +0 -1
- package/dist/commands/worker/utils/display.d.ts +0 -6
- package/dist/commands/worker/utils/display.d.ts.map +0 -1
- package/dist/commands/worker/utils/display.js +0 -32
- package/dist/commands/worker/utils/display.js.map +0 -1
- package/dist/commands/worker/utils/finder.d.ts +0 -12
- package/dist/commands/worker/utils/finder.d.ts.map +0 -1
- package/dist/commands/worker/utils/finder.js +0 -60
- package/dist/commands/worker/utils/finder.js.map +0 -1
- package/dist/config/environment.d.ts +0 -52
- package/dist/config/environment.d.ts.map +0 -1
- package/dist/config/environment.js +0 -83
- package/dist/config/environment.js.map +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -3
- package/dist/index.js.map +0 -1
- package/dist/lib/tonkAuth.d.ts +0 -21
- package/dist/lib/tonkAuth.d.ts.map +0 -1
- package/dist/lib/tonkAuth.js +0 -140
- package/dist/lib/tonkAuth.js.map +0 -1
- package/dist/lib/workerManager.d.ts +0 -60
- package/dist/lib/workerManager.d.ts.map +0 -1
- package/dist/lib/workerManager.js +0 -417
- package/dist/lib/workerManager.js.map +0 -1
- package/dist/scripts/aws/create-key.sh +0 -20
- package/dist/scripts/aws/ec2-dns.sh +0 -20
- package/dist/scripts/aws/provision.sh +0 -93
- package/dist/tonk.d.ts +0 -2
- package/dist/tonk.d.ts.map +0 -1
- package/dist/tonk.js +0 -106
- package/dist/tonk.js.map +0 -1
- package/dist/types/worker.d.ts +0 -161
- package/dist/types/worker.d.ts.map +0 -1
- package/dist/types/worker.js +0 -7
- package/dist/types/worker.js.map +0 -1
- package/dist/types/workerConfig.d.ts +0 -164
- package/dist/types/workerConfig.d.ts.map +0 -1
- package/dist/types/workerConfig.js +0 -80
- package/dist/types/workerConfig.js.map +0 -1
- package/dist/utils/analytics.d.ts +0 -26
- package/dist/utils/analytics.d.ts.map +0 -1
- package/dist/utils/analytics.js +0 -218
- package/dist/utils/analytics.js.map +0 -1
- package/dist/utils/messages.d.ts +0 -6
- package/dist/utils/messages.d.ts.map +0 -1
- package/dist/utils/messages.js +0 -18
- package/dist/utils/messages.js.map +0 -1
- package/dist/utils/serverUtils.d.ts +0 -5
- package/dist/utils/serverUtils.d.ts.map +0 -1
- package/dist/utils/serverUtils.js +0 -34
- package/dist/utils/serverUtils.js.map +0 -1
- package/dist/utils/version.d.ts +0 -2
- package/dist/utils/version.d.ts.map +0 -1
- package/dist/utils/version.js +0 -3
- package/dist/utils/version.js.map +0 -1
- package/scripts/aws/create-key.sh +0 -20
- package/scripts/aws/ec2-dns.sh +0 -20
- package/scripts/aws/provision.sh +0 -93
package/dist/commands/start.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import fetch from 'node-fetch';
|
|
4
|
-
import { trackCommand, trackCommandError, trackCommandSuccess, shutdownAnalytics, } from '../utils/analytics.js';
|
|
5
|
-
import { getServerConfig } from '../config/environment.js';
|
|
6
|
-
export const startCommand = new Command('start')
|
|
7
|
-
.description('Start a bundle on a route')
|
|
8
|
-
.option('-u, --url <url>', 'URL of the Tonk server', getServerConfig().defaultUrl)
|
|
9
|
-
.option('-r, --route <route>', 'Route path for the bundle (defaults to /bundleName)')
|
|
10
|
-
.option('-p, --port <port>', 'Port for the bundle server (legacy option, prefer --route)')
|
|
11
|
-
.argument('<bundleName>', 'Name of the bundle to start')
|
|
12
|
-
.action(async (bundleName, options) => {
|
|
13
|
-
const startTime = Date.now();
|
|
14
|
-
const serverUrl = options.url;
|
|
15
|
-
try {
|
|
16
|
-
trackCommand('start', {
|
|
17
|
-
bundleName,
|
|
18
|
-
serverUrl,
|
|
19
|
-
route: options.route,
|
|
20
|
-
port: options.port,
|
|
21
|
-
});
|
|
22
|
-
console.log(chalk.blue(`Starting bundle ${bundleName}...`));
|
|
23
|
-
const requestBody = {
|
|
24
|
-
bundleName,
|
|
25
|
-
};
|
|
26
|
-
// Prefer route over port
|
|
27
|
-
if (options.route) {
|
|
28
|
-
requestBody.route = options.route;
|
|
29
|
-
}
|
|
30
|
-
else if (options.port) {
|
|
31
|
-
requestBody.port = parseInt(options.port, 10);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
// Default to route-based deployment
|
|
35
|
-
requestBody.route = `/${bundleName}`;
|
|
36
|
-
}
|
|
37
|
-
const response = await fetch(`${serverUrl}/start`, {
|
|
38
|
-
method: 'POST',
|
|
39
|
-
headers: {
|
|
40
|
-
'Content-Type': 'application/json',
|
|
41
|
-
},
|
|
42
|
-
body: JSON.stringify(requestBody),
|
|
43
|
-
});
|
|
44
|
-
if (!response.ok) {
|
|
45
|
-
const errorText = await response.text();
|
|
46
|
-
throw new Error(`Server error: ${errorText}`);
|
|
47
|
-
}
|
|
48
|
-
const result = (await response.json());
|
|
49
|
-
console.log(chalk.green('Bundle started successfully!'));
|
|
50
|
-
console.log(chalk.green(`Server ID: ${result.id}`));
|
|
51
|
-
if (result.route) {
|
|
52
|
-
console.log(chalk.green(`Route: ${result.route}`));
|
|
53
|
-
console.log(chalk.green(`URL: ${result.url || `${serverUrl}${result.route}`}`));
|
|
54
|
-
}
|
|
55
|
-
else if (result.port) {
|
|
56
|
-
// Fallback for legacy port-based deployments
|
|
57
|
-
console.log(chalk.green(`Running on port: ${result.port}`));
|
|
58
|
-
}
|
|
59
|
-
console.log(chalk.green(`Status: ${result.status}`));
|
|
60
|
-
console.log(chalk.blue(`Use 'tonk ps' to see all running bundles`));
|
|
61
|
-
const duration = Date.now() - startTime;
|
|
62
|
-
trackCommandSuccess('start', duration, {
|
|
63
|
-
bundleName,
|
|
64
|
-
serverUrl,
|
|
65
|
-
route: result.route,
|
|
66
|
-
port: result.port,
|
|
67
|
-
serverId: result.id,
|
|
68
|
-
});
|
|
69
|
-
await shutdownAnalytics();
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
const duration = Date.now() - startTime;
|
|
73
|
-
trackCommandError('start', error, duration, {
|
|
74
|
-
bundleName,
|
|
75
|
-
serverUrl,
|
|
76
|
-
});
|
|
77
|
-
console.error(chalk.red(`Error: ${error instanceof Error ? error.message : String(error)}`));
|
|
78
|
-
await shutdownAnalytics();
|
|
79
|
-
process.exitCode = 1;
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
//# sourceMappingURL=start.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC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C,IAAI,CAAC,0CAA0C,CAAC,CAAC,CAAC;QAEpE,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;QACxC,mBAAmB,CAAC,OAAO,EAAE,QAAQ,EAAE;YACrC,UAAU;YACV,SAAS;YACT,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,QAAQ,EAAE,MAAM,CAAC,EAAE;SACpB,CAAC,CAAC;QACH,MAAM,iBAAiB,EAAE,CAAC;IAC5B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;QACxC,iBAAiB,CAAC,OAAO,EAAE,KAAc,EAAE,QAAQ,EAAE;YACnD,UAAU;YACV,SAAS;SACV,CAAC,CAAC;QAEH,OAAO,CAAC,KAAK,CACX,KAAK,CAAC,GAAG,CACP,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACnE,CACF,CAAC;QACF,MAAM,iBAAiB,EAAE,CAAC;QAC1B,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
/**
|
|
3
|
-
* Register the inspect command
|
|
4
|
-
*/
|
|
5
|
-
export declare function registerInspectCommand(workerCommand: Command): void;
|
|
6
|
-
/**
|
|
7
|
-
* Register the list command
|
|
8
|
-
*/
|
|
9
|
-
export declare function registerListCommand(workerCommand: Command): void;
|
|
10
|
-
/**
|
|
11
|
-
* Register the remove command
|
|
12
|
-
*/
|
|
13
|
-
export declare function registerRemoveCommand(workerCommand: Command): void;
|
|
14
|
-
/**
|
|
15
|
-
* Register the ping command
|
|
16
|
-
*/
|
|
17
|
-
export declare function registerPingCommand(workerCommand: Command): void;
|
|
18
|
-
/**
|
|
19
|
-
* Register the start command
|
|
20
|
-
*/
|
|
21
|
-
export declare function registerStartCommand(workerCommand: Command): void;
|
|
22
|
-
/**
|
|
23
|
-
* Register the stop command
|
|
24
|
-
*/
|
|
25
|
-
export declare function registerStopCommand(workerCommand: Command): void;
|
|
26
|
-
/**
|
|
27
|
-
* Register the logs command
|
|
28
|
-
*/
|
|
29
|
-
export declare function registerLogsCommand(workerCommand: Command): void;
|
|
30
|
-
/**
|
|
31
|
-
* Register the register command
|
|
32
|
-
*/
|
|
33
|
-
export declare function registerRegisterCommand(workerCommand: Command): void;
|
|
34
|
-
/**
|
|
35
|
-
* Register the install command
|
|
36
|
-
*/
|
|
37
|
-
export declare function registerInstallCommand(workerCommand: Command): void;
|
|
38
|
-
/**
|
|
39
|
-
* Register the init command
|
|
40
|
-
*/
|
|
41
|
-
export declare function registerInitCommand(workerCommand: Command): void;
|
|
42
|
-
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/commands/worker/commands.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAqBlC;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI,CA0JnE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI,CAsFhE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI,CA6DlE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI,CAqEhE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI,CA2DjE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI,CA2DhE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI,CAkJhE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI,CAgNpE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI,CAyMnE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI,CAqMhE"}
|