@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":"ui.js","sourceRoot":"","sources":["../../../src/public/node/ui.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,wBAAwB,CAAA;AAEjD,OAAO,gBAAgB,MAAM,sDAAsD,CAAA;AACnF,OAAO,EAAC,YAAY,EAAgB,MAAM,iBAAiB,CAAA;AAC3D,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAC,KAAK,EAAC,MAAM,gCAAgC,CAAA;AAEpD,OAAO,EAAC,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EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAA;QAC/G,CAAC;QACD,GAAG,KAAK;KACT,CAAA;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,CAAC,oBAAC,kBAAkB,OAAK,QAAQ,EAAE,QAAQ,EAAE,CAAC,KAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAI,EAAE;YACnF,WAAW,EAAE,KAAK;SACnB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW,CAAuB,KAAoB;IACpE,OAAO,UAAU,CAAC,oBAAC,KAAK,OAAK,KAAK,GAAI,CAAC,CAAA;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAW,KAAuB;IACjE,OAAO,MAAM,CAAC,oBAAC,KAAK,IAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,GAAI,CAAC,CAAA;AAC9D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAwC;IACvE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,CAAC,oBAAC,UAAU,OAAK,KAAK,EAAE,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAI,EAAE;YAC7E,WAAW,EAAE,KAAK;SACnB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {isUnitTest} from './environment/local.js'\nimport {FatalError as Fatal} from './error.js'\nimport ConcurrentOutput from '../../private/node/ui/components/ConcurrentOutput.js'\nimport {consoleError, OutputProcess} from '../../output.js'\nimport {render, renderOnce} from '../../private/node/ui.js'\nimport {alert} from '../../private/node/ui/alert.js'\nimport {AlertProps} from '../../private/node/ui/components/Alert.js'\nimport {FatalError} from '../../private/node/ui/components/FatalError.js'\nimport ScalarDict from '../../private/node/ui/components/Table/ScalarDict.js'\nimport Table, {TableProps} from '../../private/node/ui/components/Table/Table.js'\nimport {SelectPrompt, Props as SelectPromptProps} from '../../private/node/ui/components/SelectPrompt.js'\nimport {Tasks, Task} from '../../private/node/ui/components/Tasks.js'\nimport {TextPrompt, Props as TextPromptProps} from '../../private/node/ui/components/TextPrompt.js'\nimport {Item as SelectItem, Props as SelectProps} from '../../private/node/ui/components/SelectInput.js'\nimport {Props as InfoTableProps} from '../../private/node/ui/components/Prompts/InfoTable.js'\nimport {AutocompletePrompt} from '../../private/node/ui/components/AutocompletePrompt.js'\nimport React from 'react'\nimport {RenderOptions} from 'ink'\nimport {AbortController} from '@shopify/cli-kit/node/abort'\n\ninterface RenderConcurrentOptions {\n processes: OutputProcess[]\n abortController?: AbortController\n showTimestamps?: boolean\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.\n */\nexport async function renderConcurrent({\n processes,\n abortController,\n showTimestamps = true,\n renderOptions = {},\n}: RenderConcurrentOptions) {\n return render(\n <ConcurrentOutput\n processes={processes}\n abortController={abortController ?? new AbortController()}\n showTimestamps={showTimestamps}\n />,\n renderOptions,\n )\n}\n\nexport type RenderAlertOptions = Omit<AlertProps, 'type'>\n\n/**\n * Renders an information banner to the console.\n *\n * Basic:\n *\n * ```\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ Body │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n *\n * Complete:\n * ```\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * │ Body │\n * │ │\n * │ Next steps │\n * │ • Run `cd santorini-goods` │\n * │ • To preview your project, run `npm app dev` │\n * │ • To add extensions, run `npm generate extension` │\n * │ │\n * │ Reference │\n * │ • Run `npm shopify help` │\n * │ • Press 'return' to open the dev docs: │\n * │ https://shopify.dev │\n * │ │\n * │ Link: https://shopify.com │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderInfo(options: RenderAlertOptions) {\n return alert({...options, type: 'info'})\n}\n\n/**\n * Renders a success banner to the console.\n *\n * Basic:\n *\n * ```\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n *\n * Complete:\n * ```\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * │ Body │\n * │ │\n * │ Next steps │\n * │ • Run `cd santorini-goods` │\n * │ • To preview your project, run `npm app dev` │\n * │ • To add extensions, run `npm generate extension` │\n * │ │\n * │ Reference │\n * │ • Run `npm shopify help` │\n * │ • Press 'return' to open the dev docs: │\n * │ https://shopify.dev │\n * │ │\n * │ Link: https://shopify.com │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderSuccess(options: RenderAlertOptions) {\n return alert({...options, type: 'success'})\n}\n\n/**\n * Renders a warning banner to the console.\n *\n * Basic:\n *\n * ```\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n *\n * Complete:\n * ```\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * │ Body │\n * │ │\n * │ Next steps │\n * │ • Run `cd santorini-goods` │\n * │ • To preview your project, run `npm app dev` │\n * │ • To add extensions, run `npm generate extension` │\n * │ │\n * │ Reference │\n * │ • Run `npm shopify help` │\n * │ • Press 'return' to open the dev docs: │\n * │ https://shopify.dev │\n * │ │\n * │ Link: https://shopify.com │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderWarning(options: RenderAlertOptions) {\n return alert({...options, type: 'warning'})\n}\n\n/**\n * Renders a Fatal error to the console inside a banner.\n *\n * ```\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Couldn't connect to the Shopify Partner Dashboard. │\n * │ │\n * │ Check your internet connection and try again. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderFatalError(error: Fatal) {\n return renderOnce(<FatalError error={error} />, 'error', consoleError)\n}\n\n/**\n * Renders a select prompt to the console.\n *\n * ```\n * ? Associate your project with the org Castile Ventures?\n *\n * Add: • new-ext\n *\n * Remove: • integrated-demand-ext\n * • order-discount\n *\n * \\> (f) first\n * (s) second\n * (3) third\n * (4) fourth\n * (5) seventh\n * (6) tenth\n *\n * Automations\n * (7) fifth\n * (8) sixth\n *\n * Merchant Admin\n * (9) eighth\n * (10) ninth\n *\n * Press ↑↓ arrows to select, enter to confirm\n * ```\n */\nexport function renderSelectPrompt<T>(props: Omit<SelectPromptProps<T>, 'onSubmit'>): Promise<T> {\n return new Promise((resolve, reject) => {\n render(<SelectPrompt {...props} onSubmit={(value: T) => resolve(value)} />, {\n exitOnCtrlC: false,\n }).catch(reject)\n })\n}\n\ninterface RenderConfirmationPromptOptions extends Pick<SelectPromptProps<boolean>, 'message' | 'infoTable'> {\n confirmationMessage?: string\n cancellationMessage?: string\n}\n\n/**\n * Renders a confirmation prompt to the console.\n *\n * ? Do you want to continue?\n *\n * \\> (y) Yes, confirm\n * (n) No, canccel\n *\n * Press ↑↓ arrows to select, enter to confirm\n */\nexport function renderConfirmationPrompt({\n message,\n infoTable,\n confirmationMessage = 'Yes, confirm',\n cancellationMessage = 'No, cancel',\n}: RenderConfirmationPromptOptions): Promise<boolean> {\n const choices = [\n {\n label: confirmationMessage,\n value: true,\n key: 'y',\n },\n {\n label: cancellationMessage,\n value: false,\n key: 'n',\n },\n ]\n\n return renderSelectPrompt({\n choices,\n message,\n infoTable,\n })\n}\n\ninterface RenderAutocompletePromptProps<T> {\n message: string\n choices: SelectProps<T>['items']\n infoTable?: InfoTableProps['table']\n search?: (term: string) => Promise<SelectItem<T>[]>\n}\n\n/**\n * Renders an autocomplete prompt to the console.\n * ```\n * ? Select a template Type to search...\n\n * \\> first\n * second\n * third\n\n * Press ↑↓ arrows to select, enter to confirm\n * ```\n */\nexport function renderAutocompletePrompt<T>(props: RenderAutocompletePromptProps<T>): Promise<T> {\n const newProps = {\n search(term: string) {\n return Promise.resolve(props.choices.filter((item) => item.label.toLowerCase().includes(term.toLowerCase())))\n },\n ...props,\n }\n\n return new Promise((resolve, reject) => {\n render(<AutocompletePrompt {...newProps} onSubmit={(value: T) => resolve(value)} />, {\n exitOnCtrlC: false,\n }).catch(reject)\n })\n}\n\n/**\n * Renders a table to the console.\n *\n * ```\n * name role Identifier\n * ──────────────────────── ───────────── ──────────\n * Dawn [live] #1361\n * Studio #1363\n * Debut [unpublished] #1374\n * Development (1a23b4-MBP) [development] #1368\n * ```\n */\nexport function renderTable<T extends ScalarDict>(props: TableProps<T>) {\n return renderOnce(<Table {...props} />)\n}\n\n/**\n * Runs async tasks and displays their progress to the console.\n */\nexport async function renderTasks<TContext>(tasks: Task<TContext>[]) {\n return render(<Tasks tasks={tasks} silent={isUnitTest()} />)\n}\n\n/**\n * Renders a text prompt to the console.\n * ```\n * ? What is your name?\n * \\> John\n * ```\n */\nexport function renderTextPrompt(props: Omit<TextPromptProps, 'onSubmit'>): Promise<string> {\n return new Promise((resolve, reject) => {\n render(<TextPrompt {...props} onSubmit={(value: string) => resolve(value)} />, {\n exitOnCtrlC: false,\n }).catch(reject)\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/public/node/ui.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAgB,MAAM,aAAa,CAAA;AACvD,OAAO,gBAAgB,MAAM,sDAAsD,CAAA;AACnF,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAC,KAAK,E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,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;aAC5F,CAAC,CAAA;QACJ,CAAC;QACD,GAAG,KAAK;KACT,CAAA;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,CAAC,oBAAC,kBAAkB,OAAK,QAAQ,EAAE,QAAQ,EAAE,CAAC,KAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAI,EAAE;YACnF,WAAW,EAAE,KAAK;SACnB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW,CAAuB,KAAoB;IACpE,OAAO,UAAU,CAAC,oBAAC,KAAK,OAAK,KAAK,GAAI,CAAC,CAAA;AACzC,CAAC;AAID;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAW,KAAuB;IACjE,OAAO,MAAM,CAAC,oBAAC,KAAK,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC,CAAA;AACxC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAwC;IACvE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,CAAC,oBAAC,UAAU,OAAK,KAAK,EAAE,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAI,EAAE;YAC7E,WAAW,EAAE,KAAK;SACnB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {FatalError as Fatal} from './error.js'\nimport {consoleError, OutputProcess} from './output.js'\nimport ConcurrentOutput from '../../private/node/ui/components/ConcurrentOutput.js'\nimport {render, renderOnce} from '../../private/node/ui.js'\nimport {alert} from '../../private/node/ui/alert.js'\nimport {AlertProps, CustomSection} from '../../private/node/ui/components/Alert.js'\nimport {FatalError} from '../../private/node/ui/components/FatalError.js'\nimport ScalarDict from '../../private/node/ui/components/Table/ScalarDict.js'\nimport Table, {TableProps} from '../../private/node/ui/components/Table/Table.js'\nimport {SelectPrompt, Props as SelectPromptProps} from '../../private/node/ui/components/SelectPrompt.js'\nimport {Tasks, Task} from '../../private/node/ui/components/Tasks.js'\nimport {TextPrompt, Props as TextPromptProps} from '../../private/node/ui/components/TextPrompt.js'\nimport {Props as SelectProps} from '../../private/node/ui/components/SelectInput.js'\nimport {Props as InfoTableProps} from '../../private/node/ui/components/Prompts/InfoTable.js'\nimport {AutocompletePrompt, SearchResults} from '../../private/node/ui/components/AutocompletePrompt.js'\nimport {TokenItem} from '../../private/node/ui/components/TokenizedText.js'\nimport React from 'react'\nimport {RenderOptions} from 'ink'\nimport {AbortController} from '@shopify/cli-kit/node/abort'\n\nexport {TokenItem}\n\ninterface RenderConcurrentOptions {\n processes: OutputProcess[]\n abortController?: AbortController\n showTimestamps?: boolean\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.\n */\nexport async function renderConcurrent({\n processes,\n abortController,\n showTimestamps = true,\n renderOptions = {},\n}: RenderConcurrentOptions) {\n return render(\n <ConcurrentOutput\n processes={processes}\n abortController={abortController ?? new AbortController()}\n showTimestamps={showTimestamps}\n />,\n renderOptions,\n )\n}\n\nexport type AlertCustomSection = CustomSection\nexport type RenderAlertOptions = Omit<AlertProps, 'type'>\n\n/**\n * Renders an information banner to the console.\n *\n * Basic:\n *\n * ```\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ Body │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n *\n * Complete:\n * ```\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * │ Body │\n * │ │\n * │ Next steps │\n * │ • Run `cd santorini-goods` │\n * │ • To preview your project, run `npm app dev` │\n * │ • To add extensions, run `npm generate extension` │\n * │ │\n * │ Reference │\n * │ • Run `npm shopify help` │\n * │ • Press 'return' to open the dev docs: │\n * │ https://shopify.dev │\n * │ │\n * │ Link: https://shopify.com │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderInfo(options: RenderAlertOptions) {\n return alert({...options, type: 'info'})\n}\n\n/**\n * Renders a success banner to the console.\n *\n * Basic:\n *\n * ```\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n *\n * Complete:\n * ```\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * │ Body │\n * │ │\n * │ Next steps │\n * │ • Run `cd santorini-goods` │\n * │ • To preview your project, run `npm app dev` │\n * │ • To add extensions, run `npm generate extension` │\n * │ │\n * │ Reference │\n * │ • Run `npm shopify help` │\n * │ • Press 'return' to open the dev docs: │\n * │ https://shopify.dev │\n * │ │\n * │ Link: https://shopify.com │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderSuccess(options: RenderAlertOptions) {\n return alert({...options, type: 'success'})\n}\n\n/**\n * Renders a warning banner to the console.\n *\n * Basic:\n *\n * ```\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n *\n * Complete:\n * ```\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * │ Body │\n * │ │\n * │ Next steps │\n * │ • Run `cd santorini-goods` │\n * │ • To preview your project, run `npm app dev` │\n * │ • To add extensions, run `npm generate extension` │\n * │ │\n * │ Reference │\n * │ • Run `npm shopify help` │\n * │ • Press 'return' to open the dev docs: │\n * │ https://shopify.dev │\n * │ │\n * │ Link: https://shopify.com │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderWarning(options: RenderAlertOptions) {\n return alert({...options, type: 'warning'})\n}\n\n/**\n * Renders a Fatal error to the console inside a banner.\n *\n * ```\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Couldn't connect to the Shopify Partner Dashboard. │\n * │ │\n * │ Check your internet connection and try again. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderFatalError(error: Fatal) {\n return renderOnce(<FatalError error={error} />, 'error', consoleError)\n}\n\n/**\n * Renders a select prompt to the console.\n *\n * ```\n * ? Associate your project with the org Castile Ventures?\n *\n * Add: • new-ext\n *\n * Remove: • integrated-demand-ext\n * • order-discount\n *\n * \\> (f) first\n * (s) second\n * (3) third\n * (4) fourth\n * (5) seventh\n * (6) tenth\n *\n * Automations\n * (7) fifth\n * (8) sixth\n *\n * Merchant Admin\n * (9) eighth\n * (10) ninth\n *\n * Press ↑↓ arrows to select, enter to confirm\n * ```\n */\nexport function renderSelectPrompt<T>(props: Omit<SelectPromptProps<T>, 'onSubmit'>): Promise<T> {\n return new Promise((resolve, reject) => {\n render(<SelectPrompt {...props} onSubmit={(value: T) => resolve(value)} />, {\n exitOnCtrlC: false,\n }).catch(reject)\n })\n}\n\ninterface RenderConfirmationPromptOptions extends Pick<SelectPromptProps<boolean>, 'message' | 'infoTable'> {\n confirmationMessage?: string\n cancellationMessage?: string\n}\n\n/**\n * Renders a confirmation prompt to the console.\n *\n * ? Do you want to continue?\n *\n * \\> (y) Yes, confirm\n * (n) No, canccel\n *\n * Press ↑↓ arrows to select, enter to confirm\n */\nexport function renderConfirmationPrompt({\n message,\n infoTable,\n confirmationMessage = 'Yes, confirm',\n cancellationMessage = 'No, cancel',\n}: RenderConfirmationPromptOptions): Promise<boolean> {\n const choices = [\n {\n label: confirmationMessage,\n value: true,\n key: 'y',\n },\n {\n label: cancellationMessage,\n value: false,\n key: 'n',\n },\n ]\n\n return renderSelectPrompt({\n choices,\n message,\n infoTable,\n })\n}\n\ninterface RenderAutocompletePromptProps<T> {\n message: string\n choices: SelectProps<T>['items']\n infoTable?: InfoTableProps['table']\n search?: (term: string) => Promise<SearchResults<T>>\n hasMorePages?: boolean\n}\n\n/**\n * Renders an autocomplete prompt to the console.\n * ```\n * ? Select a template Type to search...\n\n * \\> first\n * second\n * third\n\n * Press ↑↓ arrows to select, enter to confirm\n * ```\n */\nexport function renderAutocompletePrompt<T>(props: RenderAutocompletePromptProps<T>): Promise<T> {\n const newProps = {\n search(term: string) {\n return Promise.resolve({\n data: props.choices.filter((item) => item.label.toLowerCase().includes(term.toLowerCase())),\n })\n },\n ...props,\n }\n\n return new Promise((resolve, reject) => {\n render(<AutocompletePrompt {...newProps} onSubmit={(value: T) => resolve(value)} />, {\n exitOnCtrlC: false,\n }).catch(reject)\n })\n}\n\n/**\n * Renders a table to the console.\n *\n * ```\n * name role Identifier\n * ──────────────────────── ───────────── ──────────\n * Dawn [live] #1361\n * Studio #1363\n * Debut [unpublished] #1374\n * Development (1a23b4-MBP) [development] #1368\n * ```\n */\nexport function renderTable<T extends ScalarDict>(props: TableProps<T>) {\n return renderOnce(<Table {...props} />)\n}\n\nexport {Task}\n\n/**\n * Runs async tasks and displays their progress to the console.\n */\nexport async function renderTasks<TContext>(tasks: Task<TContext>[]) {\n return render(<Tasks tasks={tasks} />)\n}\n\n/**\n * Renders a text prompt to the console.\n * ```\n * ? What is your name?\n * \\> John\n * ```\n */\nexport function renderTextPrompt(props: Omit<TextPromptProps, 'onSubmit'>): Promise<string> {\n return new Promise((resolve, reject) => {\n render(<TextPrompt {...props} onSubmit={(value: string) => resolve(value)} />, {\n exitOnCtrlC: false,\n }).catch(reject)\n })\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fileExists, writeFile, readFile, findPathUp } from './fs.js';
|
|
2
2
|
import { joinPath, cwd } from './path.js';
|
|
3
|
-
import {
|
|
3
|
+
import { outputContent, outputToken, outputDebug } from '../../public/node/output.js';
|
|
4
4
|
/**
|
|
5
5
|
* Check if user editor is VS Code.
|
|
6
6
|
*
|
|
@@ -8,7 +8,7 @@ import { content, token, debug } from '../../output.js';
|
|
|
8
8
|
* @returns True if user editor is VS Code.
|
|
9
9
|
*/
|
|
10
10
|
export async function isVSCode(root = cwd()) {
|
|
11
|
-
|
|
11
|
+
outputDebug(outputContent `Checking if the directory ${outputToken.path(root)} or any of its parents has a .vscode directory... `);
|
|
12
12
|
const config = await findPathUp(joinPath(root, '.vscode'), { type: 'directory' });
|
|
13
13
|
if (!config) {
|
|
14
14
|
return false;
|
|
@@ -22,8 +22,8 @@ export async function isVSCode(root = cwd()) {
|
|
|
22
22
|
* @param recommendations - List of VSCode extensions to recommend.
|
|
23
23
|
*/
|
|
24
24
|
export async function addRecommendedExtensions(directory, recommendations) {
|
|
25
|
-
|
|
26
|
-
${
|
|
25
|
+
outputDebug(outputContent `Adding VSCode recommended extensions at ${outputToken.path(directory)}:
|
|
26
|
+
${outputToken.json(recommendations)}
|
|
27
27
|
`);
|
|
28
28
|
const extensionsPath = joinPath(directory, '.vscode/extensions.json');
|
|
29
29
|
if (await isVSCode(directory)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vscode.js","sourceRoot":"","sources":["../../../src/public/node/vscode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,SAAS,CAAA;AACnE,OAAO,EAAC,QAAQ,EAAE,GAAG,EAAC,MAAM,WAAW,CAAA;AACvC,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"vscode.js","sourceRoot":"","sources":["../../../src/public/node/vscode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,SAAS,CAAA;AACnE,OAAO,EAAC,QAAQ,EAAE,GAAG,EAAC,MAAM,WA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CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;KAC5E;AACH,CAAC","sourcesContent":["import {fileExists, writeFile, readFile, findPathUp} from './fs.js'\nimport {joinPath, cwd} from './path.js'\nimport {outputContent, outputToken, outputDebug} from '../../public/node/output.js'\n\n/**\n * Check if user editor is VS Code.\n *\n * @param root - Root directory to start searching for .vscode directory.\n * @returns True if user editor is VS Code.\n */\nexport async function isVSCode(root = cwd()): Promise<boolean> {\n outputDebug(\n outputContent`Checking if the directory ${outputToken.path(\n root,\n )} or any of its parents has a .vscode directory... `,\n )\n const config = await findPathUp(joinPath(root, '.vscode'), {type: 'directory'})\n\n if (!config) {\n return false\n }\n\n return fileExists(config)\n}\n\n/**\n * Add VSCode extension recommendations.\n *\n * @param directory - Directory that contains the .vscode folder.\n * @param recommendations - List of VSCode extensions to recommend.\n */\nexport async function addRecommendedExtensions(directory: string, recommendations: string[]): Promise<void> {\n outputDebug(outputContent`Adding VSCode recommended extensions at ${outputToken.path(directory)}:\n${outputToken.json(recommendations)}\n `)\n const extensionsPath = joinPath(directory, '.vscode/extensions.json')\n\n if (await isVSCode(directory)) {\n let originalExtensionsJson = {recommendations: []}\n if (await fileExists(extensionsPath)) {\n const originalExtensionsFile = await readFile(extensionsPath)\n originalExtensionsJson = JSON.parse(originalExtensionsFile)\n }\n const newExtensionsJson = {\n ...originalExtensionsJson,\n recommendations: [...originalExtensionsJson.recommendations, ...recommendations],\n }\n await writeFile(extensionsPath, JSON.stringify(newExtensionsJson, null, 2))\n }\n}\n"]}
|