@shopify/cli-kit 4.9.5 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/cli/api/graphql/admin/generated/metafield_definitions_by_owner_type.d.ts +5 -0
  2. package/dist/cli/api/graphql/admin/generated/metafield_definitions_by_owner_type.js +22 -0
  3. package/dist/cli/api/graphql/admin/generated/metafield_definitions_by_owner_type.js.map +1 -1
  4. package/dist/private/node/api/graphql.d.ts +2 -1
  5. package/dist/private/node/api/graphql.js +12 -1
  6. package/dist/private/node/api/graphql.js.map +1 -1
  7. package/dist/private/node/api.d.ts +2 -0
  8. package/dist/private/node/api.js +49 -22
  9. package/dist/private/node/api.js.map +1 -1
  10. package/dist/private/node/command-json-schema.js +1 -0
  11. package/dist/private/node/command-json-schema.js.map +1 -1
  12. package/dist/private/node/constants.d.ts +1 -0
  13. package/dist/private/node/constants.js +1 -0
  14. package/dist/private/node/constants.js.map +1 -1
  15. package/dist/private/node/dev-instance-output.d.ts +47 -0
  16. package/dist/private/node/dev-instance-output.js +143 -0
  17. package/dist/private/node/dev-instance-output.js.map +1 -0
  18. package/dist/private/node/json-error.d.ts +1 -15
  19. package/dist/private/node/json-error.js +4 -98
  20. package/dist/private/node/json-error.js.map +1 -1
  21. package/dist/private/node/output-context.d.ts +8 -0
  22. package/dist/private/node/output-context.js +10 -0
  23. package/dist/private/node/output-context.js.map +1 -0
  24. package/dist/private/node/output.test.js +4 -4
  25. package/dist/private/node/output.test.js.map +1 -1
  26. package/dist/private/node/session/automation-token.d.ts +50 -0
  27. package/dist/private/node/session/automation-token.js +77 -0
  28. package/dist/private/node/session/automation-token.js.map +1 -0
  29. package/dist/private/node/session/exchange.d.ts +2 -1
  30. package/dist/private/node/session/exchange.js +5 -3
  31. package/dist/private/node/session/exchange.js.map +1 -1
  32. package/dist/private/node/session/permanent-store-domain.d.ts +21 -0
  33. package/dist/private/node/session/permanent-store-domain.js +72 -0
  34. package/dist/private/node/session/permanent-store-domain.js.map +1 -0
  35. package/dist/private/node/session.d.ts +3 -2
  36. package/dist/private/node/session.js +12 -3
  37. package/dist/private/node/session.js.map +1 -1
  38. package/dist/private/node/themes/trust-challenge.d.ts +31 -0
  39. package/dist/private/node/themes/trust-challenge.js +143 -0
  40. package/dist/private/node/themes/trust-challenge.js.map +1 -0
  41. package/dist/private/node/ui/alert.js +1 -1
  42. package/dist/private/node/ui/alert.js.map +1 -1
  43. package/dist/private/node/ui/components/ConcurrentOutput.d.ts +2 -7
  44. package/dist/private/node/ui/components/ConcurrentOutput.js +4 -8
  45. package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
  46. package/dist/private/node/ui/components/LoadingBar.js +9 -15
  47. package/dist/private/node/ui/components/LoadingBar.js.map +1 -1
  48. package/dist/private/node/ui/components/LoadingBar.test.js +45 -107
  49. package/dist/private/node/ui/components/LoadingBar.test.js.map +1 -1
  50. package/dist/private/node/ui/components/LoadingIndicator.d.ts +7 -0
  51. package/dist/private/node/ui/components/LoadingIndicator.js +22 -0
  52. package/dist/private/node/ui/components/LoadingIndicator.js.map +1 -0
  53. package/dist/public/common/version.d.ts +1 -1
  54. package/dist/public/common/version.js +1 -1
  55. package/dist/public/common/version.js.map +1 -1
  56. package/dist/public/node/api/admin.js +13 -0
  57. package/dist/public/node/api/admin.js.map +1 -1
  58. package/dist/public/node/api/graphql.js +38 -7
  59. package/dist/public/node/api/graphql.js.map +1 -1
  60. package/dist/public/node/archiver.js +13 -6
  61. package/dist/public/node/archiver.js.map +1 -1
  62. package/dist/public/node/base-command.d.ts +6 -0
  63. package/dist/public/node/base-command.js +97 -16
  64. package/dist/public/node/base-command.js.map +1 -1
  65. package/dist/public/node/dev-instance.d.ts +138 -0
  66. package/dist/public/node/dev-instance.js +365 -0
  67. package/dist/public/node/dev-instance.js.map +1 -0
  68. package/dist/public/node/environment.d.ts +6 -3
  69. package/dist/public/node/environment.js +11 -4
  70. package/dist/public/node/environment.js.map +1 -1
  71. package/dist/public/node/error/index.js +2 -1
  72. package/dist/public/node/error/index.js.map +1 -1
  73. package/dist/public/node/error/schema.d.ts +24 -24
  74. package/dist/public/node/error/serialization.d.ts +8 -0
  75. package/dist/public/node/error/serialization.js +103 -0
  76. package/dist/public/node/error/serialization.js.map +1 -0
  77. package/dist/public/node/graphiql/server.js +18 -2
  78. package/dist/public/node/graphiql/server.js.map +1 -1
  79. package/dist/public/node/is-global.js +2 -1
  80. package/dist/public/node/is-global.js.map +1 -1
  81. package/dist/public/node/notifications-system.d.ts +6 -6
  82. package/dist/public/node/path.d.ts +19 -3
  83. package/dist/public/node/path.js +21 -3
  84. package/dist/public/node/path.js.map +1 -1
  85. package/dist/public/node/session.d.ts +36 -2
  86. package/dist/public/node/session.js +48 -4
  87. package/dist/public/node/session.js.map +1 -1
  88. package/dist/public/node/system.d.ts +4 -0
  89. package/dist/public/node/system.js +39 -9
  90. package/dist/public/node/system.js.map +1 -1
  91. package/dist/public/node/themes/api.d.ts +9 -0
  92. package/dist/public/node/themes/api.js +50 -22
  93. package/dist/public/node/themes/api.js.map +1 -1
  94. package/dist/public/node/themes/theme-manager.d.ts +8 -1
  95. package/dist/public/node/themes/theme-manager.js +1 -1
  96. package/dist/public/node/themes/theme-manager.js.map +1 -1
  97. package/dist/public/node/tree-kill.js +12 -2
  98. package/dist/public/node/tree-kill.js.map +1 -1
  99. package/dist/public/node/ui/components.d.ts +1 -0
  100. package/dist/public/node/ui/components.js +1 -0
  101. package/dist/public/node/ui/components.js.map +1 -1
  102. package/dist/public/node/ui.d.ts +24 -4
  103. package/dist/public/node/ui.js +41 -18
  104. package/dist/public/node/ui.js.map +1 -1
  105. package/dist/public/node/upgrade/output.d.ts +17 -0
  106. package/dist/public/node/upgrade/output.js +51 -0
  107. package/dist/public/node/upgrade/output.js.map +1 -0
  108. package/dist/public/node/upgrade/result.d.ts +8 -0
  109. package/dist/public/node/upgrade/result.js +21 -0
  110. package/dist/public/node/upgrade/result.js.map +1 -0
  111. package/dist/public/node/upgrade/types.d.ts +61 -0
  112. package/dist/public/node/upgrade/types.js +46 -0
  113. package/dist/public/node/upgrade/types.js.map +1 -0
  114. package/dist/public/node/upgrade.d.ts +8 -0
  115. package/dist/public/node/upgrade.js +57 -22
  116. package/dist/public/node/upgrade.js.map +1 -1
  117. package/dist/tsconfig.tsbuildinfo +1 -1
  118. package/package.json +3 -3
  119. package/dist/private/node/ui/components/TextAnimation.d.ts +0 -10
  120. package/dist/private/node/ui/components/TextAnimation.js +0 -56
  121. package/dist/private/node/ui/components/TextAnimation.js.map +0 -1
  122. package/dist/private/node/ui/components/TextAnimation.test.d.ts +0 -1
  123. package/dist/private/node/ui/components/TextAnimation.test.js +0 -73
  124. package/dist/private/node/ui/components/TextAnimation.test.js.map +0 -1
@@ -396,9 +396,9 @@ export async function renderTasks(tasks, { renderOptions, noProgressBar } = {})
396
396
  return taskResult;
397
397
  }
