@shopify/cli-kit 3.0.26 → 3.2.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.
- package/CHANGELOG.md +25 -0
- package/dist/analytics.d.ts +3 -1
- package/dist/analytics.js +20 -5
- package/dist/analytics.js.map +1 -1
- package/dist/api/graphql/find_store_by_domain.d.ts +21 -0
- package/dist/api/graphql/find_store_by_domain.js +24 -0
- package/dist/api/graphql/find_store_by_domain.js.map +1 -0
- package/dist/api/graphql/index.d.ts +1 -0
- package/dist/api/graphql/index.js +1 -0
- package/dist/api/graphql/index.js.map +1 -1
- package/dist/api/identity.js +3 -0
- package/dist/api/identity.js.map +1 -1
- package/dist/error.js +4 -0
- package/dist/error.js.map +1 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/node/base-command.d.ts +6 -0
- package/dist/node/base-command.js +9 -0
- package/dist/node/base-command.js.map +1 -0
- package/dist/{checksum.d.ts → node/checksum.d.ts} +6 -1
- package/dist/{checksum.js → node/checksum.js} +8 -3
- package/dist/node/checksum.js.map +1 -0
- package/dist/node/cli.js +5 -45
- package/dist/node/cli.js.map +1 -1
- package/dist/{colors.d.ts → node/colors.d.ts} +0 -0
- package/dist/{colors.js → node/colors.js} +0 -0
- package/dist/node/colors.js.map +1 -0
- package/dist/{dot-env.d.ts → node/dot-env.d.ts} +8 -3
- package/dist/{dot-env.js → node/dot-env.js} +10 -5
- package/dist/node/dot-env.js.map +1 -0
- package/dist/node/error-handler.d.ts +3 -0
- package/dist/node/error-handler.js +79 -0
- package/dist/node/error-handler.js.map +1 -0
- package/dist/node/hooks/postrun.d.ts +2 -0
- package/dist/node/hooks/postrun.js +6 -0
- package/dist/node/hooks/postrun.js.map +1 -0
- package/dist/node/hooks/prerun.d.ts +2 -0
- package/dist/node/hooks/prerun.js +9 -0
- package/dist/node/hooks/prerun.js.map +1 -0
- package/dist/{dependency.d.ts → node/node-package-manager.d.ts} +92 -23
- package/dist/{dependency.js → node/node-package-manager.js} +56 -49
- package/dist/node/node-package-manager.js.map +1 -0
- package/dist/{ruby.d.ts → node/ruby.d.ts} +11 -2
- package/dist/{ruby.js → node/ruby.js} +15 -10
- package/dist/node/ruby.js.map +1 -0
- package/dist/output.d.ts +9 -2
- package/dist/output.js +17 -7
- package/dist/output.js.map +1 -1
- package/dist/port.js +23 -1
- package/dist/port.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/autocomplete.js +1 -1
- package/dist/ui/autocomplete.js.map +1 -1
- package/dist/ui/input.js +1 -1
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/select.js +1 -1
- package/dist/ui/select.js.map +1 -1
- package/dist/ui.js +3 -3
- package/dist/ui.js.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +7 -3
- package/dist/checksum.js.map +0 -1
- package/dist/colors.js.map +0 -1
- package/dist/dependency.js.map +0 -1
- package/dist/dot-env.js.map +0 -1
- package/dist/ruby.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @shopify/cli-kit
|
|
2
2
|
|
|
3
|
+
## 3.2.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 86b04187: Exit without error message on deliberate user actions
|
|
8
|
+
|
|
9
|
+
## 3.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- d17770e8: Massage error stacktraces to be properly formatted on Bugsnag
|
|
14
|
+
- d17770e8: Not report unhandled errors that go straight to the Node runtime
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 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
|
|
19
|
+
- de8ee02d: [FEATURE] Add query to fetch shop by domain
|
|
20
|
+
- 45f0f0b9: Bump theme-check version
|
|
21
|
+
|
|
22
|
+
## 3.0.27
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- e2e8b4db: Fix identity token validation which is requiring a new login every time
|
|
27
|
+
|
|
3
28
|
## 3.0.26
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
package/dist/analytics.d.ts
CHANGED
|
@@ -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 {
|
|
6
|
-
import {
|
|
5
|
+
import { exists as fileExists } from './file.js';
|
|
6
|
+
import { join as joinPath, resolve } from './path.js';
|
|
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(
|
|
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
|
package/dist/analytics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,IAAI,
|
|
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,C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A;AAID,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,SAAiB;IACpD,MAAM,cAAc,GAAG,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;IAC1D,MAAM,cAAc,GAAG,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;IACrD,MAAM,aAAa,GAAG,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC,CAAA;IAE1D,IAAI,MAAM,UAAU,CAAC,cAAc,CAAC,EAAE;QACpC,OAAO,MAAM,CAAA;KACd;SAAM,IAAI,MAAM,UAAU,CAAC,cAAc,CAAC,EAAE;QAC3C,OAAO,MAAM,CAAA;KACd;SAAM,IAAI,MAAM,UAAU,CAAC,aAAa,CAAC,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,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/api/identity.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { identity } from '../environment/fqdn.js';
|
|
2
2
|
import { debug } from '../output.js';
|
|
3
|
+
import { fetch } from '../http.js';
|
|
3
4
|
export async function validateIdentityToken(token) {
|
|
4
5
|
try {
|
|
5
6
|
const instrospectionURL = await getInstrospectionEndpoint();
|
|
@@ -11,6 +12,7 @@ export async function validateIdentityToken(token) {
|
|
|
11
12
|
};
|
|
12
13
|
debug(`Sending Identity Introspection request to URL: ${instrospectionURL}`);
|
|
13
14
|
const response = await fetch(instrospectionURL, options);
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
16
|
const json = await response.json();
|
|
15
17
|
debug(`The identity token is valid: ${json.valid}`);
|
|
16
18
|
return json.valid;
|
|
@@ -23,6 +25,7 @@ export async function validateIdentityToken(token) {
|
|
|
23
25
|
}
|
|
24
26
|
async function getInstrospectionEndpoint() {
|
|
25
27
|
const response = await fetch(`https://${await identity()}/.well-known/openid-configuration.json`);
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
29
|
const json = await response.json();
|
|
27
30
|
return json.introspection_endpoint;
|
|
28
31
|
}
|
package/dist/api/identity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../src/api/identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../src/api/identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAA;AAClC,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAEhC,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,KAAa;IACvD,IAAI;QACF,MAAM,iBAAiB,GAAG,MAAM,yBAAyB,EAAE,CAAA;QAC3D,MAAM,OAAO,GAAG;YACd,MAAM,EAAE,MAAM;YACd,gEAAgE;YAChE,OAAO,EAAE,EAAC,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAC;YAC/E,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAC,KAAK,EAAC,CAAC;SAC9B,CAAA;QACD,KAAK,CAAC,kDAAkD,iBAAiB,EAAE,CAAC,CAAA;QAE5E,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAA;QACxD,8DAA8D;QAC9D,MAAM,IAAI,GAAQ,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QAEvC,KAAK,CAAC,gCAAgC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;QACnD,OAAO,IAAI,CAAC,KAAK,CAAA;QACjB,qDAAqD;KACtD;IAAC,OAAO,KAAK,EAAE;QACd,KAAK,CAAC,kCAAkC,KAAK,EAAE,CAAC,CAAA;QAChD,OAAO,KAAK,CAAA;KACb;AACH,CAAC;AAED,KAAK,UAAU,yBAAyB;IACtC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,WAAW,MAAM,QAAQ,EAAE,wCAAwC,CAAC,CAAA;IACjG,8DAA8D;IAC9D,MAAM,IAAI,GAAQ,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;IACvC,OAAO,IAAI,CAAC,sBAAsB,CAAA;AACpC,CAAC","sourcesContent":["import {identity} from '../environment/fqdn.js'\nimport {debug} from '../output.js'\nimport {fetch} from '../http.js'\n\nexport async function validateIdentityToken(token: string) {\n try {\n const instrospectionURL = await getInstrospectionEndpoint()\n const options = {\n method: 'POST',\n // eslint-disable-next-line @typescript-eslint/naming-convention\n headers: {Authorization: `Bearer ${token}`, 'Content-Type': 'application/json'},\n body: JSON.stringify({token}),\n }\n debug(`Sending Identity Introspection request to URL: ${instrospectionURL}`)\n\n const response = await fetch(instrospectionURL, options)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const json: any = await response.json()\n\n debug(`The identity token is valid: ${json.valid}`)\n return json.valid\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n debug(`The identity token is invalid: ${error}`)\n return false\n }\n}\n\nasync function getInstrospectionEndpoint(): Promise<string> {\n const response = await fetch(`https://${await identity()}/.well-known/openid-configuration.json`)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const json: any = await response.json()\n return json.introspection_endpoint\n}\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;I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,WAAW,CAAC,KAAK,CAAC,CAAA;IACxB,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;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
|
@@ -2,10 +2,7 @@ export { default as constants } from './constants.js';
|
|
|
2
2
|
export * as abort from './abort.js';
|
|
3
3
|
export * as analytics from './analytics.js';
|
|
4
4
|
export * as api from './api.js';
|
|
5
|
-
export * as checksum from './checksum.js';
|
|
6
5
|
export * as cli from './cli.js';
|
|
7
|
-
export * as dependency from './dependency.js';
|
|
8
|
-
export * as dotenv from './dot-env.js';
|
|
9
6
|
export * as environment from './environment.js';
|
|
10
7
|
export * as error from './error.js';
|
|
11
8
|
export * as fastify from 'fastify';
|
|
@@ -21,7 +18,6 @@ export * as output from './output.js';
|
|
|
21
18
|
export * as path from './path.js';
|
|
22
19
|
export * as plugins from './plugins.js';
|
|
23
20
|
export * as port from './port.js';
|
|
24
|
-
export * as ruby from './ruby.js';
|
|
25
21
|
export * as schema from './schema.js';
|
|
26
22
|
export * as semver from './semver.js';
|
|
27
23
|
export * as session from './session.js';
|
package/dist/index.js
CHANGED
|
@@ -2,10 +2,7 @@ export { default as constants } from './constants.js';
|
|
|
2
2
|
export * as abort from './abort.js';
|
|
3
3
|
export * as analytics from './analytics.js';
|
|
4
4
|
export * as api from './api.js';
|
|
5
|
-
export * as checksum from './checksum.js';
|
|
6
5
|
export * as cli from './cli.js';
|
|
7
|
-
export * as dependency from './dependency.js';
|
|
8
|
-
export * as dotenv from './dot-env.js';
|
|
9
6
|
export * as environment from './environment.js';
|
|
10
7
|
export * as error from './error.js';
|
|
11
8
|
export * as fastify from 'fastify';
|
|
@@ -21,7 +18,6 @@ export * as output from './output.js';
|
|
|
21
18
|
export * as path from './path.js';
|
|
22
19
|
export * as plugins from './plugins.js';
|
|
23
20
|
export * as port from './port.js';
|
|
24
|
-
export * as ruby from './ruby.js';
|
|
25
21
|
export * as schema from './schema.js';
|
|
26
22
|
export * as semver from './semver.js';
|
|
27
23
|
export * as session from './session.js';
|
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,KA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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 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,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"]}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { Abort } from '
|
|
1
|
+
import { Abort } from '../error.js';
|
|
2
|
+
/**
|
|
3
|
+
* An error that's thrown when a file's MD5 doesn't match the expected value.
|
|
4
|
+
* @param options An options object that includes the file path, and the expected and actual MD5.
|
|
5
|
+
* @returns An instance of Abort.
|
|
6
|
+
*/
|
|
2
7
|
export declare const InvalidChecksumError: ({ file, expected, got }: {
|
|
3
8
|
file: string;
|
|
4
9
|
expected: string;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { fetch } from '
|
|
2
|
-
import { Abort } from '
|
|
3
|
-
import { debug, token } from '
|
|
1
|
+
import { fetch } from '../http.js';
|
|
2
|
+
import { Abort } from '../error.js';
|
|
3
|
+
import { debug, token } from '../output.js';
|
|
4
4
|
import md5File from 'md5-file';
|
|
5
|
+
/**
|
|
6
|
+
* An error that's thrown when a file's MD5 doesn't match the expected value.
|
|
7
|
+
* @param options An options object that includes the file path, and the expected and actual MD5.
|
|
8
|
+
* @returns An instance of Abort.
|
|
9
|
+
*/
|
|
5
10
|
export const InvalidChecksumError = ({ file, expected, got }) => {
|
|
6
11
|
return new Abort(`The validation of ${file} failed. We expected the checksum ${expected}, but got ${got})`);
|
|
7
12
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checksum.js","sourceRoot":"","sources":["../../src/node/checksum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAChC,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,EAAC,KAAK,EAAE,KAAK,EAAC,MAAM,cAAc,CAAA;AACzC,OAAO,OAAO,MAAM,UAAU,CAAA;AAE9B;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAgD,EAAE,EAAE;IAC3G,OAAO,IAAI,KAAK,CAAC,qBAAqB,IAAI,qCAAqC,QAAQ,aAAa,GAAG,GAAG,CAAC,CAAA;AAC7G,CAAC,CAAA;AACD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,EAAC,IAAI,EAAE,UAAU,EAAqC;IACtF,KAAK,CAAC,wBAAwB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,CAAC,CAAA;IACrG,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,CAAA;IAC3C,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,CAAA;IAC5C,MAAM,YAAY,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC9C,IAAI,CAAC,CAAC,YAAY,KAAK,SAAS,CAAC,EAAE;QACjC,MAAM,oBAAoB,CAAC;YACzB,IAAI;YACJ,GAAG,EAAE,SAAS;YACd,QAAQ,EAAE,YAAY;SACvB,CAAC,CAAA;KACH;AACH,CAAC","sourcesContent":["import {fetch} from '../http.js'\nimport {Abort} from '../error.js'\nimport {debug, token} from '../output.js'\nimport md5File from 'md5-file'\n\n/**\n * An error that's thrown when a file's MD5 doesn't match the expected value.\n * @param options An options object that includes the file path, and the expected and actual MD5.\n * @returns An instance of Abort.\n */\nexport const InvalidChecksumError = ({file, expected, got}: {file: string; expected: string; got: string}) => {\n return new Abort(`The validation of ${file} failed. We expected the checksum ${expected}, but got ${got})`)\n}\n/**\n * Given a local file and a URL pointing to a remote file representing the MD5 of a local file,\n * it validates the authenticity of the binary using an MD5 checksum.\n * @param options: The file to validate and the URL that points to the file containing the MD5.\n */\nexport async function validateMD5({file, md5FileURL}: {file: string; md5FileURL: string}) {\n debug(`Checking MD5 of file ${token.path(file)} against the MD5 in ${token.link('URL', md5FileURL)}`)\n const md5Digest = await md5File(file)\n const md5Response = await fetch(md5FileURL)\n const md5Contents = await md5Response.text()\n const canonicalMD5 = md5Contents.split(' ')[0]\n if (!(canonicalMD5 === md5Digest)) {\n throw InvalidChecksumError({\n file,\n got: md5Digest,\n expected: canonicalMD5,\n })\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
|
package/dist/node/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/node/cli.ts"],"names":[],"mappings":"AAAA,MAAM;AACN,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/node/cli.ts"],"names":[],"mappings":"AAAA,MAAM;AACN,OAAO,EAAC,wBAAwB,EAAC,MAAM,2BAA2B,CAAA;AAClE,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAA;AAC/C,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,eAAe,EAAC,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAChD,OAAO,OAAO,MAAM,aAAa,CAAA;AASjC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAAsB;IACjD,MAAM,qBAAqB,E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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"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Abort } from '
|
|
1
|
+
import { Abort } from '../error.js';
|
|
2
2
|
/**
|
|
3
3
|
* Error that's thrown when the .env is not found.
|
|
4
4
|
* @param path {string} Path to the .env file.
|
|
@@ -20,9 +20,14 @@ export interface DotEnvFile {
|
|
|
20
20
|
[name: string]: string;
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Reads and parses a .env file.
|
|
25
|
+
* @param path {string} Path to the .env file
|
|
26
|
+
* @returns {Promise<DotEnvFile>} An in-memory representation of the .env file.
|
|
27
|
+
*/
|
|
28
|
+
export declare function readAndParseDotEnv(path: string): Promise<DotEnvFile>;
|
|
24
29
|
/**
|
|
25
30
|
* Writes a .env file to disk.
|
|
26
31
|
* @param file {DotEnvFile} .env file to be written.
|
|
27
32
|
*/
|
|
28
|
-
export declare function
|
|
33
|
+
export declare function writeDotEnv(file: DotEnvFile): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Abort } from '
|
|
2
|
-
import { exists, read as readFile, write as writeFile } from '
|
|
3
|
-
import { debug, content as outputContent, token } from '
|
|
1
|
+
import { Abort } from '../error.js';
|
|
2
|
+
import { exists, read as readFile, write as writeFile } from '../file.js';
|
|
3
|
+
import { debug, content as outputContent, token } from '../output.js';
|
|
4
4
|
import { parse, stringify } from 'envfile';
|
|
5
5
|
/**
|
|
6
6
|
* Error that's thrown when the .env is not found.
|
|
@@ -10,7 +10,12 @@ import { parse, stringify } from 'envfile';
|
|
|
10
10
|
export const DotEnvNotFoundError = (path) => {
|
|
11
11
|
return new Abort(`The environment file at ${path} does not exist.`);
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Reads and parses a .env file.
|
|
15
|
+
* @param path {string} Path to the .env file
|
|
16
|
+
* @returns {Promise<DotEnvFile>} An in-memory representation of the .env file.
|
|
17
|
+
*/
|
|
18
|
+
export async function readAndParseDotEnv(path) {
|
|
14
19
|
debug(outputContent `Reading the .env file at ${token.path(path)}`);
|
|
15
20
|
if (!(await exists(path))) {
|
|
16
21
|
throw DotEnvNotFoundError(path);
|
|
@@ -25,7 +30,7 @@ export async function read(path) {
|
|
|
25
30
|
* Writes a .env file to disk.
|
|
26
31
|
* @param file {DotEnvFile} .env file to be written.
|
|
27
32
|
*/
|
|
28
|
-
export async function
|
|
33
|
+
export async function writeDotEnv(file) {
|
|
29
34
|
await writeFile(file.path, stringify(file.variables));
|
|
30
35
|
}
|
|
31
36
|
//# sourceMappingURL=dot-env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dot-env.js","sourceRoot":"","sources":["../../src/node/dot-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,EAAC,MAAM,EAAE,IAAI,IAAI,QAAQ,EAAE,KAAK,IAAI,SAAS,EAAC,MAAM,YAAY,CAAA;AACvE,OAAO,EAAC,KAAK,EAAE,OAAO,IAAI,aAAa,EAAE,KAAK,EAAC,MAAM,cAAc,CAAA;AACnE,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,MAAM,SAAS,CAAA;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAE,EAAE;IAClD,OAAO,IAAI,KAAK,CAAC,2BAA2B,IAAI,kBAAkB,CAAC,CAAA;AACrE,CAAC,CAAA;AAgBD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAAY;IACnD,KAAK,CAAC,aAAa,CAAA,4BAA4B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAClE,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE;QACzB,MAAM,mBAAmB,CAAC,IAAI,CAAC,CAAA;KAChC;IACD,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAA;IACpC,OAAO;QACL,IAAI;QACJ,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC;KAC1B,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAgB;IAChD,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAA;AACvD,CAAC","sourcesContent":["import {Abort} from '../error.js'\nimport {exists, read as readFile, write as writeFile} from '../file.js'\nimport {debug, content as outputContent, token} from '../output.js'\nimport {parse, stringify} from 'envfile'\n\n/**\n * Error that's thrown when the .env is not found.\n * @param path {string} Path to the .env file.\n * @returns {Abort} An abort error.\n */\nexport const DotEnvNotFoundError = (path: string) => {\n return new Abort(`The environment file at ${path} does not exist.`)\n}\n\n/**\n * This interface represents a .env file.\n */\nexport interface DotEnvFile {\n /**\n * Path to the .env file.\n */\n path: string\n /**\n * Variables of the .env file.\n */\n variables: {[name: string]: string}\n}\n\n/**\n * Reads and parses a .env file.\n * @param path {string} Path to the .env file\n * @returns {Promise<DotEnvFile>} An in-memory representation of the .env file.\n */\nexport async function readAndParseDotEnv(path: string): Promise<DotEnvFile> {\n debug(outputContent`Reading the .env file at ${token.path(path)}`)\n if (!(await exists(path))) {\n throw DotEnvNotFoundError(path)\n }\n const content = await readFile(path)\n return {\n path,\n variables: parse(content),\n }\n}\n\n/**\n * Writes a .env file to disk.\n * @param file {DotEnvFile} .env file to be written.\n */\nexport async function writeDotEnv(file: DotEnvFile) {\n await writeFile(file.path, stringify(file.variables))\n}\n"]}
|