git-stack-cli 2.1.1-beta → 2.1.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
@@ -37090,11 +37090,24 @@ var BaseStore = createStore()(immer2((set2, get) => ({
37090
37090
  state.mutate.output(state, { node });
37091
37091
  });
37092
37092
  },
37093
- error(message) {
37094
- set2((state) => {
37095
- const node = /* @__PURE__ */ React16.createElement(Text, {
37093
+ error(error) {
37094
+ let node;
37095
+ if (typeof error === "string") {
37096
+ node = /* @__PURE__ */ React16.createElement(Text, {
37097
+ color: colors.red
37098
+ }, error);
37099
+ } else if (error instanceof Error) {
37100
+ node = /* @__PURE__ */ React16.createElement(Box_default, {
37101
+ flexDirection: "column"
37102
+ }, /* @__PURE__ */ React16.createElement(Text, {
37103
+ color: colors.red
37104
+ }, error.stack));
37105
+ } else {
37106
+ node = /* @__PURE__ */ React16.createElement(Text, {
37096
37107
  color: colors.red
37097
- }, message);
37108
+ }, `Unhandled error: ${JSON.stringify(error)}`);
37109
+ }
37110
+ set2((state) => {
37098
37111
  state.mutate.output(state, { node });
37099
37112
  });
37100
37113
  },
@@ -37280,9 +37293,7 @@ async function cli(unsafe_command, unsafe_options) {
37280
37293
  };
37281
37294
  state.actions.set((state2) => state2.mutate.end_pending_output(state2, id));
37282
37295
  state.actions.debug(log.end(result));
37283
- state.actions.debug(result.output);
37284
- state.actions.debug(`
37285
- `);
37296
+ state.actions.debug(log.output(result));
37286
37297
  if (!options.ignoreExitCode && result.code !== 0) {
37287
37298
  reject(new Error(log.error(result)));
37288
37299
  } else {
@@ -37318,7 +37329,7 @@ cli.sync = function cli_sync(unsafe_command, unsafe_options) {
37318
37329
  duration
37319
37330
  };
37320
37331
  state.actions.debug(log.end(result));
37321
- state.actions.debug(result.output);
37332
+ state.actions.debug(log.output(result));
37322
37333
  if (!options.ignoreExitCode && result.code !== 0) {
37323
37334
  throw new Error(log.error(result));
37324
37335
  }
@@ -37336,6 +37347,10 @@ var log = {
37336
37347
  const { command, code, duration } = result;
37337
37348
  return `[end] ${command} (exit_code=${code} duration=${duration})`;
37338
37349
  },
37350
+ output(result) {
37351
+ return `${result.output}
37352
+ `;
37353
+ },
37339
37354
  error(result) {
37340
37355
  const { command, code, duration } = result;
37341
37356
  return `${command} (exit_code=${code} duration=${duration})`;
@@ -45625,7 +45640,7 @@ var yargs_default = Yargs;
45625
45640
 
45626
45641
  // src/command.ts
45627
45642
  async function command2() {
45628
- 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.1.1-beta").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
45643
+ 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.1.2").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
45629
45644
  }
45630
45645
  var GlobalOptions = {
45631
45646
  verbose: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-stack-cli",
3
- "version": "2.1.1-beta",
3
+ "version": "2.1.2",
4
4
  "description": "",
5
5
  "author": "magus",
6
6
  "license": "MIT",
package/src/app/Store.tsx CHANGED
@@ -84,7 +84,7 @@ export type State = {
84
84
  unmount(): void;
85
85
  newline(): void;
86
86
  json(value: pretty_json.JSONValue): void;
87
- error(message: string): void;
87
+ error(error: unknown): void;
88
88
  output(node: React.ReactNode): void;
89
89
  debug(node: React.ReactNode, id?: string): void;
90
90
 
@@ -176,9 +176,24 @@ const BaseStore = createStore<State>()(
176
176
  });
177
177
  },
178
178
 
179
- error(message) {
179
+ error(error) {
180
+ let node: React.ReactNode;
181
+
182
+ if (typeof error === "string") {
183
+ node = <Ink.Text color={colors.red}>{error}</Ink.Text>;
184
+ } else if (error instanceof Error) {
185
+ node = (
186
+ <Ink.Box flexDirection="column">
187
+ <Ink.Text color={colors.red}>{error.stack}</Ink.Text>
188
+ </Ink.Box>
189
+ );
190
+ } else {
191
+ node = (
192
+ <Ink.Text color={colors.red}>{`Unhandled error: ${JSON.stringify(error)}`}</Ink.Text>
193
+ );
194
+ }
195
+
180
196
  set((state) => {
181
- const node = <Ink.Text color={colors.red}>{message}</Ink.Text>;
182
197
  state.mutate.output(state, { node });
183
198
  });
184
199
  },
package/src/core/cli.ts CHANGED
@@ -79,8 +79,7 @@ export async function cli(
79
79
 
80
80
  state.actions.set((state) => state.mutate.end_pending_output(state, id));
81
81
  state.actions.debug(log.end(result));
82
- state.actions.debug(result.output);
83
- state.actions.debug("\n");
82
+ state.actions.debug(log.output(result));
84
83
 
85
84
  if (!options.ignoreExitCode && result.code !== 0) {
86
85
  reject(new Error(log.error(result)));
@@ -131,7 +130,7 @@ cli.sync = function cli_sync(
131
130
  };
132
131
 
133
132
  state.actions.debug(log.end(result));
134
- state.actions.debug(result.output);
133
+ state.actions.debug(log.output(result));
135
134
 
136
135
  if (!options.ignoreExitCode && result.code !== 0) {
137
136
  throw new Error(log.error(result));
@@ -154,6 +153,10 @@ const log = {
154
153
  return `[end] ${command} (exit_code=${code} duration=${duration})`;
155
154
  },
156
155
 
156
+ output(result: Return) {
157
+ return `${result.output}\n`;
158
+ },
159
+
157
160
  error(result: Return) {
158
161
  const { command, code, duration } = result;
159
162
  return `${command} (exit_code=${code} duration=${duration})`;