git-stack-cli 2.3.1 → 2.3.2

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
@@ -32698,34 +32698,34 @@ async function sleep(time) {
32698
32698
  // src/app/Exit.tsx
32699
32699
  function Exit(props) {
32700
32700
  React14.useEffect(() => {
32701
- handle_exit().catch((err) => {
32701
+ Exit.handle_exit(props).catch((err) => {
32702
32702
  console.error(err);
32703
32703
  });
32704
- async function handle_exit() {
32705
- const state = Store.getState();
32706
- const actions = state.actions;
32707
- actions.debug(`[Exit] handle_exit ${JSON.stringify(props)}`);
32708
- let exit_code = props.code;
32709
- if (state.abort_handler) {
32710
- exit_code = await state.abort_handler();
32711
- }
32712
- if (state.is_dirty_check_stash) {
32713
- await cli("git stash pop");
32714
- actions.output(/* @__PURE__ */ React14.createElement(Text, {
32715
- color: colors.green
32716
- }, "✅ Changes restored from stash"));
32717
- }
32718
- await sleep(1);
32719
- if (props.clear) {
32720
- actions.clear();
32721
- }
32722
- actions.unmount();
32723
- process.exitCode = exit_code;
32724
- process.exit();
32725
- }
32726
32704
  }, [props.clear, props.code]);
32727
32705
  return null;
32728
32706
  }
32707
+ Exit.handle_exit = async function handle_exit(props) {
32708
+ const state = Store.getState();
32709
+ const actions = state.actions;
32710
+ actions.debug(`[Exit] handle_exit ${JSON.stringify(props)}`);
32711
+ let exit_code = props.code;
32712
+ if (state.abort_handler) {
32713
+ exit_code = await state.abort_handler();
32714
+ }
32715
+ if (state.is_dirty_check_stash) {
32716
+ await cli("git stash pop");
32717
+ actions.output(/* @__PURE__ */ React14.createElement(Text, {
32718
+ color: colors.green
32719
+ }, "✅ Changes restored from stash"));
32720
+ }
32721
+ await sleep(1);
32722
+ if (props.clear) {
32723
+ actions.clear();
32724
+ }
32725
+ actions.unmount();
32726
+ process.exitCode = exit_code;
32727
+ process.exit();
32728
+ };
32729
32729
 
32730
32730
  // src/app/LogTimestamp.tsx
32731
32731
  var React15 = __toESM(require_react(), 1);
@@ -39216,7 +39216,7 @@ Rebase.run = async function run5(props) {
39216
39216
  actions.output(/* @__PURE__ */ React34.createElement(Text, {
39217
39217
  color: colors.red
39218
39218
  }, "\uD83D\uDEA8 Abort"));
39219
- handle_exit();
39219
+ handle_exit2();
39220
39220
  return 19;
39221
39221
  });
39222
39222
  const temp_branch_name = `${branch_name}_${short_id()}`;
@@ -39310,7 +39310,7 @@ Rebase.run = async function run5(props) {
39310
39310
  }
39311
39311
  cli.sync(`pwd`, spawn_options);
39312
39312
  }
39313
- function handle_exit() {
39313
+ function handle_exit2() {
39314
39314
  actions.output(/* @__PURE__ */ React34.createElement(Text, {
39315
39315
  color: colors.yellow
39316
39316
  }, "Restoring ", /* @__PURE__ */ React34.createElement(Brackets, null, branch_name), "…"));
@@ -39360,7 +39360,7 @@ async function run6() {
39360
39360
  actions.output(/* @__PURE__ */ React36.createElement(Text, {
39361
39361
  color: colors.red
39362
39362
  }, "\uD83D\uDEA8 Abort"));
39363
- handle_exit();
39363
+ handle_exit2();
39364
39364
  return 15;
39365
39365
  });
39366
39366
  const temp_branch_name = `${branch_name}_${short_id()}`;
@@ -39439,7 +39439,7 @@ async function run6() {
39439
39439
  }
39440
39440
  cli.sync(`pwd`, spawn_options);
39441
39441
  }
39442
- function handle_exit() {
39442
+ function handle_exit2() {
39443
39443
  actions.output(/* @__PURE__ */ React36.createElement(Text, {
39444
39444
  color: colors.yellow
39445
39445
  }, "Restoring ", /* @__PURE__ */ React36.createElement(Brackets, null, branch_name), "…"));
@@ -40258,7 +40258,7 @@ async function run9() {
40258
40258
  actions.output(/* @__PURE__ */ React44.createElement(Text, {
40259
40259
  color: colors.red
40260
40260
  }, "\uD83D\uDEA8 Abort"));
40261
- handle_exit();
40261
+ handle_exit2();
40262
40262
  return 17;
40263
40263
  });
40264
40264
  let DEFAULT_PR_BODY = "";
@@ -40403,7 +40403,7 @@ async function run9() {
40403
40403
  });
40404
40404
  }
