@cedarjs/cli 8.0.0-canary.3592 → 8.0.0-canary.3597
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/commands/build/buildHandler.js +3 -2
- package/dist/commands/dev/devHandler.js +2 -1
- package/dist/commands/serve.js +10 -8
- package/dist/commands/setup/deploy/providers/baremetalHandler.js +6 -5
- package/dist/commands/setup/tenancy/tenancy.js +0 -1
- package/dist/commands/setup/uploads/gitignore.js +17 -0
- package/dist/commands/setup/uploads/uploadsHandler.js +27 -1
- package/dist/commands/type-checkHandler.js +2 -1
- package/dist/lib/telemetryWorkspaces.js +11 -0
- package/package.json +13 -13
|
@@ -24,6 +24,7 @@ import { timedTelemetry } from "@cedarjs/telemetry";
|
|
|
24
24
|
import { buildCedarApp } from "@cedarjs/vite/build";
|
|
25
25
|
import { generatePrismaCommand } from "../../lib/generatePrismaClient.js";
|
|
26
26
|
import { getPaths, getConfig } from "../../lib/index.js";
|
|
27
|
+
import { workspacesForTelemetry } from "../../lib/telemetryWorkspaces.js";
|
|
27
28
|
import { buildPackagesTask } from "./buildPackagesTask.js";
|
|
28
29
|
function checkWorkspacePackageEntryPoints(cedarPaths) {
|
|
29
30
|
const packagesDir = cedarPaths.packages;
|
|
@@ -84,11 +85,11 @@ const handler = async ({
|
|
|
84
85
|
}) => {
|
|
85
86
|
recordTelemetryAttributes({
|
|
86
87
|
command: "build",
|
|
87
|
-
workspace:
|
|
88
|
+
workspace: workspacesForTelemetry(workspace),
|
|
88
89
|
verbose,
|
|
89
90
|
prisma,
|
|
90
91
|
prerender,
|
|
91
|
-
apiRootPath
|
|
92
|
+
apiRootPath: apiRootPath !== void 0
|
|
92
93
|
});
|
|
93
94
|
const cedarPaths = getPaths();
|
|
94
95
|
const cedarConfig = getConfig();
|
|
@@ -16,6 +16,7 @@ import { generatePrismaClient } from "../../lib/generatePrismaClient.js";
|
|
|
16
16
|
import { getPaths } from "../../lib/index.js";
|
|
17
17
|
import { getFreePort } from "../../lib/ports.js";
|
|
18
18
|
import { serverFileExists } from "../../lib/project.js";
|
|
19
|
+
import { workspacesForTelemetry } from "../../lib/telemetryWorkspaces.js";
|
|
19
20
|
import { getApiDebugFlag } from "./apiDebugFlag.js";
|
|
20
21
|
import { getPackageWatchCommands } from "./packageWatchCommands.js";
|
|
21
22
|
const createdRequire = createRequire(import.meta.url);
|
|
@@ -54,7 +55,7 @@ const handler = async ({
|
|
|
54
55
|
}) => {
|
|
55
56
|
recordTelemetryAttributes({
|
|
56
57
|
command: "dev",
|
|
57
|
-
workspace:
|
|
58
|
+
workspace: workspacesForTelemetry(workspace),
|
|
58
59
|
generate
|
|
59
60
|
});
|
|
60
61
|
const cedarPaths = getPaths();
|
package/dist/commands/serve.js
CHANGED
|
@@ -80,8 +80,8 @@ const builder = async (yargs) => {
|
|
|
80
80
|
recordTelemetryAttributes({
|
|
81
81
|
command: "serve",
|
|
82
82
|
port: argv.port,
|
|
83
|
-
host: argv.host,
|
|
84
|
-
socket: argv.socket
|
|
83
|
+
host: argv.host !== void 0,
|
|
84
|
+
socket: argv.socket !== void 0
|
|
85
85
|
});
|
|
86
86
|
if (argv.ud) {
|
|
87
87
|
if (argv.port) {
|
|
@@ -210,9 +210,11 @@ const builder = async (yargs) => {
|
|
|
210
210
|
recordTelemetryAttributes({
|
|
211
211
|
command: "serve",
|
|
212
212
|
port: argv.port,
|
|
213
|
-
host: argv.host,
|
|
214
|
-
socket: argv.socket,
|
|
215
|
-
apiRootPath
|
|
213
|
+
host: argv.host !== void 0,
|
|
214
|
+
socket: argv.socket !== void 0,
|
|
215
|
+
// `--apiRootPath` defaults to '/', so a custom root path is anything
|
|
216
|
+
// else
|
|
217
|
+
apiRootPath: argv.apiRootPath !== void 0 && argv.apiRootPath !== "/"
|
|
216
218
|
});
|
|
217
219
|
const { getAPIHost, getAPIPort } = await import("@cedarjs/api-server/cliHelpers");
|
|
218
220
|
const apiPort = argv.port ?? getAPIPort({ isPublicSide: true });
|
|
@@ -257,9 +259,9 @@ const builder = async (yargs) => {
|
|
|
257
259
|
recordTelemetryAttributes({
|
|
258
260
|
command: "serve",
|
|
259
261
|
port: argv.port,
|
|
260
|
-
host: argv.host,
|
|
261
|
-
socket: argv.socket,
|
|
262
|
-
apiHost: argv.apiHost
|
|
262
|
+
host: argv.host !== void 0,
|
|
263
|
+
socket: argv.socket !== void 0,
|
|
264
|
+
apiHost: argv.apiHost !== void 0
|
|
263
265
|
});
|
|
264
266
|
if (streamingEnabled) {
|
|
265
267
|
await webSsrServerHandler(rscEnabled);
|
|
@@ -117,12 +117,8 @@ const handler = async ({
|
|
|
117
117
|
force,
|
|
118
118
|
monitor: monitorOption
|
|
119
119
|
}) => {
|
|
120
|
-
recordTelemetryAttributes({
|
|
121
|
-
command: "setup deploy baremetal",
|
|
122
|
-
force,
|
|
123
|
-
monitor: monitorOption
|
|
124
|
-
});
|
|
125
120
|
if (monitorOption !== void 0 && !isMonitor(monitorOption)) {
|
|
121
|
+
recordTelemetryAttributes({ command: "setup deploy baremetal", force });
|
|
126
122
|
console.error(
|
|
127
123
|
c.error(
|
|
128
124
|
`Unknown monitor "${monitorOption}". Use one of ${MONITORS.join(", ")}.`
|
|
@@ -130,6 +126,11 @@ const handler = async ({
|
|
|
130
126
|
);
|
|
131
127
|
process.exit(1);
|
|
132
128
|
}
|
|
129
|
+
recordTelemetryAttributes({
|
|
130
|
+
command: "setup deploy baremetal",
|
|
131
|
+
force,
|
|
132
|
+
monitor: monitorOption
|
|
133
|
+
});
|
|
133
134
|
const monitor = monitorOption ?? await promptForMonitor();
|
|
134
135
|
if (!monitor) {
|
|
135
136
|
console.log("Aborting baremetal setup.");
|
|
@@ -16,7 +16,6 @@ const builder = (yargs) => {
|
|
|
16
16
|
const handler = async (options) => {
|
|
17
17
|
recordTelemetryAttributes({
|
|
18
18
|
command: "setup tenancy",
|
|
19
|
-
tenantField: options.tenantField,
|
|
20
19
|
force: options.force
|
|
21
20
|
});
|
|
22
21
|
const { handler: handler2 } = await import("./tenancyHandler.js");
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import execa from "execa";
|
|
1
2
|
const UPLOADS_GITIGNORE_ENTRY = "api/.uploads";
|
|
2
3
|
function transformGitignore(source) {
|
|
3
4
|
const activeLines = source.split("\n").map((line) => line.trimEnd()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
@@ -11,7 +12,23 @@ ${UPLOADS_GITIGNORE_ENTRY}`);
|
|
|
11
12
|
const prefix = source === "" || source.endsWith("\n") ? source : source + "\n";
|
|
12
13
|
return prefix + UPLOADS_GITIGNORE_ENTRY + "\n";
|
|
13
14
|
}
|
|
15
|
+
async function findIgnoredPaths(cwd, paths) {
|
|
16
|
+
if (paths.length === 0) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const { stdout } = await execa("git", ["check-ignore", "-z", "--stdin"], {
|
|
21
|
+
cwd,
|
|
22
|
+
input: paths.join("\0") + "\0",
|
|
23
|
+
reject: false
|
|
24
|
+
});
|
|
25
|
+
return stdout.split("\0").filter(Boolean);
|
|
26
|
+
} catch {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
14
30
|
export {
|
|
15
31
|
UPLOADS_GITIGNORE_ENTRY,
|
|
32
|
+
findIgnoredPaths,
|
|
16
33
|
transformGitignore
|
|
17
34
|
};
|
|
@@ -18,7 +18,7 @@ import { getPaths, transformTSToJS, writeFile } from "../../../lib/index.js";
|
|
|
18
18
|
import { isTypeScriptProject } from "../../../lib/project.js";
|
|
19
19
|
import { generateSecret } from "../../generate/secret/secret.js";
|
|
20
20
|
import { setupServerFileTasks } from "../server-file/serverFileHandler.js";
|
|
21
|
-
import { transformGitignore } from "./gitignore.js";
|
|
21
|
+
import { findIgnoredPaths, transformGitignore } from "./gitignore.js";
|
|
22
22
|
import { addUploadModel } from "./schemaPrisma.js";
|
|
23
23
|
import {
|
|
24
24
|
addUploadsPlugin,
|
|
@@ -102,6 +102,8 @@ const handler = async ({ targets, force }) => {
|
|
|
102
102
|
const packageJson = await import(pathToFileURL(path.join(paths.base, "package.json")).href, { with: { type: "json" } });
|
|
103
103
|
const cedarVersion = packageJson.default.devDependencies["@cedarjs/core"] ?? "latest";
|
|
104
104
|
const serverFilePath = path.join(paths.api.src, `server.${ext}`);
|
|
105
|
+
const generatedFilePaths = [];
|
|
106
|
+
let ignoredFilesWarning;
|
|
105
107
|
const writeTemplateFile = async (templateFile, outputPath, replacements = {}) => {
|
|
106
108
|
const templatePath = path.resolve(
|
|
107
109
|
import.meta.dirname,
|
|
@@ -113,6 +115,7 @@ const handler = async ({ targets, force }) => {
|
|
|
113
115
|
templateContent = templateContent.replaceAll(token, value);
|
|
114
116
|
}
|
|
115
117
|
const content = projectIsTypescript ? templateContent : await transformTSToJS(outputPath, templateContent);
|
|
118
|
+
generatedFilePaths.push(outputPath);
|
|
116
119
|
return writeFile(outputPath, content, { overwriteExisting: force });
|
|
117
120
|
};
|
|
118
121
|
const apiPackages = [`@cedarjs/uploads@${cedarVersion}`];
|
|
@@ -285,6 +288,24 @@ const handler = async ({ targets, force }) => {
|
|
|
285
288
|
fs.writeFileSync(gitignorePath, updated, "utf-8");
|
|
286
289
|
}
|
|
287
290
|
},
|
|
291
|
+
{
|
|
292
|
+
title: "Checking the generated files are tracked by git...",
|
|
293
|
+
task: async () => {
|
|
294
|
+
const ignoredPaths = await findIgnoredPaths(paths.base, [
|
|
295
|
+
...generatedFilePaths,
|
|
296
|
+
serverFilePath
|
|
297
|
+
]);
|
|
298
|
+
if (ignoredPaths.length === 0) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
const relativePaths = ignoredPaths.map((ignoredPath) => path.relative(paths.base, ignoredPath)).join("\n");
|
|
302
|
+
ignoredFilesWarning = `A .gitignore rule is hiding generated file(s) from git:
|
|
303
|
+
|
|
304
|
+
${relativePaths}
|
|
305
|
+
|
|
306
|
+
This usually happens after migrating from @cedarjs/storage, which left behind an unanchored \`uploads\` or \`uploads/\` rule. Anchor it (e.g. \`/uploads/\`) or remove it, then make sure the file(s) above get committed.`;
|
|
307
|
+
}
|
|
308
|
+
},
|
|
288
309
|
{
|
|
289
310
|
title: "Prettifying changed files",
|
|
290
311
|
task: async (_ctx, task) => {
|
|
@@ -349,6 +370,11 @@ const handler = async ({ targets, force }) => {
|
|
|
349
370
|
);
|
|
350
371
|
try {
|
|
351
372
|
await tasks.run();
|
|
373
|
+
if (ignoredFilesWarning) {
|
|
374
|
+
console.warn(`
|
|
375
|
+
${c.warning(ignoredFilesWarning)}
|
|
376
|
+
`);
|
|
377
|
+
}
|
|
352
378
|
} catch (e) {
|
|
353
379
|
const message = e instanceof Error ? e.message : String(e);
|
|
354
380
|
const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
|
|
@@ -6,6 +6,7 @@ import { runBin } from "@cedarjs/cli-helpers/packageManager/exec";
|
|
|
6
6
|
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers/telemetry";
|
|
7
7
|
import { generatePrismaClient } from "../lib/generatePrismaClient.js";
|
|
8
8
|
import { getPaths } from "../lib/index.js";
|
|
9
|
+
import { workspacesForTelemetry } from "../lib/telemetryWorkspaces.js";
|
|
9
10
|
const isConcurrentlyErrorArray = (value) => {
|
|
10
11
|
return Array.isArray(value);
|
|
11
12
|
};
|
|
@@ -20,7 +21,7 @@ const handler = async ({
|
|
|
20
21
|
);
|
|
21
22
|
recordTelemetryAttributes({
|
|
22
23
|
command: "type-check",
|
|
23
|
-
sides:
|
|
24
|
+
sides: workspacesForTelemetry(selectedSides),
|
|
24
25
|
verbose,
|
|
25
26
|
prisma,
|
|
26
27
|
generate
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const KNOWN_WORKSPACES = /* @__PURE__ */ new Set(["api", "web", "packages/*"]);
|
|
2
|
+
function workspacesForTelemetry(workspaces) {
|
|
3
|
+
return JSON.stringify(
|
|
4
|
+
workspaces.map(
|
|
5
|
+
(workspace) => KNOWN_WORKSPACES.has(workspace) ? workspace : "package"
|
|
6
|
+
)
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
workspacesForTelemetry
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "8.0.0-canary.
|
|
3
|
+
"version": "8.0.0-canary.3597",
|
|
4
4
|
"description": "The CedarJS Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
"@babel/preset-typescript": "7.29.7",
|
|
37
37
|
"@babel/traverse": "7.29.12",
|
|
38
38
|
"@babel/types": "7.29.11",
|
|
39
|
-
"@cedarjs/api-server": "8.0.0-canary.
|
|
40
|
-
"@cedarjs/babel-config": "8.0.0-canary.
|
|
41
|
-
"@cedarjs/cli-helpers": "8.0.0-canary.
|
|
42
|
-
"@cedarjs/internal": "8.0.0-canary.
|
|
43
|
-
"@cedarjs/prerender": "8.0.0-canary.
|
|
44
|
-
"@cedarjs/project-config": "8.0.0-canary.
|
|
45
|
-
"@cedarjs/structure": "8.0.0-canary.
|
|
46
|
-
"@cedarjs/telemetry": "8.0.0-canary.
|
|
47
|
-
"@cedarjs/utils": "8.0.0-canary.
|
|
48
|
-
"@cedarjs/vite": "8.0.0-canary.
|
|
49
|
-
"@cedarjs/web-server": "8.0.0-canary.
|
|
39
|
+
"@cedarjs/api-server": "8.0.0-canary.3597",
|
|
40
|
+
"@cedarjs/babel-config": "8.0.0-canary.3597",
|
|
41
|
+
"@cedarjs/cli-helpers": "8.0.0-canary.3597",
|
|
42
|
+
"@cedarjs/internal": "8.0.0-canary.3597",
|
|
43
|
+
"@cedarjs/prerender": "8.0.0-canary.3597",
|
|
44
|
+
"@cedarjs/project-config": "8.0.0-canary.3597",
|
|
45
|
+
"@cedarjs/structure": "8.0.0-canary.3597",
|
|
46
|
+
"@cedarjs/telemetry": "8.0.0-canary.3597",
|
|
47
|
+
"@cedarjs/utils": "8.0.0-canary.3597",
|
|
48
|
+
"@cedarjs/vite": "8.0.0-canary.3597",
|
|
49
|
+
"@cedarjs/web-server": "8.0.0-canary.3597",
|
|
50
50
|
"@listr2/prompt-adapter-enquirer": "4.4.3",
|
|
51
51
|
"@opentelemetry/api": "1.9.1",
|
|
52
52
|
"@opentelemetry/core": "2.12.0",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"yargs": "18.2.0"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
|
-
"@cedarjs/framework-tools": "8.0.0-canary.
|
|
96
|
+
"@cedarjs/framework-tools": "8.0.0-canary.3597",
|
|
97
97
|
"@prisma/dmmf": "7.10.1",
|
|
98
98
|
"@types/archiver": "^7.0.0",
|
|
99
99
|
"memfs": "4.80.0",
|