@cedarjs/cli 5.0.0-canary.2455 → 5.0.0-canary.2457
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import boxen from "boxen";
|
|
4
|
+
import execa from "execa";
|
|
4
5
|
import { Listr } from "listr2";
|
|
5
6
|
import * as toml from "smol-toml";
|
|
6
7
|
import { env as envInterpolation } from "string-env-interpolation";
|
|
@@ -490,6 +491,44 @@ const commands = (yargs, ssh) => {
|
|
|
490
491
|
}
|
|
491
492
|
return servers;
|
|
492
493
|
};
|
|
494
|
+
const warnIfUnpushedCommits = async () => {
|
|
495
|
+
try {
|
|
496
|
+
const { stdout } = await execa("git", ["log", "@{u}..", "--oneline"], {
|
|
497
|
+
cwd: getPaths().base
|
|
498
|
+
});
|
|
499
|
+
const unpushedCommits = stdout.trim();
|
|
500
|
+
if (!unpushedCommits) {
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
console.warn(
|
|
504
|
+
c.warning("\nWarning: You have local commits that have not been pushed:")
|
|
505
|
+
);
|
|
506
|
+
console.warn(
|
|
507
|
+
unpushedCommits.split("\n").map((line) => ` ${line}`).join("\n")
|
|
508
|
+
);
|
|
509
|
+
console.warn(
|
|
510
|
+
c.warning(
|
|
511
|
+
"The server will pull from the remote, so these commits will not be deployed.\n"
|
|
512
|
+
)
|
|
513
|
+
);
|
|
514
|
+
const { default: prompts } = await import("prompts");
|
|
515
|
+
const { confirmed } = await prompts({
|
|
516
|
+
type: "confirm",
|
|
517
|
+
name: "confirmed",
|
|
518
|
+
message: "Deploy anyway?",
|
|
519
|
+
initial: false
|
|
520
|
+
});
|
|
521
|
+
if (!confirmed) {
|
|
522
|
+
console.log("Aborting deploy. Push your commits and try again.");
|
|
523
|
+
process.exit(1);
|
|
524
|
+
}
|
|
525
|
+
} catch (e) {
|
|
526
|
+
console.error(
|
|
527
|
+
c.error("\nCould not check for unpushed commits before deploying.")
|
|
528
|
+
);
|
|
529
|
+
throw e;
|
|
530
|
+
}
|
|
531
|
+
};
|
|
493
532
|
const handler = async (yargs) => {
|
|
494
533
|
const { SshExecutor } = await import("./SshExecutor.js");
|
|
495
534
|
const tomlPath = path.join(getPaths().base, "deploy.toml");
|
|
@@ -500,6 +539,9 @@ const handler = async (yargs) => {
|
|
|
500
539
|
);
|
|
501
540
|
process.exit(1);
|
|
502
541
|
}
|
|
542
|
+
if (yargs.gitCheck) {
|
|
543
|
+
await warnIfUnpushedCommits();
|
|
544
|
+
}
|
|
503
545
|
const ssh = new SshExecutor(yargs.verbose);
|
|
504
546
|
try {
|
|
505
547
|
const tasks = new Listr(commands(yargs, ssh), {
|
|
@@ -533,5 +575,6 @@ export {
|
|
|
533
575
|
serverConfigWithDefaults,
|
|
534
576
|
throwMissingConfig,
|
|
535
577
|
verifyConfig,
|
|
536
|
-
verifyServerConfig
|
|
578
|
+
verifyServerConfig,
|
|
579
|
+
warnIfUnpushedCommits
|
|
537
580
|
};
|
|
@@ -71,6 +71,11 @@ const builder = (yargs) => {
|
|
|
71
71
|
default: false,
|
|
72
72
|
type: "boolean"
|
|
73
73
|
});
|
|
74
|
+
yargs.option("git-check", {
|
|
75
|
+
describe: "Check for unpushed commits before deploying",
|
|
76
|
+
default: true,
|
|
77
|
+
type: "boolean"
|
|
78
|
+
});
|
|
74
79
|
yargs.epilogue(
|
|
75
80
|
`Also see the ${terminalLink(
|
|
76
81
|
"Redwood Baremetal Deploy Reference",
|
|
@@ -92,7 +97,8 @@ async function handler(yargs) {
|
|
|
92
97
|
cleanup: yargs.cleanup,
|
|
93
98
|
maintenance: yargs.maintenance,
|
|
94
99
|
rollback: yargs.rollback,
|
|
95
|
-
verbose: yargs.verbose
|
|
100
|
+
verbose: yargs.verbose,
|
|
101
|
+
gitCheck: yargs.gitCheck
|
|
96
102
|
});
|
|
97
103
|
const { handler: baremetalHandler } = await import("./baremetal/baremetalHandler.js");
|
|
98
104
|
return baremetalHandler(yargs);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "5.0.0-canary.
|
|
3
|
+
"version": "5.0.0-canary.2457",
|
|
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.3",
|
|
35
35
|
"@babel/preset-typescript": "7.28.5",
|
|
36
|
-
"@cedarjs/api-server": "5.0.0-canary.
|
|
37
|
-
"@cedarjs/cli-helpers": "5.0.0-canary.
|
|
38
|
-
"@cedarjs/fastify-web": "5.0.0-canary.
|
|
39
|
-
"@cedarjs/internal": "5.0.0-canary.
|
|
40
|
-
"@cedarjs/prerender": "5.0.0-canary.
|
|
41
|
-
"@cedarjs/project-config": "5.0.0-canary.
|
|
42
|
-
"@cedarjs/structure": "5.0.0-canary.
|
|
43
|
-
"@cedarjs/telemetry": "5.0.0-canary.
|
|
44
|
-
"@cedarjs/utils": "5.0.0-canary.
|
|
45
|
-
"@cedarjs/vite": "5.0.0-canary.
|
|
46
|
-
"@cedarjs/web-server": "5.0.0-canary.
|
|
36
|
+
"@cedarjs/api-server": "5.0.0-canary.2457",
|
|
37
|
+
"@cedarjs/cli-helpers": "5.0.0-canary.2457",
|
|
38
|
+
"@cedarjs/fastify-web": "5.0.0-canary.2457",
|
|
39
|
+
"@cedarjs/internal": "5.0.0-canary.2457",
|
|
40
|
+
"@cedarjs/prerender": "5.0.0-canary.2457",
|
|
41
|
+
"@cedarjs/project-config": "5.0.0-canary.2457",
|
|
42
|
+
"@cedarjs/structure": "5.0.0-canary.2457",
|
|
43
|
+
"@cedarjs/telemetry": "5.0.0-canary.2457",
|
|
44
|
+
"@cedarjs/utils": "5.0.0-canary.2457",
|
|
45
|
+
"@cedarjs/vite": "5.0.0-canary.2457",
|
|
46
|
+
"@cedarjs/web-server": "5.0.0-canary.2457",
|
|
47
47
|
"@listr2/prompt-adapter-enquirer": "4.2.1",
|
|
48
48
|
"@opentelemetry/api": "1.9.1",
|
|
49
49
|
"@opentelemetry/core": "1.30.1",
|