@cedarjs/cli 3.0.0-canary.13445 → 3.0.0-canary.13447
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,9 +10,57 @@ import { generate } from "@cedarjs/internal/dist/generate/generate";
|
|
|
10
10
|
import { loadAndValidateSdls } from "@cedarjs/internal/dist/validateSchema";
|
|
11
11
|
import { detectPrerenderRoutes } from "@cedarjs/prerender/detection";
|
|
12
12
|
import { timedTelemetry } from "@cedarjs/telemetry";
|
|
13
|
+
import c from "../../lib/colors.js";
|
|
13
14
|
import { generatePrismaCommand } from "../../lib/generatePrismaClient.js";
|
|
14
15
|
import { getPaths, getConfig } from "../../lib/index.js";
|
|
15
16
|
import { buildPackagesTask } from "./buildPackagesTask.js";
|
|
17
|
+
function checkWorkspacePackageEntryPoints(cedarPaths) {
|
|
18
|
+
const packagesDir = cedarPaths.packages;
|
|
19
|
+
if (!packagesDir || !fs.existsSync(packagesDir)) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
const problems = [];
|
|
23
|
+
const packageDirs = fs.readdirSync(packagesDir, { withFileTypes: true });
|
|
24
|
+
for (const entry of packageDirs) {
|
|
25
|
+
if (!entry.isDirectory()) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const pkgJsonPath = path.join(packagesDir, entry.name, "package.json");
|
|
29
|
+
if (!fs.existsSync(pkgJsonPath)) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
|
|
33
|
+
const pkgName = pkgJson.name || entry.name;
|
|
34
|
+
const pkgDir = path.join(packagesDir, entry.name);
|
|
35
|
+
const entryFiles = /* @__PURE__ */ new Set();
|
|
36
|
+
if (pkgJson.main) {
|
|
37
|
+
entryFiles.add(path.normalize(pkgJson.main));
|
|
38
|
+
}
|
|
39
|
+
if (pkgJson.exports) {
|
|
40
|
+
const collectPaths = (obj) => {
|
|
41
|
+
if (typeof obj === "string") {
|
|
42
|
+
if (!obj.endsWith(".d.ts")) {
|
|
43
|
+
entryFiles.add(path.normalize(obj));
|
|
44
|
+
}
|
|
45
|
+
} else if (obj && typeof obj === "object") {
|
|
46
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
47
|
+
if (key !== "types") {
|
|
48
|
+
collectPaths(value);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
collectPaths(pkgJson.exports);
|
|
54
|
+
}
|
|
55
|
+
for (const entryFile of entryFiles) {
|
|
56
|
+
const resolvedPath = path.resolve(pkgDir, entryFile);
|
|
57
|
+
if (!fs.existsSync(resolvedPath)) {
|
|
58
|
+
problems.push({ pkgName, entryFile, pkgDir });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return problems;
|
|
63
|
+
}
|
|
16
64
|
const handler = async ({
|
|
17
65
|
workspace = ["api", "web", "packages/*"],
|
|
18
66
|
verbose = false,
|
|
@@ -56,6 +104,25 @@ const handler = async ({
|
|
|
56
104
|
title: "Building Packages...",
|
|
57
105
|
task: (_ctx, task) => buildPackagesTask(task, nonApiWebWorkspaces)
|
|
58
106
|
},
|
|
107
|
+
(workspace.includes("web") || workspace.includes("api")) && {
|
|
108
|
+
title: "Checking workspace packages...",
|
|
109
|
+
task: () => {
|
|
110
|
+
const problems = checkWorkspacePackageEntryPoints(cedarPaths);
|
|
111
|
+
if (problems.length === 0) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const details = problems.map(
|
|
115
|
+
({ pkgName, entryFile, pkgDir }) => ` \u2022 ${c.error(pkgName)}: missing "${entryFile}" (in ${pkgDir})`
|
|
116
|
+
).join("\n");
|
|
117
|
+
throw new Error(
|
|
118
|
+
`The following workspace package entry points are missing:
|
|
119
|
+
${details}
|
|
120
|
+
|
|
121
|
+
This usually means the package has not been built yet.
|
|
122
|
+
Run ` + c.info("yarn cedar build") + " (without specifying a workspace) to build everything,\nor build the package manually first, e.g. " + c.info(`yarn workspace ${problems[0].pkgName} build`)
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
},
|
|
59
126
|
// If using GraphQL Fragments or Trusted Documents, then we need to use
|
|
60
127
|
// codegen to generate the types needed for possible types and the trusted
|
|
61
128
|
// document store hashes
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import
|
|
3
|
+
import execa from "execa";
|
|
4
4
|
import { importStatementPath } from "@cedarjs/project-config";
|
|
5
5
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
6
|
-
import { exitWithError } from "../../lib/exit.js";
|
|
7
6
|
import { getPaths } from "../../lib/index.js";
|
|
8
7
|
async function buildPackagesTask(task, nonApiWebWorkspaces) {
|
|
9
8
|
const cedarPaths = getPaths();
|
|
@@ -22,28 +21,30 @@ async function buildPackagesTask(task, nonApiWebWorkspaces) {
|
|
|
22
21
|
task.skip("No packages to build at " + nonApiWebWorkspaces.join(", "));
|
|
23
22
|
return;
|
|
24
23
|
}
|
|
25
|
-
|
|
24
|
+
return task.newListr(
|
|
26
25
|
workspacePaths.map((workspacePath) => {
|
|
26
|
+
const name = workspacePath.split("/").at(-1);
|
|
27
27
|
return {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
title: name,
|
|
29
|
+
task: async () => {
|
|
30
|
+
try {
|
|
31
|
+
await execa("yarn", ["build"], { cwd: workspacePath });
|
|
32
|
+
} catch (e) {
|
|
33
|
+
errorTelemetry(
|
|
34
|
+
process.argv,
|
|
35
|
+
`Error building package "${name}": ${e.message}`
|
|
36
|
+
);
|
|
37
|
+
throw new Error(
|
|
38
|
+
`Building "${name}" failed
|
|
39
|
+
|
|
40
|
+
${e.stderr || e.message}`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
31
44
|
};
|
|
32
45
|
}),
|
|
33
|
-
{
|
|
34
|
-
prefix: "{name} |",
|
|
35
|
-
timestampFormat: "HH:mm:ss"
|
|
36
|
-
}
|
|
46
|
+
{ concurrent: true, rendererOptions: { collapseSubtasks: false } }
|
|
37
47
|
);
|
|
38
|
-
await result.catch((e) => {
|
|
39
|
-
if (e?.message) {
|
|
40
|
-
errorTelemetry(
|
|
41
|
-
process.argv,
|
|
42
|
-
`Error concurrently building sides: ${e.message}`
|
|
43
|
-
);
|
|
44
|
-
exitWithError(e);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
48
|
}
|
|
48
49
|
export {
|
|
49
50
|
buildPackagesTask
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "3.0.0-canary.
|
|
3
|
+
"version": "3.0.0-canary.13447+a36a861f1",
|
|
4
4
|
"description": "The CedarJS Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
"@babel/parser": "7.29.0",
|
|
35
35
|
"@babel/preset-typescript": "7.28.5",
|
|
36
36
|
"@babel/runtime-corejs3": "7.29.0",
|
|
37
|
-
"@cedarjs/api-server": "3.0.0-canary.
|
|
38
|
-
"@cedarjs/cli-helpers": "3.0.0-canary.
|
|
39
|
-
"@cedarjs/fastify-web": "3.0.0-canary.
|
|
40
|
-
"@cedarjs/internal": "3.0.0-canary.
|
|
41
|
-
"@cedarjs/prerender": "3.0.0-canary.
|
|
42
|
-
"@cedarjs/project-config": "3.0.0-canary.
|
|
43
|
-
"@cedarjs/structure": "3.0.0-canary.
|
|
44
|
-
"@cedarjs/telemetry": "3.0.0-canary.
|
|
45
|
-
"@cedarjs/web-server": "3.0.0-canary.
|
|
37
|
+
"@cedarjs/api-server": "3.0.0-canary.13447",
|
|
38
|
+
"@cedarjs/cli-helpers": "3.0.0-canary.13447",
|
|
39
|
+
"@cedarjs/fastify-web": "3.0.0-canary.13447",
|
|
40
|
+
"@cedarjs/internal": "3.0.0-canary.13447",
|
|
41
|
+
"@cedarjs/prerender": "3.0.0-canary.13447",
|
|
42
|
+
"@cedarjs/project-config": "3.0.0-canary.13447",
|
|
43
|
+
"@cedarjs/structure": "3.0.0-canary.13447",
|
|
44
|
+
"@cedarjs/telemetry": "3.0.0-canary.13447",
|
|
45
|
+
"@cedarjs/web-server": "3.0.0-canary.13447",
|
|
46
46
|
"@listr2/prompt-adapter-enquirer": "2.0.16",
|
|
47
47
|
"@opentelemetry/api": "1.9.0",
|
|
48
48
|
"@opentelemetry/core": "1.30.1",
|
|
@@ -106,5 +106,5 @@
|
|
|
106
106
|
"publishConfig": {
|
|
107
107
|
"access": "public"
|
|
108
108
|
},
|
|
109
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "a36a861f1c3b192cd3e80f2369981fe0a55e0a5a"
|
|
110
110
|
}
|