@cedarjs/api-server-watch 8.0.0-canary.3601 → 8.0.0-canary.3604
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/bin.js +14 -32
- package/dist/serverManager.d.ts.map +1 -1
- package/dist/serverManager.js +7 -25
- package/package.json +5 -5
package/dist/bin.js
CHANGED
|
@@ -89,13 +89,17 @@ var BuildManager = class {
|
|
|
89
89
|
|
|
90
90
|
// src/serverManager.ts
|
|
91
91
|
import { fork } from "child_process";
|
|
92
|
-
import fs from "node:fs";
|
|
93
92
|
import { createRequire } from "node:module";
|
|
94
93
|
import path from "path";
|
|
95
94
|
import ansis from "ansis";
|
|
96
95
|
import yargs from "yargs";
|
|
97
96
|
import { hideBin } from "yargs/helpers";
|
|
98
|
-
import {
|
|
97
|
+
import {
|
|
98
|
+
getConfig,
|
|
99
|
+
getOTelImportArgs,
|
|
100
|
+
getPaths,
|
|
101
|
+
resolveFile
|
|
102
|
+
} from "@cedarjs/project-config";
|
|
99
103
|
var require2 = createRequire(import.meta.url);
|
|
100
104
|
var argv = yargs(hideBin(process.argv)).option("debugPort", {
|
|
101
105
|
description: "Port on which to expose API server debugger",
|
|
@@ -111,30 +115,8 @@ var ServerManager = class {
|
|
|
111
115
|
httpServerProcess = null;
|
|
112
116
|
async startApiServer() {
|
|
113
117
|
const forkOpts = {
|
|
114
|
-
execArgv: process.execArgv
|
|
118
|
+
execArgv: process.execArgv.concat(getOTelImportArgs())
|
|
115
119
|
};
|
|
116
|
-
if (getConfig().experimental.opentelemetry.enabled) {
|
|
117
|
-
const opentelemetrySDKScriptPath = path.join(
|
|
118
|
-
rwjsPaths.api.dist,
|
|
119
|
-
"opentelemetry.js"
|
|
120
|
-
);
|
|
121
|
-
const opentelemetrySDKScriptPathRelative = path.relative(
|
|
122
|
-
rwjsPaths.base,
|
|
123
|
-
opentelemetrySDKScriptPath
|
|
124
|
-
);
|
|
125
|
-
console.log(
|
|
126
|
-
`Setting up OpenTelemetry using the setup file: ${opentelemetrySDKScriptPathRelative}`
|
|
127
|
-
);
|
|
128
|
-
if (fs.existsSync(opentelemetrySDKScriptPath)) {
|
|
129
|
-
forkOpts.execArgv = forkOpts.execArgv.concat([
|
|
130
|
-
`--require=${opentelemetrySDKScriptPath}`
|
|
131
|
-
]);
|
|
132
|
-
} else {
|
|
133
|
-
console.error(
|
|
134
|
-
`OpenTelemetry setup file does not exist at ${opentelemetrySDKScriptPathRelative}`
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
120
|
const debugPort = argv["debug-port"];
|
|
139
121
|
if (debugPort) {
|
|
140
122
|
forkOpts.execArgv = forkOpts.execArgv.concat([`--inspect=${debugPort}`]);
|
|
@@ -195,7 +177,7 @@ var ServerManager = class {
|
|
|
195
177
|
var serverManager = new ServerManager();
|
|
196
178
|
|
|
197
179
|
// src/watchPaths.ts
|
|
198
|
-
import
|
|
180
|
+
import fs from "node:fs";
|
|
199
181
|
import path2 from "node:path";
|
|
200
182
|
import {
|
|
201
183
|
getDbDir,
|
|
@@ -209,17 +191,17 @@ async function workspacePackagesPaths() {
|
|
|
209
191
|
try {
|
|
210
192
|
const rootPackageJsonPath = path2.join(cedarPaths2.base, "package.json");
|
|
211
193
|
const rootPackageJson = JSON.parse(
|
|
212
|
-
|
|
194
|
+
fs.readFileSync(rootPackageJsonPath, "utf8")
|
|
213
195
|
);
|
|
214
196
|
const hasPackageJsonWorkspaces = Array.isArray(rootPackageJson.workspaces) && rootPackageJson.workspaces.some((w) => w.startsWith("packages/"));
|
|
215
|
-
if (!hasPackageJsonWorkspaces || !
|
|
197
|
+
if (!hasPackageJsonWorkspaces || !fs.existsSync(packagesDir)) {
|
|
216
198
|
return [];
|
|
217
199
|
}
|
|
218
200
|
const globPattern = path2.join(packagesDir, "*").replaceAll("\\", "/");
|
|
219
|
-
const packageDirs = await Array.fromAsync(
|
|
201
|
+
const packageDirs = await Array.fromAsync(fs.promises.glob(globPattern));
|
|
220
202
|
const apiPackageJsonPath = path2.join(cedarPaths2.api.base, "package.json");
|
|
221
203
|
const apiPackageJson = JSON.parse(
|
|
222
|
-
|
|
204
|
+
fs.readFileSync(apiPackageJsonPath, "utf8")
|
|
223
205
|
);
|
|
224
206
|
const deps = {
|
|
225
207
|
...apiPackageJson.dependencies ?? {},
|
|
@@ -234,10 +216,10 @@ async function workspacePackagesPaths() {
|
|
|
234
216
|
}
|
|
235
217
|
for (const packageDir of packageDirs) {
|
|
236
218
|
const packageJsonPath = path2.join(packageDir, "package.json");
|
|
237
|
-
if (!
|
|
219
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
238
220
|
continue;
|
|
239
221
|
}
|
|
240
|
-
const pkgJson = JSON.parse(
|
|
222
|
+
const pkgJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
241
223
|
if (workspaceDepNames.has(pkgJson.name)) {
|
|
242
224
|
packages.push(path2.join(packageDir, "dist"));
|
|
243
225
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverManager.d.ts","sourceRoot":"","sources":["../src/serverManager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serverManager.d.ts","sourceRoot":"","sources":["../src/serverManager.ts"],"names":[],"mappings":"AAiCA,qBAAa,aAAa;IACxB,OAAO,CAAC,iBAAiB,CAA4B;YAEvC,cAAc;IAwCtB,gBAAgB;IAKhB,aAAa;CAmCpB;AAED,eAAO,MAAM,aAAa,eAAsB,CAAA"}
|
package/dist/serverManager.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { fork } from "child_process";
|
|
2
|
-
import fs from "node:fs";
|
|
3
2
|
import { createRequire } from "node:module";
|
|
4
3
|
import path from "path";
|
|
5
4
|
import ansis from "ansis";
|
|
6
5
|
import yargs from "yargs";
|
|
7
6
|
import { hideBin } from "yargs/helpers";
|
|
8
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
getConfig,
|
|
9
|
+
getOTelImportArgs,
|
|
10
|
+
getPaths,
|
|
11
|
+
resolveFile
|
|
12
|
+
} from "@cedarjs/project-config";
|
|
9
13
|
const require2 = createRequire(import.meta.url);
|
|
10
14
|
const argv = yargs(hideBin(process.argv)).option("debugPort", {
|
|
11
15
|
description: "Port on which to expose API server debugger",
|
|
@@ -21,30 +25,8 @@ class ServerManager {
|
|
|
21
25
|
httpServerProcess = null;
|
|
22
26
|
async startApiServer() {
|
|
23
27
|
const forkOpts = {
|
|
24
|
-
execArgv: process.execArgv
|
|
28
|
+
execArgv: process.execArgv.concat(getOTelImportArgs())
|
|
25
29
|
};
|
|
26
|
-
if (getConfig().experimental.opentelemetry.enabled) {
|
|
27
|
-
const opentelemetrySDKScriptPath = path.join(
|
|
28
|
-
rwjsPaths.api.dist,
|
|
29
|
-
"opentelemetry.js"
|
|
30
|
-
);
|
|
31
|
-
const opentelemetrySDKScriptPathRelative = path.relative(
|
|
32
|
-
rwjsPaths.base,
|
|
33
|
-
opentelemetrySDKScriptPath
|
|
34
|
-
);
|
|
35
|
-
console.log(
|
|
36
|
-
`Setting up OpenTelemetry using the setup file: ${opentelemetrySDKScriptPathRelative}`
|
|
37
|
-
);
|
|
38
|
-
if (fs.existsSync(opentelemetrySDKScriptPath)) {
|
|
39
|
-
forkOpts.execArgv = forkOpts.execArgv.concat([
|
|
40
|
-
`--require=${opentelemetrySDKScriptPath}`
|
|
41
|
-
]);
|
|
42
|
-
} else {
|
|
43
|
-
console.error(
|
|
44
|
-
`OpenTelemetry setup file does not exist at ${opentelemetrySDKScriptPathRelative}`
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
30
|
const debugPort = argv["debug-port"];
|
|
49
31
|
if (debugPort) {
|
|
50
32
|
forkOpts.execArgv = forkOpts.execArgv.concat([`--inspect=${debugPort}`]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/api-server-watch",
|
|
3
|
-
"version": "8.0.0-canary.
|
|
3
|
+
"version": "8.0.0-canary.3604",
|
|
4
4
|
"description": "CedarJS's dev-time watcher that rebuilds and restarts the api server on change",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
"test:watch": "vitest watch"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@cedarjs/api-server": "8.0.0-canary.
|
|
32
|
-
"@cedarjs/internal": "8.0.0-canary.
|
|
33
|
-
"@cedarjs/project-config": "8.0.0-canary.
|
|
31
|
+
"@cedarjs/api-server": "8.0.0-canary.3604",
|
|
32
|
+
"@cedarjs/internal": "8.0.0-canary.3604",
|
|
33
|
+
"@cedarjs/project-config": "8.0.0-canary.3604",
|
|
34
34
|
"ansis": "4.4.0",
|
|
35
35
|
"chokidar": "3.6.0",
|
|
36
36
|
"dotenv-defaults": "5.0.2",
|
|
37
37
|
"yargs": "18.2.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@cedarjs/framework-tools": "8.0.0-canary.
|
|
40
|
+
"@cedarjs/framework-tools": "8.0.0-canary.3604",
|
|
41
41
|
"@types/dotenv-defaults": "^5.0.0",
|
|
42
42
|
"@types/yargs": "17.0.35",
|
|
43
43
|
"typescript": "5.9.3",
|