bakit 2.1.0 → 2.1.2
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/cli.js +14 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +8 -6
package/dist/cli.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
3
3
|
import { fork } from 'child_process';
|
|
4
4
|
import { config } from 'dotenv';
|
|
5
5
|
import { program } from 'commander';
|
|
6
6
|
import glob from 'tiny-glob';
|
|
7
|
-
import {
|
|
7
|
+
import { startServiceServer } from '@bakit/service';
|
|
8
8
|
|
|
9
9
|
// package.json
|
|
10
10
|
var package_default = {
|
|
11
11
|
name: "bakit",
|
|
12
|
-
version: "2.1.
|
|
12
|
+
version: "2.1.2"};
|
|
13
13
|
|
|
14
14
|
// src/lib/cli/index.ts
|
|
15
15
|
config();
|
|
@@ -38,11 +38,13 @@ async function runSupervisor(names = []) {
|
|
|
38
38
|
function spawnServices(services) {
|
|
39
39
|
let children = [];
|
|
40
40
|
process.on("SIGINT", shutdown), process.on("SIGTERM", shutdown);
|
|
41
|
+
let hasTSX = hasPackage("tsx");
|
|
41
42
|
for (let service of services) {
|
|
42
43
|
let child = fork(cliPath, ["start", service.name], {
|
|
43
44
|
env: {
|
|
44
45
|
...process.env,
|
|
45
|
-
BAKIT_SERVICE_NAME: service.name
|
|
46
|
+
BAKIT_SERVICE_NAME: service.name,
|
|
47
|
+
NODE_OPTIONS: hasTSX ? "--import tsx" : void 0
|
|
46
48
|
},
|
|
47
49
|
stdio: "inherit"
|
|
48
50
|
});
|
|
@@ -66,8 +68,12 @@ async function loadServices() {
|
|
|
66
68
|
}
|
|
67
69
|
async function runServiceWorker(name) {
|
|
68
70
|
let service = (await loadServices()).find((s) => s.name === name);
|
|
69
|
-
service || (console.error(`Service "${name}" not found.`), process.exit(1)), await
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
service || (console.error(`Service "${name}" not found.`), process.exit(1)), await startServiceServer(service), console.log(`Service "${name}" started as server`);
|
|
72
|
+
}
|
|
73
|
+
function hasPackage(name) {
|
|
74
|
+
try {
|
|
75
|
+
return import.meta.resolve(name), !0;
|
|
76
|
+
} catch {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
73
79
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { DEFAULT_GATEWAY_MANAGER_OPTIONS, DEFAULT_WORKER_PATH, GatewayManager, GatewayManagerEvents, GatewayManagerOptions, GatewayWorker, GatewayWorkerEvents, GatewayWorkerOptions, GatewayWorkerState, createGatewayManager, createWorker } from '@bakit/gateway';
|
|
2
|
-
export { REST, RESTEndpoint, RESTEvents, RESTMethod, RESTOptions,
|
|
2
|
+
export { REST, RESTEndpoint, RESTEvents, RESTMethod, RESTOptions, createREST } from '@bakit/rest';
|
|
3
3
|
export { Awaitable, Collection, EventBus, EventMap, FunctionLike, Promisify, PromisifyValue, Queue, QueueOptions, ReadonlyCollection, RejectFn, ResolveFn, attachEventBus, capitalize, createEventBus, createQueue, isPlainObject, isPromiseLike, promisify, sleep } from '@bakit/utils';
|
|
4
4
|
export { RPCError, RPCErrorPayload, RPCHandler, RPCRequestMessage, RPCResponseMessage, Serializable, Service, ServiceFunction, ServiceOptions, TransportClient, TransportClientOptions, TransportDriver, TransportServer, TransportServerOptions, createIPCClient, createIPCServer, createService, createTransportClient, createTransportServer, deserializeRPCError, getIPCPath, serializeRPCError } from '@bakit/service';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { DEFAULT_GATEWAY_MANAGER_OPTIONS, DEFAULT_WORKER_PATH, createGatewayManager, createWorker } from '@bakit/gateway';
|
|
2
|
-
export { createREST
|
|
2
|
+
export { createREST } from '@bakit/rest';
|
|
3
3
|
export { Collection, attachEventBus, capitalize, createEventBus, createQueue, isPlainObject, isPromiseLike, promisify, sleep } from '@bakit/utils';
|
|
4
4
|
export { RPCError, createIPCClient, createIPCServer, createService, createTransportClient, createTransportServer, deserializeRPCError, getIPCPath, serializeRPCError } from '@bakit/service';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bakit",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "A framework for discordeno",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -31,16 +31,18 @@
|
|
|
31
31
|
],
|
|
32
32
|
"author": "louiszn",
|
|
33
33
|
"license": "MIT",
|
|
34
|
+
"optionalDependencies": {
|
|
35
|
+
"tsx": "^4.21.0"
|
|
36
|
+
},
|
|
34
37
|
"dependencies": {
|
|
35
38
|
"commander": "^14.0.2",
|
|
36
39
|
"dotenv": "^17.2.3",
|
|
37
40
|
"tiny-glob": "^0.2.9",
|
|
38
|
-
"tsx": "^4.21.0",
|
|
39
41
|
"type-fest": "^4.41.0",
|
|
40
|
-
"@bakit/
|
|
41
|
-
"@bakit/
|
|
42
|
-
"@bakit/
|
|
43
|
-
"@bakit/
|
|
42
|
+
"@bakit/gateway": "^2.1.4",
|
|
43
|
+
"@bakit/service": "^3.2.1",
|
|
44
|
+
"@bakit/rest": "^2.1.0",
|
|
45
|
+
"@bakit/utils": "^2.0.0"
|
|
44
46
|
},
|
|
45
47
|
"scripts": {
|
|
46
48
|
"build": "tsup",
|