git-stack-cli 1.14.0 → 1.15.1

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.
Files changed (49) hide show
  1. package/README.md +2 -4
  2. package/dist/cjs/index.cjs +310 -180
  3. package/package.json +2 -1
  4. package/scripts/link.ts +14 -0
  5. package/src/app/App.tsx +41 -30
  6. package/src/app/AutoUpdate.tsx +9 -24
  7. package/src/app/CherryPickCheck.tsx +1 -2
  8. package/src/app/Debug.tsx +5 -6
  9. package/src/app/DependencyCheck.tsx +6 -6
  10. package/src/app/DetectInitialPR.tsx +2 -8
  11. package/src/app/DirtyCheck.tsx +51 -26
  12. package/src/app/Exit.tsx +41 -8
  13. package/src/app/FormatText.tsx +1 -5
  14. package/src/app/GatherMetadata.tsx +6 -13
  15. package/src/app/GithubApiError.tsx +1 -1
  16. package/src/app/HandleCtrlCSigint.tsx +36 -0
  17. package/src/app/LocalCommitStatus.tsx +1 -3
  18. package/src/app/LogTimestamp.tsx +1 -5
  19. package/src/app/ManualRebase.tsx +15 -37
  20. package/src/app/MultiSelect.tsx +2 -2
  21. package/src/app/PostRebaseStatus.tsx +2 -0
  22. package/src/app/PreManualRebase.tsx +3 -5
  23. package/src/app/RebaseCheck.tsx +1 -2
  24. package/src/app/SelectCommitRanges.tsx +6 -10
  25. package/src/app/Status.tsx +1 -1
  26. package/src/app/StatusTable.tsx +1 -4
  27. package/src/app/Store.tsx +29 -3
  28. package/src/app/SyncGithub.tsx +15 -45
  29. package/src/app/Table.tsx +4 -14
  30. package/src/app/TextInput.tsx +2 -7
  31. package/src/app/VerboseDebugInfo.tsx +1 -5
  32. package/src/app/YesNoPrompt.tsx +42 -31
  33. package/src/command.ts +8 -17
  34. package/src/commands/Fixup.tsx +17 -24
  35. package/src/commands/Log.tsx +3 -7
  36. package/src/commands/Rebase.tsx +18 -38
  37. package/src/components/ErrorBoundary.tsx +79 -0
  38. package/src/components/ExitingGate.tsx +27 -0
  39. package/src/core/CommitMetadata.ts +1 -1
  40. package/src/core/GitReviseTodo.test.ts +3 -3
  41. package/src/core/GitReviseTodo.ts +6 -8
  42. package/src/core/Metadata.test.ts +4 -4
  43. package/src/core/StackSummaryTable.ts +3 -3
  44. package/src/core/chalk.ts +1 -5
  45. package/src/core/cli.ts +2 -2
  46. package/src/core/github.tsx +15 -14
  47. package/src/core/pretty_json.ts +7 -0
  48. package/src/github/gh.auth_status.test.ts +2 -6
  49. package/src/index.tsx +42 -6
package/src/index.tsx CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ /* eslint-disable no-console */
4
+
3
5
  import * as React from "react";
4
6
 
5
7
  import * as Ink from "ink-cjs";
@@ -7,12 +9,33 @@ import * as Ink from "ink-cjs";
7
9
  import { App } from "~/app/App";
8
10
  import { Store } from "~/app/Store";
9
11
  import { command } from "~/command";
12
+ import { pretty_json } from "~/core/pretty_json";
13
+
14
+ (async function main() {
15
+ try {
16
+ const argv = await command();
17
+
18
+ process.on("uncaughtException", (error) => {
19
+ console.error("🚨 uncaughtException");
20
+ console.error(error);
21
+ maybe_verbose_help();
22
+ process.exit(237);
23
+ });
24
+
25
+ process.on("unhandledRejection", (reason, _promise) => {
26
+ console.error("🚨 unhandledRejection");
27
+ console.error(reason);
28
+ maybe_verbose_help();
29
+ process.exit(238);
30
+ });
10
31
 
11
- command()
12
- .then((argv) => {
13
32
  const ink = Ink.render(<App />, {
14
33
  // If true, each update will be rendered as a separate output, without replacing the previous one.
15
34
  // debug: true,
35
+ //
36
+ // Configure whether Ink should listen to Ctrl+C keyboard input and exit the app.
37
+ // We intentionally handle this ourselves in `<Exit />`
38
+ exitOnCtrlC: false,
16
39
  });
17
40
 
18
41
  Store.setState((state) => {
@@ -22,7 +45,20 @@ command()
22
45
  state.cwd = process.cwd();
23
46
  });
24
47
 
25
- Store.getState().actions.debug(JSON.stringify(argv, null, 2));
26
- })
27
- // eslint-disable-next-line no-console
28
- .catch(console.error);
48
+ Store.getState().actions.debug(pretty_json(argv as any));
49
+
50
+ await ink.waitUntilExit();
51
+
52
+ function maybe_verbose_help() {
53
+ if (!argv.verbose) {
54
+ console.error();
55
+ console.error("Try again with `--verbose` to see more information.");
56
+ }
57
+ }
58
+ } catch (err) {
59
+ console.error(err);
60
+ process.exit(236);
61
+ }
62
+ })().catch((err) => {
63
+ console.error(err);
64
+ });