@shopify/cli-kit 3.37.0 → 3.39.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/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/private/common/json.d.ts +2 -2
- package/dist/private/common/lodash.d.ts +4 -4
- package/dist/private/common/ts/overloaded-parameters.d.ts +5 -5
- package/dist/private/node/api/graphql.js +7 -7
- package/dist/private/node/api/graphql.js.map +1 -1
- package/dist/private/node/api/headers.d.ts +1 -1
- package/dist/private/node/api.d.ts +2 -0
- package/dist/{network → private/node}/api.js +0 -0
- package/dist/private/node/api.js.map +1 -0
- package/dist/private/node/conf-store.js +4 -4
- package/dist/private/node/conf-store.js.map +1 -1
- package/dist/private/node/constants.d.ts +2 -2
- package/dist/{content-tokens.d.ts → private/node/content-tokens.d.ts} +11 -11
- package/dist/{content-tokens.js → private/node/content-tokens.js} +3 -3
- package/dist/private/node/content-tokens.js.map +1 -0
- package/dist/private/node/environment/service.d.ts +1 -1
- package/dist/private/node/error-handler.d.ts +2 -0
- package/dist/private/node/error-handler.js +5 -0
- package/dist/private/node/error-handler.js.map +1 -0
- package/dist/private/node/secure-store.js +4 -4
- package/dist/private/node/secure-store.js.map +1 -1
- package/dist/private/node/session/authorize.js +3 -3
- package/dist/private/node/session/authorize.js.map +1 -1
- package/dist/private/node/session/device-authorization.js +6 -6
- package/dist/private/node/session/device-authorization.js.map +1 -1
- package/dist/private/node/session/exchange.d.ts +1 -1
- package/dist/private/node/session/exchange.js.map +1 -1
- package/dist/private/node/session/identity-token-validation.js +5 -5
- package/dist/private/node/session/identity-token-validation.js.map +1 -1
- package/dist/private/node/session/identity.d.ts +1 -1
- package/dist/private/node/session/identity.js.map +1 -1
- package/dist/private/node/session/redirect-listener.d.ts +1 -1
- package/dist/private/node/session/redirect-listener.js +7 -7
- package/dist/private/node/session/redirect-listener.js.map +1 -1
- package/dist/private/node/session/schema.d.ts +3 -3
- package/dist/private/node/session/scopes.d.ts +1 -1
- package/dist/private/node/session/scopes.js +1 -1
- package/dist/private/node/session/scopes.js.map +1 -1
- package/dist/private/node/session/store.js +4 -4
- package/dist/private/node/session/store.js.map +1 -1
- package/dist/private/node/session/validate.d.ts +1 -1
- package/dist/private/node/session/validate.js +2 -2
- package/dist/private/node/session/validate.js.map +1 -1
- package/dist/private/node/session.d.ts +4 -4
- package/dist/private/node/session.js +19 -19
- package/dist/private/node/session.js.map +1 -1
- package/dist/private/node/ui/alert.js +1 -1
- package/dist/private/node/ui/alert.js.map +1 -1
- package/dist/private/node/ui/components/Alert.test.js +1 -1
- package/dist/private/node/ui/components/Alert.test.js.map +1 -1
- package/dist/private/node/ui/components/AutocompletePrompt.d.ts +9 -2
- package/dist/private/node/ui/components/AutocompletePrompt.js +8 -4
- package/dist/private/node/ui/components/AutocompletePrompt.js.map +1 -1
- package/dist/private/node/ui/components/AutocompletePrompt.test.js +62 -8
- package/dist/private/node/ui/components/AutocompletePrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/Banner.d.ts +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.d.ts +3 -3
- package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.test.js +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -1
- package/dist/private/node/ui/components/FatalError.test.js +1 -1
- package/dist/private/node/ui/components/FatalError.test.js.map +1 -1
- package/dist/private/node/ui/components/List.test.js +1 -1
- package/dist/private/node/ui/components/List.test.js.map +1 -1
- package/dist/private/node/ui/components/SelectInput.d.ts +3 -1
- package/dist/private/node/ui/components/SelectInput.js +8 -2
- package/dist/private/node/ui/components/SelectInput.js.map +1 -1
- package/dist/private/node/ui/components/SelectInput.test.js +26 -0
- package/dist/private/node/ui/components/SelectInput.test.js.map +1 -1
- package/dist/private/node/ui/components/SelectPrompt.test.js +1 -1
- package/dist/private/node/ui/components/SelectPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/Table/Row.d.ts +1 -1
- package/dist/private/node/ui/components/Table/ScalarDict.d.ts +1 -1
- package/dist/private/node/ui/components/Table/Table.d.ts +1 -1
- package/dist/private/node/ui/components/Tasks.d.ts +5 -1
- package/dist/private/node/ui/components/Tasks.js +31 -6
- package/dist/private/node/ui/components/Tasks.js.map +1 -1
- package/dist/private/node/ui/components/Tasks.test.js +260 -20
- package/dist/private/node/ui/components/Tasks.test.js.map +1 -1
- package/dist/private/node/ui/components/TextPrompt.test.js +1 -1
- package/dist/private/node/ui/components/TextPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/TokenizedText.d.ts +2 -2
- package/dist/private/node/ui/components/TokenizedText.test.js +1 -1
- package/dist/private/node/ui/components/TokenizedText.test.js.map +1 -1
- package/dist/private/node/ui.d.ts +2 -2
- package/dist/private/node/ui.js +1 -1
- package/dist/private/node/ui.js.map +1 -1
- package/dist/public/common/string.d.ts +1 -1
- package/dist/public/common/string.js +1 -1
- package/dist/public/common/string.js.map +1 -1
- package/dist/{private → public}/common/ts/deep-required.d.ts +2 -1
- package/dist/{private → public}/common/ts/deep-required.js +0 -0
- package/dist/public/common/ts/deep-required.js.map +1 -0
- package/dist/public/common/ts/pick-by-prefix.d.ts +2 -1
- package/dist/public/common/ts/pick-by-prefix.js.map +1 -1
- package/dist/public/common/version.d.ts +1 -1
- package/dist/public/common/version.js +1 -1
- package/dist/public/common/version.js.map +1 -1
- package/dist/public/node/analytics.js +5 -5
- package/dist/public/node/analytics.js.map +1 -1
- package/dist/public/node/api/admin.js +2 -2
- package/dist/public/node/api/admin.js.map +1 -1
- package/dist/public/node/api/http.d.ts +1 -0
- package/dist/public/node/api/http.js +1 -1
- package/dist/public/node/archiver.d.ts +20 -6
- package/dist/public/node/archiver.js +16 -15
- package/dist/public/node/archiver.js.map +1 -1
- package/dist/public/node/base-command.js +4 -4
- package/dist/public/node/base-command.js.map +1 -1
- package/dist/public/node/crypto.d.ts +1 -1
- package/dist/public/node/dot-env.js +4 -2
- package/dist/public/node/dot-env.js.map +1 -1
- package/dist/public/node/environment/local.d.ts +1 -1
- package/dist/public/node/environment/spin.d.ts +1 -1
- package/dist/public/node/environment/spin.js +2 -2
- package/dist/public/node/environment/spin.js.map +1 -1
- package/dist/public/node/error-handler.d.ts +1 -2
- package/dist/public/node/error-handler.js +15 -5
- package/dist/public/node/error-handler.js.map +1 -1
- package/dist/public/node/error.d.ts +5 -5
- package/dist/public/node/error.js +1 -1
- package/dist/public/node/error.js.map +1 -1
- package/dist/public/node/fs.d.ts +24 -4
- package/dist/public/node/fs.js +50 -21
- package/dist/public/node/fs.js.map +1 -1
- package/dist/public/node/git.d.ts +9 -1
- package/dist/public/node/git.js +39 -9
- package/dist/public/node/git.js.map +1 -1
- package/dist/public/node/github.js +2 -2
- package/dist/public/node/github.js.map +1 -1
- package/dist/public/node/hooks/postrun.js +2 -2
- package/dist/public/node/hooks/postrun.js.map +1 -1
- package/dist/public/node/hooks/prerun.js +2 -2
- package/dist/public/node/hooks/prerun.js.map +1 -1
- package/dist/public/node/http.d.ts +9 -1
- package/dist/public/node/http.js +37 -3
- package/dist/public/node/http.js.map +1 -1
- package/dist/public/node/liquid.js +2 -2
- package/dist/public/node/liquid.js.map +1 -1
- package/dist/public/node/metadata.d.ts +7 -7
- package/dist/public/node/monorail.d.ts +6 -6
- package/dist/public/node/monorail.js +4 -4
- package/dist/public/node/monorail.js.map +1 -1
- package/dist/public/node/node-package-manager.d.ts +5 -5
- package/dist/public/node/node-package-manager.js +9 -9
- package/dist/public/node/node-package-manager.js.map +1 -1
- package/dist/public/node/os.d.ts +2 -2
- package/dist/public/node/os.js +2 -2
- package/dist/public/node/os.js.map +1 -1
- package/dist/public/node/output.d.ts +188 -0
- package/dist/{output.js → public/node/output.js} +129 -50
- package/dist/public/node/output.js.map +1 -0
- package/dist/public/node/path.d.ts +1 -1
- package/dist/public/node/plugins/tunnel.d.ts +5 -5
- package/dist/public/node/plugins.d.ts +4 -4
- package/dist/public/node/result.d.ts +1 -1
- package/dist/public/node/ruby.d.ts +1 -1
- package/dist/public/node/ruby.js +7 -5
- package/dist/public/node/ruby.js.map +1 -1
- package/dist/public/node/session.d.ts +1 -1
- package/dist/public/node/session.js +9 -9
- package/dist/public/node/session.js.map +1 -1
- package/dist/public/node/system.d.ts +1 -1
- package/dist/public/node/system.js +2 -2
- package/dist/public/node/system.js.map +1 -1
- package/dist/public/node/tcp.js +4 -4
- package/dist/public/node/tcp.js.map +1 -1
- package/dist/public/node/testing/output.js +10 -9
- package/dist/public/node/testing/output.js.map +1 -1
- package/dist/public/node/ui.d.ts +11 -6
- package/dist/public/node/ui.js +5 -4
- package/dist/public/node/ui.js.map +1 -1
- package/dist/public/node/vscode.js +4 -4
- package/dist/public/node/vscode.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui.d.ts +6 -20
- package/dist/ui.js +8 -28
- package/dist/ui.js.map +1 -1
- package/package.json +6 -7
- package/dist/content-tokens.js.map +0 -1
- package/dist/network/api.d.ts +0 -2
- package/dist/network/api.js.map +0 -1
- package/dist/output.d.ts +0 -129
- package/dist/output.js.map +0 -1
- package/dist/private/common/ts/deep-required.js.map +0 -1
- package/dist/private/node/simple-definitions.d.ts +0 -4
- package/dist/private/node/simple-definitions.js +0 -2
- package/dist/private/node/simple-definitions.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src/public/common/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,YAAY,CAAA;AAC9C,OAAO,EAAC,QAAQ,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src/public/common/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,YAAY,CAAA;AAC9C,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAA;AAGpD,MAAM,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;;GAEG;AACH,OAAO,EAAC,SAAS,IAAI,QAAQ,EAAC,MAAM,aAAa,CAAA;AAEjD;;GAEG;AACH,OAAO,EAAC,SAAS,IAAI,SAAS,EAAC,MAAM,aAAa,CAAA;AAElD;;GAEG;AACH,OAAO,EAAC,SAAS,IAAI,UAAU,EAAC,MAAM,aAAa,CAAA;AAEnD;;GAEG;AACH,OAAO,EAAC,YAAY,IAAI,WAAW,EAAC,MAAM,aAAa,CAAA","sourcesContent":["import {takeRandomFromArray} from './array.js'\nimport {unstyled} from '../../public/node/output.js'\nimport {TokenItem} from '../../private/node/ui/components/TokenizedText.js'\n\nconst SAFE_RANDOM_BUSINESS_ADJECTIVES = [\n 'commercial',\n 'profitable',\n 'amortizable',\n 'branded',\n 'integrated',\n 'synergistic',\n 'consolidated',\n 'diversified',\n 'lean',\n 'niche',\n 'premium',\n 'luxury',\n 'scalable',\n 'optimized',\n 'empowered',\n 'international',\n 'beneficial',\n 'fruitful',\n 'extensive',\n 'lucrative',\n 'modern',\n]\n\nconst SAFE_RANDOM_CREATIVE_ADJECTIVES = [\n 'bright',\n 'impactful',\n 'stylish',\n 'colorful',\n 'modern',\n 'minimal',\n 'trendy',\n 'creative',\n 'artistic',\n 'spectacular',\n 'glamorous',\n 'luxury',\n 'retro',\n 'nostalgic',\n 'comfy',\n 'polished',\n 'fabulous',\n 'balanced',\n 'monochrome',\n 'glitched',\n]\n\nconst SAFE_RANDOM_BUSINESS_NOUNS = [\n 'account',\n 'consumer',\n 'customer',\n 'enterprise',\n 'business',\n 'venture',\n 'marketplace',\n 'revenue',\n 'vertical',\n 'portfolio',\n 'negotiation',\n 'shipping',\n 'demand',\n 'supply',\n 'growth',\n 'merchant',\n 'investment',\n 'shareholder',\n 'conversion',\n 'capital',\n 'projection',\n 'upside',\n 'trade',\n 'deal',\n 'merchandise',\n 'transaction',\n 'sale',\n]\n\nconst SAFE_RANDOM_CREATIVE_NOUNS = [\n 'vibe',\n 'style',\n 'moment',\n 'mood',\n 'flavor',\n 'look',\n 'appearance',\n 'perspective',\n 'aspect',\n 'ambience',\n 'quality',\n 'backdrop',\n 'focus',\n 'tone',\n]\n\nexport type RandomNameFamily = 'business' | 'creative'\n\n/**\n * Generates a random name by combining an adjective and noun.\n *\n * @param family - Theme to use for the random name (business or creative).\n * @returns A random name generated by combining an adjective and noun.\n */\nexport function getRandomName(family: RandomNameFamily = 'business'): string {\n const mapping = {\n business: {\n adjectives: SAFE_RANDOM_BUSINESS_ADJECTIVES,\n nouns: SAFE_RANDOM_BUSINESS_NOUNS,\n },\n creative: {\n adjectives: SAFE_RANDOM_CREATIVE_ADJECTIVES,\n nouns: SAFE_RANDOM_CREATIVE_NOUNS,\n },\n }\n return `${takeRandomFromArray(mapping[family].adjectives)}-${takeRandomFromArray(mapping[family].nouns)}`\n}\n\n/**\n * Given a string, it returns it with the first letter capitalized.\n *\n * @param str - String to capitalize.\n * @returns String with the first letter capitalized.\n */\nexport function capitalize(str: string): string {\n return str.substring(0, 1).toUpperCase() + str.substring(1)\n}\n\n/**\n * Given a list of items, it returns a pluralized string based on the amount of items.\n *\n * @param items - List of items.\n * @param plural - Supplier used when the list of items has more than one item.\n * @param singular - Supplier used when the list of items has a single item.\n * @param none - Supplier used when the list has no items.\n * @returns The {@link TokenItem} supplied by the {@link plural}, {@link singular}, or {@link none} functions.\n */\nexport function pluralize<T>(\n items: T[],\n plural: (items: T[]) => TokenItem,\n singular: (item: T) => TokenItem,\n none?: () => TokenItem,\n): TokenItem {\n if (items.length === 1) {\n return singular(items[0]!)\n }\n\n if (items.length > 1) {\n return plural(items)\n }\n\n if (none) {\n return none()\n }\n\n return ''\n}\n\n/**\n * Try to convert a string to an int, falling back to undefined if unable to.\n *\n * @param maybeInt - String to convert to an int.\n * @returns The int if it was able to convert, otherwise undefined.\n */\nexport function tryParseInt(maybeInt: string | undefined): number | undefined {\n let asInt: number | undefined\n if (maybeInt !== undefined) {\n asInt = parseInt(maybeInt, 10)\n if (isNaN(asInt)) {\n asInt = undefined\n }\n }\n return asInt\n}\n\n/**\n * Transforms a matrix of strings into a single string with the columns aligned.\n *\n * @param lines - Array of rows, where each row is an array of strings (representing columns).\n * @returns A string with the columns aligned.\n */\nexport function linesToColumns(lines: string[][]): string {\n const widths: number[] = []\n for (let i = 0; lines[0] && i < lines[0].length; i++) {\n const columnRows = lines.map((line) => line[i]!)\n widths.push(Math.max(...columnRows.map((row) => unstyled(row).length)))\n }\n const paddedLines = lines\n .map((line) => {\n return line\n .map((col, index) => {\n return `${col}${' '.repeat(widths[index]! - unstyled(col).length)}`\n })\n .join(' ')\n .trimEnd()\n })\n .join('\\n')\n return paddedLines\n}\n\n/**\n * Given a string, it transforms it to a slug (lowercase, hyphenated, no special chars, trimmed...).\n *\n * @param str - String to slugify.\n * @returns The slugified string.\n */\nexport function slugify(str: string): string {\n return str\n .toLowerCase()\n .trim()\n .replace(/[^\\w\\s-]/g, '')\n .replace(/[\\s_-]+/g, '-')\n .replace(/^-+|-+$/g, '')\n}\n\n/**\n * Given a string, it returns it with the special regex characters escaped.\n * More info: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping.\n *\n * @param str - String to escape.\n * @returns The escaped string.\n */\nexport function escapeRegExp(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\n/**\n * Transform a string to camelCase.\n */\nexport {camelCase as camelize} from 'change-case'\n\n/**\n * Transform a string to param-case.\n */\nexport {paramCase as hyphenate} from 'change-case'\n\n/**\n * Transform a string to snake_case.\n */\nexport {snakeCase as underscore} from 'change-case'\n\n/**\n * Transform a string to CONSTANT_CASE.\n */\nexport {constantCase as constantize} from 'change-case'\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep-required.js","sourceRoot":"","sources":["../../../../src/public/common/ts/deep-required.ts"],"names":[],"mappings":"","sourcesContent":["export {}\n\n/**\n * Converts a mapping type to be non-optional.\n *\n * ```ts\n * type T = DeepRequired<{optionalKey?: string, nullableValue: string | null, undefinableValue: string | undefined}>\n * T = {optionalKey: string, nullableValue: string, undefinableValue: string}\n * ```\n *.\n */\nexport type DeepRequired<T> = {\n [TKey in keyof Required<T>]: NonNullable<Required<T>[TKey]>\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export {};
|
|
1
2
|
/**
|
|
2
3
|
* Produces a subset of a mapping type, where the keys either match some prefix string, or are in a list of exact matches.
|
|
3
4
|
*
|
|
@@ -8,6 +9,6 @@
|
|
|
8
9
|
* ```
|
|
9
10
|
* .
|
|
10
11
|
*/
|
|
11
|
-
export
|
|
12
|
+
export type PickByPrefix<TMapping, TPrefix extends string, TKeys extends keyof TMapping = never> = {
|
|
12
13
|
[TKey in keyof TMapping as TKey extends `${TPrefix}${infer _TSuffix}` | TKeys ? TKey : never]: TMapping[TKey];
|
|
13
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pick-by-prefix.js","sourceRoot":"","sources":["../../../../src/public/common/ts/pick-by-prefix.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Produces a subset of a mapping type, where the keys either match some prefix string, or are in a list of exact matches.\n *\n * ```ts\n * type T = PickByPrefix<{foo_1: number, foo_2: number, nope: string, included: string, also: number}, 'foo_', 'included' | 'also'>.\n *\n * T = {foo_1: number, foo_2: number, included: string, also: number}\n * ```\n * .\n */\nexport type PickByPrefix<TMapping, TPrefix extends string, TKeys extends keyof TMapping = never> = {\n [TKey in keyof TMapping as TKey extends `${TPrefix}${infer _TSuffix}` | TKeys ? TKey : never]: TMapping[TKey]\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pick-by-prefix.js","sourceRoot":"","sources":["../../../../src/public/common/ts/pick-by-prefix.ts"],"names":[],"mappings":"","sourcesContent":["export {}\n\n/**\n * Produces a subset of a mapping type, where the keys either match some prefix string, or are in a list of exact matches.\n *\n * ```ts\n * type T = PickByPrefix<{foo_1: number, foo_2: number, nope: string, included: string, also: number}, 'foo_', 'included' | 'also'>.\n *\n * T = {foo_1: number, foo_2: number, included: string, also: number}\n * ```\n * .\n */\nexport type PickByPrefix<TMapping, TPrefix extends string, TKeys extends keyof TMapping = never> = {\n [TKey in keyof TMapping as TKey extends `${TPrefix}${infer _TSuffix}` | TKeys ? TKey : never]: TMapping[TKey]\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const CLI_KIT_VERSION = "3.
|
|
1
|
+
export declare const CLI_KIT_VERSION = "3.39.0";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const CLI_KIT_VERSION = '3.
|
|
1
|
+
export const CLI_KIT_VERSION = '3.39.0';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/public/common/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAA","sourcesContent":["export const CLI_KIT_VERSION = '3.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/public/common/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAA","sourcesContent":["export const CLI_KIT_VERSION = '3.39.0'\n"]}
|
|
@@ -3,7 +3,7 @@ import { alwaysLogAnalytics, analyticsDisabled, isShopify } from './environment/
|
|
|
3
3
|
import * as metadata from './metadata.js';
|
|
4
4
|
import { publishMonorailEvent, MONORAIL_COMMAND_TOPIC } from './monorail.js';
|
|
5
5
|
import { fanoutHooks } from './plugins.js';
|
|
6
|
-
import {
|
|
6
|
+
import { outputContent, outputDebug, outputToken } from '../../public/node/output.js';
|
|
7
7
|
import { getEnvironmentData, getSensitiveEnvironmentData } from '../../private/node/analytics.js';
|
|
8
8
|
import { CLI_KIT_VERSION } from '../common/version.js';
|
|
9
9
|
/**
|
|
@@ -20,12 +20,12 @@ export async function reportAnalyticsEvent(options) {
|
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
if (!alwaysLogAnalytics() && analyticsDisabled()) {
|
|
23
|
-
|
|
23
|
+
outputDebug(outputContent `Skipping command analytics, payload: ${outputToken.json(payload)}`);
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
const response = await publishMonorailEvent(MONORAIL_COMMAND_TOPIC, payload.public, payload.sensitive);
|
|
27
27
|
if (response.type === 'error') {
|
|
28
|
-
|
|
28
|
+
outputDebug(response.message);
|
|
29
29
|
}
|
|
30
30
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
|
31
31
|
}
|
|
@@ -34,13 +34,13 @@ export async function reportAnalyticsEvent(options) {
|
|
|
34
34
|
if (error instanceof Error) {
|
|
35
35
|
message = message.concat(`: ${error.message}`);
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
outputDebug(message);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
async function buildPayload({ config, errorMessage }) {
|
|
41
41
|
const { commandStartOptions, ...sensitiveMetadata } = metadata.getAllSensitiveMetadata();
|
|
42
42
|
if (commandStartOptions === undefined) {
|
|
43
|
-
|
|
43
|
+
outputDebug('Unable to log analytics event - no information on executed command');
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
const { startCommand, startArgs, startTime } = commandStartOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../src/public/node/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,WAAW,CAAA;AAChD,OAAO,EAAC,kBAAkB,EAAE,iBAAiB,EAAE,SAAS,EAAC,MAAM,wBAAwB,CAAA;AACvF,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,EAAC,oBAAoB,EAAE,sBAAsB,EAAC,MAAM,eAAe,CAAA;AAC1E,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAA;AACxC,OAAO,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I,EAAE;YACzC,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;YAC9C,WAAW,EAAE,MAAM,SAAS,EAAE;YAC9B,GAAG,eAAe;YAClB,GAAG,SAAS;YACZ,GAAG,QAAQ,CAAC,oBAAoB,EAAE;SACnC;QACD,SAAS,EAAE;YACT,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;YACzB,aAAa,EAAE,YAAY;YAC3B,GAAG,YAAY;YACf,GAAG,wBAAwB;YAC3B,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC;gBACvB,GAAG,iBAAiB;gBACpB,WAAW,EAAE;oBACX,GAAG,kBAAkB;iBACtB;gBACD,cAAc,EAAE,EAAC,GAAG,qBAAqB,EAAC;aAC3C,CAAC;SACH;KACF,CAAA;AACH,CAAC","sourcesContent":["import {version as rubyVersion} from './ruby.js'\nimport {alwaysLogAnalytics, analyticsDisabled, isShopify} from './environment/local.js'\nimport * as metadata from './metadata.js'\nimport {publishMonorailEvent, MONORAIL_COMMAND_TOPIC} from './monorail.js'\nimport {fanoutHooks} from './plugins.js'\nimport {outputContent, outputDebug, outputToken} from '../../public/node/output.js'\nimport {getEnvironmentData, getSensitiveEnvironmentData} from '../../private/node/analytics.js'\nimport {CLI_KIT_VERSION} from '../common/version.js'\nimport {Interfaces} from '@oclif/core'\n\ninterface ReportAnalyticsEventOptions {\n config: Interfaces.Config\n errorMessage?: string\n}\n\n/**\n * Report an analytics event, sending it off to Monorail -- Shopify's internal analytics service.\n *\n * The payload for an event includes both generic data, and data gathered from installed plug-ins.\n *\n */\nexport async function reportAnalyticsEvent(options: ReportAnalyticsEventOptions): Promise<void> {\n try {\n const payload = await buildPayload(options)\n if (payload === undefined) {\n // Nothing to log\n return\n }\n if (!alwaysLogAnalytics() && analyticsDisabled()) {\n outputDebug(outputContent`Skipping command analytics, payload: ${outputToken.json(payload)}`)\n return\n }\n const response = await publishMonorailEvent(MONORAIL_COMMAND_TOPIC, payload.public, payload.sensitive)\n if (response.type === 'error') {\n outputDebug(response.message)\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 outputDebug(message)\n }\n}\n\nasync function buildPayload({config, errorMessage}: ReportAnalyticsEventOptions) {\n const {commandStartOptions, ...sensitiveMetadata} = metadata.getAllSensitiveMetadata()\n if (commandStartOptions === undefined) {\n outputDebug('Unable to log analytics event - no information on executed command')\n return\n }\n const {startCommand, startArgs, startTime} = commandStartOptions\n const currentTime = new Date().getTime()\n\n const {'@shopify/app': appPublic, ...otherPluginsPublic} = await fanoutHooks(config, 'public_command_metadata', {})\n const {'@shopify/app': appSensitive, ...otherPluginsSensitive} = await fanoutHooks(\n config,\n 'sensitive_command_metadata',\n {},\n )\n\n const environmentData = await getEnvironmentData(config)\n const sensitiveEnvironmentData = await getSensitiveEnvironmentData(config)\n\n return {\n public: {\n command: startCommand,\n time_start: startTime,\n time_end: currentTime,\n total_time: currentTime - startTime,\n success: errorMessage === undefined,\n cli_version: CLI_KIT_VERSION,\n ruby_version: (await rubyVersion()) || '',\n node_version: process.version.replace('v', ''),\n is_employee: await isShopify(),\n ...environmentData,\n ...appPublic,\n ...metadata.getAllPublicMetadata(),\n },\n sensitive: {\n args: startArgs.join(' '),\n error_message: errorMessage,\n ...appSensitive,\n ...sensitiveEnvironmentData,\n metadata: JSON.stringify({\n ...sensitiveMetadata,\n extraPublic: {\n ...otherPluginsPublic,\n },\n extraSensitive: {...otherPluginsSensitive},\n }),\n },\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { outputContent, outputToken } from '../../../public/node/output.js';
|
|
2
2
|
import { BugError, AbortError } from '../error.js';
|
|
3
3
|
import { graphqlRequest } from '../../../private/node/api/graphql.js';
|
|
4
4
|
import { restRequestBody, restRequestHeaders, restRequestUrl } from '../../../private/node/api/rest.js';
|
|
@@ -38,7 +38,7 @@ async function fetchApiVersion(session) {
|
|
|
38
38
|
catch (error) {
|
|
39
39
|
if (error instanceof ClientError && error.response.status === 403) {
|
|
40
40
|
const storeName = session.storeFqdn.replace('.myshopify.com', '');
|
|
41
|
-
throw new AbortError(
|
|
41
|
+
throw new AbortError(outputContent `Looks like you don't have access this dev store: (${outputToken.link(storeName, `https://${session.storeFqdn}`)})`, outputContent `If you're not the owner, create a dev store staff account for yourself`);
|
|
42
42
|
}
|
|
43
43
|
throw new BugError(`Unknown error connecting to your store`);
|
|
44
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../../../../src/public/node/api/admin.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../../../../src/public/node/api/admin.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAE,WAAW,EAAC,MAAM,gCAAgC,CAAA;AACzE,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAC,MAAM,aAAa,CAAA;AAChD,OAAO,EAAC,cAAc,EAAmB,MAAM,sCAAsC,CAAA;AACrF,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAE,cAAc,EAAC,MAAM,mCAAmC,CAAA;AACrG,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAChC,OAAO,EAAC,WAAW,EAAE,GAAG,EAAC,MAAM,iBAAiB,CAAA;AAEhD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAI,KAAa,EAAE,OAAqB,EAAE,SAA4B;IACtG,MAAM,GAAG,GAAG,OAAO,CAAA;IACnB,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC,CAAA;IAC9C,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IAChD,OAAO,cAAc,CAAC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AAc,WAAW,eAAe,CAAA;AACjE,CAAC;AAMD;;;;GAIG;AACH,SAAS,eAAe;IACtB,OAAO,GAAG,CAAA;;;;;;;GAOT,CAAA;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAc,EACd,IAAY,EACZ,OAAqB,EACrB,WAAe,EACf,eAAyC,EAAE,EAC3C,UAAU,GAAG,UAAU;IAEvB,MAAM,GAAG,GAAG,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,CAAC,CAAA;IACnE,MAAM,IAAI,GAAG,eAAe,CAAI,WAAW,CAAC,CAAA;IAE5C,MAAM,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAA;IAC3C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAChC,OAAO;QACP,MAAM;QACN,IAAI;KACL,CAAC,CAAA;IAEF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAEpD,OAAO;QACL,IAAI;QACJ,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE;KAChC,CAAA;AACH,CAAC","sourcesContent":["import {AdminSession} from '../session.js'\nimport {outputContent, outputToken} from '../../../public/node/output.js'\nimport {BugError, AbortError} from '../error.js'\nimport {graphqlRequest, GraphQLVariables} from '../../../private/node/api/graphql.js'\nimport {restRequestBody, restRequestHeaders, restRequestUrl} from '../../../private/node/api/rest.js'\nimport {fetch} from '../http.js'\nimport {ClientError, gql} from 'graphql-request'\n\n/**\n * Executes a GraphQL query against the Admin API.\n *\n * @param query - GraphQL query to execute.\n * @param session - Shopify admin session including token and Store FQDN.\n * @param variables - GraphQL variables to pass to the query.\n * @returns The response of the query of generic type <T>.\n */\nexport async function adminRequest<T>(query: string, session: AdminSession, variables?: GraphQLVariables): Promise<T> {\n const api = 'Admin'\n const version = await fetchApiVersion(session)\n const url = adminUrl(session.storeFqdn, version)\n return graphqlRequest(query, api, url, session.token, variables)\n}\n\n/**\n * GraphQL query to retrieve the latest supported API version.\n *\n * @param session - Shopify admin session including token and Store FQDN.\n * @returns - The latest supported API version.\n */\nasync function fetchApiVersion(session: AdminSession): Promise<string> {\n const url = adminUrl(session.storeFqdn, 'unstable')\n const query = apiVersionQuery()\n try {\n const data: ApiVersionResponse = await graphqlRequest(query, 'Admin', url, session.token, {}, false)\n\n return data.publicApiVersions\n .filter((item) => item.supported)\n .map((item) => item.handle)\n .sort()\n .reverse()[0]!\n } catch (error) {\n if (error instanceof ClientError && error.response.status === 403) {\n const storeName = session.storeFqdn.replace('.myshopify.com', '')\n throw new AbortError(\n outputContent`Looks like you don't have access this dev store: (${outputToken.link(\n storeName,\n `https://${session.storeFqdn}`,\n )})`,\n outputContent`If you're not the owner, create a dev store staff account for yourself`,\n )\n }\n throw new BugError(`Unknown error connecting to your store`)\n }\n}\n\n/**\n * Returns the Admin API URL for the given store and version.\n *\n * @param store - Store FQDN.\n * @param version - API version.\n * @returns - Admin API URL.\n */\nfunction adminUrl(store: string, version: string | undefined): string {\n const realVersion = version || 'unstable'\n return `https://${store}/admin/api/${realVersion}/graphql.json`\n}\n\ninterface ApiVersionResponse {\n publicApiVersions: {handle: string; supported: boolean}[]\n}\n\n/**\n * GraphQL query string to retrieve the latest supported API version.\n *\n * @returns - A query string.\n */\nfunction apiVersionQuery(): string {\n return gql`\n query {\n publicApiVersions {\n handle\n supported\n }\n }\n `\n}\n\n/**\n * Executes a REST request against the Admin API.\n *\n * @param method - Request's HTTP method.\n * @param path - Path of the REST resource.\n * @param session - Shopify Admin session including token and Store FQDN.\n * @param requestBody - Request body of including REST resource specific parameters.\n * @param searchParams - Search params, appended to the URL.\n * @param apiVersion - Admin API version.\n * @returns - The {@link RestResponse}.\n */\nexport async function restRequest<T>(\n method: string,\n path: string,\n session: AdminSession,\n requestBody?: T,\n searchParams: {[name: string]: string} = {},\n apiVersion = 'unstable',\n): Promise<RestResponse> {\n const url = restRequestUrl(session, apiVersion, path, searchParams)\n const body = restRequestBody<T>(requestBody)\n\n const headers = restRequestHeaders(session)\n const response = await fetch(url, {\n headers,\n method,\n body,\n })\n\n const json = await response.json().catch(() => ({}))\n\n return {\n json,\n status: response.status,\n headers: response.headers.raw(),\n }\n}\n\n/**\n * Respose of a REST request.\n */\nexport interface RestResponse {\n /**\n * REST JSON respose.\n */\n // Using `any` to avoid introducing extra DTO layers.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n json: any\n\n /**\n * HTTP response status.\n */\n status: number\n\n /**\n * HTTP response headers.\n */\n headers: {[key: string]: string[]}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=http.js.map
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
+
interface ZipOptions {
|
|
2
|
+
/**
|
|
3
|
+
* The absolute path to the directory to be zipped.
|
|
4
|
+
*/
|
|
5
|
+
inputDirectory: string;
|
|
6
|
+
/**
|
|
7
|
+
* The absolute path to the output zip file.
|
|
8
|
+
*/
|
|
9
|
+
outputZipPath: string;
|
|
10
|
+
/**
|
|
11
|
+
* Pattern to match when adding files to zip, uses glob expressions.
|
|
12
|
+
*/
|
|
13
|
+
matchFilePattern?: string;
|
|
14
|
+
}
|
|
1
15
|
/**
|
|
2
|
-
* It zips a directory
|
|
3
|
-
*
|
|
4
|
-
*
|
|
16
|
+
* It zips a directory and by default normalizes the paths to be forward-slash.
|
|
17
|
+
* Even with forward-slash paths, zip files should still be able to be opened on
|
|
18
|
+
* Windows.
|
|
5
19
|
*
|
|
6
|
-
* @param
|
|
7
|
-
* @param outputZipPath - The absolute path to the output zip file.
|
|
20
|
+
* @param options - ZipOptions.
|
|
8
21
|
*/
|
|
9
|
-
export declare function zip(
|
|
22
|
+
export declare function zip(options: ZipOptions): Promise<void>;
|
|
23
|
+
export {};
|
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import { relativePath } from './path.js';
|
|
2
2
|
import { glob } from './fs.js';
|
|
3
|
-
import {
|
|
3
|
+
import { outputDebug, outputContent, outputToken } from '../../public/node/output.js';
|
|
4
4
|
import archiver from 'archiver';
|
|
5
5
|
import { createWriteStream } from 'fs';
|
|
6
6
|
/**
|
|
7
|
-
* It zips a directory
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* It zips a directory and by default normalizes the paths to be forward-slash.
|
|
8
|
+
* Even with forward-slash paths, zip files should still be able to be opened on
|
|
9
|
+
* Windows.
|
|
10
10
|
*
|
|
11
|
-
* @param
|
|
12
|
-
* @param outputZipPath - The absolute path to the output zip file.
|
|
11
|
+
* @param options - ZipOptions.
|
|
13
12
|
*/
|
|
14
|
-
export async function zip(
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
export async function zip(options) {
|
|
14
|
+
const { inputDirectory, outputZipPath, matchFilePattern = '**/*' } = options;
|
|
15
|
+
outputDebug(outputContent `Zipping ${outputToken.path(inputDirectory)} into ${outputToken.path(outputZipPath)}`);
|
|
16
|
+
const pathsToZip = await glob(matchFilePattern, {
|
|
17
|
+
cwd: inputDirectory,
|
|
18
|
+
absolute: true,
|
|
19
|
+
dot: true,
|
|
20
|
+
followSymbolicLinks: false,
|
|
21
|
+
});
|
|
17
22
|
return new Promise((resolve, reject) => {
|
|
18
23
|
const archive = archiver('zip');
|
|
19
24
|
const output = createWriteStream(outputZipPath);
|
|
20
|
-
output.on('close',
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
archive.on('error', function (error) {
|
|
24
|
-
reject(error);
|
|
25
|
-
});
|
|
25
|
+
output.on('close', () => resolve());
|
|
26
|
+
archive.on('error', (error) => reject(error));
|
|
26
27
|
archive.pipe(output);
|
|
27
28
|
for (const filePath of pathsToZip) {
|
|
28
29
|
const fileRelativePath = relativePath(inputDirectory, filePath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archiver.js","sourceRoot":"","sources":["../../../src/public/node/archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAA;AACtC,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"archiver.js","sourceRoot":"","sources":["../../../src/public/node/archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAA;AACtC,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAC,WAAW,EAAE,aAAa,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAA;AACnF,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAC,iBAAiB,EAAC,MAAM,IAAI,CAAA;AAmBpC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,OAAmB;IAC3C,MAAM,EAAC,cAAc,EAAE,aAAa,EAAE,gBAAgB,GAAG,MAAM,EAAC,GAAG,OAAO,CAAA;IAC1E,WAAW,CAAC,aAAa,CAAA,WAAW,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;IAC/G,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE;QAC9C,GAAG,EAAE,cAAc;QACnB,QAAQ,EAAE,IAAI;QACd,GAAG,EAAE,IAAI;QACT,mBAAmB,EAAE,KAAK;KAC3B,CAAC,CAAA;IAEF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;QAE/B,MAAM,MAAM,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAA;QAC/C,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAA;QACnC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;QAC7C,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAEpB,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE;YACjC,MAAM,gBAAgB,GAAG,YAAY,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAA;YAC/D,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,gBAAgB,EAAC,CAAC,CAAA;SACjD;QAED,mEAAmE;QACnE,OAAO,CAAC,QAAQ,EAAE,CAAA;IACpB,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {relativePath} from './path.js'\nimport {glob} from './fs.js'\nimport {outputDebug, outputContent, outputToken} from '../../public/node/output.js'\nimport archiver from 'archiver'\nimport {createWriteStream} from 'fs'\n\ninterface ZipOptions {\n /**\n * The absolute path to the directory to be zipped.\n */\n inputDirectory: string\n\n /**\n * The absolute path to the output zip file.\n */\n outputZipPath: string\n\n /**\n * Pattern to match when adding files to zip, uses glob expressions.\n */\n matchFilePattern?: string\n}\n\n/**\n * It zips a directory and by default normalizes the paths to be forward-slash.\n * Even with forward-slash paths, zip files should still be able to be opened on\n * Windows.\n *\n * @param options - ZipOptions.\n */\nexport async function zip(options: ZipOptions): Promise<void> {\n const {inputDirectory, outputZipPath, matchFilePattern = '**/*'} = options\n outputDebug(outputContent`Zipping ${outputToken.path(inputDirectory)} into ${outputToken.path(outputZipPath)}`)\n const pathsToZip = await glob(matchFilePattern, {\n cwd: inputDirectory,\n absolute: true,\n dot: true,\n followSymbolicLinks: false,\n })\n\n return new Promise((resolve, reject) => {\n const archive = archiver('zip')\n\n const output = createWriteStream(outputZipPath)\n output.on('close', () => resolve())\n archive.on('error', (error) => reject(error))\n archive.pipe(output)\n\n for (const filePath of pathsToZip) {\n const fileRelativePath = relativePath(inputDirectory, filePath)\n archive.file(filePath, {name: fileRelativePath})\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n archive.finalize()\n })\n}\n"]}
|
|
@@ -4,7 +4,7 @@ import { isDevelopment } from './environment/local.js';
|
|
|
4
4
|
import { addPublicMetadata } from './metadata.js';
|
|
5
5
|
import { AbortError } from './error.js';
|
|
6
6
|
import { cwd } from './path.js';
|
|
7
|
-
import {
|
|
7
|
+
import { outputContent, outputInfo, outputToken } from '../../public/node/output.js';
|
|
8
8
|
import { hashString } from '../../public/node/crypto.js';
|
|
9
9
|
import { isTruthy } from '../../private/node/environment/utilities.js';
|
|
10
10
|
import { Command } from '@oclif/core';
|
|
@@ -27,7 +27,7 @@ class BaseCommand extends Command {
|
|
|
27
27
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
28
28
|
exitWithTimestampWhenEnvVariablePresent() {
|
|
29
29
|
if (isTruthy(process.env.SHOPIFY_CLI_ENV_STARTUP_PERFORMANCE_RUN)) {
|
|
30
|
-
|
|
30
|
+
outputInfo(`
|
|
31
31
|
SHOPIFY_CLI_TIMESTAMP_START
|
|
32
32
|
{ "timestamp": ${Date.now()} }
|
|
33
33
|
SHOPIFY_CLI_TIMESTAMP_END
|
|
@@ -102,7 +102,7 @@ function reportPresetApplication(noDefaultsFlags, flagsWithPresets, presetName,
|
|
|
102
102
|
}
|
|
103
103
|
if (Object.keys(changes).length === 0)
|
|
104
104
|
return;
|
|
105
|
-
|
|
105
|
+
outputInfo(outputContent `Using applicable flags from the preset ${outputToken.yellow(presetName)}:
|
|
106
106
|
|
|
107
107
|
${Object.entries(changes)
|
|
108
108
|
.map(([name, value]) => `• ${name} = ${value}`)
|
|
@@ -156,7 +156,7 @@ function argsFromPreset(preset, options, noDefaultsResult) {
|
|
|
156
156
|
args.push(`--${label}`);
|
|
157
157
|
}
|
|
158
158
|
else {
|
|
159
|
-
throw new AbortError(
|
|
159
|
+
throw new AbortError(outputContent `Presets can only specify true for boolean flags. Attempted to set ${outputToken.yellow(label)} to false.`);
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
else if (Array.isArray(value)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-command.js","sourceRoot":"","sources":["../../../src/public/node/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,2CAA2C,EAAC,MAAM,oBAAoB,CAAA;AAC5F,OAAO,EAAC,wBAAwB,EAAC,MAAM,cAAc,CAAA;AACrD,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,EAAC,GAAG,EAAC,MAAM,WAAW,CAAA;AAE7B,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAC,QAAQ,EAAC,MAAM,6CAA6C,CAAA;AACpE,OAAO,EAAC,OAAO,EAAa,MAAM,aAAa,CAAA;AAO/C,MAAe,WAAY,SAAQ,OAAO;IACjC,MAAM,CAAC,qBAAqB;QACjC,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,KAA8C;QACxD,MAAM,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IACxC,CAAC;IAED,8DAA8D;IACpD,KAAK,CAAC,IAAI;QAClB,IAAI,CAAC,uCAAuC,EAAE,CAAA;QAC9C,IAAI,CAAC,aAAa,EAAE,EAAE;YACpB,yCAAyC;YACzC,MAAM,2CAA2C,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;SAC/D;QACD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K,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACnD,MAAM,uBAAuB,GAAG,OAAO,EAAE,KAAK,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;QAC5G,MAAM,qBAAqB,GACzB,gBAAgB,CAAC,KAAK,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;QAC/F,IAAI,uBAAuB,IAAI,CAAC,qBAAqB,EAAE;YACrD,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE;gBAC9B,IAAI,KAAK,KAAK,IAAI,EAAE;oBAClB,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAA;iBACxB;qBAAM;oBACL,MAAM,IAAI,UAAU,CAClB,OAAO,CAAA,qEAAqE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAC5G,CAAA;iBACF;aACF;iBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBAC/B,KAAK,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,CAAA;aAClE;iBAAM;gBACL,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,CAAC,CAAA;aACpC;SACF;KACF;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,eAAe,WAAW,CAAA","sourcesContent":["import {errorHandler, registerCleanBugsnagErrorsFromWithinPlugins} from './error-handler.js'\nimport {loadPresetsFromDirectory} from './presets.js'\nimport {isDevelopment} from './environment/local.js'\nimport {addPublicMetadata} from './metadata.js'\nimport {AbortError} from './error.js'\nimport {cwd} from './path.js'\nimport {JsonMap} from '../../private/common/json.js'\nimport {content, info, token} from '../../output.js'\nimport {hashString} from '../../public/node/crypto.js'\nimport {isTruthy} from '../../private/node/environment/utilities.js'\nimport {Command, Interfaces} from '@oclif/core'\n\ninterface PresettableFlags {\n preset?: string\n path?: string\n}\n\nabstract class BaseCommand extends Command {\n public static analyticsNameOverride(): string | undefined {\n return undefined\n }\n\n async catch(error: Error & {exitCode?: number | undefined}): Promise<void> {\n await errorHandler(error, this.config)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n protected async init(): Promise<any> {\n this.exitWithTimestampWhenEnvVariablePresent()\n if (!isDevelopment()) {\n // This function runs just prior to `run`\n await registerCleanBugsnagErrorsFromWithinPlugins(this.config)\n }\n return super.init()\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n protected exitWithTimestampWhenEnvVariablePresent() {\n if (isTruthy(process.env.SHOPIFY_CLI_ENV_STARTUP_PERFORMANCE_RUN)) {\n info(`\n SHOPIFY_CLI_TIMESTAMP_START\n { \"timestamp\": ${Date.now()} }\n SHOPIFY_CLI_TIMESTAMP_END\n `)\n process.exit(0)\n }\n }\n\n protected async parse<\n TFlags extends Interfaces.FlagOutput & {path?: string; verbose?: boolean},\n TGlobalFlags extends Interfaces.FlagOutput,\n TArgs extends Interfaces.OutputArgs,\n >(\n options?: Interfaces.Input<TFlags, TGlobalFlags>,\n argv?: string[],\n ): Promise<Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>> {\n let result = await super.parse<TFlags, TGlobalFlags, TArgs>(options, argv)\n result = await this.resultWithPreset<TFlags, TGlobalFlags, TArgs>(result, options, argv)\n await addFromParsedFlags(result.flags)\n return result\n }\n\n protected async resultWithPreset<\n TFlags extends Interfaces.FlagOutput & {path?: string; verbose?: boolean},\n TGlobalFlags extends Interfaces.FlagOutput,\n TArgs extends Interfaces.OutputArgs,\n >(\n originalResult: Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>,\n options?: Interfaces.Input<TFlags, TGlobalFlags>,\n argv?: string[],\n ): Promise<Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>> {\n // If no preset is specified, don't modify the results\n const flags = originalResult.flags as PresettableFlags\n if (!flags.preset) return originalResult\n\n // If the specified preset isn't found, don't modify the results\n const presets = await loadPresetsFromDirectory(await this.presetsPath(flags), {findUp: this.findUpForPresets()})\n const preset = presets[flags.preset]\n if (!preset) return originalResult\n\n // Parse using noDefaultsOptions to derive a list of flags specified as\n // command-line arguments.\n const noDefaultsResult = await super.parse<TFlags, TGlobalFlags, TArgs>(noDefaultsOptions(options), argv)\n\n // Add the preset's settings to argv and pass them to `super.parse`. This\n // invokes oclif's validation system without breaking the oclif black box.\n // Replace the original result with this one.\n const result = await super.parse<TFlags, TGlobalFlags, TArgs>(options, [\n // Need to specify argv default because we're merging with argsFromPreset.\n ...(argv || this.argv),\n ...argsFromPreset<TFlags, TGlobalFlags, TArgs>(preset, options, noDefaultsResult),\n ])\n\n // Report successful application of the preset.\n reportPresetApplication<TFlags, TGlobalFlags, TArgs>(noDefaultsResult.flags, result.flags, flags.preset, preset)\n\n return result\n }\n\n protected async presetsPath(rawFlags: {path?: string}): Promise<string> {\n return rawFlags.path || cwd()\n }\n\n protected findUpForPresets(): boolean {\n return true\n }\n}\n\nexport async function addFromParsedFlags(flags: {path?: string; verbose?: boolean}): Promise<void> {\n await addPublicMetadata(() => ({\n cmd_all_verbose: flags.verbose,\n cmd_all_path_override: flags.path !== undefined,\n cmd_all_path_override_hash: flags.path === undefined ? undefined : hashString(flags.path),\n }))\n}\n\n/**\n * Any flag which is:\n *\n * 1. Present in the final set of flags\n * 2. Specified in the preset\n * 3. Not specified by the user as a command line argument\n *\n * should be reported.\n *\n * It doesn't matter if the preset flag's value was the same as the default; from\n * the user's perspective, they want to know their preset was applied.\n */\nfunction reportPresetApplication<\n TFlags extends Interfaces.FlagOutput,\n TGlobalFlags extends Interfaces.FlagOutput,\n TArgs extends Interfaces.OutputArgs,\n>(\n noDefaultsFlags: Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>['flags'],\n flagsWithPresets: Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>['flags'],\n presetName: string,\n preset: JsonMap,\n): void {\n const changes: JsonMap = {}\n for (const [name, value] of Object.entries(flagsWithPresets)) {\n const userSpecifiedThisFlag = Object.prototype.hasOwnProperty.call(noDefaultsFlags, name)\n const presetContainsFlag = Object.prototype.hasOwnProperty.call(preset, name)\n if (!userSpecifiedThisFlag && presetContainsFlag) changes[name] = value\n }\n if (Object.keys(changes).length === 0) return\n info(content`Using applicable flags from the preset ${token.yellow(presetName)}:\n\n${Object.entries(changes)\n .map(([name, value]) => `• ${name} = ${value}`)\n .join('\\n')}\\n`)\n}\n\n/**\n * Strips the defaults from configured flags. For example, if flags contains:\n *\n * ```\n * someFlag: Flags.boolean({\n * description: 'some flag',\n * default: false\n * })\n * ```\n *\n * it becomes:\n *\n * ```\n * someFlag: Flags.boolean({\n * description: 'some flag'\n * })\n * ```\n *\n * If we parse using this configuration, the only specified flags will be those\n * the user actually passed on the command line.\n */\nfunction noDefaultsOptions<TFlags extends Interfaces.FlagOutput, TGlobalFlags extends Interfaces.FlagOutput>(\n options: Interfaces.Input<TFlags, TGlobalFlags> | undefined,\n): Interfaces.Input<TFlags, TGlobalFlags> | undefined {\n if (!options?.flags) return options\n return {\n ...options,\n flags: Object.fromEntries(\n Object.entries(options.flags).map(([label, settings]) => {\n const copiedSettings = {...(settings as {default?: unknown})}\n delete copiedSettings.default\n return [label, copiedSettings]\n }),\n ) as Interfaces.FlagInput<TFlags>,\n }\n}\n\n/**\n * Converts the preset's settings to arguments as though passed on the command\n * line, skipping any arguments the user specified on the command line.\n */\nfunction argsFromPreset<\n TFlags extends Interfaces.FlagOutput,\n TGlobalFlags extends Interfaces.FlagOutput,\n TArgs extends Interfaces.OutputArgs,\n>(\n preset: JsonMap,\n options: Interfaces.Input<TFlags, TGlobalFlags> | undefined,\n noDefaultsResult: Interfaces.ParserOutput<TFlags, TArgs>,\n): string[] {\n const args: string[] = []\n for (const [label, value] of Object.entries(preset)) {\n const flagIsRelevantToCommand = options?.flags && Object.prototype.hasOwnProperty.call(options.flags, label)\n const userSpecifiedThisFlag =\n noDefaultsResult.flags && Object.prototype.hasOwnProperty.call(noDefaultsResult.flags, label)\n if (flagIsRelevantToCommand && !userSpecifiedThisFlag) {\n if (typeof value === 'boolean') {\n if (value === true) {\n args.push(`--${label}`)\n } else {\n throw new AbortError(\n content`Presets can only specify true for boolean flags. Attempted to set ${token.yellow(label)} to false.`,\n )\n }\n } else if (Array.isArray(value)) {\n value.forEach((element) => args.push(`--${label}`, `${element}`))\n } else {\n args.push(`--${label}`, `${value}`)\n }\n }\n }\n return args\n}\n\nexport default BaseCommand\n"]}
|
|
1
|
+
{"version":3,"file":"base-command.js","sourceRoot":"","sources":["../../../src/public/node/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,2CAA2C,EAAC,MAAM,oBAAoB,CAAA;AAC5F,OAAO,EAAC,wBAAwB,EAAC,MAAM,cAAc,CAAA;AACrD,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,EAAC,GAAG,EAAC,MAAM,WAAW,CAAA;AAE7B,OAAO,EAAC,aAAa,EAAE,UAAU,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAA;AAClF,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAC,QAAQ,EAAC,MAAM,6CAA6C,CAAA;AACpE,OAAO,EAAC,OAAO,EAAa,MAAM,aAAa,CAAA;AAO/C,MAAe,WAAY,SAAQ,OAAO;IACjC,MAAM,CAAC,qBAAqB;QACjC,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,KAAK,C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C,KAAK,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,CAAC,CAAA;aACpC;SACF;KACF;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,eAAe,WAAW,CAAA","sourcesContent":["import {errorHandler, registerCleanBugsnagErrorsFromWithinPlugins} from './error-handler.js'\nimport {loadPresetsFromDirectory} from './presets.js'\nimport {isDevelopment} from './environment/local.js'\nimport {addPublicMetadata} from './metadata.js'\nimport {AbortError} from './error.js'\nimport {cwd} from './path.js'\nimport {JsonMap} from '../../private/common/json.js'\nimport {outputContent, outputInfo, outputToken} from '../../public/node/output.js'\nimport {hashString} from '../../public/node/crypto.js'\nimport {isTruthy} from '../../private/node/environment/utilities.js'\nimport {Command, Interfaces} from '@oclif/core'\n\ninterface PresettableFlags {\n preset?: string\n path?: string\n}\n\nabstract class BaseCommand extends Command {\n public static analyticsNameOverride(): string | undefined {\n return undefined\n }\n\n async catch(error: Error & {exitCode?: number | undefined}): Promise<void> {\n await errorHandler(error, this.config)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n protected async init(): Promise<any> {\n this.exitWithTimestampWhenEnvVariablePresent()\n if (!isDevelopment()) {\n // This function runs just prior to `run`\n await registerCleanBugsnagErrorsFromWithinPlugins(this.config)\n }\n return super.init()\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n protected exitWithTimestampWhenEnvVariablePresent() {\n if (isTruthy(process.env.SHOPIFY_CLI_ENV_STARTUP_PERFORMANCE_RUN)) {\n outputInfo(`\n SHOPIFY_CLI_TIMESTAMP_START\n { \"timestamp\": ${Date.now()} }\n SHOPIFY_CLI_TIMESTAMP_END\n `)\n process.exit(0)\n }\n }\n\n protected async parse<\n TFlags extends Interfaces.FlagOutput & {path?: string; verbose?: boolean},\n TGlobalFlags extends Interfaces.FlagOutput,\n TArgs extends Interfaces.OutputArgs,\n >(\n options?: Interfaces.Input<TFlags, TGlobalFlags>,\n argv?: string[],\n ): Promise<Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>> {\n let result = await super.parse<TFlags, TGlobalFlags, TArgs>(options, argv)\n result = await this.resultWithPreset<TFlags, TGlobalFlags, TArgs>(result, options, argv)\n await addFromParsedFlags(result.flags)\n return result\n }\n\n protected async resultWithPreset<\n TFlags extends Interfaces.FlagOutput & {path?: string; verbose?: boolean},\n TGlobalFlags extends Interfaces.FlagOutput,\n TArgs extends Interfaces.OutputArgs,\n >(\n originalResult: Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>,\n options?: Interfaces.Input<TFlags, TGlobalFlags>,\n argv?: string[],\n ): Promise<Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>> {\n // If no preset is specified, don't modify the results\n const flags = originalResult.flags as PresettableFlags\n if (!flags.preset) return originalResult\n\n // If the specified preset isn't found, don't modify the results\n const presets = await loadPresetsFromDirectory(await this.presetsPath(flags), {findUp: this.findUpForPresets()})\n const preset = presets[flags.preset]\n if (!preset) return originalResult\n\n // Parse using noDefaultsOptions to derive a list of flags specified as\n // command-line arguments.\n const noDefaultsResult = await super.parse<TFlags, TGlobalFlags, TArgs>(noDefaultsOptions(options), argv)\n\n // Add the preset's settings to argv and pass them to `super.parse`. This\n // invokes oclif's validation system without breaking the oclif black box.\n // Replace the original result with this one.\n const result = await super.parse<TFlags, TGlobalFlags, TArgs>(options, [\n // Need to specify argv default because we're merging with argsFromPreset.\n ...(argv || this.argv),\n ...argsFromPreset<TFlags, TGlobalFlags, TArgs>(preset, options, noDefaultsResult),\n ])\n\n // Report successful application of the preset.\n reportPresetApplication<TFlags, TGlobalFlags, TArgs>(noDefaultsResult.flags, result.flags, flags.preset, preset)\n\n return result\n }\n\n protected async presetsPath(rawFlags: {path?: string}): Promise<string> {\n return rawFlags.path || cwd()\n }\n\n protected findUpForPresets(): boolean {\n return true\n }\n}\n\nexport async function addFromParsedFlags(flags: {path?: string; verbose?: boolean}): Promise<void> {\n await addPublicMetadata(() => ({\n cmd_all_verbose: flags.verbose,\n cmd_all_path_override: flags.path !== undefined,\n cmd_all_path_override_hash: flags.path === undefined ? undefined : hashString(flags.path),\n }))\n}\n\n/**\n * Any flag which is:\n *\n * 1. Present in the final set of flags\n * 2. Specified in the preset\n * 3. Not specified by the user as a command line argument\n *\n * should be reported.\n *\n * It doesn't matter if the preset flag's value was the same as the default; from\n * the user's perspective, they want to know their preset was applied.\n */\nfunction reportPresetApplication<\n TFlags extends Interfaces.FlagOutput,\n TGlobalFlags extends Interfaces.FlagOutput,\n TArgs extends Interfaces.OutputArgs,\n>(\n noDefaultsFlags: Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>['flags'],\n flagsWithPresets: Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>['flags'],\n presetName: string,\n preset: JsonMap,\n): void {\n const changes: JsonMap = {}\n for (const [name, value] of Object.entries(flagsWithPresets)) {\n const userSpecifiedThisFlag = Object.prototype.hasOwnProperty.call(noDefaultsFlags, name)\n const presetContainsFlag = Object.prototype.hasOwnProperty.call(preset, name)\n if (!userSpecifiedThisFlag && presetContainsFlag) changes[name] = value\n }\n if (Object.keys(changes).length === 0) return\n outputInfo(outputContent`Using applicable flags from the preset ${outputToken.yellow(presetName)}:\n\n${Object.entries(changes)\n .map(([name, value]) => `• ${name} = ${value}`)\n .join('\\n')}\\n`)\n}\n\n/**\n * Strips the defaults from configured flags. For example, if flags contains:\n *\n * ```\n * someFlag: Flags.boolean({\n * description: 'some flag',\n * default: false\n * })\n * ```\n *\n * it becomes:\n *\n * ```\n * someFlag: Flags.boolean({\n * description: 'some flag'\n * })\n * ```\n *\n * If we parse using this configuration, the only specified flags will be those\n * the user actually passed on the command line.\n */\nfunction noDefaultsOptions<TFlags extends Interfaces.FlagOutput, TGlobalFlags extends Interfaces.FlagOutput>(\n options: Interfaces.Input<TFlags, TGlobalFlags> | undefined,\n): Interfaces.Input<TFlags, TGlobalFlags> | undefined {\n if (!options?.flags) return options\n return {\n ...options,\n flags: Object.fromEntries(\n Object.entries(options.flags).map(([label, settings]) => {\n const copiedSettings = {...(settings as {default?: unknown})}\n delete copiedSettings.default\n return [label, copiedSettings]\n }),\n ) as Interfaces.FlagInput<TFlags>,\n }\n}\n\n/**\n * Converts the preset's settings to arguments as though passed on the command\n * line, skipping any arguments the user specified on the command line.\n */\nfunction argsFromPreset<\n TFlags extends Interfaces.FlagOutput,\n TGlobalFlags extends Interfaces.FlagOutput,\n TArgs extends Interfaces.OutputArgs,\n>(\n preset: JsonMap,\n options: Interfaces.Input<TFlags, TGlobalFlags> | undefined,\n noDefaultsResult: Interfaces.ParserOutput<TFlags, TArgs>,\n): string[] {\n const args: string[] = []\n for (const [label, value] of Object.entries(preset)) {\n const flagIsRelevantToCommand = options?.flags && Object.prototype.hasOwnProperty.call(options.flags, label)\n const userSpecifiedThisFlag =\n noDefaultsResult.flags && Object.prototype.hasOwnProperty.call(noDefaultsResult.flags, label)\n if (flagIsRelevantToCommand && !userSpecifiedThisFlag) {\n if (typeof value === 'boolean') {\n if (value === true) {\n args.push(`--${label}`)\n } else {\n throw new AbortError(\n outputContent`Presets can only specify true for boolean flags. Attempted to set ${outputToken.yellow(\n label,\n )} to false.`,\n )\n }\n } else if (Array.isArray(value)) {\n value.forEach((element) => args.push(`--${label}`, `${element}`))\n } else {\n args.push(`--${label}`, `${value}`)\n }\n }\n }\n return args\n}\n\nexport default BaseCommand\n"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { AbortError } from './error.js';
|
|
2
2
|
import { fileExists, readFile, writeFile } from './fs.js';
|
|
3
|
-
import {
|
|
3
|
+
import { outputDebug, outputContent, outputToken } from '../../public/node/output.js';
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
5
|
+
// @ts-ignore
|
|
4
6
|
import { parse, stringify } from 'envfile';
|
|
5
7
|
/**
|
|
6
8
|
* Error that's thrown when the .env is not found.
|
|
@@ -16,7 +18,7 @@ export const DotEnvNotFoundError = (path) => {
|
|
|
16
18
|
* @returns An in-memory representation of the .env file.
|
|
17
19
|
*/
|
|
18
20
|
export async function readAndParseDotEnv(path) {
|
|
19
|
-
|
|
21
|
+
outputDebug(outputContent `Reading the .env file at ${outputToken.path(path)}`);
|
|
20
22
|
if (!(await fileExists(path))) {
|
|
21
23
|
throw DotEnvNotFoundError(path);
|
|
22
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dot-env.js","sourceRoot":"","sources":["../../../src/public/node/dot-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,SAAS,CAAA;AACvD,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"dot-env.js","sourceRoot":"","sources":["../../../src/public/node/dot-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,SAAS,CAAA;AACvD,OAAO,EAAC,WAAW,EAAE,aAAa,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAA;AACnF,6DAA6D;AAC7D,aAAa;AACb,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,MAAM,SAAS,CAAA;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAc,EAAE;IAC9D,OAAO,IAAI,UAAU,CAAC,2BAA2B,IAAI,kBAAkB,CAAC,CAAA;AAC1E,CAAC,CAAA;AAgBD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAAY;IACnD,WAAW,CAAC,aAAa,CAAA,4BAA4B,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC9E,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE;QAC7B,MAAM,mBAAmB,CAAC,IAAI,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M,CAAC,QAAQ,EAAE,YAAY,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpE,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YAC1C,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAA;SACjD;KACF;IAED,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC/B,CAAC","sourcesContent":["import {AbortError} from './error.js'\nimport {fileExists, readFile, writeFile} from './fs.js'\nimport {outputDebug, outputContent, outputToken} from '../../public/node/output.js'\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport {parse, stringify} from 'envfile'\n\n/**\n * Error that's thrown when the .env is not found.\n * @param path - Path to the .env file.\n * @returns An abort error.\n */\nexport const DotEnvNotFoundError = (path: string): AbortError => {\n return new AbortError(`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 - Path to the .env file\n * @returns An in-memory representation of the .env file.\n */\nexport async function readAndParseDotEnv(path: string): Promise<DotEnvFile> {\n outputDebug(outputContent`Reading the .env file at ${outputToken.path(path)}`)\n if (!(await fileExists(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 - .env file to be written.\n */\nexport async function writeDotEnv(file: DotEnvFile): Promise<void> {\n await writeFile(file.path, stringify(file.variables))\n}\n\n/**\n * Given an .env file content, generates a new one with new values\n * without removing already existing lines.\n * @param envFileContent - .env file contents.\n * @param updatedValues - object containing new env variables values.\n */\nexport function patchEnvFile(\n envFileContent: string | null,\n updatedValues: {[key: string]: string | undefined},\n): string {\n const outputLines: string[] = []\n const lines = envFileContent === null ? [] : envFileContent.split('\\n')\n\n const alreadyPresentKeys: string[] = []\n\n const toLine = (key: string, value?: string) => `${key}=${value}`\n\n for (const line of lines) {\n const match = line.match(/^([^=:#]+?)[=:](.*)/)\n let lineToWrite = line\n\n if (match) {\n const key = match[1]!.trim()\n const newValue = updatedValues[key]\n if (newValue) {\n alreadyPresentKeys.push(key)\n lineToWrite = toLine(key, newValue)\n }\n }\n\n outputLines.push(lineToWrite)\n }\n\n for (const [patchKey, updatedValue] of Object.entries(updatedValues)) {\n if (!alreadyPresentKeys.includes(patchKey)) {\n outputLines.push(toLine(patchKey, updatedValue))\n }\n }\n\n return outputLines.join('\\n')\n}\n"]}
|
|
@@ -2,12 +2,12 @@ import { fileExists, readFileSync } from '../fs.js';
|
|
|
2
2
|
import { isTruthy } from '../../../private/node/environment/utilities.js';
|
|
3
3
|
import { environmentVariables } from '../../../private/node/constants.js';
|
|
4
4
|
import { captureOutput } from '../system.js';
|
|
5
|
-
import {
|
|
5
|
+
import { outputContent, outputToken } from '../../../public/node/output.js';
|
|
6
6
|
import { getCachedSpinFqdn, setCachedSpinFqdn } from '../../../private/node/environment/spin-cache.js';
|
|
7
7
|
import { AbortError } from '../error.js';
|
|
8
8
|
import { Environment, serviceEnvironment } from '../../../private/node/environment/service.js';
|
|
9
9
|
const SpinInstanceNotFoundMessages = (spinInstance, error) => {
|
|
10
|
-
const errorMessage =
|
|
10
|
+
const errorMessage = outputContent `${outputToken.genericShellCommand(`spin`)} yielded the following error trying to obtain the fully qualified domain name of the Spin instance:
|
|
11
11
|
${error}
|
|
12
12
|
`;
|
|
13
13
|
let nextSteps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spin.js","sourceRoot":"","sources":["../../../../src/public/node/environment/spin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,UAAU,CAAA;AACjD,OAAO,EAAC,QAAQ,EAAC,MAAM,gDAAgD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AC,IAAI,CAAC,CAAC,CAAA;AACjD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG;IACxC,OAAO,GAAG,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAA;AAC/C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG;IACjD,OAAO,kBAAkB,CAAC,GAAG,CAAC,KAAK,WAAW,CAAC,IAAI,CAAA;AACrD,CAAC","sourcesContent":["import {fileExists, readFileSync} from '../fs.js'\nimport {isTruthy} from '../../../private/node/environment/utilities.js'\nimport {environmentVariables} from '../../../private/node/constants.js'\nimport {captureOutput} from '../system.js'\nimport {outputContent, outputToken} from '../../../public/node/output.js'\nimport {getCachedSpinFqdn, setCachedSpinFqdn} from '../../../private/node/environment/spin-cache.js'\nimport {AbortError} from '../error.js'\nimport {Environment, serviceEnvironment} from '../../../private/node/environment/service.js'\n\nconst SpinInstanceNotFoundMessages = (spinInstance: string | undefined, error: string) => {\n const errorMessage = outputContent`${outputToken.genericShellCommand(\n `spin`,\n )} yielded the following error trying to obtain the fully qualified domain name of the Spin instance:\n${error}\n `\n let nextSteps: string | undefined\n if (spinInstance) {\n nextSteps = `Make sure ${spinInstance} is the instance name and not a fully qualified domain name`\n }\n return {errorMessage, nextSteps}\n}\n\nconst spinFqdnFilePath = '/etc/spin/machine/fqdn'\n\n/**\n * When ran in a Spin environment, it returns the fqdn of the instance.\n *\n * Will cache the value of the Spin FQDN during the execution of the CLI.\n * To avoid multiple calls to `readSync` or `show`.\n *\n * @param env - Environment variables.\n * @returns Fqdn of the Spin environment.\n */\nexport async function spinFqdn(env = process.env): Promise<string> {\n let spinFqdn = getCachedSpinFqdn()\n if (spinFqdn) return spinFqdn\n\n if (await fileExists(spinFqdnFilePath)) {\n spinFqdn = await readFileSync(spinFqdnFilePath).toString()\n } else {\n const spinInstance = await instance(env)\n const showResponse = await show(spinInstance, env)\n\n spinFqdn = showResponse.fqdn\n }\n setCachedSpinFqdn(spinFqdn)\n return spinFqdn\n}\n\n/**\n * Runs \"spin show\" and returns the JSON-parsed output.\n *\n * @param spinInstance - When it's undefined, we'll fetch the latest one.\n * @param env - Environment variables.\n * @returns The JSON-parsed output of the Spin CLI.\n * @throws Any error raised from the underlying Spin CLI.\n */\nexport async function show(spinInstance: string | undefined, env = process.env): Promise<{fqdn: string}> {\n const latest = spinInstance === undefined\n const args = latest ? ['show', '--latest', '--json'] : ['show', '--json']\n const output = await captureOutput('spin', args, {env})\n const json = JSON.parse(output)\n if (json.error) {\n const {errorMessage, nextSteps} = SpinInstanceNotFoundMessages(spinInstance, json.error)\n throw new AbortError(errorMessage, nextSteps)\n } else {\n return json\n }\n}\n\n/**\n * Returns true if the CLI is running in a Spin environment.\n *\n * @param env - Environment variables.\n * @returns True if the CLI is running in a Spin environment.\n */\nexport function isSpin(env = process.env): boolean {\n return isTruthy(env[environmentVariables.spin])\n}\n\n/**\n * Returns the value of the SPIN_INSTANCE environment variable.\n *\n * @param env - Environment variables.\n * @returns The value of the SPIN_INSTANCE environment variable.\n */\nexport function instance(env = process.env): string | undefined {\n return env[environmentVariables.spinInstance]\n}\n\n/**\n * Returns true if the CLI is running in a Spin environment.\n *\n * @param env - Environment variables.\n * @returns True if the CLI is running in a Spin environment.\n */\nexport function isSpinEnvironment(env = process.env): boolean {\n return serviceEnvironment(env) === Environment.Spin\n}\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AbortSilentError, CancelExecution } from './error.js';
|
|
2
2
|
import { Interfaces } from '@oclif/core';
|
|
3
|
-
import { Event } from '@bugsnag/js';
|
|
4
3
|
export declare function errorHandler(error: (CancelExecution | AbortSilentError) & {
|
|
5
4
|
exitCode?: number | undefined;
|
|
6
5
|
}, config?: Interfaces.Config): void;
|
|
@@ -38,4 +37,4 @@ export declare function cleanStackFrameFilePath({ currentFilePath, projectRoot,
|
|
|
38
37
|
*
|
|
39
38
|
*/
|
|
40
39
|
export declare function registerCleanBugsnagErrorsFromWithinPlugins(config: Interfaces.Config): Promise<void>;
|
|
41
|
-
export declare function addBugsnagMetadata(event:
|
|
40
|
+
export declare function addBugsnagMetadata(event: any, config: Interfaces.Config): Promise<void>;
|