git-stack-cli 2.0.0-beta → 2.0.1-beta

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/js/index.js CHANGED
@@ -37050,15 +37050,20 @@ var BaseStore = createStore()(immer2((set2, get) => ({
37050
37050
  sync_github: null,
37051
37051
  is_dirty_check_stash: false,
37052
37052
  abort_handler: null,
37053
- is_exiting: false,
37053
+ exit_mode: null,
37054
37054
  step: "loading",
37055
37055
  output: [],
37056
37056
  pending_output: {},
37057
37057
  pr: {},
37058
37058
  actions: {
37059
- exit(code, clear = true) {
37059
+ exit(code, args) {
37060
37060
  set2((state) => {
37061
- state.is_exiting = true;
37061
+ if (args?.quiet ?? code === 0) {
37062
+ state.exit_mode = "quiet";
37063
+ } else {
37064
+ state.exit_mode = "normal";
37065
+ }
37066
+ let clear = args?.clear ?? true;
37062
37067
  const node = /* @__PURE__ */ React16.createElement(Exit, {
37063
37068
  clear,
37064
37069
  code
@@ -40576,6 +40581,7 @@ async function run11() {
40576
40581
  }, "✅ Changes restored from stash"));
40577
40582
  }
40578
40583
  }
40584
+ actions.exit(0);
40579
40585
  }
40580
40586
 
40581
40587
  // src/commands/Log.tsx
@@ -40611,6 +40617,7 @@ async function run12(args) {
40611
40617
  ].join(" | ");
40612
40618
  const result = await cli(command);
40613
40619
  actions.output(result.stdout);
40620
+ actions.exit(0);
40614
40621
  }
40615
40622
 
40616
40623
  // src/components/ErrorBoundary.tsx
@@ -40672,17 +40679,24 @@ class ErrorBoundary extends React52.Component {
40672
40679
  // src/components/ExitingGate.tsx
40673
40680
  var React53 = __toESM(require_react(), 1);
40674
40681
  function ExitingGate(props) {
40675
- const is_exiting = Store.useState((state) => state.is_exiting);
40676
- if (!is_exiting) {
40682
+ const exit_mode = Store.useState((state) => state.exit_mode);
40683
+ if (!exit_mode) {
40677
40684
  return props.children;
40678
40685
  }
40679
- return /* @__PURE__ */ React53.createElement(Box_default, {
40680
- flexDirection: "column"
40681
- }, /* @__PURE__ */ React53.createElement(Text, {
40682
- color: colors.red
40683
- }, /* @__PURE__ */ React53.createElement(FormatText, {
40684
- message: "\uD83D\uDEA8 Exiting…"
40685
- })));
40686
+ switch (exit_mode) {
40687
+ case "quiet":
40688
+ return null;
40689
+ case "normal":
40690
+ return /* @__PURE__ */ React53.createElement(Box_default, {
40691
+ flexDirection: "column"
40692
+ }, /* @__PURE__ */ React53.createElement(Text, {
40693
+ color: colors.red
40694
+ }, /* @__PURE__ */ React53.createElement(FormatText, {
40695
+ message: "\uD83D\uDEA8 Exiting…"
40696
+ })));
40697
+ default:
40698
+ return null;
40699
+ }
40686
40700
  }
40687
40701
 
40688
40702
  // src/app/App.tsx
@@ -45580,7 +45594,7 @@ var yargs_default = Yargs;
45580
45594
 
45581
45595
  // src/command.ts
45582
45596
  async function command2() {
45583
- return yargs_default(hideBin(process.argv)).usage("Usage: git stack [command] [options]").command("$0", "Sync commit ranges to Github", (yargs) => yargs.options(DefaultOptions)).command("fixup [commit]", "Amend staged changes to a specific commit in history", (yargs) => yargs.positional("commit", FixupOptions.commit)).command("log [args...]", "Print an abbreviated log with numbered commits, useful for git stack fixup", (yargs) => yargs.strict(false)).command("rebase", "Update local branch via rebase with latest changes from origin master branch", (yargs) => yargs).option("verbose", GlobalOptions.verbose).wrap(123).strict().version("2.0.0-beta").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
45597
+ return yargs_default(hideBin(process.argv)).usage("Usage: git stack [command] [options]").command("$0", "Sync commit ranges to Github", (yargs) => yargs.options(DefaultOptions)).command("fixup [commit]", "Amend staged changes to a specific commit in history", (yargs) => yargs.positional("commit", FixupOptions.commit)).command("log [args...]", "Print an abbreviated log with numbered commits, useful for git stack fixup", (yargs) => yargs.strict(false)).command("rebase", "Update local branch via rebase with latest changes from origin master branch", (yargs) => yargs).option("verbose", GlobalOptions.verbose).wrap(123).strict().version("2.0.1-beta").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
45584
45598
  }
45585
45599
  var GlobalOptions = {
45586
45600
  verbose: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-stack-cli",
3
- "version": "2.0.0-beta",
3
+ "version": "2.0.1-beta",
4
4
  "description": "",
5
5
  "author": "magus",
6
6
  "license": "MIT",
@@ -75,6 +75,8 @@ async function run_build() {
75
75
  if (!WATCH) {
76
76
  await run_build();
77
77
  } else {
78
+ await run_build();
79
+
78
80
  console.debug("👀 Watching for changes…");
79
81
 
80
82
  const { signal } = new AbortController();
@@ -35,7 +35,7 @@ if (!previous_version_match?.groups) {
35
35
 
36
36
  const previous_version = previous_version_match.groups.version;
37
37
  // convert `1.0.4` to `104`
38
- const not_dot_version = previous_version.replace(/\./g, "");
38
+ const not_dot_version = previous_version.replace(/[^a-z0-9]/gi, "");
39
39
  const previous_class = `GitStackAT${not_dot_version}`;
40
40
  previous_formula = previous_formula.replace("class GitStack", `class ${previous_class}`);
41
41
 
package/src/app/Store.tsx CHANGED
@@ -33,6 +33,11 @@ type SyncGithubState = {
33
33
  // async function that returns exit code
34
34
  type AbortHandler = () => Promise<number>;
35
35
 
36
+ type ExitArgs = {
37
+ quiet?: boolean;
38
+ clear?: boolean;
39
+ };
40
+
36
41
  export type State = {
37
42
  // set immediately in `index.tsx` so no `null` scenario
38
43
  process_argv: Array<string>;
@@ -53,7 +58,7 @@ export type State = {
53
58
  sync_github: null | SyncGithubState;
54
59
  is_dirty_check_stash: boolean;
55
60
  abort_handler: null | AbortHandler;
56
- is_exiting: boolean;
61
+ exit_mode: null | "normal" | "quiet";
57
62
 
58
63
  step:
59
64
  | "github-api-error"
@@ -74,7 +79,7 @@ export type State = {
74
79
  pr: { [branch: string]: PullRequest };
75
80
 
76
81
  actions: {
77
- exit(code: number, clear?: boolean): void;
82
+ exit(code: number, args?: ExitArgs): void;
78
83
  clear(): void;
79
84
  unmount(): void;
80
85
  newline(): void;
@@ -124,7 +129,7 @@ const BaseStore = createStore<State>()(
124
129
  sync_github: null,
125
130
  is_dirty_check_stash: false,
126
131
  abort_handler: null,
127
- is_exiting: false,
132
+ exit_mode: null,
128
133
 
129
134
  step: "loading",
130
135
 
@@ -134,9 +139,15 @@ const BaseStore = createStore<State>()(
134
139
  pr: {},
135
140
 
136
141
  actions: {
137
- exit(code, clear = true) {
142
+ exit(code, args) {
138
143
  set((state) => {
139
- state.is_exiting = true;
144
+ if (args?.quiet ?? code === 0) {
145
+ state.exit_mode = "quiet";
146
+ } else {
147
+ state.exit_mode = "normal";
148
+ }
149
+
150
+ let clear = args?.clear ?? true;
140
151
 
141
152
  const node = <Exit clear={clear} code={code} />;
142
153
  state.mutate.output(state, { node });
@@ -118,4 +118,6 @@ async function run() {
118
118
  actions.output(<Ink.Text color={colors.green}>✅ Changes restored from stash</Ink.Text>);
119
119
  }
120
120
  }
121
+
122
+ actions.exit(0);
121
123
  }
@@ -65,4 +65,6 @@ async function run(args: Args) {
65
65
  const result = await cli(command);
66
66
 
67
67
  actions.output(result.stdout);
68
+
69
+ actions.exit(0);
68
70
  }
@@ -11,17 +11,27 @@ type Props = {
11
11
  };
12
12
 
13
13
  export function ExitingGate(props: Props) {
14
- const is_exiting = Store.useState((state) => state.is_exiting);
14
+ const exit_mode = Store.useState((state) => state.exit_mode);
15
15
 
16
- if (!is_exiting) {
16
+ if (!exit_mode) {
17
17
  return props.children;
18
18
  }
19
19
 
20
- return (
21
- <Ink.Box flexDirection="column">
22
- <Ink.Text color={colors.red}>
23
- <FormatText message="🚨 Exiting…" />
24
- </Ink.Text>
25
- </Ink.Box>
26
- );
20
+ switch (exit_mode) {
21
+ case "quiet":
22
+ return null;
23
+
24
+ case "normal":
25
+ return (
26
+ <Ink.Box flexDirection="column">
27
+ <Ink.Text color={colors.red}>
28
+ <FormatText message="🚨 Exiting…" />
29
+ </Ink.Text>
30
+ </Ink.Box>
31
+ );
32
+
33
+ default:
34
+ exit_mode satisfies never;
35
+ return null;
36
+ }
27
37
  }