backport 7.3.3 → 7.3.6

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.
@@ -21,6 +21,7 @@ const setupRepo_1 = require("./ui/setupRepo");
21
21
  async function backportRun(processArgs, optionsFromModule = {}) {
22
22
  const argv = (0, yargs_parser_1.default)(processArgs);
23
23
  const ci = argv.ci ?? optionsFromModule.ci;
24
+ const ls = argv.ls ?? optionsFromModule.ls;
24
25
  const logFilePath = argv.logFilePath ?? optionsFromModule.logFilePath;
25
26
  (0, logger_1.initLogger)({ ci, logFilePath });
26
27
  // don't show spinner for yargs commands that exit the process without stopping the spinner first
@@ -81,18 +82,8 @@ async function backportRun(processArgs, optionsFromModule = {}) {
81
82
  backportResponse,
82
83
  });
83
84
  }
84
- if (e instanceof HandledError_1.HandledError || e instanceof apiRequestV4_1.GithubV4Exception) {
85
- (0, logger_1.consoleLog)(e.message);
86
- }
87
- else if (e instanceof Error) {
88
- // output
89
- (0, logger_1.consoleLog)('\n');
90
- (0, logger_1.consoleLog)(chalk_1.default.bold('⚠️ Ouch! An unhandled error occured 😿'));
91
- (0, logger_1.consoleLog)(e.stack ? e.stack : e.message);
92
- (0, logger_1.consoleLog)('Please open an issue in https://github.com/sqren/backport/issues or contact me directly on https://twitter.com/sorenlouv');
93
- (0, logger_1.consoleLog)(chalk_1.default.italic(`For additional details see the logs: ${(0, env_1.getLogfilePath)({
94
- logFilePath,
95
- })}`));
85
+ if (!ls) {
86
+ outputError({ e, logFilePath });
96
87
  }
97
88
  logger_1.logger.error('Unhandled exception', e);
98
89
  process.exitCode = 1;
@@ -100,3 +91,19 @@ async function backportRun(processArgs, optionsFromModule = {}) {
100
91
  }
101
92
  }
102
93
  exports.backportRun = backportRun;
94
+ function outputError({ e, logFilePath, }) {
95
+ if (e instanceof HandledError_1.HandledError || e instanceof apiRequestV4_1.GithubV4Exception) {
96
+ (0, logger_1.consoleLog)(e.message);
97
+ return;
98
+ }
99
+ if (e instanceof Error) {
100
+ // output
101
+ (0, logger_1.consoleLog)('\n');
102
+ (0, logger_1.consoleLog)(chalk_1.default.bold('⚠️ Ouch! An unhandled error occured 😿'));
103
+ (0, logger_1.consoleLog)(e.stack ? e.stack : e.message);
104
+ (0, logger_1.consoleLog)('Please open an issue in https://github.com/sqren/backport/issues or contact me directly on https://twitter.com/sorenlouv');
105
+ (0, logger_1.consoleLog)(chalk_1.default.italic(`For additional details see the logs: ${(0, env_1.getLogfilePath)({
106
+ logFilePath,
107
+ })}`));
108
+ }
109
+ }
@@ -1,9 +1,9 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { DocumentNode } from 'graphql';
3
3
  interface GithubError {
4
- type: string;
5
- path: string[];
6
- locations: {
4
+ type?: string;
5
+ path?: string[];
6
+ locations?: {
7
7
  line: number;
8
8
  column: number;
9
9
  }[];
@@ -15,7 +15,7 @@ function throwOnInvalidAccessToken({ error, repoOwner, repoName, }) {
15
15
  const statusCode = error.githubResponse.status;
16
16
  switch (statusCode) {
17
17
  case 200: {
18
- const repoNotFound = error.githubResponse.data.errors?.some((error) => error.type === 'NOT_FOUND' && error.path.join('.') === 'repository');
18
+ const repoNotFound = error.githubResponse.data.errors?.some((error) => error.type === 'NOT_FOUND' && error.path?.join('.') === 'repository');
19
19
  const grantedScopes = error.githubResponse.headers['x-oauth-scopes'] || '';
20
20
  const requiredScopes = error.githubResponse.headers['x-accepted-oauth-scopes'] || '';
21
21
  const ssoHeader = (0, maybe_1.maybe)(error.githubResponse.headers['x-github-sso']);
@@ -40,7 +40,7 @@ exports.parseRemoteConfig = parseRemoteConfig;
40
40
  function swallowMissingConfigFileException(error) {
41
41
  const { data, errors } = error.githubResponse.data;
42
42
  const missingConfigError = errors?.some((error) => {
43
- return error.path.includes('remoteConfig') && error.type === 'NOT_FOUND';
43
+ return error.path?.includes('remoteConfig') && error.type === 'NOT_FOUND';
44
44
  });
45
45
  // swallow error if it's just the config file that's missing
46
46
  if (missingConfigError && data != null) {
@@ -63,7 +63,12 @@ async function getCommits(options) {
63
63
  });
64
64
  }
65
65
  catch (e) {
66
- spinner.fail();
66
+ if (options.ls) {
67
+ spinner.stop();
68
+ }
69
+ else {
70
+ spinner.fail();
71
+ }
67
72
  throw e;
68
73
  }
69
74
  }
@@ -1 +1 @@
1
- export declare const PACKAGE_VERSION = "7.3.3";
1
+ export declare const PACKAGE_VERSION = "7.3.6";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PACKAGE_VERSION = void 0;
4
- exports.PACKAGE_VERSION = '7.3.3';
4
+ exports.PACKAGE_VERSION = '7.3.6';
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "branches",
15
15
  "branching"
16
16
  ],
17
- "version": "7.3.3",
17
+ "version": "7.3.6",
18
18
  "main": "./dist/entrypoint.module.js",
19
19
  "types": "dist/entrypoint.module.d.ts",
20
20
  "bin": {