398
398
  /**
399
- * Awaits a single task and displays a loading bar while it's in progress. The task's result is returned.
399
+ * Awaits a single task and displays a loading indicator while it's in progress. The task's result is returned.
400
400
  * @param options - Configuration object
401
- * @param options.title - The initial title to display with the loading bar
401
+ * @param options.title - The initial title to display with the loading indicator
402
402
  * @param options.task - The async task to execute. Receives an updateStatus callback to change the displayed title.
403
403
  * @param options.retry - The number of additional attempts after a failure. Defaults to zero.
404
404
  * @param options.renderOptions - Optional render configuration
@@ -541,27 +541,50 @@ export async function renderDangerousConfirmationPrompt({ renderOptions, ...prop
541
541
  return confirmed;
542
542
  });
543
543
  }
544
- /** Waits for any key to be pressed except Ctrl+C which will terminate the process. */
545
- export const keypress = async (stdin = process.stdin, uiDebugOptions = defaultUIDebugOptions) => {
544
+ /**
545
+ * Waits for a key to be pressed. Ctrl+C rejects with AbortSilentError, which terminates the process.
546
+ *
547
+ * Raw mode is set back to the state it had before the call. A command that keeps stdin raw for
548
+ * its own single-key shortcuts (for example `theme dev`) keeps them.
549
+ *
550
+ * Chunks are read as text: an active Ink renderer calls `stdin.setEncoding('utf8')`, and then
551
+ * stdin emits strings instead of Buffers.
552
+ *
553
+ * @param stdin - The stream to read from.
554
+ * @param uiDebugOptions - Debug options; `skipTTYCheck` allows a non-TTY stdin.
555
+ * @param options - The keys that end the wait.
556
+ * @returns A promise that resolves when an accepted key is pressed.
557
+ */
558
+ export const keypress = async (stdin = process.stdin, uiDebugOptions = defaultUIDebugOptions, { keys } = {}) => {
546
559
  throwInNonTTY({ message: 'Press any key' }, uiDebugOptions);
547
560
  return runWithTimer('cmd_all_timing_prompts_ms')(() => {
548
- return new Promise((resolve, reject) => {
549
- const handler = (buffer) => {
561
+ const { promise, resolve, reject } = Promise.withResolvers();
562
+ const stdinWasRaw = stdin.isRaw === true;
563
+ const stopListening = () => {
564
+ stdin.off('data', handler);
565
+ if (!stdinWasRaw)
550
566
  stdin.setRawMode(false);
551
- const bytes = Array.from(buffer);
552
- if (bytes.length && bytes[0] === 3) {
553
- outputDebug('Canceled keypress, User pressed CTRL+C');
554
- reject(new AbortSilentError());
555
- }
556
- stdin.unref();
567
+ stdin.unref();
568
+ };
569
+ const handler = (chunk) => {
570
+ const text = chunk.toString();
571
+ if (text.includes('\u0003')) {
572
+ stopListening();
573
+ outputDebug('Canceled keypress, User pressed CTRL+C');
574
+ reject(new AbortSilentError());
575
+ }
576
+ else if (!keys || [...text].some((character) => keys.includes(character))) {
577
+ stopListening();
557
578
  process.nextTick(resolve);
558
- };
579
+ }
580
+ };
581
+ if (!stdinWasRaw)
559
582
  stdin.setRawMode(true);
560
- stdin.once('data', handler);
561
- // We want to indicate that we're still using stdin, so that the process
562
- // doesn't exit early.
563
- stdin.ref();
564
- });
583
+ stdin.on('data', handler);
584
+ // We want to indicate that we're still using stdin, so that the process
585
+ // doesn't exit early.
586
+ stdin.ref();
587
+ return promise;
565
588
  });
566
589
  };
567
590
  export function isTTY({ stdin = undefined, uiDebugOptions = defaultUIDebugOptions } = {}) {
@@ -1 +1 @@
1
- {"version":3,"file":"ui.js","sourceRoot":"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EAAE,CAAC,CAAA;gBAChC,CAAC;gBACD,KAAK,CAAC,KAAK,EAAE,CAAA;gBACb,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;YAC3B,CAAC,CAAA;YAED,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;YACtB,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;YAE3B,wEAAwE;YACxE,sBAAsB;YACtB,KAAK,CAAC,GAAG,EAAE,CAAA;QACb,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAOD,MAAM,UAAU,KAAK,CAAC,EAAC,KAAK,GAAG,SAAS,EAAE,cAAc,GAAG,qBAAqB,KAAkB,EAAE;IAClG,wIAAwI;IACxI,OAAO,OAAO,CAAC,cAAc,CAAC,YAAY,IAAI,KAAK,IAAI,yBAAyB,EAAE,CAAC,CAAA;AACrF,CAAC;AAOD,SAAS,aAAa,CAAC,EAAC,OAAO,EAAE,KAAK,GAAG,SAAS,EAAuB,EAAE,cAA8B;IACvG,IAAI,KAAK,CAAC,EAAC,KAAK,EAAE,cAAc,EAAC,CAAC;QAAE,OAAM;IAE1C,MAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAA;IAC7C,MAAM,YAAY,GAAG;;EAErB,aAAa,CAAA,GAAG,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK;;2IAEqF,CAAA;IACzI,MAAM,IAAI,UAAU,CAClB,YAAY,EACZ,mIAAmI,CACpI,CAAA;AACH,CAAC;AAID,OAAO,EAA2F,MAAM,EAAE,WAAW,EAAC,CAAA","sourcesContent":["/* eslint-disable tsdoc/syntax */\nimport {AbortError, AbortSilentError, FatalError as Fatal} from './error.js'\nimport {commandEventOutputMode, emitCommandEvent} from './command-events.js'\nimport {randomUUID} from './crypto.js'\nimport {outputContent, outputDebug, outputToken, TokenizedString, unstyled} from './output.js'\nimport {terminalSupportsPrompting} from './system.js'\nimport {AbortController} from './abort.js'\nimport {runWithTimer} from './metadata.js'\nimport {\n ConcurrentOutput,\n ConcurrentOutputProps,\n runConcurrentProcessesForJson,\n} from '../../private/node/ui/components/ConcurrentOutput.js'\nimport {handleCtrlC, render, renderOnce} from '../../private/node/ui.js'\nimport {alert, AlertOptions} from '../../private/node/ui/alert.js'\nimport {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, TableColumn, TableProps} from '../../private/node/ui/components/Table/Table.js'\nimport {\n tokenItemToString,\n type InlineToken,\n type LinkToken,\n type ListToken,\n type Token,\n type TokenItem,\n} from '../../private/node/ui/components/token-item.js'\nimport {\n DangerousConfirmationPrompt,\n DangerousConfirmationPromptProps,\n} from '../../private/node/ui/components/DangerousConfirmationPrompt.js'\nimport {SelectPrompt, SelectPromptProps} from '../../private/node/ui/components/SelectPrompt.js'\nimport {Tasks, Task} from '../../private/node/ui/components/Tasks.js'\nimport {runTasks} from '../../private/node/ui/tasks.js'\nimport {TextPrompt, TextPromptProps} from '../../private/node/ui/components/TextPrompt.js'\nimport {AutocompletePromptProps, AutocompletePrompt} from '../../private/node/ui/components/AutocompletePrompt.js'\nimport {InfoTableSection} from '../../private/node/ui/components/Prompts/InfoTable.js'\nimport {InfoMessageProps} from '../../private/node/ui/components/Prompts/InfoMessage.js'\nimport {SingleTask} from '../../private/node/ui/components/SingleTask.js'\n\nimport React from 'react'\nimport {Key as InkKey, RenderOptions} from 'ink'\n\ntype PartialBy<T, TKey extends keyof T> = Omit<T, TKey> & Partial<Pick<T, TKey>>\n\ninterface UIDebugOptions {\n /** If true, don't check if the current terminal is interactive or not */\n skipTTYCheck?: boolean\n}\nconst defaultUIDebugOptions: UIDebugOptions = {\n skipTTYCheck: false,\n}\n\nexport interface RenderConcurrentOptions extends PartialBy<ConcurrentOutputProps, 'abortSignal'> {\n /** Ink options for terminal UI. Finite JSON output uses the command event channel on stderr instead. */\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.\n * @example\n * 00:00:00 │ backend │ first backend message\n * 00:00:00 │ backend │ second backend message\n * 00:00:00 │ backend │ third backend message\n * 00:00:00 │ frontend │ first frontend message\n * 00:00:00 │ frontend │ second frontend message\n * 00:00:00 │ frontend │ third frontend message\n *\n */\nexport async function renderConcurrent({renderOptions, ...props}: RenderConcurrentOptions) {\n const abortSignal = props.abortSignal ?? new AbortController().signal\n\n // Streaming callers retain their existing Ink lifecycle; finite JSON results must keep stdout clear.\n if (commandEventOutputMode() === 'json' && !props.keepRunningAfterProcessesResolve) {\n if (props.processes.length === 0) return\n return renderSingleTask({\n title: outputContent`Running concurrent processes`,\n task: async () => runConcurrentProcessesForJson({...props, abortSignal}),\n })\n }\n\n return render(<ConcurrentOutput {...props} abortSignal={abortSignal} />, renderOptions)\n}\n\nexport type AlertCustomSection = CustomSection\nexport type RenderAlertOptions = Omit<AlertOptions, 'type'>\n\n/**\n * Renders an information banner to the console.\n * @example Basic\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ CLI update available. │\n * │ │\n * │ Run `npm run shopify upgrade`. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ my-app initialized and ready to build. │\n * │ │\n * │ Next steps │\n * │ • Run `cd verification-app` │\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 * │ • Dev docs [1] │\n * │ │\n * │ Custom section │\n * │ • Item 1 [2] │\n * │ • Item 2 │\n * │ • Item 3 [3] │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://shopify.dev\n * [2] https://www.google.com/search?q=jh56t9l34kpo35tw8s28hn7s9s2xvzla01d8cn6j7yq&rlz=1C1GCEU_enUS832US832&oq=jh56t9l34kpo35tw8s28hn7s9s2xvzla01d8cn6j7yq&aqs=chrome.0.35i39l2j0l4j46j69i60.2711j0j7&sourceid=chrome&ie=UTF-8\n * [3] https://shopify.com\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 * @example Basic\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ CLI updated. │\n * │ │\n * │ You are now running version 3.47. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Deployment successful. │\n * │ │\n * │ Your extensions have been uploaded to your Shopify │\n * │ Partners Dashboard. │\n * │ │\n * │ Next steps │\n * │ • See your deployment and set it live [1] │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://partners.shopify.com/1797046/apps/4523695/deployments\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 * @example Basic\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ You have reached your limit of checkout extensions for │\n * │ this app. │\n * │ │\n * │ You can free up space for a new one by deleting an │\n * │ existing one. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Required access scope update. │\n * │ │\n * │ The deadline for re-selecting your app scopes is May │\n * │ 1, 2022. │\n * │ │\n * │ Reference │\n * │ • Dev docs [1] │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://shopify.dev/app/scopes\n *\n */\nexport function renderWarning(options: RenderAlertOptions) {\n return alert({...options, type: 'warning'})\n}\n\n/**\n * Renders an error banner to the console.\n * @example\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Version couldn't be released. │\n * │ │\n * │ This version needs to be submitted for review and │\n * │ approved by Shopify before it can be released. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n */\nexport function renderError(options: RenderAlertOptions) {\n return alert({...options, type: 'error'})\n}\n\ninterface RenderFatalErrorOptions {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a Fatal error to the console inside a banner.\n * @example Basic\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Something went wrong. │\n * │ │\n * │ To investigate the issue, examine this stack trace: │\n * │ at _compile (internal/modules/cjs/loader.js:1137) │\n * │ at js (internal/modules/cjs/loader.js:1157) │\n * │ at load (internal/modules/cjs/loader.js:985) │\n * │ at _load (internal/modules/cjs/loader.js:878) │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ No Organization found │\n * │ │\n * │ Next steps │\n * │ • Have you created a Shopify Partners organization │\n * │ [1]? │\n * │ • Have you confirmed your accounts from the emails │\n * │ you received? │\n * │ • Need to connect to a different App or │\n * │ organization? Run the command again with `--reset` │\n * │ │\n * │ amortizable-marketplace-ext │\n * │ • Some other error │\n * │ Validation errors │\n * │ • Missing expected key(s). │\n * │ │\n * │ amortizable-marketplace-ext-2 │\n * │ • Something was not found │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://partners.shopify.com/signup\n *\n */\n\nexport function renderFatalError(error: Fatal, {renderOptions}: RenderFatalErrorOptions = {}) {\n return renderOnce(<FatalError error={error} />, {logLevel: 'error', renderOptions})\n}\n\nexport interface RenderSelectPromptOptions<T> extends Omit<SelectPromptProps<T>, 'onSubmit'> {\n isConfirmationPrompt?: boolean\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a select prompt to the console.\n * @example\n * ? Associate your project with the org Castile Ventures?\n *\n * ┃ Add\n * ┃ • new-ext\n * ┃\n * ┃ Remove\n * ┃ • integrated-demand-ext\n * ┃ • order-discount\n *\n * Automations\n * > fifth\n * sixth\n *\n * Merchant Admin\n * eighth\n * ninth\n *\n * Other\n * first\n * second\n * third (limit reached)\n * fourth\n * seventh\n * tenth\n *\n * Press ↑↓ arrows to select, enter to confirm.\n *\n */\n\nexport async function renderSelectPrompt<T>(\n {renderOptions, isConfirmationPrompt, ...props}: RenderSelectPromptOptions<T>,\n uiDebugOptions: UIDebugOptions = defaultUIDebugOptions,\n): Promise<T> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin}, uiDebugOptions)\n\n return runWithTimer('cmd_all_timing_prompts_ms')(async () => {\n let selectedValue: T\n await render(\n <SelectPrompt\n {...props}\n onSubmit={(value: T) => {\n selectedValue = value\n }}\n />,\n {\n stdout: process.stderr as unknown as NodeJS.WriteStream,\n ...renderOptions,\n exitOnCtrlC: false,\n },\n )\n return selectedValue!\n })\n}\n\nexport interface RenderConfirmationPromptOptions extends Pick<\n SelectPromptProps<boolean>,\n 'message' | 'infoTable' | 'infoMessage' | 'abortSignal'\n> {\n confirmationMessage?: string\n cancellationMessage?: string\n renderOptions?: RenderOptions\n defaultValue?: boolean\n}\n\n/**\n * Renders a confirmation prompt to the console.\n * @example\n * ? Delete the following themes from the store?\n *\n * ┃ Info message title\n * ┃\n * ┃ Info message body\n * ┃\n * ┃ • first theme (#1)\n * ┃ • second theme (#2)\n *\n * > (y) Yes, confirm changes\n * (n) Cancel\n *\n * Press ↑↓ arrows to select, enter or a shortcut to\n * confirm.\n *\n */\nexport async function renderConfirmationPrompt({\n message,\n infoTable,\n confirmationMessage = 'Yes, confirm',\n cancellationMessage = 'No, cancel',\n renderOptions,\n defaultValue = true,\n abortSignal,\n infoMessage,\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 renderOptions,\n defaultValue,\n isConfirmationPrompt: true,\n abortSignal,\n infoMessage,\n })\n}\n\nexport interface RenderAutocompleteOptions<T> extends PartialBy<\n Omit<AutocompletePromptProps<T>, 'onSubmit'>,\n 'search'\n> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders an autocomplete prompt to the console.\n * @example\n * ? Select a template: Type to search...\n *\n * ┃ Info message title\n * ┃\n * ┃ Info message body\n *\n * > first\n * second\n * third\n * fourth\n * fifth\n * sixth\n * seventh\n * eighth\n * ninth\n * tenth\n * eleventh\n * twelfth\n * thirteenth\n * fourteenth\n * fifteenth\n * sixteenth\n * seventeenth\n * eighteenth\n * nineteenth (disabled)\n * twentieth\n * twenty-first\n * twenty-second\n * twenty-third\n * twenty-fourth\n * twenty-fifth\n *\n * Press ↑↓ arrows to select, enter to confirm.\n *\n */\n\nexport async function renderAutocompletePrompt<T>(\n {renderOptions, ...props}: RenderAutocompleteOptions<T>,\n uiDebugOptions: UIDebugOptions = defaultUIDebugOptions,\n): Promise<T> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin}, uiDebugOptions)\n\n // The default search filters in-memory choices synchronously, so it doesn't need\n // throttling. Skipping the throttle makes the keystroke-to-result latency feel\n // instant. Callers that supply their own (typically remote/paginated) search keep\n // the component's default throttle unless they opt out via `searchDebounceMs`.\n const usingDefaultSearch = props.search === undefined\n const newProps = {\n search(term: string) {\n const lowerTerm = term.toLowerCase()\n return Promise.resolve({\n data: props.choices.filter((item) => {\n return item.label.toLowerCase().includes(lowerTerm) || item.group?.toLowerCase().includes(lowerTerm)\n }),\n })\n },\n ...(usingDefaultSearch ? {searchDebounceMs: 0} : {}),\n ...props,\n }\n\n return runWithTimer('cmd_all_timing_prompts_ms')(async () => {\n let selectedValue: T | undefined\n await render(\n <AutocompletePrompt\n {...newProps}\n onSubmit={(value: T) => {\n selectedValue = value\n }}\n />,\n {\n stdout: process.stderr as unknown as NodeJS.WriteStream,\n ...renderOptions,\n exitOnCtrlC: false,\n },\n )\n\n if (selectedValue === undefined) {\n throw new Error(\n 'Prompt was interrupted before a selection was made. This can happen if the process received a signal, was terminated, or the prompt was aborted.',\n )\n }\n\n return selectedValue\n })\n}\n\ninterface RenderTableOptions<T extends ScalarDict> extends TableProps<T> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a table to the console.\n * @example\n * ID Name email\n * ── ────────── ─────────────\n * 1 John Doe jon@doe.com\n * 2 Jane Doe jane@doe.com\n * 3 John Smith jon@smith.com\n */\nexport function renderTable<T extends ScalarDict>({renderOptions, ...props}: RenderTableOptions<T>) {\n return renderOnce(<Table {...props} />, {renderOptions})\n}\n\ninterface RenderTasksOptions {\n renderOptions?: RenderOptions\n noProgressBar?: boolean\n}\n\n/**\n * Runs async tasks and displays their progress to the console.\n * @example\n * Installing dependencies ...\n */\n\nexport async function renderTasks<TContext>(\n tasks: Task<TContext>[],\n {renderOptions, noProgressBar}: RenderTasksOptions = {},\n): Promise<TContext> {\n if (commandEventOutputMode() === 'json') return runTasks(tasks)\n\n let taskResult: TContext\n await render(\n <Tasks\n tasks={tasks}\n onComplete={(ctx) => {\n taskResult = ctx\n }}\n noProgressBar={noProgressBar}\n />,\n {\n stdout: process.stderr as unknown as NodeJS.WriteStream,\n ...renderOptions,\n exitOnCtrlC: false,\n },\n )\n return taskResult!\n}\n\nexport interface RenderSingleTaskOptions<T> {\n title: TokenizedString\n task: (updateStatus: (status: TokenizedString) => void) => Promise<T>\n /** The number of additional attempts after a failure. Defaults to zero. */\n retry?: number\n onAbort?: () => void\n renderOptions?: RenderOptions\n}\n\n/**\n * Awaits a single task and displays a loading bar while it's in progress. The task's result is returned.\n * @param options - Configuration object\n * @param options.title - The initial title to display with the loading bar\n * @param options.task - The async task to execute. Receives an updateStatus callback to change the displayed title.\n * @param options.retry - The number of additional attempts after a failure. Defaults to zero.\n * @param options.renderOptions - Optional render configuration\n * @returns The result of the task\n * @example\n * Loading app ...\n */\nexport async function renderSingleTask<T>({\n title,\n task,\n retry = 0,\n onAbort,\n renderOptions,\n}: RenderSingleTaskOptions<T>): Promise<T> {\n // Keep updates correlated even when titles change or concurrent tasks share the same title.\n const operation = randomUUID()\n let currentStatus = title\n let aborted = false\n const abort = onAbort\n ? () => {\n aborted = true\n onAbort()\n }\n : undefined\n const taskWithProgressEvents = async (updateStatus: (status: TokenizedString) => void): Promise<T> => {\n emitCommandEvent(\n {type: 'progress', operation, status: 'started', message: unstyled(currentStatus.value)},\n {alreadyRendered: true},\n )\n const updateTaskStatus = (status: TokenizedString) => {\n currentStatus = status\n emitCommandEvent(\n {type: 'progress', operation, status: 'updated', message: unstyled(status.value)},\n {alreadyRendered: true},\n )\n updateStatus(status)\n }\n\n for (let attempt = 0; ; attempt++) {\n let result: T\n try {\n // eslint-disable-next-line no-await-in-loop\n result = await task(updateTaskStatus)\n } catch (error) {\n // A custom abort callback can reject the task; cancellation must not start another attempt.\n if (aborted) throw error\n\n const shouldRetry = attempt < retry\n emitCommandEvent(\n {\n type: 'progress',\n operation,\n status: shouldRetry ? 'retrying' : 'failed',\n message: unstyled(currentStatus.value),\n },\n {alreadyRendered: true},\n )\n if (!shouldRetry) throw error\n continue\n }\n\n if (!aborted) {\n emitCommandEvent(\n {\n type: 'progress',\n operation,\n status: 'completed',\n message: unstyled(currentStatus.value),\n current: 1,\n total: 1,\n },\n {alreadyRendered: true},\n )\n }\n return result\n }\n }\n\n if (commandEventOutputMode() === 'json') {\n // Without Ink's raw input handling, Ctrl+C arrives as SIGINT. Leave the default\n // signal behavior intact when the caller has no custom abort callback.\n const onSigint = () => abort?.()\n if (onAbort) process.once('SIGINT', onSigint)\n try {\n return await taskWithProgressEvents(() => {})\n } finally {\n if (onAbort) process.removeListener('SIGINT', onSigint)\n }\n }\n\n let taskResult: T\n await render(\n <SingleTask\n title={title}\n task={taskWithProgressEvents}\n onComplete={(result) => {\n taskResult = result\n }}\n onAbort={abort}\n />,\n {\n stdout: process.stderr as unknown as NodeJS.WriteStream,\n ...renderOptions,\n exitOnCtrlC: false,\n },\n )\n return taskResult!\n}\n\nexport interface RenderTextPromptOptions extends Omit<TextPromptProps, 'onSubmit'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a text prompt to the console.\n * @example\n * ? App project name (can be changed later):\n * > expansive commerce app\n * ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n *\n */\n\nexport async function renderTextPrompt(\n {renderOptions, ...props}: RenderTextPromptOptions,\n uiDebugOptions: UIDebugOptions = defaultUIDebugOptions,\n): Promise<string> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin}, uiDebugOptions)\n\n return runWithTimer('cmd_all_timing_prompts_ms')(async () => {\n let enteredText = ''\n await render(\n <TextPrompt\n {...props}\n onSubmit={(value: string) => {\n enteredText = value\n }}\n />,\n {\n stdout: process.stderr as unknown as NodeJS.WriteStream,\n ...renderOptions,\n exitOnCtrlC: false,\n },\n )\n return enteredText\n })\n}\n\nexport interface RenderDangerousConfirmationPromptOptions extends Omit<DangerousConfirmationPromptProps, 'onSubmit'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a dangerous confirmation prompt to the console, forcing the user to\n * type a confirmation string to proceed.\n * @example\n * ? Release a new version of nightly-app-2023-06-19?\n *\n * ┃ Includes:\n * ┃ + web-px (new)\n * ┃ + sub-ui-ext\n * ┃ + theme-app-ext\n * ┃ + paymentify (from Partner Dashboard)\n * ┃\n * ┃ Removes:\n * ┃ - prod-discount-fun\n * ┃\n * ┃ This can permanently delete app user data.\n *\n * Type nightly-app-2023-06-19 to confirm, or press Escape\n * to cancel.\n * > █\n * ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n *\n */\n\nexport async function renderDangerousConfirmationPrompt(\n {renderOptions, ...props}: RenderDangerousConfirmationPromptOptions,\n uiDebugOptions: UIDebugOptions = defaultUIDebugOptions,\n): Promise<boolean> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin}, uiDebugOptions)\n\n return runWithTimer('cmd_all_timing_prompts_ms')(async () => {\n let confirmed: boolean\n await render(\n <DangerousConfirmationPrompt\n {...props}\n onSubmit={(value: boolean) => {\n confirmed = value\n }}\n />,\n {\n stdout: process.stderr as unknown as NodeJS.WriteStream,\n ...renderOptions,\n exitOnCtrlC: false,\n },\n )\n return confirmed!\n })\n}\n\n/** Waits for any key to be pressed except Ctrl+C which will terminate the process. */\n\nexport const keypress = async (stdin = process.stdin, uiDebugOptions: UIDebugOptions = defaultUIDebugOptions) => {\n throwInNonTTY({message: 'Press any key'}, uiDebugOptions)\n\n return runWithTimer('cmd_all_timing_prompts_ms')(() => {\n return new Promise((resolve, reject) => {\n const handler = (buffer: Buffer) => {\n stdin.setRawMode(false)\n\n const bytes = Array.from(buffer)\n\n if (bytes.length && bytes[0] === 3) {\n outputDebug('Canceled keypress, User pressed CTRL+C')\n reject(new AbortSilentError())\n }\n stdin.unref()\n process.nextTick(resolve)\n }\n\n stdin.setRawMode(true)\n stdin.once('data', handler)\n\n // We want to indicate that we're still using stdin, so that the process\n // doesn't exit early.\n stdin.ref()\n })\n })\n}\n\ninterface IsTTYOptions {\n stdin?: NodeJS.ReadStream\n uiDebugOptions?: UIDebugOptions\n}\n\nexport function isTTY({stdin = undefined, uiDebugOptions = defaultUIDebugOptions}: IsTTYOptions = {}) {\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- false should fall through to stdin/terminalSupportsPrompting\n return Boolean(uiDebugOptions.skipTTYCheck || stdin || terminalSupportsPrompting())\n}\n\ninterface ThrowInNonTTYOptions {\n message: TokenItem\n stdin?: NodeJS.ReadStream\n}\n\nfunction throwInNonTTY({message, stdin = undefined}: ThrowInNonTTYOptions, uiDebugOptions: UIDebugOptions) {\n if (isTTY({stdin, uiDebugOptions})) return\n\n const promptText = tokenItemToString(message)\n const errorMessage = `Failed to prompt:\n\n${outputContent`${outputToken.cyan(promptText)}`.value}\n\nThis usually happens when running a command non-interactively, for example in a CI environment, or when piping to or from another process.`\n throw new AbortError(\n errorMessage,\n 'To resolve this, specify the option in the command, or run the command in an interactive environment such as your local terminal.',\n )\n}\n\nexport type Key = InkKey\nexport type InfoMessage = InfoMessageProps['message']\nexport {Token, Task, TokenItem, InlineToken, LinkToken, TableColumn, InfoTableSection, ListToken, render, handleCtrlC}\n"]}
1
+ {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/public/node/ui.tsx"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,OAAO,EAAC,UAAU,EAAE,gBAAgB,EAAsB,MAAM,YAAY,CAAA;AAC5E,OAAO,EAAC,sBAAsB,EAAE,gBAAgB,EAAC,MAAM,qBAAqB,CAAA;AAC5E,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AACtC,OAAO,EAAC,aAAa,EAAE,WAAW,EAAE,WAAW,EAAmB,QAAQ,EAAC,MAAM,aAAa,CAAA;AAC9F,OAAO,EAAC,yBAAyB,EAAC,MAAM,aAAa,CAAA;AACrD,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAA;AAC1C,OAAO,EACL,gBAAgB,EAEhB,6BAA6B,GAC9B,MAAM,sDAAsD,CAAA;AAC7D,OAAO,EAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAC,MAAM,0BAA0B,CAAA;AACxE,OAAO,EAAC,KAAK,EAAe,MAAM,gCAAgC,CAAA;AAElE,OAAO,EAAC,UAAU,EAAC,MAAM,gDAAgD,CAAA;AAEzE,OAAO,EAAC,KAAK,EAA0B,MAAM,iDAAiD,CAAA;AAC9F,OAAO,EACL,iBAAiB,GAMlB,MAAM,gDAAgD,CAAA;AACvD,OAAO,EACL,2BAA2B,GAE5B,MAAM,iEAAiE,CAAA;AACxE,OAAO,EAAC,YAAY,EAAoB,MAAM,kDAAkD,CAAA;AAChG,OAA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E;IAClG,wIAAwI;IACxI,OAAO,OAAO,CAAC,cAAc,CAAC,YAAY,IAAI,KAAK,IAAI,yBAAyB,EAAE,CAAC,CAAA;AACrF,CAAC;AAOD,SAAS,aAAa,CAAC,EAAC,OAAO,EAAE,KAAK,GAAG,SAAS,EAAuB,EAAE,cAA8B;IACvG,IAAI,KAAK,CAAC,EAAC,KAAK,EAAE,cAAc,EAAC,CAAC;QAAE,OAAM;IAE1C,MAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAA;IAC7C,MAAM,YAAY,GAAG;;EAErB,aAAa,CAAA,GAAG,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK;;2IAEqF,CAAA;IACzI,MAAM,IAAI,UAAU,CAClB,YAAY,EACZ,mIAAmI,CACpI,CAAA;AACH,CAAC;AAID,OAAO,EAA2F,MAAM,EAAE,WAAW,EAAC,CAAA","sourcesContent":["/* eslint-disable tsdoc/syntax */\nimport {AbortError, AbortSilentError, FatalError as Fatal} from './error.js'\nimport {commandEventOutputMode, emitCommandEvent} from './command-events.js'\nimport {randomUUID} from './crypto.js'\nimport {outputContent, outputDebug, outputToken, TokenizedString, unstyled} from './output.js'\nimport {terminalSupportsPrompting} from './system.js'\nimport {AbortController} from './abort.js'\nimport {runWithTimer} from './metadata.js'\nimport {\n ConcurrentOutput,\n ConcurrentOutputProps,\n runConcurrentProcessesForJson,\n} from '../../private/node/ui/components/ConcurrentOutput.js'\nimport {handleCtrlC, render, renderOnce} from '../../private/node/ui.js'\nimport {alert, AlertOptions} from '../../private/node/ui/alert.js'\nimport {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, TableColumn, TableProps} from '../../private/node/ui/components/Table/Table.js'\nimport {\n tokenItemToString,\n type InlineToken,\n type LinkToken,\n type ListToken,\n type Token,\n type TokenItem,\n} from '../../private/node/ui/components/token-item.js'\nimport {\n DangerousConfirmationPrompt,\n DangerousConfirmationPromptProps,\n} from '../../private/node/ui/components/DangerousConfirmationPrompt.js'\nimport {SelectPrompt, SelectPromptProps} from '../../private/node/ui/components/SelectPrompt.js'\nimport {Tasks, Task} from '../../private/node/ui/components/Tasks.js'\nimport {runTasks} from '../../private/node/ui/tasks.js'\nimport {TextPrompt, TextPromptProps} from '../../private/node/ui/components/TextPrompt.js'\nimport {AutocompletePromptProps, AutocompletePrompt} from '../../private/node/ui/components/AutocompletePrompt.js'\nimport {InfoTableSection} from '../../private/node/ui/components/Prompts/InfoTable.js'\nimport {InfoMessageProps} from '../../private/node/ui/components/Prompts/InfoMessage.js'\nimport {SingleTask} from '../../private/node/ui/components/SingleTask.js'\n\nimport React from 'react'\nimport {Key as InkKey, RenderOptions} from 'ink'\n\ntype PartialBy<T, TKey extends keyof T> = Omit<T, TKey> & Partial<Pick<T, TKey>>\n\ninterface UIDebugOptions {\n /** If true, don't check if the current terminal is interactive or not */\n skipTTYCheck?: boolean\n}\nconst defaultUIDebugOptions: UIDebugOptions = {\n skipTTYCheck: false,\n}\n\nexport interface RenderConcurrentOptions extends PartialBy<ConcurrentOutputProps, 'abortSignal'> {\n /** Ink options for terminal UI. Finite JSON output uses the command event channel on stderr instead. */\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.\n * @example\n * 00:00:00 │ backend │ first backend message\n * 00:00:00 │ backend │ second backend message\n * 00:00:00 │ backend │ third backend message\n * 00:00:00 │ frontend │ first frontend message\n * 00:00:00 │ frontend │ second frontend message\n * 00:00:00 │ frontend │ third frontend message\n *\n */\nexport async function renderConcurrent({renderOptions, ...props}: RenderConcurrentOptions) {\n const abortSignal = props.abortSignal ?? new AbortController().signal\n\n // Streaming callers retain their existing Ink lifecycle; finite JSON results must keep stdout clear.\n if (commandEventOutputMode() === 'json' && !props.keepRunningAfterProcessesResolve) {\n if (props.processes.length === 0) return\n return renderSingleTask({\n title: outputContent`Running concurrent processes`,\n task: async () => runConcurrentProcessesForJson({...props, abortSignal}),\n })\n }\n\n return render(<ConcurrentOutput {...props} abortSignal={abortSignal} />, renderOptions)\n}\n\nexport type AlertCustomSection = CustomSection\nexport type RenderAlertOptions = Omit<AlertOptions, 'type'>\n\n/**\n * Renders an information banner to the console.\n * @example Basic\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ CLI update available. │\n * │ │\n * │ Run `npm run shopify upgrade`. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ my-app initialized and ready to build. │\n * │ │\n * │ Next steps │\n * │ • Run `cd verification-app` │\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 * │ • Dev docs [1] │\n * │ │\n * │ Custom section │\n * │ • Item 1 [2] │\n * │ • Item 2 │\n * │ • Item 3 [3] │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://shopify.dev\n * [2] https://www.google.com/search?q=jh56t9l34kpo35tw8s28hn7s9s2xvzla01d8cn6j7yq&rlz=1C1GCEU_enUS832US832&oq=jh56t9l34kpo35tw8s28hn7s9s2xvzla01d8cn6j7yq&aqs=chrome.0.35i39l2j0l4j46j69i60.2711j0j7&sourceid=chrome&ie=UTF-8\n * [3] https://shopify.com\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 * @example Basic\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ CLI updated. │\n * │ │\n * │ You are now running version 3.47. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Deployment successful. │\n * │ │\n * │ Your extensions have been uploaded to your Shopify │\n * │ Partners Dashboard. │\n * │ │\n * │ Next steps │\n * │ • See your deployment and set it live [1] │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://partners.shopify.com/1797046/apps/4523695/deployments\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 * @example Basic\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ You have reached your limit of checkout extensions for │\n * │ this app. │\n * │ │\n * │ You can free up space for a new one by deleting an │\n * │ existing one. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Required access scope update. │\n * │ │\n * │ The deadline for re-selecting your app scopes is May │\n * │ 1, 2022. │\n * │ │\n * │ Reference │\n * │ • Dev docs [1] │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://shopify.dev/app/scopes\n *\n */\nexport function renderWarning(options: RenderAlertOptions) {\n return alert({...options, type: 'warning'})\n}\n\n/**\n * Renders an error banner to the console.\n * @example\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Version couldn't be released. │\n * │ │\n * │ This version needs to be submitted for review and │\n * │ approved by Shopify before it can be released. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n */\nexport function renderError(options: RenderAlertOptions) {\n return alert({...options, type: 'error'})\n}\n\ninterface RenderFatalErrorOptions {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a Fatal error to the console inside a banner.\n * @example Basic\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Something went wrong. │\n * │ │\n * │ To investigate the issue, examine this stack trace: │\n * │ at _compile (internal/modules/cjs/loader.js:1137) │\n * │ at js (internal/modules/cjs/loader.js:1157) │\n * │ at load (internal/modules/cjs/loader.js:985) │\n * │ at _load (internal/modules/cjs/loader.js:878) │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ No Organization found │\n * │ │\n * │ Next steps │\n * │ • Have you created a Shopify Partners organization │\n * │ [1]? │\n * │ • Have you confirmed your accounts from the emails │\n * │ you received? │\n * │ • Need to connect to a different App or │\n * │ organization? Run the command again with `--reset` │\n * │ │\n * │ amortizable-marketplace-ext │\n * │ • Some other error │\n * │ Validation errors │\n * │ • Missing expected key(s). │\n * │ │\n * │ amortizable-marketplace-ext-2 │\n * │ • Something was not found │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://partners.shopify.com/signup\n *\n */\n\nexport function renderFatalError(error: Fatal, {renderOptions}: RenderFatalErrorOptions = {}) {\n return renderOnce(<FatalError error={error} />, {logLevel: 'error', renderOptions})\n}\n\nexport interface RenderSelectPromptOptions<T> extends Omit<SelectPromptProps<T>, 'onSubmit'> {\n isConfirmationPrompt?: boolean\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a select prompt to the console.\n * @example\n * ? Associate your project with the org Castile Ventures?\n *\n * ┃ Add\n * ┃ • new-ext\n * ┃\n * ┃ Remove\n * ┃ • integrated-demand-ext\n * ┃ • order-discount\n *\n * Automations\n * > fifth\n * sixth\n *\n * Merchant Admin\n * eighth\n * ninth\n *\n * Other\n * first\n * second\n * third (limit reached)\n * fourth\n * seventh\n * tenth\n *\n * Press ↑↓ arrows to select, enter to confirm.\n *\n */\n\nexport async function renderSelectPrompt<T>(\n {renderOptions, isConfirmationPrompt, ...props}: RenderSelectPromptOptions<T>,\n uiDebugOptions: UIDebugOptions = defaultUIDebugOptions,\n): Promise<T> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin}, uiDebugOptions)\n\n return runWithTimer('cmd_all_timing_prompts_ms')(async () => {\n let selectedValue: T\n await render(\n <SelectPrompt\n {...props}\n onSubmit={(value: T) => {\n selectedValue = value\n }}\n />,\n {\n stdout: process.stderr as unknown as NodeJS.WriteStream,\n ...renderOptions,\n exitOnCtrlC: false,\n },\n )\n return selectedValue!\n })\n}\n\nexport interface RenderConfirmationPromptOptions extends Pick<\n SelectPromptProps<boolean>,\n 'message' | 'infoTable' | 'infoMessage' | 'abortSignal'\n> {\n confirmationMessage?: string\n cancellationMessage?: string\n renderOptions?: RenderOptions\n defaultValue?: boolean\n}\n\n/**\n * Renders a confirmation prompt to the console.\n * @example\n * ? Delete the following themes from the store?\n *\n * ┃ Info message title\n * ┃\n * ┃ Info message body\n * ┃\n * ┃ • first theme (#1)\n * ┃ • second theme (#2)\n *\n * > (y) Yes, confirm changes\n * (n) Cancel\n *\n * Press ↑↓ arrows to select, enter or a shortcut to\n * confirm.\n *\n */\nexport async function renderConfirmationPrompt({\n message,\n infoTable,\n confirmationMessage = 'Yes, confirm',\n cancellationMessage = 'No, cancel',\n renderOptions,\n defaultValue = true,\n abortSignal,\n infoMessage,\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 renderOptions,\n defaultValue,\n isConfirmationPrompt: true,\n abortSignal,\n infoMessage,\n })\n}\n\nexport interface RenderAutocompleteOptions<T> extends PartialBy<\n Omit<AutocompletePromptProps<T>, 'onSubmit'>,\n 'search'\n> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders an autocomplete prompt to the console.\n * @example\n * ? Select a template: Type to search...\n *\n * ┃ Info message title\n * ┃\n * ┃ Info message body\n *\n * > first\n * second\n * third\n * fourth\n * fifth\n * sixth\n * seventh\n * eighth\n * ninth\n * tenth\n * eleventh\n * twelfth\n * thirteenth\n * fourteenth\n * fifteenth\n * sixteenth\n * seventeenth\n * eighteenth\n * nineteenth (disabled)\n * twentieth\n * twenty-first\n * twenty-second\n * twenty-third\n * twenty-fourth\n * twenty-fifth\n *\n * Press ↑↓ arrows to select, enter to confirm.\n *\n */\n\nexport async function renderAutocompletePrompt<T>(\n {renderOptions, ...props}: RenderAutocompleteOptions<T>,\n uiDebugOptions: UIDebugOptions = defaultUIDebugOptions,\n): Promise<T> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin}, uiDebugOptions)\n\n // The default search filters in-memory choices synchronously, so it doesn't need\n // throttling. Skipping the throttle makes the keystroke-to-result latency feel\n // instant. Callers that supply their own (typically remote/paginated) search keep\n // the component's default throttle unless they opt out via `searchDebounceMs`.\n const usingDefaultSearch = props.search === undefined\n const newProps = {\n search(term: string) {\n const lowerTerm = term.toLowerCase()\n return Promise.resolve({\n data: props.choices.filter((item) => {\n return item.label.toLowerCase().includes(lowerTerm) || item.group?.toLowerCase().includes(lowerTerm)\n }),\n })\n },\n ...(usingDefaultSearch ? {searchDebounceMs: 0} : {}),\n ...props,\n }\n\n return runWithTimer('cmd_all_timing_prompts_ms')(async () => {\n let selectedValue: T | undefined\n await render(\n <AutocompletePrompt\n {...newProps}\n onSubmit={(value: T) => {\n selectedValue = value\n }}\n />,\n {\n stdout: process.stderr as unknown as NodeJS.WriteStream,\n ...renderOptions,\n exitOnCtrlC: false,\n },\n )\n\n if (selectedValue === undefined) {\n throw new Error(\n 'Prompt was interrupted before a selection was made. This can happen if the process received a signal, was terminated, or the prompt was aborted.',\n )\n }\n\n return selectedValue\n })\n}\n\ninterface RenderTableOptions<T extends ScalarDict> extends TableProps<T> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a table to the console.\n * @example\n * ID Name email\n * ── ────────── ─────────────\n * 1 John Doe jon@doe.com\n * 2 Jane Doe jane@doe.com\n * 3 John Smith jon@smith.com\n */\nexport function renderTable<T extends ScalarDict>({renderOptions, ...props}: RenderTableOptions<T>) {\n return renderOnce(<Table {...props} />, {renderOptions})\n}\n\ninterface RenderTasksOptions {\n renderOptions?: RenderOptions\n noProgressBar?: boolean\n}\n\n/**\n * Runs async tasks and displays their progress to the console.\n * @example\n * Installing dependencies ...\n */\n\nexport async function renderTasks<TContext>(\n tasks: Task<TContext>[],\n {renderOptions, noProgressBar}: RenderTasksOptions = {},\n): Promise<TContext> {\n if (commandEventOutputMode() === 'json') return runTasks(tasks)\n\n let taskResult: TContext\n await render(\n <Tasks\n tasks={tasks}\n onComplete={(ctx) => {\n taskResult = ctx\n }}\n noProgressBar={noProgressBar}\n />,\n {\n stdout: process.stderr as unknown as NodeJS.WriteStream,\n ...renderOptions,\n exitOnCtrlC: false,\n },\n )\n return taskResult!\n}\n\nexport interface RenderSingleTaskOptions<T> {\n title: TokenizedString\n task: (updateStatus: (status: TokenizedString) => void) => Promise<T>\n /** The number of additional attempts after a failure. Defaults to zero. */\n retry?: number\n onAbort?: () => void\n renderOptions?: RenderOptions\n}\n\n/**\n * Awaits a single task and displays a loading indicator while it's in progress. The task's result is returned.\n * @param options - Configuration object\n * @param options.title - The initial title to display with the loading indicator\n * @param options.task - The async task to execute. Receives an updateStatus callback to change the displayed title.\n * @param options.retry - The number of additional attempts after a failure. Defaults to zero.\n * @param options.renderOptions - Optional render configuration\n * @returns The result of the task\n * @example\n * Loading app ...\n */\nexport async function renderSingleTask<T>({\n title,\n task,\n retry = 0,\n onAbort,\n renderOptions,\n}: RenderSingleTaskOptions<T>): Promise<T> {\n // Keep updates correlated even when titles change or concurrent tasks share the same title.\n const operation = randomUUID()\n let currentStatus = title\n let aborted = false\n const abort = onAbort\n ? () => {\n aborted = true\n onAbort()\n }\n : undefined\n const taskWithProgressEvents = async (updateStatus: (status: TokenizedString) => void): Promise<T> => {\n emitCommandEvent(\n {type: 'progress', operation, status: 'started', message: unstyled(currentStatus.value)},\n {alreadyRendered: true},\n )\n const updateTaskStatus = (status: TokenizedString) => {\n currentStatus = status\n emitCommandEvent(\n {type: 'progress', operation, status: 'updated', message: unstyled(status.value)},\n {alreadyRendered: true},\n )\n updateStatus(status)\n }\n\n for (let attempt = 0; ; attempt++) {\n let result: T\n try {\n // eslint-disable-next-line no-await-in-loop\n result = await task(updateTaskStatus)\n } catch (error) {\n // A custom abort callback can reject the task; cancellation must not start another attempt.\n if (aborted) throw error\n\n const shouldRetry = attempt < retry\n emitCommandEvent(\n {\n type: 'progress',\n operation,\n status: shouldRetry ? 'retrying' : 'failed',\n message: unstyled(currentStatus.value),\n },\n {alreadyRendered: true},\n )\n if (!shouldRetry) throw error\n continue\n }\n\n if (!aborted) {\n emitCommandEvent(\n {\n type: 'progress',\n operation,\n status: 'completed',\n message: unstyled(currentStatus.value),\n current: 1,\n total: 1,\n },\n {alreadyRendered: true},\n )\n }\n return result\n }\n }\n\n if (commandEventOutputMode() === 'json') {\n // Without Ink's raw input handling, Ctrl+C arrives as SIGINT. Leave the default\n // signal behavior intact when the caller has no custom abort callback.\n const onSigint = () => abort?.()\n if (onAbort) process.once('SIGINT', onSigint)\n try {\n return await taskWithProgressEvents(() => {})\n } finally {\n if (onAbort) process.removeListener('SIGINT', onSigint)\n }\n }\n\n let taskResult: T\n await render(\n <SingleTask\n title={title}\n task={taskWithProgressEvents}\n onComplete={(result) => {\n taskResult = result\n }}\n onAbort={abort}\n />,\n {\n stdout: process.stderr as unknown as NodeJS.WriteStream,\n ...renderOptions,\n exitOnCtrlC: false,\n },\n )\n return taskResult!\n}\n\nexport interface RenderTextPromptOptions extends Omit<TextPromptProps, 'onSubmit'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a text prompt to the console.\n * @example\n * ? App project name (can be changed later):\n * > expansive commerce app\n * ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n *\n */\n\nexport async function renderTextPrompt(\n {renderOptions, ...props}: RenderTextPromptOptions,\n uiDebugOptions: UIDebugOptions = defaultUIDebugOptions,\n): Promise<string> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin}, uiDebugOptions)\n\n return runWithTimer('cmd_all_timing_prompts_ms')(async () => {\n let enteredText = ''\n await render(\n <TextPrompt\n {...props}\n onSubmit={(value: string) => {\n enteredText = value\n }}\n />,\n {\n stdout: process.stderr as unknown as NodeJS.WriteStream,\n ...renderOptions,\n exitOnCtrlC: false,\n },\n )\n return enteredText\n })\n}\n\nexport interface RenderDangerousConfirmationPromptOptions extends Omit<DangerousConfirmationPromptProps, 'onSubmit'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a dangerous confirmation prompt to the console, forcing the user to\n * type a confirmation string to proceed.\n * @example\n * ? Release a new version of nightly-app-2023-06-19?\n *\n * ┃ Includes:\n * ┃ + web-px (new)\n * ┃ + sub-ui-ext\n * ┃ + theme-app-ext\n * ┃ + paymentify (from Partner Dashboard)\n * ┃\n * ┃ Removes:\n * ┃ - prod-discount-fun\n * ┃\n * ┃ This can permanently delete app user data.\n *\n * Type nightly-app-2023-06-19 to confirm, or press Escape\n * to cancel.\n * > █\n * ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n *\n */\n\nexport async function renderDangerousConfirmationPrompt(\n {renderOptions, ...props}: RenderDangerousConfirmationPromptOptions,\n uiDebugOptions: UIDebugOptions = defaultUIDebugOptions,\n): Promise<boolean> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin}, uiDebugOptions)\n\n return runWithTimer('cmd_all_timing_prompts_ms')(async () => {\n let confirmed: boolean\n await render(\n <DangerousConfirmationPrompt\n {...props}\n onSubmit={(value: boolean) => {\n confirmed = value\n }}\n />,\n {\n stdout: process.stderr as unknown as NodeJS.WriteStream,\n ...renderOptions,\n exitOnCtrlC: false,\n },\n )\n return confirmed!\n })\n}\n\ninterface KeypressOptions {\n /**\n * The keys that end the wait, for example `['\\r']` for Enter. Other keys are ignored.\n * Without this option, any key ends the wait.\n */\n keys?: string[]\n}\n\n/**\n * Waits for a key to be pressed. Ctrl+C rejects with AbortSilentError, which terminates the process.\n *\n * Raw mode is set back to the state it had before the call. A command that keeps stdin raw for\n * its own single-key shortcuts (for example `theme dev`) keeps them.\n *\n * Chunks are read as text: an active Ink renderer calls `stdin.setEncoding('utf8')`, and then\n * stdin emits strings instead of Buffers.\n *\n * @param stdin - The stream to read from.\n * @param uiDebugOptions - Debug options; `skipTTYCheck` allows a non-TTY stdin.\n * @param options - The keys that end the wait.\n * @returns A promise that resolves when an accepted key is pressed.\n */\nexport const keypress = async (\n stdin = process.stdin,\n uiDebugOptions: UIDebugOptions = defaultUIDebugOptions,\n {keys}: KeypressOptions = {},\n) => {\n throwInNonTTY({message: 'Press any key'}, uiDebugOptions)\n\n return runWithTimer('cmd_all_timing_prompts_ms')(() => {\n const {promise, resolve, reject} = Promise.withResolvers<void>()\n const stdinWasRaw = stdin.isRaw === true\n\n const stopListening = () => {\n stdin.off('data', handler)\n if (!stdinWasRaw) stdin.setRawMode(false)\n stdin.unref()\n }\n\n const handler = (chunk: Buffer | string) => {\n const text = chunk.toString()\n if (text.includes('\\u0003')) {\n stopListening()\n outputDebug('Canceled keypress, User pressed CTRL+C')\n reject(new AbortSilentError())\n } else if (!keys || [...text].some((character) => keys.includes(character))) {\n stopListening()\n process.nextTick(resolve)\n }\n }\n\n if (!stdinWasRaw) stdin.setRawMode(true)\n stdin.on('data', handler)\n\n // We want to indicate that we're still using stdin, so that the process\n // doesn't exit early.\n stdin.ref()\n return promise\n })\n}\n\ninterface IsTTYOptions {\n stdin?: NodeJS.ReadStream\n uiDebugOptions?: UIDebugOptions\n}\n\nexport function isTTY({stdin = undefined, uiDebugOptions = defaultUIDebugOptions}: IsTTYOptions = {}) {\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- false should fall through to stdin/terminalSupportsPrompting\n return Boolean(uiDebugOptions.skipTTYCheck || stdin || terminalSupportsPrompting())\n}\n\ninterface ThrowInNonTTYOptions {\n message: TokenItem\n stdin?: NodeJS.ReadStream\n}\n\nfunction throwInNonTTY({message, stdin = undefined}: ThrowInNonTTYOptions, uiDebugOptions: UIDebugOptions) {\n if (isTTY({stdin, uiDebugOptions})) return\n\n const promptText = tokenItemToString(message)\n const errorMessage = `Failed to prompt:\n\n${outputContent`${outputToken.cyan(promptText)}`.value}\n\nThis usually happens when running a command non-interactively, for example in a CI environment, or when piping to or from another process.`\n throw new AbortError(\n errorMessage,\n 'To resolve this, specify the option in the command, or run the command in an interactive environment such as your local terminal.',\n )\n}\n\nexport type Key = InkKey\nexport type InfoMessage = InfoMessageProps['message']\nexport {Token, Task, TokenItem, InlineToken, LinkToken, TableColumn, InfoTableSection, ListToken, render, handleCtrlC}\n"]}
@@ -0,0 +1,17 @@
1
+ import { Writable } from 'node:stream';
2
+ /**
3
+ * Keeps package-manager output off the result channel in JSON mode.
4
+ *
5
+ * @returns Streams for package-manager diagnostics, or the original terminal streams.
6
+ */
7
+ export declare function upgradeOutputStreams(): {
8
+ stdout: Writable;
9
+ stderr: Writable;
10
+ };
11
+ /**
12
+ * Runs a global upgrade with terminal input and format-appropriate diagnostics.
13
+ *
14
+ * @param command - The package-manager executable.
15
+ * @param args - The install arguments.
16
+ */
17
+ export declare function execUpgradeCommand(command: string, args: string[]): Promise<void>;
@@ -0,0 +1,51 @@
1
+ import { commandEventOutputMode } from '../command-events.js';
2
+ import { outputInfo } from '../output.js';
3
+ import { exec } from '../system.js';
4
+ import { Writable } from 'node:stream';
5
+ import { StringDecoder } from 'node:string_decoder';
6
+ /**
7
+ * Keeps package-manager output off the result channel in JSON mode.
8
+ *
9
+ * @returns Streams for package-manager diagnostics, or the original terminal streams.
10
+ */
11
+ export function upgradeOutputStreams() {
12
+ if (commandEventOutputMode() !== 'json')
13
+ return { stdout: process.stdout, stderr: process.stderr };
14
+ return { stdout: diagnosticStream(), stderr: diagnosticStream() };
15
+ }
16
+ function diagnosticStream() {
17
+ const decoder = new StringDecoder('utf8');
18
+ return new Writable({
19
+ write(chunk, _encoding, callback) {
20
+ const message = decoder.write(chunk);
21
+ if (message)
22
+ outputInfo(message);
23
+ callback();
24
+ },
25
+ final(callback) {
26
+ const message = decoder.end();
27
+ if (message)
28
+ outputInfo(message);
29
+ callback();
30
+ },
31
+ });
32
+ }
33
+ /**
34
+ * Runs a global upgrade with terminal input and format-appropriate diagnostics.
35
+ *
36
+ * @param command - The package-manager executable.
37
+ * @param args - The install arguments.
38
+ */
39
+ export async function execUpgradeCommand(command, args) {
40
+ const streams = upgradeOutputStreams();
41
+ try {
42
+ await exec(command, args, streams.stdout === process.stdout ? { stdio: 'inherit' } : { stdin: 'inherit', ...streams });
43
+ }
44
+ finally {
45
+ if (streams.stdout !== process.stdout)
46
+ streams.stdout.end();
47
+ if (streams.stderr !== process.stderr)
48
+ streams.stderr.end();
49
+ }
50
+ }
51
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../../../../src/public/node/upgrade/output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AACvC,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAA;AACjC,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAA;AACpC,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAA;AAEjD;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAClC,IAAI,sBAAsB,EAAE,KAAK,MAAM;QAAE,OAAO,EAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAC,CAAA;IAEhG,OAAO,EAAC,MAAM,EAAE,gBAAgB,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAAC,CAAA;AACjE,CAAC;AAED,SAAS,gBAAgB;IACvB,MAAM,OAAO,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAA;IACzC,OAAO,IAAI,QAAQ,CAAC;QAClB,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ;YAC9B,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YACpC,IAAI,OAAO;gBAAE,UAAU,CAAC,OAAO,CAAC,CAAA;YAChC,QAAQ,EAAE,CAAA;QACZ,CAAC;QACD,KAAK,CAAC,QAAQ;YACZ,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;YAC7B,IAAI,OAAO;gBAAE,UAAU,CAAC,OAAO,CAAC,CAAA;YAChC,QAAQ,EAAE,CAAA;QACZ,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAAe,EAAE,IAAc;IACtE,MAAM,OAAO,GAAG,oBAAoB,EAAE,CAAA;IACtC,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAC,KAAK,EAAE,SAAS,EAAC,CAAC,CAAC,CAAC,EAAC,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,EAAC,CAAC,CAAA;IACpH,CAAC;YAAS,CAAC;QACT,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM;YAAE,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;QAC3D,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM;YAAE,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;IAC7D,CAAC;AACH,CAAC","sourcesContent":["import {commandEventOutputMode} from '../command-events.js'\nimport {outputInfo} from '../output.js'\nimport {exec} from '../system.js'\nimport {Writable} from 'node:stream'\nimport {StringDecoder} from 'node:string_decoder'\n\n/**\n * Keeps package-manager output off the result channel in JSON mode.\n *\n * @returns Streams for package-manager diagnostics, or the original terminal streams.\n */\nexport function upgradeOutputStreams(): {stdout: Writable; stderr: Writable} {\n if (commandEventOutputMode() !== 'json') return {stdout: process.stdout, stderr: process.stderr}\n\n return {stdout: diagnosticStream(), stderr: diagnosticStream()}\n}\n\nfunction diagnosticStream(): Writable {\n const decoder = new StringDecoder('utf8')\n return new Writable({\n write(chunk, _encoding, callback) {\n const message = decoder.write(chunk)\n if (message) outputInfo(message)\n callback()\n },\n final(callback) {\n const message = decoder.end()\n if (message) outputInfo(message)\n callback()\n },\n })\n}\n\n/**\n * Runs a global upgrade with terminal input and format-appropriate diagnostics.\n *\n * @param command - The package-manager executable.\n * @param args - The install arguments.\n */\nexport async function execUpgradeCommand(command: string, args: string[]): Promise<void> {\n const streams = upgradeOutputStreams()\n try {\n await exec(command, args, streams.stdout === process.stdout ? {stdio: 'inherit'} : {stdin: 'inherit', ...streams})\n } finally {\n if (streams.stdout !== process.stdout) streams.stdout.end()\n if (streams.stderr !== process.stderr) streams.stderr.end()\n }\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import { type UpgradeResult } from './types.js';
2
+ /**
3
+ * Presents the upgrade result without changing progress or package-manager output.
4
+ *
5
+ * @param result - The completed upgrade outcome.
6
+ * @param format - The output format selected by the caller.
7
+ */
8
+ export declare function presentUpgradeResult(result: UpgradeResult, format: 'json' | 'text'): void;
@@ -0,0 +1,21 @@
1
+ import { upgradeJsonOutputSchema } from './types.js';
2
+ import { outputResult } from '../output.js';
3
+ import { renderSuccess } from '../ui.js';
4
+ /**
5
+ * Presents the upgrade result without changing progress or package-manager output.
6
+ *
7
+ * @param result - The completed upgrade outcome.
8
+ * @param format - The output format selected by the caller.
9
+ */
10
+ export function presentUpgradeResult(result, format) {
11
+ if (format === 'json') {
12
+ outputResult(upgradeJsonOutputSchema.encode(result));
13
+ }
14
+ else if (result.status === 'success' && result.scope === 'global') {
15
+ renderSuccess({
16
+ headline: 'Shopify CLI upgraded.',
17
+ body: `You're now on version ${result.version}.`,
18
+ });
19
+ }
20
+ }
21
+ //# sourceMappingURL=result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.js","sourceRoot":"","sources":["../../../../src/public/node/upgrade/result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAqB,MAAM,YAAY,CAAA;AACtE,OAAO,EAAC,YAAY,EAAC,MAAM,cAAc,CAAA;AACzC,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAA;AAEtC;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAqB,EAAE,MAAuB;IACjF,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,YAAY,CAAC,uBAAuB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;IACtD,CAAC;SAAM,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QACpE,aAAa,CAAC;YACZ,QAAQ,EAAE,uBAAuB;YACjC,IAAI,EAAE,yBAAyB,MAAM,CAAC,OAAO,GAAG;SACjD,CAAC,CAAA;IACJ,CAAC;AACH,CAAC","sourcesContent":["import {upgradeJsonOutputSchema, type UpgradeResult} from './types.js'\nimport {outputResult} from '../output.js'\nimport {renderSuccess} from '../ui.js'\n\n/**\n * Presents the upgrade result without changing progress or package-manager output.\n *\n * @param result - The completed upgrade outcome.\n * @param format - The output format selected by the caller.\n */\nexport function presentUpgradeResult(result: UpgradeResult, format: 'json' | 'text'): void {\n if (format === 'json') {\n outputResult(upgradeJsonOutputSchema.encode(result))\n } else if (result.status === 'success' && result.scope === 'global') {\n renderSuccess({\n headline: 'Shopify CLI upgraded.',\n body: `You're now on version ${result.version}.`,\n })\n }\n}\n"]}
@@ -0,0 +1,61 @@
1
+ import { type InferJsonOutputSchema } from '../json-output-schema.js';
2
+ import { zod } from '../schema.js';
3
+ export declare const upgradeJsonOutputSchema: import("../json-output-schema.js").JsonOutputSchema<zod.ZodUnion<[zod.ZodObject<{
4
+ status: zod.ZodLiteral<"success">;
5
+ changed: zod.ZodBoolean;
6
+ scope: zod.ZodLiteral<"global">;
7
+ previousVersion: zod.ZodString;
8
+ version: zod.ZodString;
9
+ packageManager: zod.ZodEnum<["npm", "pnpm", "yarn", "bun", "homebrew"]>;
10
+ }, "strict", zod.ZodTypeAny, {
11
+ status: "success";
12
+ version: string;
13
+ scope: "global";
14
+ changed: boolean;
15
+ previousVersion: string;
16
+ packageManager: "yarn" | "npm" | "pnpm" | "bun" | "homebrew";
17
+ }, {
18
+ status: "success";
19
+ version: string;
20
+ scope: "global";
21
+ changed: boolean;
22
+ previousVersion: string;
23
+ packageManager: "yarn" | "npm" | "pnpm" | "bun" | "homebrew";
24
+ }>, zod.ZodObject<{
25
+ status: zod.ZodLiteral<"success">;
26
+ changed: zod.ZodNull;
27
+ scope: zod.ZodLiteral<"local">;
28
+ directory: zod.ZodEffects<zod.ZodEffects<zod.ZodString, string, string>, string, string>;
29
+ previousVersion: zod.ZodString;
30
+ availableVersion: zod.ZodNullable<zod.ZodString>;
31
+ packages: zod.ZodArray<zod.ZodString, "many">;
32
+ }, "strict", zod.ZodTypeAny, {
33
+ status: "success";
34
+ directory: string;
35
+ scope: "local";
36
+ changed: null;
37
+ previousVersion: string;
38
+ availableVersion: string | null;
39
+ packages: string[];
40
+ }, {
41
+ status: "success";
42
+ directory: string;
43
+ scope: "local";
44
+ changed: null;
45
+ previousVersion: string;
46
+ availableVersion: string | null;
47
+ packages: string[];
48
+ }>, zod.ZodObject<{
49
+ status: zod.ZodLiteral<"skipped">;
50
+ reason: zod.ZodEnum<["development", "local-autoupgrade", "dependency-not-found"]>;
51
+ scope: zod.ZodEnum<["global", "local"]>;
52
+ }, "strict", zod.ZodTypeAny, {
53
+ status: "skipped";
54
+ scope: "local" | "global";
55
+ reason: "development" | "local-autoupgrade" | "dependency-not-found";
56
+ }, {
57
+ status: "skipped";
58
+ scope: "local" | "global";
59
+ reason: "development" | "local-autoupgrade" | "dependency-not-found";
60
+ }>]>>;
61
+ export type UpgradeResult = InferJsonOutputSchema<typeof upgradeJsonOutputSchema>;
@@ -0,0 +1,46 @@
1
+ import { defineJsonOutputSchema } from '../json-output-schema.js';
2
+ import { isAbsolutePath } from '../path.js';
3
+ import { zod } from '../schema.js';
4
+ // eslint-disable-next-line no-restricted-imports -- JSON filesystem paths use native platform separators.
5
+ import { resolve } from 'node:path';
6
+ export const upgradeJsonOutputSchema = defineJsonOutputSchema({
7
+ name: 'UpgradeResult',
8
+ schema: zod.union([
9
+ zod
10
+ .object({
11
+ status: zod.literal('success'),
12
+ changed: zod.boolean().describe('Whether the verified installed version differs from previousVersion.'),
13
+ scope: zod.literal('global'),
14
+ previousVersion: zod.string().min(1),
15
+ version: zod.string().min(1),
16
+ packageManager: zod.enum(['npm', 'pnpm', 'yarn', 'bun', 'homebrew']),
17
+ })
18
+ .strict(),
19
+ zod
20
+ .object({
21
+ status: zod.literal('success'),
22
+ changed: zod.null().describe('Null because local dependency changes and installed versions are not verified.'),
23
+ scope: zod.literal('local'),
24
+ directory: zod
25
+ .string()
26
+ .refine(isAbsolutePath, 'Must be an absolute filesystem path.')
27
+ .transform((directory) => resolve(directory)),
28
+ previousVersion: zod.string().min(1),
29
+ availableVersion: zod
30
+ .string()
31
+ .min(1)
32
+ .nullable()
33
+ .describe('The available registry version, or null when unknown.'),
34
+ packages: zod.array(zod.string().min(1)),
35
+ })
36
+ .strict(),
37
+ zod
38
+ .object({
39
+ status: zod.literal('skipped'),
40
+ reason: zod.enum(['development', 'local-autoupgrade', 'dependency-not-found']),
41
+ scope: zod.enum(['global', 'local']),
42
+ })
43
+ .strict(),
44
+ ]),
45
+ });
46
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/public/node/upgrade/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAA6B,MAAM,0BAA0B,CAAA;AAC3F,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAA;AACzC,OAAO,EAAC,GAAG,EAAC,MAAM,cAAc,CAAA;AA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AAE;iBACV,QAAQ,CAAC,uDAAuD,CAAC;YACpE,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACzC,CAAC;aACD,MAAM,EAAE;QACX,GAAG;aACA,MAAM,CAAC;YACN,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC;YAC9B,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,mBAAmB,EAAE,sBAAsB,CAAC,CAAC;YAC9E,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;SACrC,CAAC;aACD,MAAM,EAAE;KACZ,CAAC;CACH,CAAC,CAAA","sourcesContent":["import {defineJsonOutputSchema, type InferJsonOutputSchema} from '../json-output-schema.js'\nimport {isAbsolutePath} from '../path.js'\nimport {zod} from '../schema.js'\n// eslint-disable-next-line no-restricted-imports -- JSON filesystem paths use native platform separators.\nimport {resolve} from 'node:path'\n\nexport const upgradeJsonOutputSchema = defineJsonOutputSchema({\n name: 'UpgradeResult',\n schema: zod.union([\n zod\n .object({\n status: zod.literal('success'),\n changed: zod.boolean().describe('Whether the verified installed version differs from previousVersion.'),\n scope: zod.literal('global'),\n previousVersion: zod.string().min(1),\n version: zod.string().min(1),\n packageManager: zod.enum(['npm', 'pnpm', 'yarn', 'bun', 'homebrew']),\n })\n .strict(),\n zod\n .object({\n status: zod.literal('success'),\n changed: zod.null().describe('Null because local dependency changes and installed versions are not verified.'),\n scope: zod.literal('local'),\n directory: zod\n .string()\n .refine(isAbsolutePath, 'Must be an absolute filesystem path.')\n .transform((directory) => resolve(directory)),\n previousVersion: zod.string().min(1),\n availableVersion: zod\n .string()\n .min(1)\n .nullable()\n .describe('The available registry version, or null when unknown.'),\n packages: zod.array(zod.string().min(1)),\n })\n .strict(),\n zod\n .object({\n status: zod.literal('skipped'),\n reason: zod.enum(['development', 'local-autoupgrade', 'dependency-not-found']),\n scope: zod.enum(['global', 'local']),\n })\n .strict(),\n ]),\n})\n\nexport type UpgradeResult = InferJsonOutputSchema<typeof upgradeJsonOutputSchema>\n"]}
@@ -1,4 +1,5 @@
1
1
  import { getAutoUpgradeEnabled, setAutoUpgradeEnabled } from '../../private/node/conf-store.js';
2
+ import type { UpgradeResult } from './upgrade/types.js';
2
3
  export { getAutoUpgradeEnabled, setAutoUpgradeEnabled };
3
4
  /**
4
5
  * Utility function for generating an install command for the user to run
@@ -27,6 +28,13 @@ export interface RunCLIUpgradeOptions {
27
28
  * @throws AbortError if the package manager or command cannot be determined.
28
29
  */
29
30
  export declare function runCLIUpgrade(options?: RunCLIUpgradeOptions): Promise<void>;
31
+ /**
32
+ * Upgrades the CLI and returns the outcome independently of final presentation.
33
+ *
34
+ * @param options - Whether the upgrade was triggered automatically.
35
+ * @returns The verified global version, local dependency update, or skip reason.
36
+ */
37
+ export declare function upgradeCLI(options?: RunCLIUpgradeOptions): Promise<UpgradeResult>;
30
38
  /**
31
39
  * Returns the version to auto-upgrade to, or undefined if auto-upgrade should be skipped.
32
40
  * Auto-upgrade is enabled by default and can be disabled via `setAutoUpgradeEnabled(false)`.