40405
40405
  }
40406
- function handle_exit() {
40406
+ function handle_exit2() {
40407
40407
  actions.output(/* @__PURE__ */ React44.createElement(Text, {
40408
40408
  color: colors.yellow
40409
40409
  }, "Restoring PR state…"));
@@ -40709,7 +40709,9 @@ class ErrorBoundary extends React52.Component {
40709
40709
  component_stack = component_stack.split(`
40710
40710
  `).slice(1).join(`
40711
40711
  `);
40712
- this.setState({ component_stack });
40712
+ this.setState({ component_stack }, async () => {
40713
+ await Exit.handle_exit({ code: 30, clear: true });
40714
+ });
40713
40715
  }
40714
40716
  }
40715
40717
  render() {
@@ -45664,7 +45666,7 @@ var yargs_default = Yargs;
45664
45666
 
45665
45667
  // src/command.ts
45666
45668
  async function command2() {
45667
- return yargs_default(hideBin(process.argv)).scriptName("git stack").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.3.1").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
45669
+ return yargs_default(hideBin(process.argv)).scriptName("git stack").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.3.2").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
45668
45670
  }
45669
45671
  var GlobalOptions = {
45670
45672
  verbose: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-stack-cli",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "",
5
5
  "author": "magus",
6
6
  "license": "MIT",
package/src/app/Exit.tsx CHANGED
@@ -15,44 +15,44 @@ type Props = {
15
15
  export function Exit(props: Props) {
16
16
  React.useEffect(() => {
17
17
  // immediately handle exit on mount
18
- handle_exit().catch((err) => {
18
+ Exit.handle_exit(props).catch((err) => {
19
19
  // eslint-disable-next-line no-console
20
20
  console.error(err);
21
21
  });
22
+ }, [props.clear, props.code]);
22
23
 
23
- async function handle_exit() {
24
- const state = Store.getState();
25
- const actions = state.actions;
24
+ return null;
25
+ }
26
26
 
27
- actions.debug(`[Exit] handle_exit ${JSON.stringify(props)}`);
27
+ Exit.handle_exit = async function handle_exit(props: Props) {
28
+ const state = Store.getState();
29
+ const actions = state.actions;
28
30
 
29
- let exit_code = props.code;
31
+ actions.debug(`[Exit] handle_exit ${JSON.stringify(props)}`);
30
32
 
31
- // run abort_handler if it exists
32
- if (state.abort_handler) {
33
- exit_code = await state.abort_handler();
34
- }
33
+ let exit_code = props.code;
35
34
 
36
- // restore git stash if necessary
37
- if (state.is_dirty_check_stash) {
38
- await cli("git stash pop");
39
- actions.output(<Ink.Text color={colors.green}>✅ Changes restored from stash</Ink.Text>);
40
- }
35
+ // run abort_handler if it exists
36
+ if (state.abort_handler) {
37
+ exit_code = await state.abort_handler();
38
+ }
41
39
 
42
- // ensure output has a chance to render
43
- await sleep(1);
40
+ // restore git stash if necessary
41
+ if (state.is_dirty_check_stash) {
42
+ await cli("git stash pop");
43
+ actions.output(<Ink.Text color={colors.green}>✅ Changes restored from stash</Ink.Text>);
44
+ }
44
45
 
45
- // finally handle the actual app and process exit
46
- if (props.clear) {
47
- actions.clear();
48
- }
46
+ // ensure output has a chance to render
47
+ await sleep(1);
49
48
 
50
- actions.unmount();
49
+ // finally handle the actual app and process exit
50
+ if (props.clear) {
51
+ actions.clear();
52
+ }
51
53
 
52
- process.exitCode = exit_code;
53
- process.exit();
54
- }
55
- }, [props.clear, props.code]);
54
+ actions.unmount();
56
55
 
57
- return null;
58
- }
56
+ process.exitCode = exit_code;
57
+ process.exit();
58
+ };
@@ -3,6 +3,7 @@ import * as React from "react";
3
3
 
4
4
  import * as Ink from "ink-cjs";
5
5
 
6
+ import { Exit } from "~/app/Exit";
6
7
  import { FormatText } from "~/app/FormatText";
7
8
  import { Store } from "~/app/Store";
8
9
  import { colors } from "~/core/colors";
@@ -36,7 +37,9 @@ export class ErrorBoundary extends React.Component<Props, State> {
36
37
  if (component_stack) {
37
38
  // remove first line of component_stack
38
39
  component_stack = component_stack.split("\n").slice(1).join("\n");
39
- this.setState({ component_stack });
40
+ this.setState({ component_stack }, async () => {
41
+ await Exit.handle_exit({ code: 30, clear: true });
42
+ });
40
43
  }
41
44
  }
42
45