@cedarjs/cli 8.0.0-canary.3630 → 8.0.0-canary.3633

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.
@@ -888,43 +888,55 @@ const commands = (yargs, ssh) => {
888
888
  }
889
889
  return servers;
890
890
  };
891
- const warnIfUnpushedCommits = async () => {
891
+ const warnIfUnpushedCommits = async (yes = false) => {
892
+ let unpushedCommits;
892
893
  try {
893
894
  const { stdout } = await execa("git", ["log", "@{u}..", "--oneline"], {
894
895
  cwd: getPaths().base
895
896
  });
896
- const unpushedCommits = stdout.trim();
897
- if (!unpushedCommits) {
898
- return;
899
- }
900
- console.warn(
901
- c.warning("\nWarning: You have local commits that have not been pushed:")
902
- );
903
- console.warn(
904
- unpushedCommits.split("\n").map((line) => ` ${line}`).join("\n")
905
- );
906
- console.warn(
907
- c.warning(
908
- "The server will pull from the remote, so these commits will not be deployed.\n"
909
- )
910
- );
911
- const { default: prompts } = await import("prompts");
912
- const { confirmed } = await prompts({
913
- type: "confirm",
914
- name: "confirmed",
915
- message: "Deploy anyway?",
916
- initial: false
917
- });
918
- if (!confirmed) {
919
- console.log("Aborting deploy. Push your commits and try again.");
920
- process.exit(1);
921
- }
897
+ unpushedCommits = stdout.trim();
922
898
  } catch (e) {
923
899
  console.error(
924
900
  c.error("\nCould not check for unpushed commits before deploying.")
925
901
  );
926
902
  throw e;
927
903
  }
904
+ if (!unpushedCommits) {
905
+ return;
906
+ }
907
+ console.warn(
908
+ c.warning("\nWarning: You have local commits that have not been pushed:")
909
+ );
910
+ console.warn(
911
+ unpushedCommits.split("\n").map((line) => ` ${line}`).join("\n")
912
+ );
913
+ console.warn(
914
+ c.warning(
915
+ "The server will pull from the remote, so these commits will not be deployed.\n"
916
+ )
917
+ );
918
+ console.warn(c.warning("To skip this check, rerun with --no-git-check.\n"));
919
+ if (yes) {
920
+ return;
921
+ }
922
+ if (process.stdin.isTTY !== true) {
923
+ throw new Error(
924
+ "Cannot ask whether to deploy anyway without a terminal. Push your commits, rerun with --no-git-check to skip this check, or rerun with --yes to deploy anyway."
925
+ );
926
+ }
927
+ const { default: prompts } = await import("prompts");
928
+ const { confirmed } = await prompts({
929
+ type: "confirm",
930
+ name: "confirmed",
931
+ message: "Deploy anyway?",
932
+ initial: false
933
+ });
934
+ if (!confirmed) {
935
+ console.log(
936
+ "Aborting deploy. Push your commits and try again, or rerun with --no-git-check."
937
+ );
938
+ process.exit(1);
939
+ }
928
940
  };
929
941
  const handler = async (yargs) => {
930
942
  const { SshExecutor } = await import("./SshExecutor.js");
@@ -936,7 +948,7 @@ const handler = async (yargs) => {
936
948
  process.exit(1);
937
949
  }
938
950
  if (yargs.gitCheck) {
939
- await warnIfUnpushedCommits();
951
+ await warnIfUnpushedCommits(yargs.yes);
940
952
  }
941
953
  const ssh = new SshExecutor(yargs.verbose ?? false);
942
954
  try {
@@ -81,6 +81,12 @@ const builder = (yargs) => {
81
81
  default: true,
82
82
  type: "boolean"
83
83
  });
84
+ yargs.option("yes", {
85
+ alias: "y",
86
+ describe: "Deploy despite unpushed commits, without prompting",
87
+ default: false,
88
+ type: "boolean"
89
+ });
84
90
  yargs.epilogue(
85
91
  `Also see the ${terminalLink(
86
92
  "Cedar Baremetal Deploy Reference",
@@ -104,7 +110,8 @@ async function handler(yargs) {
104
110
  maintenance: yargs.maintenance,
105
111
  rollback: yargs.rollback,
106
112
  verbose: yargs.verbose,
107
- gitCheck: yargs.gitCheck
113
+ gitCheck: yargs.gitCheck,
114
+ yes: yargs.yes
108
115
  });
109
116
  const { handler: baremetalHandler } = await import("./baremetal/baremetalHandler.js");
110
117
  return baremetalHandler(yargs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "8.0.0-canary.3630",
3
+ "version": "8.0.0-canary.3633",
4
4
  "description": "The CedarJS Command Line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,17 +35,17 @@
35
35
  "@babel/preset-typescript": "7.29.7",
36
36
  "@babel/traverse": "7.29.12",
37
37
  "@babel/types": "7.29.11",
38
- "@cedarjs/api-server": "8.0.0-canary.3630",
39
- "@cedarjs/babel-config": "8.0.0-canary.3630",
40
- "@cedarjs/cli-helpers": "8.0.0-canary.3630",
41
- "@cedarjs/internal": "8.0.0-canary.3630",
42
- "@cedarjs/prerender": "8.0.0-canary.3630",
43
- "@cedarjs/project-config": "8.0.0-canary.3630",
44
- "@cedarjs/structure": "8.0.0-canary.3630",
45
- "@cedarjs/telemetry": "8.0.0-canary.3630",
46
- "@cedarjs/utils": "8.0.0-canary.3630",
47
- "@cedarjs/vite": "8.0.0-canary.3630",
48
- "@cedarjs/web-server": "8.0.0-canary.3630",
38
+ "@cedarjs/api-server": "8.0.0-canary.3633",
39
+ "@cedarjs/babel-config": "8.0.0-canary.3633",
40
+ "@cedarjs/cli-helpers": "8.0.0-canary.3633",
41
+ "@cedarjs/internal": "8.0.0-canary.3633",
42
+ "@cedarjs/prerender": "8.0.0-canary.3633",
43
+ "@cedarjs/project-config": "8.0.0-canary.3633",
44
+ "@cedarjs/structure": "8.0.0-canary.3633",
45
+ "@cedarjs/telemetry": "8.0.0-canary.3633",
46
+ "@cedarjs/utils": "8.0.0-canary.3633",
47
+ "@cedarjs/vite": "8.0.0-canary.3633",
48
+ "@cedarjs/web-server": "8.0.0-canary.3633",
49
49
  "@listr2/prompt-adapter-enquirer": "4.4.3",
50
50
  "@prisma/internals": "7.10.1",
51
51
  "ansis": "4.5.0",
@@ -86,7 +86,7 @@
86
86
  "yargs": "18.2.0"
87
87
  },
88
88
  "devDependencies": {
89
- "@cedarjs/framework-tools": "8.0.0-canary.3630",
89
+ "@cedarjs/framework-tools": "8.0.0-canary.3633",
90
90
  "@prisma/dmmf": "7.10.1",
91
91
  "@types/archiver": "^7.0.0",
92
92
  "memfs": "4.80.0",