@shopify/cli-kit 3.0.27 → 3.3.0

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 (56) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/analytics.d.ts +3 -1
  3. package/dist/analytics.js +19 -4
  4. package/dist/analytics.js.map +1 -1
  5. package/dist/api/graphql/find_store_by_domain.d.ts +21 -0
  6. package/dist/api/graphql/find_store_by_domain.js +24 -0
  7. package/dist/api/graphql/find_store_by_domain.js.map +1 -0
  8. package/dist/api/graphql/index.d.ts +1 -0
  9. package/dist/api/graphql/index.js +1 -0
  10. package/dist/api/graphql/index.js.map +1 -1
  11. package/dist/error.js +4 -0
  12. package/dist/error.js.map +1 -1
  13. package/dist/index.d.ts +0 -1
  14. package/dist/index.js +0 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/node/base-command.d.ts +6 -0
  17. package/dist/node/base-command.js +9 -0
  18. package/dist/node/base-command.js.map +1 -0
  19. package/dist/node/cli.js +5 -45
  20. package/dist/node/cli.js.map +1 -1
  21. package/dist/{colors.d.ts → node/colors.d.ts} +0 -0
  22. package/dist/{colors.js → node/colors.js} +0 -0
  23. package/dist/node/colors.js.map +1 -0
  24. package/dist/node/error-handler.d.ts +3 -0
  25. package/dist/node/error-handler.js +79 -0
  26. package/dist/node/error-handler.js.map +1 -0
  27. package/dist/node/hooks/postrun.d.ts +2 -0
  28. package/dist/node/hooks/postrun.js +6 -0
  29. package/dist/node/hooks/postrun.js.map +1 -0
  30. package/dist/node/hooks/prerun.d.ts +2 -0
  31. package/dist/node/hooks/prerun.js +9 -0
  32. package/dist/node/hooks/prerun.js.map +1 -0
  33. package/dist/{dependency.d.ts → node/node-package-manager.d.ts} +92 -23
  34. package/dist/{dependency.js → node/node-package-manager.js} +56 -49
  35. package/dist/node/node-package-manager.js.map +1 -0
  36. package/dist/node/ruby.js +1 -1
  37. package/dist/node/ruby.js.map +1 -1
  38. package/dist/output.d.ts +9 -2
  39. package/dist/output.js +17 -7
  40. package/dist/output.js.map +1 -1
  41. package/dist/port.js +23 -1
  42. package/dist/port.js.map +1 -1
  43. package/dist/tsconfig.tsbuildinfo +1 -1
  44. package/dist/ui/autocomplete.js +1 -1
  45. package/dist/ui/autocomplete.js.map +1 -1
  46. package/dist/ui/input.js +1 -1
  47. package/dist/ui/input.js.map +1 -1
  48. package/dist/ui/select.js +1 -1
  49. package/dist/ui/select.js.map +1 -1
  50. package/dist/ui.js +3 -3
  51. package/dist/ui.js.map +1 -1
  52. package/dist/version.js +1 -1
  53. package/dist/version.js.map +1 -1
  54. package/package.json +8 -4
  55. package/dist/colors.js.map +0 -1
  56. package/dist/dependency.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @shopify/cli-kit
2
2
 
3
+ ## 3.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f7708fcc: Replace fastify/http-proxy with node-http-proxy to support Node < 17
8
+
9
+ ## 3.2.0
10
+
11
+ ### Patch Changes
12
+
13
+ - 86b04187: Exit without error message on deliberate user actions
14
+
15
+ ## 3.1.0
16
+
17
+ ### Minor Changes
18
+
19
+ - d17770e8: Massage error stacktraces to be properly formatted on Bugsnag
20
+ - d17770e8: Not report unhandled errors that go straight to the Node runtime
21
+
22
+ ### Patch Changes
23
+
24
+ - 740f73ac: Added a retrying implementation to the method that obtains a random local port. Occasionally that third party logic failed in the middle of the execution of a command and abort the process. Running the command for a second time solved that temporary problem
25
+ - de8ee02d: [FEATURE] Add query to fetch shop by domain
26
+ - 45f0f0b9: Bump theme-check version
27
+
3
28
  ## 3.0.27
4
29
 
5
30
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  interface startOptions {
2
2
  command: string;
3
- args: string;
3
+ args: string[];
4
4
  currentTime?: number;
5
5
  }
6
6
  export declare const start: ({ command, args, currentTime }: startOptions) => void;
@@ -8,4 +8,6 @@ interface ReportEventOptions {
8
8
  errorMessage?: string;
9
9
  }
10
10
  export declare const reportEvent: (options?: ReportEventOptions) => Promise<void>;
11
+ export declare type ProjectType = 'node' | 'php' | 'ruby' | undefined;
12
+ export declare function getProjectType(directory: string): Promise<ProjectType>;
11
13
  export {};
package/dist/analytics.js CHANGED
@@ -2,10 +2,10 @@
2
2
  import * as environment from './environment.js';
3
3
  import { fetch } from './http.js';
4
4
  import { platformAndArch } from './os.js';
5
- import { join, resolve } from './path.js';
5
+ import { exists as fileExists } from './file.js';
6
+ import { join as joinPath, resolve } from './path.js';
6
7
  import { version as rubyVersion } from './node/ruby.js';
7
8
  import { debug, content, token } from './output.js';
8
- import { getProjectType } from './dependency.js';
9
9
  import constants from './constants.js';
10
10
  import { cliKitStore } from './store.js';
11
11
  const url = 'https://monorail-edge.shopifysvc.com/v1/produce';
