@cedarjs/cli 5.0.0-canary.13893 → 5.0.0-canary.13895

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.
@@ -11,6 +11,7 @@ import {
11
11
  } from "@cedarjs/cli-helpers/packageManager/display";
12
12
  import { runBin } from "@cedarjs/cli-helpers/packageManager/exec";
13
13
  import {
14
+ buildApi,
14
15
  buildApiWithVite,
15
16
  cleanApiBuild
16
17
  } from "@cedarjs/internal/dist/build/api";
@@ -206,8 +207,51 @@ Run ` + c.info(formatCedarCommand(["build"])) + " (without specifying a workspac
206
207
  }
207
208
  }
208
209
  },
209
- // Unified build path (default, non-streaming-SSR)
210
- (workspace.includes("api") || workspace.includes("web")) && !getConfig().experimental?.streamingSsr?.enabled && {
210
+ // Legacy separate build path (default when not --ud, non-streaming-SSR)
211
+ workspace.includes("api") && !ud && !getConfig().experimental?.streamingSsr?.enabled && {
212
+ title: "Building API...",
213
+ task: async () => {
214
+ await cleanApiBuild();
215
+ const { errors, warnings } = await buildApi();
216
+ if (warnings.length) {
217
+ console.warn(warnings);
218
+ }
219
+ if (errors.length) {
220
+ throw new Error(
221
+ `API build failed with ${errors.length} error(s). See output above for details.`
222
+ );
223
+ }
224
+ }
225
+ },
226
+ workspace.includes("web") && !ud && !getConfig().experimental?.streamingSsr?.enabled && {
227
+ title: "Building Web...",
228
+ task: async () => {
229
+ process.env.VITE_CJS_IGNORE_WARNING = "true";
230
+ const createdRequire = createRequire(import.meta.url);
231
+ const buildBinPath = createdRequire.resolve(
232
+ "@cedarjs/vite/bins/cedar-vite-build.mjs"
233
+ );
234
+ await execa(
235
+ `node ${buildBinPath} --webDir="${cedarPaths.web.base}" --verbose=${verbose}`,
236
+ {
237
+ stdio: verbose ? "inherit" : "pipe",
238
+ shell: true,
239
+ // `cwd` is needed for yarn to find the cedar-vite-build binary
240
+ // It won't change process.cwd for anything else here, in this
241
+ // process
242
+ cwd: cedarPaths.web.base
243
+ }
244
+ );
245
+ console.log("Creating 200.html...");
246
+ const indexHtmlPath = path.join(getPaths().web.dist, "index.html");
247
+ fs.copyFileSync(
248
+ indexHtmlPath,
249
+ path.join(getPaths().web.dist, "200.html")
250
+ );
251
+ }
252
+ },
253
+ // Unified build path (experimental, non-streaming-SSR, --ud)
254
+ (workspace.includes("api") || workspace.includes("web")) && ud && !getConfig().experimental?.streamingSsr?.enabled && {
211
255
  title: workspace.includes("api") && workspace.includes("web") ? "Building App..." : workspace.includes("api") ? "Building API..." : "Building Web...",
212
256
  task: async () => {
213
257
  process.env.VITE_CJS_IGNORE_WARNING = "true";
@@ -68,19 +68,40 @@ const handler = async ({
68
68
  }
69
69
  webPortChangeNeeded = webAvailablePort !== webPreferredPort;
70
70
  }
71
- if (webPortChangeNeeded) {
72
- const message = [
73
- "The currently configured port for the development server is",
74
- "unavailable. Suggested change to your port, which can be changed in",
75
- "cedar.toml (or redwood.toml):\n",
76
- ` - Web to use port ${webAvailablePort} instead`,
77
- "of your currently configured",
78
- `${webPreferredPort}
71
+ if (ud) {
72
+ if (webPortChangeNeeded) {
73
+ const message = [
74
+ "The currently configured port for the development server is",
75
+ "unavailable. Suggested change to your port, which can be changed in",
76
+ "cedar.toml (or redwood.toml):\n",
77
+ ` - Web to use port ${webAvailablePort} instead`,
78
+ "of your currently configured",
79
+ `${webPreferredPort}
79
80
  `,
80
- "\nCannot run the development server until your configured port is",
81
- "changed or becomes available."
82
- ].filter(Boolean).join(" ");
83
- exitWithError(void 0, { message });
81
+ "\nCannot run the development server until your configured port is",
82
+ "changed or becomes available."
83
+ ].filter(Boolean).join(" ");
84
+ exitWithError(void 0, { message });
85
+ }
86
+ } else {
87
+ if (apiPortChangeNeeded || webPortChangeNeeded) {
88
+ const message = [
89
+ "The currently configured ports for the development server are",
90
+ "unavailable. Suggested changes to your ports, which can be changed in",
91
+ "cedar.toml (or redwood.toml), are:\n",
92
+ apiPortChangeNeeded && ` - API to use port ${apiAvailablePort} instead`,
93
+ apiPortChangeNeeded && "of your currently configured",
94
+ apiPortChangeNeeded && `${apiPreferredPort}
95
+ `,
96
+ webPortChangeNeeded && ` - Web to use port ${webAvailablePort} instead`,
97
+ webPortChangeNeeded && "of your currently configured",
98
+ webPortChangeNeeded && `${webPreferredPort}
99
+ `,
100
+ "\nCannot run the development server until your configured ports are",
101
+ "changed or become available."
102
+ ].filter(Boolean).join(" ");
103
+ exitWithError(void 0, { message });
104
+ }
84
105
  }
