@cedarjs/cli 4.0.0-canary.13863 → 4.0.0-canary.13864

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.
@@ -10,7 +10,10 @@ import {
10
10
  formatRunWorkspaceScriptCommand
11
11
  } from "@cedarjs/cli-helpers/packageManager/display";
12
12
  import { runBin } from "@cedarjs/cli-helpers/packageManager/exec";
13
- import { buildApi, cleanApiBuild } from "@cedarjs/internal/dist/build/api";
13
+ import {
14
+ buildApiWithVite,
15
+ cleanApiBuild
16
+ } from "@cedarjs/internal/dist/build/api";
14
17
  import { generate } from "@cedarjs/internal/dist/generate/generate";
15
18
  import { generateGqlormArtifacts } from "@cedarjs/internal/dist/generate/gqlormSchema";
16
19
  import { loadAndValidateSdls } from "@cedarjs/internal/dist/validateSchema";
@@ -162,13 +165,7 @@ Run ` + c.info(formatCedarCommand(["build"])) + " (without specifying a workspac
162
165
  title: "Building API...",
163
166
  task: async () => {
164
167
  await cleanApiBuild();
165
- const { errors, warnings } = await buildApi();
166
- if (errors.length) {
167
- console.error(errors);
168
- }
169
- if (warnings.length) {
170
- console.warn(warnings);
171
- }
168
+ await buildApiWithVite();
172
169
  }
173
170
  },
174
171
  workspace.includes("web") && {
@@ -120,48 +120,84 @@ const handler = async ({
120
120
  console.error(c.error(`Error generating gqlorm schema: ${message}`));
121
121
  }
122
122
  }
123
- const cedarConfigPath = getConfigPath();
124
123
  const streamingSsrEnabled = getConfig().experimental?.streamingSsr?.enabled;
125
124
  process.env.VITE_CJS_IGNORE_WARNING = "true";
126
- let webCommand = `yarn cross-env NODE_ENV=development cedar-vite-dev ${forward}`;
127
- if (streamingSsrEnabled) {
128
- webCommand = `yarn cross-env NODE_ENV=development cedar-dev-fe ${forward}`;
129
- }
130
125
  const rootPackageJsonPath = path.join(cedarPaths.base, "package.json");
131
126
  const rootPackageJson = JSON.parse(
132
127
  fs.readFileSync(rootPackageJsonPath, "utf8")
133
128
  );
134
- const isEsm = rootPackageJson.type === "module";
135
- const serverWatchCommand = isEsm ? `cedarjs-api-server-watch` : `cedar-api-server-watch`;
129
+ const buildUnifiedDevCommand = () => {
130
+ if (streamingSsrEnabled) {
131
+ return null;
132
+ }
133
+ if (!workspace.includes("api") || !workspace.includes("web")) {
134
+ return null;
135
+ }
136
+ if (serverFile) {
137
+ return null;
138
+ }
139
+ if (!fs.existsSync(cedarPaths.api.src) || !fs.existsSync(cedarPaths.web.src)) {
140
+ console.log("api.src or web.src does not exist");
141
+ return null;
142
+ }
143
+ return [
144
+ `yarn cross-env NODE_ENV=development cedar-unified-dev`,
145
+ ` --port ${webAvailablePort}`,
146
+ ` --apiPort ${apiAvailablePort}`,
147
+ getApiDebugFlag(apiDebugPort, apiAvailablePort),
148
+ forward
149
+ ].join(" ").replace(/\s+/g, " ").trim();
150
+ };
151
+ const unifiedDevCommand = buildUnifiedDevCommand();
136
152
  const jobs = [];
137
- if (workspace.includes("api")) {
153
+ if (unifiedDevCommand) {
138
154
  jobs.push({
139
- name: "api",
140
- command: [
141
- "yarn nodemon",
142
- " --quiet",
143
- ` --watch "${cedarConfigPath}"`,
144
- ` --exec "yarn ${serverWatchCommand}`,
145
- ` --port ${apiAvailablePort}`,
146
- ` ${getApiDebugFlag(apiDebugPort, apiAvailablePort)}`,
147
- ` | cedar-log-formatter"`
148
- ].join(" ").replace(/\s+/g, " "),
155
+ name: "dev",
156
+ command: unifiedDevCommand,
149
157
  env: {
150
158
  NODE_ENV: "development",
151
159
  NODE_OPTIONS: getDevNodeOptions()
152
160
  },
153
161
  prefixColor: "cyan",
