@cedarjs/cli 3.0.1-next.0 → 3.0.1-next.28
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/deploy/baremetal.js +2 -1
- package/dist/commands/dev/apiDebugFlag.js +5 -4
- package/dist/commands/dev/devHandler.js +1 -1
- package/dist/commands/dev.js +1 -1
- package/dist/commands/experimental/setupRscHandler.js +4 -3
- package/dist/commands/generate/package/packageHandler.js +2 -1
- package/dist/commands/upgrade/upgrade.js +3 -1
- package/dist/commands/upgrade/upgradeHandler.js +30 -27
- package/dist/lib/merge/index.js +2 -0
- package/package.json +17 -14
|
@@ -80,6 +80,7 @@ const handler = async ({
|
|
|
80
80
|
const cedarConfig = getConfig();
|
|
81
81
|
const useFragments = cedarConfig.graphql?.fragments;
|
|
82
82
|
const useTrustedDocuments = cedarConfig.graphql?.trustedDocuments;
|
|
83
|
+
const usePackagesWorkspace = cedarConfig.experimental?.packagesWorkspace?.enabled;
|
|
83
84
|
const prismaSchemaExists = fs.existsSync(cedarPaths.api.prismaConfig);
|
|
84
85
|
const prerenderRoutes = prerender && workspace.includes("web") ? detectPrerenderRoutes() : [];
|
|
85
86
|
const shouldGeneratePrismaClient = prisma && prismaSchemaExists && (workspace.includes("api") || prerenderRoutes.length > 0);
|
|
@@ -104,11 +105,11 @@ const handler = async ({
|
|
|
104
105
|
});
|
|
105
106
|
}
|
|
106
107
|
},
|
|
107
|
-
nonApiWebWorkspaces.length > 0 && {
|
|
108
|
+
nonApiWebWorkspaces.length > 0 && usePackagesWorkspace && {
|
|
108
109
|
title: "Building Packages...",
|
|
109
110
|
task: (_ctx, task) => buildPackagesTask(task, nonApiWebWorkspaces)
|
|
110
111
|
},
|
|
111
|
-
(workspace.includes("web") || workspace.includes("api")) && {
|
|
112
|
+
(workspace.includes("web") || workspace.includes("api")) && usePackagesWorkspace && {
|
|
112
113
|
title: "Checking workspace packages...",
|
|
113
114
|
task: () => {
|
|
114
115
|
const problems = checkWorkspacePackageEntryPoints(cedarPaths);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { terminalLink } from "termi-link";
|
|
2
|
+
import { getPackageManager } from "@cedarjs/project-config/packageManager";
|
|
2
3
|
const command = "baremetal [environment]";
|
|
3
4
|
const description = "Deploy to baremetal server(s)";
|
|
4
5
|
const builder = (yargs) => {
|
|
@@ -22,7 +23,7 @@ const builder = (yargs) => {
|
|
|
22
23
|
type: "boolean"
|
|
23
24
|
});
|
|
24
25
|
yargs.option("install", {
|
|
25
|
-
describe:
|
|
26
|
+
describe: `Run \`${getPackageManager()} install\``,
|
|
26
27
|
default: true,
|
|
27
28
|
type: "boolean"
|
|
28
29
|
});
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { argv } from "node:process";
|
|
2
2
|
import { getConfig } from "@cedarjs/project-config";
|
|
3
|
-
|
|
4
|
-
function getApiDebugFlag(apiDebugPort) {
|
|
3
|
+
function getApiDebugFlag(apiDebugPort, apiAvailablePort) {
|
|
5
4
|
if (apiDebugPort) {
|
|
6
5
|
return `--debug-port ${apiDebugPort}`;
|
|
7
6
|
} else if (argv.includes("--apiDebugPort")) {
|
|
8
|
-
return `--debug-port ${
|
|
7
|
+
return `--debug-port ${"1" + apiAvailablePort}`;
|
|
9
8
|
}
|
|
10
9
|
const apiDebugPortInConfig = getConfig().api.debugPort;
|
|
11
10
|
if (apiDebugPortInConfig) {
|
|
12
11
|
return `--debug-port ${apiDebugPortInConfig}`;
|
|
12
|
+
} else if (apiDebugPortInConfig === false) {
|
|
13
|
+
return "";
|
|
13
14
|
}
|
|
14
|
-
return ""
|
|
15
|
+
return `--debug-port ${"1" + apiAvailablePort}`;
|
|
15
16
|
}
|
|
16
17
|
export {
|
|
17
18
|
getApiDebugFlag
|
|
@@ -135,7 +135,7 @@ const handler = async ({
|
|
|
135
135
|
` --watch "${cedarConfigPath}"`,
|
|
136
136
|
` --exec "yarn ${serverWatchCommand}`,
|
|
137
137
|
` --port ${apiAvailablePort}`,
|
|
138
|
-
` ${getApiDebugFlag(apiDebugPort)}`,
|
|
138
|
+
` ${getApiDebugFlag(apiDebugPort, apiAvailablePort)}`,
|
|
139
139
|
' | rw-log-formatter"'
|
|
140
140
|
].join(" ").replace(/\s+/g, " "),
|
|
141
141
|
env: {
|
package/dist/commands/dev.js
CHANGED
|
@@ -23,7 +23,7 @@ const builder = (yargs) => {
|
|
|
23
23
|
description: "Generate artifacts"
|
|
24
24
|
}).option("apiDebugPort", {
|
|
25
25
|
type: "number",
|
|
26
|
-
description: "Port on which to expose API server debugger. If you supply the flag with no value it defaults to
|
|
26
|
+
description: "Port on which to expose API server debugger. If you supply the flag with no value it defaults to 1 prepended to the api port (e.g. api port 8913 -> debug port 18913)."
|
|
27
27
|
}).middleware(() => {
|
|
28
28
|
const check = checkNodeVersion();
|
|
29
29
|
if (check.ok) {
|
|
@@ -3,7 +3,9 @@ import path from "node:path";
|
|
|
3
3
|
import execa from "execa";
|
|
4
4
|
import { Listr } from "listr2";
|
|
5
5
|
import { prettify } from "@cedarjs/cli-helpers";
|
|
6
|
+
import { install } from "@cedarjs/cli-helpers/packageManager";
|
|
6
7
|
import { getConfig, getConfigPath } from "@cedarjs/project-config";
|
|
8
|
+
import { getPackageManager } from "@cedarjs/project-config/packageManager";
|
|
7
9
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
8
10
|
import c from "../../lib/colors.js";
|
|
9
11
|
import { getPaths, transformTSToJS, writeFile } from "../../lib/index.js";
|
|
@@ -379,9 +381,8 @@ const handler = async ({ force, verbose }) => {
|
|
|
379
381
|
overwriteExisting: true
|
|
380
382
|
}
|
|
381
383
|
);
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
});
|
|
384
|
+
const pm = getPackageManager();
|
|
385
|
+
await execa(pm, [install()], { cwd: getPaths().web.base });
|
|
385
386
|
}
|
|
386
387
|
},
|
|
387
388
|
{
|
|
@@ -8,6 +8,7 @@ import { Listr } from "listr2";
|
|
|
8
8
|
import { terminalLink } from "termi-link";
|
|
9
9
|
import ts from "typescript";
|
|
10
10
|
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
11
|
+
import { workspacePackageSpecifier } from "@cedarjs/cli-helpers/packageManager";
|
|
11
12
|
import { getConfig } from "@cedarjs/project-config";
|
|
12
13
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
13
14
|
import c from "../../../lib/colors.js";
|
|
@@ -133,7 +134,7 @@ async function addDependencyToPackageJson(task, packageJsonPath, packageName) {
|
|
|
133
134
|
task.skip("Dependency already exists");
|
|
134
135
|
return;
|
|
135
136
|
}
|
|
136
|
-
packageJson.dependencies[packageName] =
|
|
137
|
+
packageJson.dependencies[packageName] = workspacePackageSpecifier();
|
|
137
138
|
await fs.promises.writeFile(
|
|
138
139
|
packageJsonPath,
|
|
139
140
|
JSON.stringify(packageJson, null, 2)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { terminalLink } from "termi-link";
|
|
2
|
+
import { dedupeIsSupported } from "@cedarjs/cli-helpers/packageManager";
|
|
2
3
|
import c from "../../lib/colors.js";
|
|
3
4
|
import { isValidCedarJSTag } from "./tags.js";
|
|
4
5
|
const SEMVER_REGEX = /(?<=^v?|\sv?)(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*)(?:\.(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*))*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?(?=$|\s)/i;
|
|
@@ -40,7 +41,8 @@ const builder = (yargs) => {
|
|
|
40
41
|
}).option("dedupe", {
|
|
41
42
|
description: "Skip dedupe check with --no-dedupe",
|
|
42
43
|
type: "boolean",
|
|
43
|
-
default: true
|
|
44
|
+
default: true,
|
|
45
|
+
hidden: !dedupeIsSupported()
|
|
44
46
|
}).option("yes", {
|
|
45
47
|
alias: "y",
|
|
46
48
|
describe: "Skip prompts and use defaults",
|
|
@@ -6,27 +6,29 @@ import latestVersion from "latest-version";
|
|
|
6
6
|
import { Listr } from "listr2";
|
|
7
7
|
import { terminalLink } from "termi-link";
|
|
8
8
|
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
9
|
+
import {
|
|
10
|
+
dedupe,
|
|
11
|
+
dedupeIsSupported,
|
|
12
|
+
install,
|
|
13
|
+
installationErrorMessage,
|
|
14
|
+
prettyPrintCedarCommand
|
|
15
|
+
} from "@cedarjs/cli-helpers/packageManager";
|
|
9
16
|
import { getConfig } from "@cedarjs/project-config";
|
|
17
|
+
import { getPackageManager } from "@cedarjs/project-config/packageManager";
|
|
10
18
|
import c from "../../lib/colors.js";
|
|
11
19
|
import { generatePrismaClient } from "../../lib/generatePrismaClient.js";
|
|
12
20
|
import { getPaths } from "../../lib/index.js";
|
|
13
21
|
import { PLUGIN_CACHE_FILENAME } from "../../lib/plugin.js";
|
|
14
22
|
import { runPreUpgradeScripts } from "./preUpgradeScripts.js";
|
|
15
23
|
import { isValidCedarJSTag } from "./tags.js";
|
|
16
|
-
const handler = async ({
|
|
17
|
-
dryRun,
|
|
18
|
-
tag,
|
|
19
|
-
verbose,
|
|
20
|
-
dedupe,
|
|
21
|
-
yes,
|
|
22
|
-
force
|
|
23
|
-
}) => {
|
|
24
|
+
const handler = async (upgradeOptions) => {
|
|
25
|
+
const { dryRun, tag, verbose, dedupe: dedupe2, yes, force } = upgradeOptions;
|
|
24
26
|
recordTelemetryAttributes({
|
|
25
27
|
command: "upgrade",
|
|
26
28
|
dryRun: !!dryRun,
|
|
27
29
|
tag: tag ?? "latest",
|
|
28
30
|
verbose: !!verbose,
|
|
29
|
-
dedupe: !!
|
|
31
|
+
dedupe: !!dedupe2,
|
|
30
32
|
yes: !!yes,
|
|
31
33
|
force: !!force
|
|
32
34
|
});
|
|
@@ -104,8 +106,8 @@ const handler = async ({
|
|
|
104
106
|
enabled: (ctx) => !ctx.preUpgradeError
|
|
105
107
|
},
|
|
106
108
|
{
|
|
107
|
-
title:
|
|
108
|
-
task: () =>
|
|
109
|
+
title: `Running ${getPackageManager()} ${install()}`,
|
|
110
|
+
task: () => packageManagerInstall({ verbose }),
|
|
109
111
|
enabled: (ctx) => !ctx.preUpgradeError,
|
|
110
112
|
skip: () => !!dryRun
|
|
111
113
|
},
|
|
@@ -117,20 +119,19 @@ const handler = async ({
|
|
|
117
119
|
},
|
|
118
120
|
{
|
|
119
121
|
title: "De-duplicating dependencies",
|
|
120
|
-
skip: () => !!dryRun || !
|
|
121
|
-
enabled: (ctx) => !ctx.preUpgradeError,
|
|
122
|
+
skip: () => !!dryRun || !dedupe2,
|
|
123
|
+
enabled: (ctx) => dedupeIsSupported() && !ctx.preUpgradeError,
|
|
122
124
|
task: (_ctx, task) => dedupeDeps(task, { verbose })
|
|
123
125
|
},
|
|
124
126
|
{
|
|
125
127
|
title: "One more thing..",
|
|
126
128
|
task: (ctx, task) => {
|
|
127
129
|
const version = ctx.versionToUpgradeTo;
|
|
130
|
+
const upgradeMessage = dryRun ? `\u{1F3C3} Dry run complete. Your project would be upgraded to CedarJS ${version}.` : `\u{1F389} Your project has been upgraded to CedarJS ${version}!`;
|
|
128
131
|
const messageSections = [
|
|
129
132
|
`One more thing...
|
|
130
133
|
|
|
131
|
-
${c.warning(
|
|
132
|
-
`\u{1F389} Your project has been upgraded to CedarJS ${version}!`
|
|
133
|
-
)}
|
|
134
|
+
${c.warning(upgradeMessage)}
|
|
134
135
|
|
|
135
136
|
`
|
|
136
137
|
];
|
|
@@ -192,17 +193,15 @@ const handler = async ({
|
|
|
192
193
|
console.log(" " + preUpgradeMessage.replace(/\n/g, "\n "));
|
|
193
194
|
}
|
|
194
195
|
};
|
|
195
|
-
async function
|
|
196
|
+
async function packageManagerInstall({ verbose }) {
|
|
196
197
|
try {
|
|
197
|
-
await execa(
|
|
198
|
+
await execa(`${getPackageManager()} ${install()}`, {
|
|
198
199
|
shell: true,
|
|
199
200
|
stdio: verbose ? "inherit" : "pipe",
|
|
200
201
|
cwd: getPaths().base
|
|
201
202
|
});
|
|
202
203
|
} catch {
|
|
203
|
-
throw new Error(
|
|
204
|
-
"Could not finish installation. Please run `yarn install` and then `yarn dedupe`, before continuing"
|
|
205
|
-
);
|
|
204
|
+
throw new Error(installationErrorMessage());
|
|
206
205
|
}
|
|
207
206
|
}
|
|
208
207
|
async function removeCliCache({
|
|
@@ -447,14 +446,18 @@ async function refreshPrismaClient(task, { verbose }) {
|
|
|
447
446
|
const message = e instanceof Error ? e.message : String(e);
|
|
448
447
|
task.skip("Refreshing the Prisma client caused an Error.");
|
|
449
448
|
console.log(
|
|
450
|
-
"You may need to update your prisma client manually: $
|
|
449
|
+
"You may need to update your prisma client manually: $ " + prettyPrintCedarCommand(["prisma", "generate"])
|
|
451
450
|
);
|
|
452
451
|
console.log(c.error(message));
|
|
453
452
|
}
|
|
454
453
|
}
|
|
455
|
-
|
|
454
|
+
async function dedupeDeps(_task, { verbose }) {
|
|
455
|
+
const dedupeCmd = dedupe();
|
|
456
|
+
if (!dedupeCmd) {
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
456
459
|
try {
|
|
457
|
-
await execa(
|
|
460
|
+
await execa(`${getPackageManager()} ${dedupeCmd}`, {
|
|
458
461
|
shell: true,
|
|
459
462
|
stdio: verbose ? "inherit" : "pipe",
|
|
460
463
|
cwd: getPaths().base
|
|
@@ -463,11 +466,11 @@ const dedupeDeps = async (_task, { verbose }) => {
|
|
|
463
466
|
const message = e instanceof Error ? e.message : String(e);
|
|
464
467
|
console.log(c.error(message));
|
|
465
468
|
throw new Error(
|
|
466
|
-
|
|
469
|
+
`Could not finish de-duplication. Please run \`${getPackageManager()} ${dedupeCmd}\` before continuing`
|
|
467
470
|
);
|
|
468
471
|
}
|
|
469
|
-
await
|
|
470
|
-
}
|
|
472
|
+
await packageManagerInstall({ verbose });
|
|
473
|
+
}
|
|
471
474
|
export {
|
|
472
475
|
handler
|
|
473
476
|
};
|
package/dist/lib/merge/index.js
CHANGED
|
@@ -80,11 +80,13 @@ function insertAfterLastImport(expression, program) {
|
|
|
80
80
|
}
|
|
81
81
|
function prune(path) {
|
|
82
82
|
switch (path.parentPath.type) {
|
|
83
|
+
// If pruning 'path' would yield an ill-formed parent (e.g, '{foo:}' or 'const x;'), prune it.
|
|
83
84
|
case "ObjectProperty":
|
|
84
85
|
case "VariableDeclarator":
|
|
85
86
|
return path.parentPath.remove();
|
|
86
87
|
default:
|
|
87
88
|
console.log(`Warning: default prune strategy for ${path.parentPath.type}`);
|
|
89
|
+
// eslint-disable-next-line no-fallthrough
|
|
88
90
|
case "Program":
|
|
89
91
|
case "ArrayExpression":
|
|
90
92
|
return path.remove();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "3.0.1-next.
|
|
3
|
+
"version": "3.0.1-next.28+231f40ecc",
|
|
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": "3.0.1-next.
|
|
37
|
-
"@cedarjs/cli-helpers": "3.0.1-next.
|
|
38
|
-
"@cedarjs/fastify-web": "3.0.1-next.
|
|
39
|
-
"@cedarjs/internal": "3.0.1-next.
|
|
40
|
-
"@cedarjs/prerender": "3.0.1-next.
|
|
41
|
-
"@cedarjs/project-config": "3.0.1-next.
|
|
42
|
-
"@cedarjs/structure": "3.0.1-next.
|
|
43
|
-
"@cedarjs/telemetry": "3.0.1-next.
|
|
44
|
-
"@cedarjs/utils": "3.0.1-next.
|
|
45
|
-
"@cedarjs/web-server": "3.0.1-next.
|
|
36
|
+
"@cedarjs/api-server": "3.0.1-next.28+231f40ecc",
|
|
37
|
+
"@cedarjs/cli-helpers": "3.0.1-next.28+231f40ecc",
|
|
38
|
+
"@cedarjs/fastify-web": "3.0.1-next.28+231f40ecc",
|
|
39
|
+
"@cedarjs/internal": "3.0.1-next.28+231f40ecc",
|
|
40
|
+
"@cedarjs/prerender": "3.0.1-next.28+231f40ecc",
|
|
41
|
+
"@cedarjs/project-config": "3.0.1-next.28+231f40ecc",
|
|
42
|
+
"@cedarjs/structure": "3.0.1-next.28+231f40ecc",
|
|
43
|
+
"@cedarjs/telemetry": "3.0.1-next.28+231f40ecc",
|
|
44
|
+
"@cedarjs/utils": "3.0.1-next.28+231f40ecc",
|
|
45
|
+
"@cedarjs/web-server": "3.0.1-next.28+231f40ecc",
|
|
46
46
|
"@listr2/prompt-adapter-enquirer": "4.2.1",
|
|
47
47
|
"@opentelemetry/api": "1.9.0",
|
|
48
48
|
"@opentelemetry/core": "1.30.1",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"semver": "7.7.4",
|
|
84
84
|
"smol-toml": "1.6.0",
|
|
85
85
|
"string-env-interpolation": "1.0.1",
|
|
86
|
-
"systeminformation": "5.31.
|
|
86
|
+
"systeminformation": "5.31.5",
|
|
87
87
|
"termi-link": "1.1.0",
|
|
88
88
|
"title-case": "3.0.3",
|
|
89
89
|
"unionfs": "4.6.0",
|
|
@@ -95,15 +95,18 @@
|
|
|
95
95
|
"@babel/cli": "7.28.6",
|
|
96
96
|
"@babel/core": "^7.26.10",
|
|
97
97
|
"@types/archiver": "^7.0.0",
|
|
98
|
-
"memfs": "4.
|
|
98
|
+
"memfs": "4.57.1",
|
|
99
99
|
"node-ssh": "13.2.1",
|
|
100
100
|
"ts-dedent": "2.2.0",
|
|
101
101
|
"tsx": "4.21.0",
|
|
102
102
|
"typescript": "5.9.3",
|
|
103
103
|
"vitest": "3.2.4"
|
|
104
104
|
},
|
|
105
|
+
"engines": {
|
|
106
|
+
"node": ">=24"
|
|
107
|
+
},
|
|
105
108
|
"publishConfig": {
|
|
106
109
|
"access": "public"
|
|
107
110
|
},
|
|
108
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "231f40eccbc8a4b508d2e6faefb1f0d273f6d793"
|
|
109
112
|
}
|