85
106
  if (workspace.includes("api")) {
86
107
  try {
@@ -90,6 +111,17 @@ const handler = async ({
90
111
  errorTelemetry(process.argv, `Error generating prisma client: ${message}`);
91
112
  console.error(c.error(message));
92
113
  }
114
+ if (!ud && !serverFile) {
115
+ try {
116
+ await shutdownPort(apiAvailablePort);
117
+ } catch (e) {
118
+ const message = getErrorMessage(e);
119
+ errorTelemetry(process.argv, `Error shutting down "api": ${message}`);
120
+ console.error(
121
+ `Error whilst shutting down "api" port: ${c.error(message)}`
122
+ );
123
+ }
124
+ }
93
125
  }
94
126
  if (workspace.includes("web") && webAvailablePort !== void 0) {
95
127
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "5.0.0-canary.13893+8801f7260c",
3
+ "version": "5.0.0-canary.13895+1afe7de6ad",
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.2",
35
35
  "@babel/preset-typescript": "7.28.5",
36
- "@cedarjs/api-server": "5.0.0-canary.13893",
37
- "@cedarjs/cli-helpers": "5.0.0-canary.13893",
38
- "@cedarjs/fastify-web": "5.0.0-canary.13893",
39
- "@cedarjs/internal": "5.0.0-canary.13893",
40
- "@cedarjs/prerender": "5.0.0-canary.13893",
41
- "@cedarjs/project-config": "5.0.0-canary.13893",
42
- "@cedarjs/structure": "5.0.0-canary.13893",
43
- "@cedarjs/telemetry": "5.0.0-canary.13893",
44
- "@cedarjs/utils": "5.0.0-canary.13893",
45
- "@cedarjs/vite": "5.0.0-canary.13893",
46
- "@cedarjs/web-server": "5.0.0-canary.13893",
36
+ "@cedarjs/api-server": "5.0.0-canary.13895",
37
+ "@cedarjs/cli-helpers": "5.0.0-canary.13895",
38
+ "@cedarjs/fastify-web": "5.0.0-canary.13895",
39
+ "@cedarjs/internal": "5.0.0-canary.13895",
40
+ "@cedarjs/prerender": "5.0.0-canary.13895",
41
+ "@cedarjs/project-config": "5.0.0-canary.13895",
42
+ "@cedarjs/structure": "5.0.0-canary.13895",
43
+ "@cedarjs/telemetry": "5.0.0-canary.13895",
44
+ "@cedarjs/utils": "5.0.0-canary.13895",
45
+ "@cedarjs/vite": "5.0.0-canary.13895",
46
+ "@cedarjs/web-server": "5.0.0-canary.13895",
47
47
  "@listr2/prompt-adapter-enquirer": "4.2.1",
48
48
  "@opentelemetry/api": "1.9.0",
49
49
  "@opentelemetry/core": "1.30.1",
@@ -108,5 +108,5 @@
108
108
  "publishConfig": {
109
109
  "access": "public"
110
110
  },
111
- "gitHead": "8801f7260cc1702114b09ff8a2aa35334b109b2f"
111
+ "gitHead": "1afe7de6ad2bec0d50331b5c9b4fbc8a0a57cc25"
112
112
  }