154
- runWhen: () => fs.existsSync(cedarPaths.api.src)
155
- });
156
- }
157
- if (workspace.includes("web")) {
158
- jobs.push({
159
- name: "web",
160
- command: webCommand,
161
- prefixColor: "blue",
162
- cwd: cedarPaths.web.base,
163
- runWhen: () => fs.existsSync(cedarPaths.web.src)
162
+ cwd: cedarPaths.web.base
164
163
  });
164
+ } else {
165
+ if (workspace.includes("api")) {
166
+ const isEsm = rootPackageJson.type === "module";
167
+ const serverWatchCommand = isEsm ? `cedarjs-api-server-watch` : `cedar-api-server-watch`;
168
+ const cedarConfigPath = getConfigPath();
169
+ jobs.push({
170
+ name: "api",
171
+ command: [
172
+ "yarn nodemon",
173
+ " --quiet",
174
+ ` --watch "${cedarConfigPath}"`,
175
+ ` --exec "yarn ${serverWatchCommand}`,
176
+ ` --port ${apiAvailablePort}`,
177
+ ` ${getApiDebugFlag(apiDebugPort, apiAvailablePort)}`,
178
+ ` | cedar-log-formatter"`
179
+ ].join(" ").replace(/\s+/g, " "),
180
+ env: {
181
+ NODE_ENV: "development",
182
+ NODE_OPTIONS: getDevNodeOptions()
183
+ },
184
+ prefixColor: "cyan",
185
+ runWhen: () => fs.existsSync(cedarPaths.api.src)
186
+ });
187
+ }
188
+ if (workspace.includes("web")) {
189
+ let webCommand = `yarn cross-env NODE_ENV=development cedar-vite-dev ${forward}`;
190
+ if (streamingSsrEnabled) {
191
+ webCommand = `yarn cross-env NODE_ENV=development cedar-dev-fe ${forward}`;
192
+ }
193
+ jobs.push({
194
+ name: "web",
195
+ command: webCommand,
196
+ prefixColor: "blue",
197
+ cwd: cedarPaths.web.base,
198
+ runWhen: () => fs.existsSync(cedarPaths.web.src)
199
+ });
200
+ }
165
201
  }
166
202
  if (generate) {
167
203
  jobs.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "4.0.0-canary.13863+1eab09c501",
3
+ "version": "4.0.0-canary.13864+6143202249",
4
4
  "description": "The CedarJS Command Line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,16 +33,16 @@
33
33
  "dependencies": {
34
34
  "@babel/parser": "7.29.2",
35
35
  "@babel/preset-typescript": "7.28.5",
36
- "@cedarjs/api-server": "4.0.0-canary.13863",
37
- "@cedarjs/cli-helpers": "4.0.0-canary.13863",
38
- "@cedarjs/fastify-web": "4.0.0-canary.13863",
39
- "@cedarjs/internal": "4.0.0-canary.13863",
40
- "@cedarjs/prerender": "4.0.0-canary.13863",
41
- "@cedarjs/project-config": "4.0.0-canary.13863",
42
- "@cedarjs/structure": "4.0.0-canary.13863",
43
- "@cedarjs/telemetry": "4.0.0-canary.13863",
44
- "@cedarjs/utils": "4.0.0-canary.13863",
45
- "@cedarjs/web-server": "4.0.0-canary.13863",
36
+ "@cedarjs/api-server": "4.0.0-canary.13864",
37
+ "@cedarjs/cli-helpers": "4.0.0-canary.13864",
38
+ "@cedarjs/fastify-web": "4.0.0-canary.13864",
39
+ "@cedarjs/internal": "4.0.0-canary.13864",
40
+ "@cedarjs/prerender": "4.0.0-canary.13864",
41
+ "@cedarjs/project-config": "4.0.0-canary.13864",
42
+ "@cedarjs/structure": "4.0.0-canary.13864",
43
+ "@cedarjs/telemetry": "4.0.0-canary.13864",
44
+ "@cedarjs/utils": "4.0.0-canary.13864",
45
+ "@cedarjs/web-server": "4.0.0-canary.13864",
46
46
  "@listr2/prompt-adapter-enquirer": "4.2.1",
47
47
  "@opentelemetry/api": "1.9.0",
48
48
  "@opentelemetry/core": "1.30.1",
@@ -108,5 +108,5 @@
108
108
  "publishConfig": {
109
109
  "access": "public"
110
110
  },
111
- "gitHead": "1eab09c501b833158bd1f18ca600a9bb33ac2c30"
111
+ "gitHead": "614320224990c781870b0f412c3fd5a058de64e5"
112
112
  }