@cedarjs/cli 5.0.0-canary.2473 → 5.0.0-canary.2474

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.
@@ -3,6 +3,7 @@ import path from "node:path";
3
3
  import { Writable } from "node:stream";
4
4
  import concurrently from "concurrently";
5
5
  import { recordTelemetryAttributes, colors as c } from "@cedarjs/cli-helpers";
6
+ import { formatRunBinCommand } from "@cedarjs/cli-helpers/packageManager/display";
6
7
  import { shutdownPort } from "@cedarjs/internal/dist/dev";
7
8
  import { generateGqlormArtifacts } from "@cedarjs/internal/dist/generate/gqlormSchema";
8
9
  import { getConfig, getConfigPath } from "@cedarjs/project-config";
@@ -29,20 +30,16 @@ const handler = async ({
29
30
  const cedarPaths = getPaths();
30
31
  const serverFile = serverFileExists();
31
32
  const apiPreferredPort = parseInt(String(getConfig().api.port));
32
- let apiAvailablePort;
33
+ let apiAvailablePort = apiPreferredPort;
33
34
  let apiPortChangeNeeded = false;
34
- if (workspace.includes("api")) {
35
- if (!serverFile) {
36
- apiAvailablePort = await getFreePort(apiPreferredPort);
37
- if (apiAvailablePort === -1) {
38
- exitWithError(void 0, {
39
- message: `Could not determine a free port for the api server`
40
- });
41
- }
42
- apiPortChangeNeeded = apiAvailablePort !== apiPreferredPort;
43
- } else {
44
- apiAvailablePort = apiPreferredPort;
35
+ if (workspace.includes("api") && !serverFile) {
36
+ apiAvailablePort = await getFreePort(apiPreferredPort);
37
+ if (apiAvailablePort === -1) {
38
+ exitWithError(void 0, {
39
+ message: `Could not determine a free port for the api server`
40
+ });
45
41
  }
42
+ apiPortChangeNeeded = apiAvailablePort !== apiPreferredPort;
46
43
  }
47
44
  let webPreferredPort = parseInt(
48
45
  String(getConfig().web.port)
@@ -117,6 +114,11 @@ const handler = async ({
117
114
  }
118
115
  }
119
116
  if (!ud && !serverFile) {
117
+ if (typeof apiAvailablePort === "undefined" || apiAvailablePort === -1) {
118
+ exitWithError(void 0, {
119
+ message: `Could not determine a free port for the api server`
120
+ });
121
+ }
120
122
  try {
121
123
  await shutdownPort(apiAvailablePort);
122
124
  } catch (e) {
@@ -171,7 +173,7 @@ const handler = async ({
171
173
  return null;
172
174
  }
173
175
  return [
174
- `yarn cross-env NODE_ENV=development cedar-unified-dev`,
176
+ `${formatRunBinCommand("cross-env", ["NODE_ENV=development", "cedar-unified-dev"])}`,
175
177
  ` --port ${webAvailablePort}`,
176
178
  ` --apiPort ${apiAvailablePort}`,
177
179
  getApiDebugFlag(apiDebugPort, apiAvailablePort),
@@ -212,15 +214,11 @@ const handler = async ({
212
214
  const cedarConfigPath = getConfigPath();
213
215
  jobs.push({
214
216
  name: "api",
215
- command: [
216
- "yarn nodemon",
217
- " --quiet",
218
- ` --watch "${cedarConfigPath}"`,
219
- ` --exec "yarn ${serverWatchCommand}`,
220
- ` --port ${apiAvailablePort}`,
221
- ` ${getApiDebugFlag(apiDebugPort, apiAvailablePort)}`,
222
- ` | cedar-log-formatter"`
223
- ].join(" ").replace(/\s+/g, " "),
217
+ command: formatRunBinCommand("nodemon", [
218
+ "--quiet",
219
+ `--watch "${cedarConfigPath}"`,
220
+ `--exec "${formatRunBinCommand(serverWatchCommand)} --port ${apiAvailablePort} ${getApiDebugFlag(apiDebugPort, apiAvailablePort)} | ${formatRunBinCommand("cedar-log-formatter")}"`
221
+ ]),
224
222
  env: {
225
223
  NODE_ENV: "development",
226
224
  NODE_OPTIONS: getDevNodeOptions()
@@ -230,9 +228,9 @@ const handler = async ({
230
228
  });
231
229
  }
232
230
  if (workspace.includes("web")) {
233
- let webCommand = `yarn cross-env NODE_ENV=development cedar-vite-dev ${forward}`;
231
+ let webCommand = `${formatRunBinCommand("cross-env", ["NODE_ENV=development", "cedar-vite-dev"])} ${forward}`;
234
232
  if (streamingSsrEnabled) {
235
- webCommand = `yarn cross-env NODE_ENV=development cedar-dev-fe ${forward}`;
233
+ webCommand = `${formatRunBinCommand("cross-env", ["NODE_ENV=development", "cedar-dev-fe"])} ${forward}`;
236
234
  }
237
235
  jobs.push({
238
236
  name: "web",
@@ -246,7 +244,7 @@ const handler = async ({
246
244
  if (generate) {
247
245
  jobs.push({
248
246
  name: "gen",
249
- command: "yarn cedar-gen-watch",
247
+ command: formatRunBinCommand("cedar-gen-watch"),
250
248
  prefixColor: "green"
251
249
  });
252
250
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "5.0.0-canary.2473",
3
+ "version": "5.0.0-canary.2474",
4
4
  "description": "The CedarJS Command Line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,17 +33,17 @@
33
33
  "dependencies": {
34
34
  "@babel/parser": "7.29.3",
35
35
  "@babel/preset-typescript": "7.28.5",
36
- "@cedarjs/api-server": "5.0.0-canary.2473",
37
- "@cedarjs/cli-helpers": "5.0.0-canary.2473",
38
- "@cedarjs/fastify-web": "5.0.0-canary.2473",
39
- "@cedarjs/internal": "5.0.0-canary.2473",
40
- "@cedarjs/prerender": "5.0.0-canary.2473",
41
- "@cedarjs/project-config": "5.0.0-canary.2473",
42
- "@cedarjs/structure": "5.0.0-canary.2473",
43
- "@cedarjs/telemetry": "5.0.0-canary.2473",
44
- "@cedarjs/utils": "5.0.0-canary.2473",
45
- "@cedarjs/vite": "5.0.0-canary.2473",
46
- "@cedarjs/web-server": "5.0.0-canary.2473",
36
+ "@cedarjs/api-server": "5.0.0-canary.2474",
37
+ "@cedarjs/cli-helpers": "5.0.0-canary.2474",
38
+ "@cedarjs/fastify-web": "5.0.0-canary.2474",
39
+ "@cedarjs/internal": "5.0.0-canary.2474",
40
+ "@cedarjs/prerender": "5.0.0-canary.2474",
41
+ "@cedarjs/project-config": "5.0.0-canary.2474",
42
+ "@cedarjs/structure": "5.0.0-canary.2474",
43
+ "@cedarjs/telemetry": "5.0.0-canary.2474",
44
+ "@cedarjs/utils": "5.0.0-canary.2474",
45
+ "@cedarjs/vite": "5.0.0-canary.2474",
46
+ "@cedarjs/web-server": "5.0.0-canary.2474",
47
47
  "@listr2/prompt-adapter-enquirer": "4.2.1",
48
48
  "@opentelemetry/api": "1.9.1",
49
49
  "@opentelemetry/core": "1.30.1",