@@ -75,9 +75,9 @@ const buildPayload = async (errorMessage, currentTime) => {
75
75
  return {
76
76
  schema_id: 'app_cli3_command/1.0',
77
77
  payload: {
78
- project_type: await getProjectType(join(directory, 'web')),
78
+ project_type: await getProjectType(joinPath(directory, 'web')),
79
79
  command: startCommand,
80
- args: startArgs,
80
+ args: startArgs.join(' '),
81
81
  time_start: startTime,
82
82
  time_end: currentTime,
83
83
  total_time: totalTime(currentTime),
@@ -93,4 +93,19 @@ const buildPayload = async (errorMessage, currentTime) => {
93
93
  },
94
94
  };
95
95
  };
96
+ export async function getProjectType(directory) {
97
+ const nodeConfigFile = joinPath(directory, 'package.json');
98
+ const rubyConfigFile = joinPath(directory, 'Gemfile');
99
+ const phpConfigFile = joinPath(directory, 'composer.json');
100
+ if (await fileExists(nodeConfigFile)) {
101
+ return 'node';
102
+ }
103
+ else if (await fileExists(rubyConfigFile)) {
104
+ return 'ruby';
105
+ }
106
+ else if (await fileExists(phpConfigFile)) {
107
+ return 'php';
108
+ }
109
+ return undefined;
110
+ }
96
111
  //# sourceMappingURL=analytics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings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UAAU,EAAE,cAAc;SAC3B;KACF,CAAA;AACH,CAAC,CAAA","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport * as environment from './environment.js'\nimport {fetch} from './http.js'\nimport {platformAndArch} from './os.js'\nimport {join, resolve} from './path.js'\nimport {version as rubyVersion} from './node/ruby.js'\nimport {debug, content, token} from './output.js'\nimport {getProjectType} from './dependency.js'\nimport constants from './constants.js'\nimport {cliKitStore} from './store.js'\n\nconst url = 'https://monorail-edge.shopifysvc.com/v1/produce'\nlet startTime: number | undefined\nlet startCommand: string\nlet startArgs: string\n\ninterface startOptions {\n command: string\n args: string\n currentTime?: number\n}\n\nexport const start = ({command, args, currentTime = new Date().getTime()}: startOptions) => {\n startCommand = command\n startArgs = args\n startTime = currentTime\n}\n\ninterface ReportEventOptions {\n errorMessage?: string\n}\n\nexport const reportEvent = async (options: ReportEventOptions = {}) => {\n if (environment.local.analyticsDisabled()) return\n if (startCommand === undefined) return\n\n try {\n const currentTime = new Date().getTime()\n const payload = await buildPayload(options.errorMessage, currentTime)\n const body = JSON.stringify(payload)\n const headers = buildHeaders(currentTime)\n\n const response = await fetch(url, {method: 'POST', body, headers})\n if (response.status === 200) {\n debug(content`Analytics event sent: ${token.json(payload)}`)\n } else {\n debug(`Failed to report usage analytics: ${response.statusText}`)\n }\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n let message = 'Failed to report usage analytics'\n if (error instanceof Error) {\n message = message.concat(`: ${error.message}`)\n }\n debug(message)\n }\n}\n\nconst totalTime = (currentTime: number): number | undefined => {\n if (startTime === undefined) return undefined\n return currentTime - startTime\n}\n\nconst buildHeaders = (currentTime: number) => {\n return {\n 'Content-Type': 'application/json; charset=utf-8',\n 'X-Monorail-Edge-Event-Created-At-Ms': currentTime.toString(),\n 'X-Monorail-Edge-Event-Sent-At-Ms': currentTime.toString(),\n }\n}\n\nconst buildPayload = async (errorMessage: string | undefined, currentTime: number) => {\n let directory = process.cwd()\n const pathFlagIndex = startArgs.indexOf('--path')\n if (pathFlagIndex >= 0) {\n directory = resolve(startArgs[pathFlagIndex + 1])\n }\n const appInfo = cliKitStore().getAppInfo(directory)\n const {platform, arch} = platformAndArch()\n\n const rawPartnerId = appInfo?.orgId\n let partnerIdAsInt: number | undefined\n if (rawPartnerId !== undefined) {\n partnerIdAsInt = parseInt(rawPartnerId, 10)\n if (isNaN(partnerIdAsInt)) {\n partnerIdAsInt = undefined\n }\n }\n\n return {\n schema_id: 'app_cli3_command/1.0',\n payload: {\n project_type: await getProjectType(join(directory, 'web')),\n command: startCommand,\n args: startArgs,\n time_start: startTime,\n time_end: currentTime,\n total_time: totalTime(currentTime),\n success: errorMessage === undefined,\n error_message: errorMessage,\n uname: `${platform} ${arch}`,\n cli_version: await constants.versions.cliKit(),\n ruby_version: (await rubyVersion()) || '',\n node_version: process.version.replace('v', ''),\n is_employee: await environment.local.isShopify(),\n api_key: appInfo?.appId,\n partner_id: partnerIdAsInt,\n },\n }\n}\n"]}
1
+ {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAC,KAAK,EAAC,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAA;AACvC,OAAO,EAAC,MAAM,IAAI,UAAU,EAAC,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAC,IAAI,IAAI,QAAQ,EAAE,OAAO,EAAC,MAAM,WAAW,CAAA;AACnD,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AACjD,OAAO,SAAS,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAA;AAEtC,MAAM,GAAG,GAAG,iDAAiD,CAAA;A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,EAAE;QAC1C,OAAO,KAAK,CAAA;KACb;IACD,OAAO,SAAS,CAAA;AAClB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport * as environment from './environment.js'\nimport {fetch} from './http.js'\nimport {platformAndArch} from './os.js'\nimport {exists as fileExists} from './file.js'\nimport {join as joinPath, resolve} from './path.js'\nimport {version as rubyVersion} from './node/ruby.js'\nimport {debug, content, token} from './output.js'\nimport constants from './constants.js'\nimport {cliKitStore} from './store.js'\n\nconst url = 'https://monorail-edge.shopifysvc.com/v1/produce'\nlet startTime: number | undefined\nlet startCommand: string\nlet startArgs: string[]\n\ninterface startOptions {\n command: string\n args: string[]\n currentTime?: number\n}\n\nexport const start = ({command, args, currentTime = new Date().getTime()}: startOptions) => {\n startCommand = command\n startArgs = args\n startTime = currentTime\n}\n\ninterface ReportEventOptions {\n errorMessage?: string\n}\n\nexport const reportEvent = async (options: ReportEventOptions = {}) => {\n if (environment.local.analyticsDisabled()) return\n if (startCommand === undefined) return\n\n try {\n const currentTime = new Date().getTime()\n const payload = await buildPayload(options.errorMessage, currentTime)\n const body = JSON.stringify(payload)\n const headers = buildHeaders(currentTime)\n\n const response = await fetch(url, {method: 'POST', body, headers})\n if (response.status === 200) {\n debug(content`Analytics event sent: ${token.json(payload)}`)\n } else {\n debug(`Failed to report usage analytics: ${response.statusText}`)\n }\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n let message = 'Failed to report usage analytics'\n if (error instanceof Error) {\n message = message.concat(`: ${error.message}`)\n }\n debug(message)\n }\n}\n\nconst totalTime = (currentTime: number): number | undefined => {\n if (startTime === undefined) return undefined\n return currentTime - startTime\n}\n\nconst buildHeaders = (currentTime: number) => {\n return {\n 'Content-Type': 'application/json; charset=utf-8',\n 'X-Monorail-Edge-Event-Created-At-Ms': currentTime.toString(),\n 'X-Monorail-Edge-Event-Sent-At-Ms': currentTime.toString(),\n }\n}\n\nconst buildPayload = async (errorMessage: string | undefined, currentTime: number) => {\n let directory = process.cwd()\n const pathFlagIndex = startArgs.indexOf('--path')\n if (pathFlagIndex >= 0) {\n directory = resolve(startArgs[pathFlagIndex + 1])\n }\n const appInfo = cliKitStore().getAppInfo(directory)\n const {platform, arch} = platformAndArch()\n\n const rawPartnerId = appInfo?.orgId\n let partnerIdAsInt: number | undefined\n if (rawPartnerId !== undefined) {\n partnerIdAsInt = parseInt(rawPartnerId, 10)\n if (isNaN(partnerIdAsInt)) {\n partnerIdAsInt = undefined\n }\n }\n\n return {\n schema_id: 'app_cli3_command/1.0',\n payload: {\n project_type: await getProjectType(joinPath(directory, 'web')),\n command: startCommand,\n args: startArgs.join(' '),\n time_start: startTime,\n time_end: currentTime,\n total_time: totalTime(currentTime),\n success: errorMessage === undefined,\n error_message: errorMessage,\n uname: `${platform} ${arch}`,\n cli_version: await constants.versions.cliKit(),\n ruby_version: (await rubyVersion()) || '',\n node_version: process.version.replace('v', ''),\n is_employee: await environment.local.isShopify(),\n api_key: appInfo?.appId,\n partner_id: partnerIdAsInt,\n },\n }\n}\n\nexport type ProjectType = 'node' | 'php' | 'ruby' | undefined\n\nexport async function getProjectType(directory: string): Promise<ProjectType> {\n const nodeConfigFile = joinPath(directory, 'package.json')\n const rubyConfigFile = joinPath(directory, 'Gemfile')\n const phpConfigFile = joinPath(directory, 'composer.json')\n\n if (await fileExists(nodeConfigFile)) {\n return 'node'\n } else if (await fileExists(rubyConfigFile)) {\n return 'ruby'\n } else if (await fileExists(phpConfigFile)) {\n return 'php'\n }\n return undefined\n}\n"]}
@@ -0,0 +1,21 @@
1
+ export declare const FindStoreByDomainQuery: string;
2
+ export interface FindStoreByDomainSchema {
3
+ organizations: {
4
+ nodes: {
5
+ id: string;
6
+ businessName: string;
7
+ website: string;
8
+ appsNext: boolean;
9
+ stores: {
10
+ nodes: {
11
+ shopId: string;
12
+ link: string;
13
+ shopDomain: string;
14
+ shopName: string;
15
+ transferDisabled: boolean;
16
+ convertableToPartnerTest: boolean;
17
+ }[];
18
+ };
19
+ }[];
20
+ };
21
+ }
@@ -0,0 +1,24 @@
1
+ import { gql } from 'graphql-request';
2
+ export const FindStoreByDomainQuery = gql `
3
+ query FindOrganization($id: ID!, $shopDomain: String) {
4
+ organizations(id: $id, first: 1) {
5
+ nodes {
6
+ id
7
+ businessName
8
+ website
9
+ appsNext
10
+ stores(shopDomain: $shopDomain, first: 1, archived: false) {
11
+ nodes {
12
+ shopId
13
+ link
14
+ shopDomain
15
+ shopName
16
+ transferDisabled
17
+ convertableToPartnerTest
18
+ }
19
+ }
20
+ }
21
+ }
22
+ }
23
+ `;
24
+ //# sourceMappingURL=find_store_by_domain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find_store_by_domain.js","sourceRoot":"","sources":["../../../src/api/graphql/find_store_by_domain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,iBAAiB,CAAA;AAEnC,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;CAqBxC,CAAA","sourcesContent":["import {gql} from 'graphql-request'\n\nexport const FindStoreByDomainQuery = gql`\n query FindOrganization($id: ID!, $shopDomain: String) {\n organizations(id: $id, first: 1) {\n nodes {\n id\n businessName\n website\n appsNext\n stores(shopDomain: $shopDomain, first: 1, archived: false) {\n nodes {\n shopId\n link\n shopDomain\n shopName\n transferDisabled\n convertableToPartnerTest\n }\n }\n }\n }\n }\n`\n\nexport interface FindStoreByDomainSchema {\n organizations: {\n nodes: {\n id: string\n businessName: string\n website: string\n appsNext: boolean\n stores: {\n nodes: {\n shopId: string\n link: string\n shopDomain: string\n shopName: string\n transferDisabled: boolean\n convertableToPartnerTest: boolean\n }[]\n }\n }[]\n }\n}\n"]}
@@ -19,3 +19,4 @@ export * from './functions/app_function_set.js';
19
19
  export * from './functions/compile_module.js';
20
20
  export * from './functions/module_compilation_status.js';
21
21
  export * from './find_org_basic.js';
22
+ export * from './find_store_by_domain.js';
@@ -19,4 +19,5 @@ export * from './functions/app_function_set.js';
19
19
  export * from './functions/compile_module.js';
20
20
  export * from './functions/module_compilation_status.js';
21
21
  export * from './find_org_basic.js';
22
+ export * from './find_store_by_domain.js';
22
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/graphql/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,uBAAuB,CAAA;AACrC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,sCAAsC,CAAA;AACpD,cAAc,qBAAqB,CAAA;AACnC,cAAc,uCAAuC,CAAA;AACrD,cAAc,kCAAkC,CAAA;AAChD,cAAc,2CAA2C,CAAA;AACzD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,0CAA0C,CAAA;AACxD,cAAc,qBAAqB,CAAA","sourcesContent":["export * from './find_org.js'\nexport * from './all_orgs.js'\nexport * from './create_app.js'\nexport * from './update_urls.js'\nexport * from './find_app.js'\nexport * from './update_draft.js'\nexport * from './generate_signed_upload_url.js'\nexport * from './create_deployment.js'\nexport * from './all_stores_by_org.js'\nexport * from './convert_dev_to_test_store.js'\nexport * from './extension_create.js'\nexport * from './extension_specifications.js'\nexport * from './all_app_extension_registrations.js'\nexport * from './get_variant_id.js'\nexport * from './functions/function_service_proxy.js'\nexport * from './functions/get_app_functions.js'\nexport * from './functions/module_upload_url_generate.js'\nexport * from './functions/app_function_set.js'\nexport * from './functions/compile_module.js'\nexport * from './functions/module_compilation_status.js'\nexport * from './find_org_basic.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/graphql/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,uBAAuB,CAAA;AACrC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,sCAAsC,CAAA;AACpD,cAAc,qBAAqB,CAAA;AACnC,cAAc,uCAAuC,CAAA;AACrD,cAAc,kCAAkC,CAAA;AAChD,cAAc,2CAA2C,CAAA;AACzD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,0CAA0C,CAAA;AACxD,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA","sourcesContent":["export * from './find_org.js'\nexport * from './all_orgs.js'\nexport * from './create_app.js'\nexport * from './update_urls.js'\nexport * from './find_app.js'\nexport * from './update_draft.js'\nexport * from './generate_signed_upload_url.js'\nexport * from './create_deployment.js'\nexport * from './all_stores_by_org.js'\nexport * from './convert_dev_to_test_store.js'\nexport * from './extension_create.js'\nexport * from './extension_specifications.js'\nexport * from './all_app_extension_registrations.js'\nexport * from './get_variant_id.js'\nexport * from './functions/function_service_proxy.js'\nexport * from './functions/get_app_functions.js'\nexport * from './functions/module_upload_url_generate.js'\nexport * from './functions/app_function_set.js'\nexport * from './functions/compile_module.js'\nexport * from './functions/module_compilation_status.js'\nexport * from './find_org_basic.js'\nexport * from './find_store_by_domain.js'\n"]}
package/dist/error.js CHANGED
@@ -57,8 +57,12 @@ export async function handler(error) {
57
57
  if (isFatal(error)) {
58
58
  fatal = error;
59
59
  }
60
+ else if (typeof error === 'string') {
61
+ fatal = new Bug(error);
62
+ }
60
63
  else {
61
64
  fatal = new Bug(error.message);
65
+ fatal.stack = error.stack;
62
66
  }
63
67
  if (fatal.type === FatalErrorType.Bug) {
64
68
  fatal.stack = error.stack;
package/dist/error.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,gBAAgB,EAAE,KAAK,IAAI,WAAW,EAAC,MAAM,aAAa,CAAA;AAC3E,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAElC,6DAA6D;AAC7D,aAAa;AACb,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAA;AACxC,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAA;AAE5C,gBAAgB,CAAC,OAAO,EAAE,CAAA;AAE1B,IAAK,cAIJ;AAJD,WAAK,cAAc;IACjB,qDAAK,CAAA;IACL,iEAAW,CAAA;IACX,iDAAG,CAAA;AACL,CAAC,EAJI,cAAc,KAAd,cAAc,QAIlB;AAED,MAAM,OAAO,eAAgB,SAAQ,KAAK;CAAG;AAE7C;;;GAGG;AACH,MAAM,OAAgB,KAAM,SAAQ,KAAK;IAGvC,YAAY,OAAgB,EAAE,IAAoB,EAAE,aAA6B,IAAI;QACnF,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAA;QAChC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QAClE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,KAAM,SAAQ,KAAK;IAC9B,YAAY,OAAgB,EAAE,aAA6B,IAAI;QAC7D,KAAK,CAAC,OAAO,EAAE,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA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AK,EAAE,MAAM,CAAC,CAAA;AAC5D,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAY;IACvC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACnB,OAAO,IAAI,CAAA;KACZ;IACD,IAAK,KAAe,CAAC,IAAI,KAAK,cAAc,CAAC,GAAG,EAAE;QAChD,OAAO,IAAI,CAAA;KACZ;IACD,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["import {Message, stringifyMessage, error as outputError} from './output.js'\nimport {Errors} from '@oclif/core'\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport sourceMapSupport from 'source-map-support'\n\nexport {ExtendableError} from 'ts-error'\nexport {AbortSignal} from 'abort-controller'\n\nsourceMapSupport.install()\n\nenum FatalErrorType {\n Abort,\n AbortSilent,\n Bug,\n}\n\nexport class CancelExecution extends Error {}\n\n/**\n * A fatal error represents an error shouldn't be rescued and that causes the execution to terminate.\n * There shouldn't be code that catches fatal errors.\n */\nexport abstract class Fatal extends Error {\n tryMessage: string | null\n type: FatalErrorType\n constructor(message: Message, type: FatalErrorType, tryMessage: Message | null = null) {\n super(stringifyMessage(message))\n this.tryMessage = tryMessage ? stringifyMessage(tryMessage) : null\n this.type = type\n }\n}\n\n/**\n * An abort error is a fatal error that shouldn't be reported as a bug.\n * Those usually represent unexpected scenarios that we can't handle and that usually require some action from the developer\n */\nexport class Abort extends Fatal {\n constructor(message: Message, tryMessage: Message | null = null) {\n super(message, FatalErrorType.Abort, tryMessage)\n }\n}\n\nexport class AbortSilent extends Fatal {\n constructor() {\n super('', FatalErrorType.AbortSilent)\n }\n}\n\n/**\n * A bug error is an error that represents a bug and therefore should be reported.\n */\nexport class Bug extends Fatal {\n constructor(message: Message, tryMessage: string | null = null) {\n super(message, FatalErrorType.Bug, tryMessage)\n }\n}\n\n/**\n * A function that handles errors that blow up in the CLI.\n * @param error Error to be handled.\n * @returns A promise that resolves with the error passed.\n */\nexport async function handler(error: Error): Promise<Error> {\n let fatal: Fatal\n if (isFatal(error)) {\n fatal = error as Fatal\n } else {\n fatal = new Bug(error.message)\n }\n\n if (fatal.type === FatalErrorType.Bug) {\n fatal.stack = error.stack\n }\n\n await outputError(fatal)\n return Promise.resolve(error)\n}\n\nexport function mapper(error: Error): Promise<Error> {\n if (error instanceof Errors.CLIError) {\n const mappedError = new Abort(error.message)\n mappedError.stack = error.stack\n return Promise.resolve(mappedError)\n } else {\n return Promise.resolve(error)\n }\n}\n\nexport function isFatal(error: Error): boolean {\n return Object.prototype.hasOwnProperty.call(error, 'type')\n}\n\nexport function shouldReport(error: Error): boolean {\n if (!isFatal(error)) {\n return true\n }\n if ((error as Fatal).type === FatalErrorType.Bug) {\n return true\n }\n return false\n}\n"]}
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,gBAAgB,EAAE,KAAK,IAAI,WAAW,EAAC,MAAM,aAAa,CAAA;AAC3E,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAElC,6DAA6D;AAC7D,aAAa;AACb,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAA;AACxC,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAA;AAE5C,gBAAgB,CAAC,OAAO,EAAE,CAAA;AAE1B,IAAK,cAIJ;AAJD,WAAK,cAAc;IACjB,qDAAK,CAAA;IACL,iEAAW,CAAA;IACX,iDAAG,CAAA;AACL,CAAC,EAJI,cAAc,KAAd,cAAc,QAIlB;AAED,MAAM,OAAO,eAAgB,SAAQ,KAAK;CAAG;AAE7C;;;GAGG;AACH,MAAM,OAAgB,KAAM,SAAQ,KAAK;IAGvC,YAAY,OAAgB,EAAE,IAAoB,EAAE,aAA6B,IAAI;QACnF,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAA;QAChC,IAAI,CAAC,UAAU,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AAA;AAC/B,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,KAAY;IACjC,IAAI,KAAK,YAAY,MAAM,CAAC,QAAQ,EAAE;QACpC,MAAM,WAAW,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC5C,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;QAC/B,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;KACpC;SAAM;QACL,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;KAC9B;AACH,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,KAAY;IAClC,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;AAC5D,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAY;IACvC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACnB,OAAO,IAAI,CAAA;KACZ;IACD,IAAK,KAAe,CAAC,IAAI,KAAK,cAAc,CAAC,GAAG,EAAE;QAChD,OAAO,IAAI,CAAA;KACZ;IACD,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["import {Message, stringifyMessage, error as outputError} from './output.js'\nimport {Errors} from '@oclif/core'\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport sourceMapSupport from 'source-map-support'\n\nexport {ExtendableError} from 'ts-error'\nexport {AbortSignal} from 'abort-controller'\n\nsourceMapSupport.install()\n\nenum FatalErrorType {\n Abort,\n AbortSilent,\n Bug,\n}\n\nexport class CancelExecution extends Error {}\n\n/**\n * A fatal error represents an error shouldn't be rescued and that causes the execution to terminate.\n * There shouldn't be code that catches fatal errors.\n */\nexport abstract class Fatal extends Error {\n tryMessage: string | null\n type: FatalErrorType\n constructor(message: Message, type: FatalErrorType, tryMessage: Message | null = null) {\n super(stringifyMessage(message))\n this.tryMessage = tryMessage ? stringifyMessage(tryMessage) : null\n this.type = type\n }\n}\n\n/**\n * An abort error is a fatal error that shouldn't be reported as a bug.\n * Those usually represent unexpected scenarios that we can't handle and that usually require some action from the developer\n */\nexport class Abort extends Fatal {\n constructor(message: Message, tryMessage: Message | null = null) {\n super(message, FatalErrorType.Abort, tryMessage)\n }\n}\n\nexport class AbortSilent extends Fatal {\n constructor() {\n super('', FatalErrorType.AbortSilent)\n }\n}\n\n/**\n * A bug error is an error that represents a bug and therefore should be reported.\n */\nexport class Bug extends Fatal {\n constructor(message: Message, tryMessage: string | null = null) {\n super(message, FatalErrorType.Bug, tryMessage)\n }\n}\n\n/**\n * A function that handles errors that blow up in the CLI.\n * @param error Error to be handled.\n * @returns A promise that resolves with the error passed.\n */\nexport async function handler(error: Error): Promise<Error> {\n let fatal: Fatal\n if (isFatal(error)) {\n fatal = error as Fatal\n } else if (typeof error === 'string') {\n fatal = new Bug(error as string)\n } else {\n fatal = new Bug(error.message)\n fatal.stack = error.stack\n }\n\n if (fatal.type === FatalErrorType.Bug) {\n fatal.stack = error.stack\n }\n\n await outputError(fatal)\n return Promise.resolve(error)\n}\n\nexport function mapper(error: Error): Promise<Error> {\n if (error instanceof Errors.CLIError) {\n const mappedError = new Abort(error.message)\n mappedError.stack = error.stack\n return Promise.resolve(mappedError)\n } else {\n return Promise.resolve(error)\n }\n}\n\nexport function isFatal(error: Error): boolean {\n return Object.prototype.hasOwnProperty.call(error, 'type')\n}\n\nexport function shouldReport(error: Error): boolean {\n if (!isFatal(error)) {\n return true\n }\n if ((error as Fatal).type === FatalErrorType.Bug) {\n return true\n }\n return false\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -3,7 +3,6 @@ export * as abort from './abort.js';
3
3
  export * as analytics from './analytics.js';
4
4
  export * as api from './api.js';
5
5
  export * as cli from './cli.js';
6
- export * as dependency from './dependency.js';
7
6
  export * as environment from './environment.js';
8
7
  export * as error from './error.js';
9
8
  export * as fastify from 'fastify';
package/dist/index.js CHANGED
@@ -3,7 +3,6 @@ export * as abort from './abort.js';
3
3
  export * as analytics from './analytics.js';
4
4
  export * as api from './api.js';
5
5
  export * as cli from './cli.js';
6
- export * as dependency from './dependency.js';
7
6
  export * as environment from './environment.js';
8
7
  export * as error from './error.js';
9
8
  export * as fastify from 'fastify';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAClC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,YAAY,MAAM,qBAAqB,CAAA","sourcesContent":["export {default as constants} from './constants.js'\nexport * as abort from './abort.js'\nexport * as analytics from './analytics.js'\nexport * as api from './api.js'\nexport * as cli from './cli.js'\nexport * as dependency from './dependency.js'\nexport * as environment from './environment.js'\nexport * as error from './error.js'\nexport * as fastify from 'fastify'\nexport * as file from './file.js'\nexport * as git from './git.js'\nexport * as github from './github.js'\nexport * as haiku from './haiku.js'\nexport * as http from './http.js'\nexport * as id from './id.js'\nexport * as npm from './npm.js'\nexport * as os from './os.js'\nexport * as output from './output.js'\nexport * as path from './path.js'\nexport * as plugins from './plugins.js'\nexport * as port from './port.js'\nexport * as schema from './schema.js'\nexport * as semver from './semver.js'\nexport * as session from './session.js'\nexport * as store from './store.js'\nexport * as string from './string.js'\nexport * as system from './system.js'\nexport * as template from './template.js'\nexport * as toml from './toml.js'\nexport * as ui from './ui.js'\nexport * as version from './version.js'\nexport * as vscode from './vscode.js'\nexport * as yaml from './yaml.js'\nexport * as outputMocker from './testing/output.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,gBAAgB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,cAAc,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,YAAY,MAAM,qBAAqB,CAAA","sourcesContent":["export {default as constants} from './constants.js'\nexport * as abort from './abort.js'\nexport * as analytics from './analytics.js'\nexport * as api from './api.js'\nexport * as cli from './cli.js'\nexport * as environment from './environment.js'\nexport * as error from './error.js'\nexport * as fastify from 'fastify'\nexport * as file from './file.js'\nexport * as git from './git.js'\nexport * as github from './github.js'\nexport * as haiku from './haiku.js'\nexport * as http from './http.js'\nexport * as id from './id.js'\nexport * as npm from './npm.js'\nexport * as os from './os.js'\nexport * as output from './output.js'\nexport * as path from './path.js'\nexport * as plugins from './plugins.js'\nexport * as port from './port.js'\nexport * as schema from './schema.js'\nexport * as semver from './semver.js'\nexport * as session from './session.js'\nexport * as store from './store.js'\nexport * as string from './string.js'\nexport * as system from './system.js'\nexport * as template from './template.js'\nexport * as toml from './toml.js'\nexport * as ui from './ui.js'\nexport * as version from './version.js'\nexport * as vscode from './vscode.js'\nexport * as yaml from './yaml.js'\nexport * as outputMocker from './testing/output.js'\n"]}
@@ -0,0 +1,6 @@
1
+ import { Command } from '@oclif/core';
2
+ export default abstract class extends Command {
3
+ catch(error: Error & {
4
+ exitCode?: number | undefined;
5
+ }): Promise<void>;
6
+ }
@@ -0,0 +1,9 @@
1
+ import { errorHandler } from './error-handler.js';
2
+ import { Command } from '@oclif/core';
3
+ // eslint-disable-next-line import/no-anonymous-default-export
4
+ export default class extends Command {
5
+ async catch(error) {
6
+ errorHandler(error);
7
+ }
8
+ }
9
+ //# sourceMappingURL=base-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-command.js","sourceRoot":"","sources":["../../src/node/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AAEnC,8DAA8D;AAC9D,MAAM,CAAC,OAAO,MAAgB,SAAQ,OAAO;IAC3C,KAAK,CAAC,KAAK,CAAC,KAA8C;QACxD,YAAY,CAAC,KAAK,CAAC,CAAA;IACrB,CAAC;CACF","sourcesContent":["import {errorHandler} from './error-handler.js'\nimport {Command} from '@oclif/core'\n\n// eslint-disable-next-line import/no-anonymous-default-export\nexport default abstract class extends Command {\n async catch(error: Error & {exitCode?: number | undefined}) {\n errorHandler(error)\n }\n}\n"]}
package/dist/node/cli.js CHANGED
@@ -1,11 +1,10 @@
1
1
  // CLI
2
+ import { findUpAndReadPackageJson } from './node-package-manager.js';
3
+ import { errorHandler } from './error-handler.js';
2
4
  import { initializeCliKitStore } from '../store.js';
3
5
  import { initiateLogging } from '../output.js';
4
6
  import { isDebug } from '../environment/local.js';
5
7
  import constants, { bugsnagApiKey } from '../constants.js';
6
- import { reportEvent } from '../analytics.js';
7
- import { mapper as errorMapper, handler as errorHandler, AbortSilent, shouldReport as shouldReportError, } from '../error.js';
8
- import { findUpAndReadPackageJson } from '../dependency.js';
9
8
  import { moduleDirectory } from '../path.js';
10
9
  import { run, settings, flush } from '@oclif/core';
11
10
  import Bugsnag from '@bugsnag/js';
@@ -22,28 +21,15 @@ export async function runCLI(options) {
22
21
  }
23
22
  else {
24
23
  Bugsnag.start({
24
+ appType: 'node',
25
25
  apiKey: bugsnagApiKey,
26
26
  logger: null,
27
27
  appVersion: await constants.versions.cliKit(),
28
28
  autoTrackSessions: false,
29
+ autoDetectErrors: false,
29
30
  });
30
31
  }
31
- run(undefined, options.moduleURL)
32
- .then(flush)
33
- .catch((error) => {
34
- if (error instanceof AbortSilent) {
35
- process.exit(1);
36
- }
37
- // eslint-disable-next-line promise/no-nesting
38
- return errorMapper(error)
39
- .then(reportError)
40
- .then((error) => {
41
- return errorHandler(error);
42
- })
43
- .then(() => {
44
- process.exit(1);
45
- });
46
- });
32
+ run(undefined, options.moduleURL).then(flush).catch(errorHandler);
47
33
  }
48
34
  /**
49
35
  * A function for create-x CLIs that automatically runs the "init" command.
@@ -61,31 +47,5 @@ export async function runCreateCLI(options) {
61
47
  }
62
48
  await runCLI(options);
63
49
  }
64
- const reportError = async (errorToReport) => {
65
- await reportEvent({ errorMessage: errorToReport.message });
66
- if (settings.debug || !shouldReportError(errorToReport))
67
- return errorToReport;
68
- let mappedError;
69
- // eslint-disable-next-line no-prototype-builtins
70
- if (Error.prototype.isPrototypeOf(errorToReport)) {
71
- mappedError = new Error(errorToReport.message);
72
- if (errorToReport.stack) {
73
- // For mac/linux, remove `file:///` from stacktrace
74
- // For windows, remove `file:///C:/` from stacktrace
75
- const regex = '\\((.*node_modules.)(@shopify.)?';
76
- mappedError.stack = errorToReport.stack.replace(new RegExp(regex, 'g'), '(');
77
- }
78
- }
79
- else if (typeof errorToReport === 'string') {
80
- mappedError = new Error(errorToReport);
81
- }
82
- else {
83
- mappedError = new Error('Unknown error');
84
- }
85
- await new Promise((resolve, reject) => {
86
- Bugsnag.notify(mappedError, undefined, resolve);
87
- });
88
- return mappedError;
89
- };
90
50
  export default runCLI;
91
51
  //# sourceMappingURL=cli.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/node/cli.ts"],"names":[],"mappings":"AAAA,MAAM;AACN,OAAO,EAAC,qBAAqB,EAAC,MAAM,aAAa,CAAA;AACjD,OAAO,EAAC,eAAe,EAAC,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAC,OAAO,EAAC,MAAM,yBAAyB,CAAA;AAC/C,OAAO,SAAS,EAAE,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EACL,MAAM,IAAI,WAAW,EACrB,OAAO,IAAI,YAAY,EACvB,WAAW,EACX,YAAY,IAAI,iBAAiB,GAClC,MAAM,aAAa,CAAA;AACpB,OAAO,EAAC,wBAAwB,EAAC,MAAM,kBAAkB,CAAA;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CAAA;YAChD,WAAW,CAAC,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAA;SAC7E;KACF;SAAM,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE;QAC5C,WAAW,GAAG,IAAI,KAAK,CAAC,aAAa,CAAC,CAAA;KACvC;SAAM;QACL,WAAW,GAAG,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;KACzC;IAED,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACpC,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC,CAAC,CAAA;IACF,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAED,eAAe,MAAM,CAAA","sourcesContent":["// CLI\nimport {initializeCliKitStore} from '../store.js'\nimport {initiateLogging} from '../output.js'\nimport {isDebug} from '../environment/local.js'\nimport constants, {bugsnagApiKey} from '../constants.js'\nimport {reportEvent} from '../analytics.js'\nimport {\n mapper as errorMapper,\n handler as errorHandler,\n AbortSilent,\n shouldReport as shouldReportError,\n} from '../error.js'\nimport {findUpAndReadPackageJson} from '../dependency.js'\nimport {moduleDirectory} from '../path.js'\nimport {run, settings, flush} from '@oclif/core'\nimport Bugsnag from '@bugsnag/js'\n\ninterface RunCLIOptions {\n /** The value of import.meta.url of the CLI executable module */\n moduleURL: string\n /** The logs file name */\n logFilename: string\n}\n\n/**\n * A function that abstracts away setting up the environment and running\n * a CLI\n * @param module {RunCLIOptions} Options.\n */\nexport async function runCLI(options: RunCLIOptions) {\n await initializeCliKitStore()\n initiateLogging({filename: options.logFilename})\n if (isDebug()) {\n settings.debug = true\n } else {\n Bugsnag.start({\n apiKey: bugsnagApiKey,\n logger: null,\n appVersion: await constants.versions.cliKit(),\n autoTrackSessions: false,\n })\n }\n\n run(undefined, options.moduleURL)\n .then(flush)\n .catch((error: Error): Promise<void | Error> => {\n if (error instanceof AbortSilent) {\n process.exit(1)\n }\n // eslint-disable-next-line promise/no-nesting\n return errorMapper(error)\n .then(reportError)\n .then((error: Error) => {\n return errorHandler(error)\n })\n .then(() => {\n process.exit(1)\n })\n })\n}\n\n/**\n * A function for create-x CLIs that automatically runs the \"init\" command.\n * @param options\n */\nexport async function runCreateCLI(options: RunCLIOptions) {\n const packageJson = await findUpAndReadPackageJson(moduleDirectory(options.moduleURL))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const packageName = (packageJson.content as any).name as string\n const name = packageName.replace('@shopify/create-', '')\n const initIndex = process.argv.findIndex((arg) => arg.includes('init'))\n if (initIndex === -1) {\n const initIndex =\n process.argv.findIndex((arg) => arg.match(new RegExp(`bin(\\\\/|\\\\\\\\)+(create-${name}|dev|run)`))) + 1\n process.argv.splice(initIndex, 0, 'init')\n }\n await runCLI(options)\n}\n\nconst reportError = async (errorToReport: Error): Promise<Error> => {\n await reportEvent({errorMessage: errorToReport.message})\n if (settings.debug || !shouldReportError(errorToReport)) return errorToReport\n\n let mappedError: Error\n\n // eslint-disable-next-line no-prototype-builtins\n if (Error.prototype.isPrototypeOf(errorToReport)) {\n mappedError = new Error(errorToReport.message)\n if (errorToReport.stack) {\n // For mac/linux, remove `file:///` from stacktrace\n // For windows, remove `file:///C:/` from stacktrace\n const regex = '\\\\((.*node_modules.)(@shopify.)?'\n mappedError.stack = errorToReport.stack.replace(new RegExp(regex, 'g'), '(')\n }\n } else if (typeof errorToReport === 'string') {\n mappedError = new Error(errorToReport)\n } else {\n mappedError = new Error('Unknown error')\n }\n\n await new Promise((resolve, reject) => {\n Bugsnag.notify(mappedError, undefined, resolve)\n })\n return mappedError\n}\n\nexport default runCLI\n"]}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/node/cli.ts"],"names":[],"mappings":"AAAA,MAAM;AACN,OAAO,EAAC,wBAAwB,EAAC,MAAM,2BAA2B,CAAA;AACl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,GAAI,WAAW,CAAC,OAAe,CAAC,IAAc,CAAA;IAC/D,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAA;IACxD,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;IACvE,IAAI,SAAS,KAAK,CAAC,CAAC,EAAE;QACpB,MAAM,SAAS,GACb,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,yBAAyB,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;QACtG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,EAAE,MAAM,CAAC,CAAA;KAC1C;IACD,MAAM,MAAM,CAAC,OAAO,CAAC,CAAA;AACvB,CAAC;AAED,eAAe,MAAM,CAAA","sourcesContent":["// CLI\nimport {findUpAndReadPackageJson} from './node-package-manager.js'\nimport {errorHandler} from './error-handler.js'\nimport {initializeCliKitStore} from '../store.js'\nimport {initiateLogging} from '../output.js'\nimport {isDebug} from '../environment/local.js'\nimport constants, {bugsnagApiKey} from '../constants.js'\nimport {moduleDirectory} from '../path.js'\nimport {run, settings, flush} from '@oclif/core'\nimport Bugsnag from '@bugsnag/js'\n\ninterface RunCLIOptions {\n /** The value of import.meta.url of the CLI executable module */\n moduleURL: string\n /** The logs file name */\n logFilename: string\n}\n\n/**\n * A function that abstracts away setting up the environment and running\n * a CLI\n * @param module {RunCLIOptions} Options.\n */\nexport async function runCLI(options: RunCLIOptions) {\n await initializeCliKitStore()\n initiateLogging({filename: options.logFilename})\n if (isDebug()) {\n settings.debug = true\n } else {\n Bugsnag.start({\n appType: 'node',\n apiKey: bugsnagApiKey,\n logger: null,\n appVersion: await constants.versions.cliKit(),\n autoTrackSessions: false,\n autoDetectErrors: false,\n })\n }\n\n run(undefined, options.moduleURL).then(flush).catch(errorHandler)\n}\n\n/**\n * A function for create-x CLIs that automatically runs the \"init\" command.\n * @param options\n */\nexport async function runCreateCLI(options: RunCLIOptions) {\n const packageJson = await findUpAndReadPackageJson(moduleDirectory(options.moduleURL))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const packageName = (packageJson.content as any).name as string\n const name = packageName.replace('@shopify/create-', '')\n const initIndex = process.argv.findIndex((arg) => arg.includes('init'))\n if (initIndex === -1) {\n const initIndex =\n process.argv.findIndex((arg) => arg.match(new RegExp(`bin(\\\\/|\\\\\\\\)+(create-${name}|dev|run)`))) + 1\n process.argv.splice(initIndex, 0, 'init')\n }\n await runCLI(options)\n}\n\nexport default runCLI\n"]}
File without changes
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src/node/colors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,QAAQ,CAAA;AAEpC;;;GAGG;AACH,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC9C,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA","sourcesContent":["import {createRequire} from 'module'\n\n/**\n * ansi-colors is a commonjs dependency that can be imported as a module.\n * This file is a wrapper to require and export ansi-colors.\n */\nconst require = createRequire(import.meta.url)\nexport const colors = require('ansi-colors')\n"]}
@@ -0,0 +1,3 @@
1
+ export declare function errorHandler(error: Error & {
2
+ exitCode?: number | undefined;
3
+ }): Promise<never> | undefined;
@@ -0,0 +1,79 @@
1
+ import { AbortSilent, CancelExecution, mapper as errorMapper, shouldReport as shouldReportError, handler, } from '../error.js';
2
+ import { info } from '../output.js';
3
+ import { reportEvent } from '../analytics.js';
4
+ import { normalize } from '../path.js';
5
+ import { settings } from '@oclif/core';
6
+ import StackTracey from 'stacktracey';
7
+ import Bugsnag from '@bugsnag/js';
8
+ export function errorHandler(error) {
9
+ if (error instanceof CancelExecution) {
10
+ if (error.message && error.message !== '') {
11
+ info(`✨ ${error.message}`);
12
+ }
13
+ }
14
+ else if (error instanceof AbortSilent) {
15
+ process.exit(1);
16
+ }
17
+ else {
18
+ return errorMapper(error)
19
+ .then((error) => {
20
+ return handler(error);
21
+ })
22
+ .then(reportError)
23
+ .then(() => {
24
+ process.exit(1);
25
+ });
26
+ }
27
+ }
28
+ const reportError = async (error) => {
29
+ await reportEvent({ errorMessage: error.message });
30
+ if (settings.debug || !shouldReportError(error))
31
+ return error;
32
+ let reportableError;
33
+ let stacktrace;
34
+ let report = false;
35
+ // eslint-disable-next-line no-prototype-builtins
36
+ if (Error.prototype.isPrototypeOf(error)) {
37
+ report = true;
38
+ reportableError = new Error(error.message);
39
+ stacktrace = error.stack;
40
+ /**
41
+ * Some errors that reach this point have an empty string. For example:
42
+ * https://app.bugsnag.com/shopify/cli/errors/62cd5d31fd5040000814086c?filters[event.since]=30d&filters[error.status]=new&filters[release.seen_in]=3.1.0
43
+ *
44
+ * Because at this point we have neither the error message nor a stack trace reporting them
45
+ * to Bugsnag is pointless and adds noise.
46
+ */
47
+ }
48
+ else if (typeof error === 'string' && error.trim().length !== 0) {
49
+ report = true;
50
+ reportableError = new Error(error);
51
+ stacktrace = reportableError.stack;
52
+ }
53
+ else {
54
+ report = false;
55
+ reportableError = new Error('Unknown error');
56
+ }
57
+ const formattedStacktrace = new StackTracey(stacktrace ?? '')
58
+ .clean()
59
+ .items.map((item) => {
60
+ const filePath = normalize(item.file).replace('file:/', '/').replace('C:/', '');
61
+ return ` at ${item.callee} (${filePath}:${item.line}:${item.column})`;
62
+ })
63
+ .join('\n');
64
+ reportableError.stack = `Error: ${reportableError.message}\n${formattedStacktrace}`;
65
+ if (report) {
66
+ await new Promise((resolve, reject) => {
67
+ Bugsnag.notify(reportableError, undefined, (error, event) => {
68
+ if (error) {
69
+ reject(error);
70
+ }
71
+ else {
72
+ resolve(reportableError);
73
+ }
74
+ });
75
+ });
76
+ }
77
+ return reportableError;
78
+ };
79
+ //# sourceMappingURL=error-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../src/node/error-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,eAAe,EACf,MAAM,IAAI,WAAW,EACrB,YAAY,IAAI,iBAAiB,EACjC,OAAO,GACR,MAAM,aAAa,CAAA;AACpB,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAA;AACjC,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAA;AACpC,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAA;AACpC,OAAO,WAAW,MAAM,aAAa,CAAA;AACrC,OAAO,OAAO,MAAM,aAAa,CAAA;AAEjC,MAAM,UAAU,YAAY,CAAC,KAA8C;IACzE,IAAI,KAAK,YAAY,eAAe,EAAE;QACpC,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,KAAK,EAAE,EAAE;YACzC,IAAI,CAAC,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;SAC5B;KACF;SAAM,IAAI,KAAK,YAAY,WAAW,EAAE;QACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KAChB;SAAM;QACL,OAAO,WAAW,CAAC,KAAK,CAAC;aACtB,IAAI,CAAC,CAAC,KAAY,EAAE,EAAE;YACrB,OAAO,OAAO,CAAC,KAAK,CAAC,CAAA;QACvB,CAAC,CAAC;aACD,IAAI,CAAC,WAAW,CAAC;aACjB,IAAI,CAAC,GAAG,EAAE;YACT,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC,CAAC,CAAA;KACL;AACH,CAAC;AAED,MAAM,WAAW,GAAG,KAAK,EAAE,KAAY,EAAkB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G,CAAA;IAC1E,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAA;IACb,eAAe,CAAC,KAAK,GAAG,UAAU,eAAe,CAAC,OAAO,KAAK,mBAAmB,EAAE,CAAA;IAEnF,IAAI,MAAM,EAAE;QACV,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACpC,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;gBAC1D,IAAI,KAAK,EAAE;oBACT,MAAM,CAAC,KAAK,CAAC,CAAA;iBACd;qBAAM;oBACL,OAAO,CAAC,eAAe,CAAC,CAAA;iBACzB;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;KACH;IACD,OAAO,eAAe,CAAA;AACxB,CAAC,CAAA","sourcesContent":["import {\n AbortSilent,\n CancelExecution,\n mapper as errorMapper,\n shouldReport as shouldReportError,\n handler,\n} from '../error.js'\nimport {info} from '../output.js'\nimport {reportEvent} from '../analytics.js'\nimport {normalize} from '../path.js'\nimport {settings} from '@oclif/core'\nimport StackTracey from 'stacktracey'\nimport Bugsnag from '@bugsnag/js'\n\nexport function errorHandler(error: Error & {exitCode?: number | undefined}) {\n if (error instanceof CancelExecution) {\n if (error.message && error.message !== '') {\n info(`✨ ${error.message}`)\n }\n } else if (error instanceof AbortSilent) {\n process.exit(1)\n } else {\n return errorMapper(error)\n .then((error: Error) => {\n return handler(error)\n })\n .then(reportError)\n .then(() => {\n process.exit(1)\n })\n }\n}\n\nconst reportError = async (error: Error): Promise<Error> => {\n await reportEvent({errorMessage: error.message})\n if (settings.debug || !shouldReportError(error)) return error\n\n let reportableError: Error\n let stacktrace: string | undefined\n let report = false\n\n // eslint-disable-next-line no-prototype-builtins\n if (Error.prototype.isPrototypeOf(error)) {\n report = true\n reportableError = new Error(error.message)\n stacktrace = error.stack\n\n /**\n * Some errors that reach this point have an empty string. For example:\n * https://app.bugsnag.com/shopify/cli/errors/62cd5d31fd5040000814086c?filters[event.since]=30d&filters[error.status]=new&filters[release.seen_in]=3.1.0\n *\n * Because at this point we have neither the error message nor a stack trace reporting them\n * to Bugsnag is pointless and adds noise.\n */\n } else if (typeof error === 'string' && (error as string).trim().length !== 0) {\n report = true\n reportableError = new Error(error)\n stacktrace = reportableError.stack\n } else {\n report = false\n reportableError = new Error('Unknown error')\n }\n\n const formattedStacktrace = new StackTracey(stacktrace ?? '')\n .clean()\n .items.map((item) => {\n const filePath = normalize(item.file).replace('file:/', '/').replace('C:/', '')\n return ` at ${item.callee} (${filePath}:${item.line}:${item.column})`\n })\n .join('\\n')\n reportableError.stack = `Error: ${reportableError.message}\\n${formattedStacktrace}`\n\n if (report) {\n await new Promise((resolve, reject) => {\n Bugsnag.notify(reportableError, undefined, (error, event) => {\n if (error) {\n reject(error)\n } else {\n resolve(reportableError)\n }\n })\n })\n }\n return reportableError\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import { Hook } from '@oclif/core';
2
+ export declare const hookPost: Hook.Postrun;
@@ -0,0 +1,6 @@
1
+ import { reportEvent } from '../../analytics.js';
2
+ // This hook is called after each successful command run. More info: https://oclif.io/docs/hooks
3
+ export const hookPost = async (_options) => {
4
+ await reportEvent();
5
+ };
6
+ //# sourceMappingURL=postrun.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postrun.js","sourceRoot":"","sources":["../../../src/node/hooks/postrun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAA;AAG9C,gGAAgG;AAChG,MAAM,CAAC,MAAM,QAAQ,GAAiB,KAAK,EAAE,QAAQ,EAAE,EAAE;IACvD,MAAM,WAAW,EAAE,CAAA;AACrB,CAAC,CAAA","sourcesContent":["import {reportEvent} from '../../analytics.js'\nimport {Hook} from '@oclif/core'\n\n// This hook is called after each successful command run. More info: https://oclif.io/docs/hooks\nexport const hookPost: Hook.Postrun = async (_options) => {\n await reportEvent()\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import { Hook } from '@oclif/core';
2
+ export declare const hook: Hook.Prerun;
@@ -0,0 +1,9 @@
1
+ import { start } from '../../analytics.js';
2
+ // This hook is called before each command run. More info: https://oclif.io/docs/hooks
3
+ export const hook = async (options) => {
4
+ const cmd = options.Command.aliases.length === 0 ? options.Command.id : options.Command.aliases[0];
5
+ const command = cmd.replace(/:/g, ' ');
6
+ const args = options.argv;
7
+ start({ command, args });
8
+ };
9
+ //# sourceMappingURL=prerun.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prerun.js","sourceRoot":"","sources":["../../../src/node/hooks/prerun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAA;AAGxC,sFAAsF;AACtF,MAAM,CAAC,MAAM,IAAI,GAAgB,KAAK,EAAE,OAAO,EAAE,EAAE;IACjD,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAClG,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IACtC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;IACzB,KAAK,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAA;AACxB,CAAC,CAAA","sourcesContent":["import {start} from '../../analytics.js'\nimport {Hook} from '@oclif/core'\n\n// This hook is called before each command run. More info: https://oclif.io/docs/hooks\nexport const hook: Hook.Prerun = async (options) => {\n const cmd = options.Command.aliases.length === 0 ? options.Command.id : options.Command.aliases[0]\n const command = cmd.replace(/:/g, ' ')\n const args = options.argv\n start({command, args})\n}\n"]}