@shopify/cli-kit 3.93.2 → 3.94.1
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/private/node/analytics.d.ts +2 -0
- package/dist/private/node/analytics.js +10 -1
- package/dist/private/node/analytics.js.map +1 -1
- package/dist/private/node/api/urls.js +19 -5
- package/dist/private/node/api/urls.js.map +1 -1
- package/dist/private/node/content-tokens.js +6 -2
- package/dist/private/node/content-tokens.js.map +1 -1
- package/dist/private/node/session/exchange.js +11 -3
- package/dist/private/node/session/exchange.js.map +1 -1
- package/dist/private/node/session.d.ts +7 -7
- package/dist/private/node/session.js +11 -9
- package/dist/private/node/session.js.map +1 -1
- package/dist/private/node/temp-dir.d.ts +1 -0
- package/dist/private/node/temp-dir.js +8 -0
- package/dist/private/node/temp-dir.js.map +1 -0
- package/dist/private/node/testing/ui.js +4 -3
- package/dist/private/node/testing/ui.js.map +1 -1
- package/dist/private/node/ui/components/AutocompletePrompt.js +5 -4
- package/dist/private/node/ui/components/AutocompletePrompt.js.map +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.js +12 -10
- package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.test.js +27 -4
- package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -1
- package/dist/private/node/ui/components/DangerousConfirmationPrompt.d.ts +2 -0
- package/dist/private/node/ui/components/DangerousConfirmationPrompt.js +12 -7
- package/dist/private/node/ui/components/DangerousConfirmationPrompt.js.map +1 -1
- package/dist/private/node/ui/components/LoadingBar.js +9 -2
- package/dist/private/node/ui/components/LoadingBar.js.map +1 -1
- package/dist/private/node/ui/components/LoadingBar.test.js +49 -88
- package/dist/private/node/ui/components/LoadingBar.test.js.map +1 -1
- package/dist/private/node/ui/components/SelectPrompt.js +4 -4
- package/dist/private/node/ui/components/SelectPrompt.js.map +1 -1
- package/dist/private/node/ui/components/SingleTask.js +12 -6
- package/dist/private/node/ui/components/SingleTask.js.map +1 -1
- package/dist/private/node/ui/components/TextPrompt.js +5 -5
- package/dist/private/node/ui/components/TextPrompt.js.map +1 -1
- package/dist/private/node/ui/hooks/use-abort-signal.js +10 -15
- package/dist/private/node/ui/hooks/use-abort-signal.js.map +1 -1
- package/dist/private/node/ui/hooks/use-async-and-unmount.js +11 -5
- package/dist/private/node/ui/hooks/use-async-and-unmount.js.map +1 -1
- package/dist/private/node/ui.d.ts +17 -1
- package/dist/private/node/ui.js +35 -4
- package/dist/private/node/ui.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/context/local.js +1 -2
- package/dist/public/node/context/local.js.map +1 -1
- package/dist/public/node/error-handler.js +4 -0
- package/dist/public/node/error-handler.js.map +1 -1
- package/dist/public/node/error.js +2 -0
- package/dist/public/node/error.js.map +1 -1
- package/dist/public/node/fs.js +10 -4
- package/dist/public/node/fs.js.map +1 -1
- package/dist/public/node/hooks/postrun.js +9 -10
- package/dist/public/node/hooks/postrun.js.map +1 -1
- package/dist/public/node/metadata.d.ts +1 -1
- package/dist/public/node/metadata.js.map +1 -1
- package/dist/public/node/monorail.d.ts +10 -1
- package/dist/public/node/monorail.js +1 -1
- package/dist/public/node/monorail.js.map +1 -1
- package/dist/public/node/node-package-manager.d.ts +12 -0
- package/dist/public/node/node-package-manager.js +62 -30
- package/dist/public/node/node-package-manager.js.map +1 -1
- package/dist/public/node/path.d.ts +8 -0
- package/dist/public/node/path.js +17 -2
- package/dist/public/node/path.js.map +1 -1
- package/dist/public/node/system.d.ts +6 -0
- package/dist/public/node/system.js +9 -0
- package/dist/public/node/system.js.map +1 -1
- package/dist/public/node/tcp.js +32 -8
- package/dist/public/node/tcp.js.map +1 -1
- package/dist/public/node/ui.d.ts +1 -3
- package/dist/public/node/ui.js +16 -14
- package/dist/public/node/ui.js.map +1 -1
- package/dist/public/node/upgrade.d.ts +7 -2
- package/dist/public/node/upgrade.js +20 -7
- package/dist/public/node/upgrade.js.map +1 -1
- package/dist/public/node/vendor/dev_server/dev-server-2024.js +1 -1
- package/dist/public/node/vendor/dev_server/dev-server-2024.js.map +1 -1
- package/dist/public/node/vendor/otel-js/service/DefaultOtelService/DefaultMeterProvider.js +1 -2
- package/dist/public/node/vendor/otel-js/service/DefaultOtelService/DefaultMeterProvider.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -8
package/dist/public/node/ui.js
CHANGED
|
@@ -364,18 +364,18 @@ export function renderTable({ renderOptions, ...props }) {
|
|
|
364
364
|
/**
|
|
365
365
|
* Runs async tasks and displays their progress to the console.
|
|
366
366
|
* @example
|
|
367
|
-
* ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
|
368
367
|
* Installing dependencies ...
|
|
369
368
|
*/
|
|
370
369
|
export async function renderTasks(tasks, { renderOptions, noProgressBar } = {}) {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
370
|
+
let taskResult;
|
|
371
|
+
await render(React.createElement(Tasks, { tasks: tasks, onComplete: (ctx) => {
|
|
372
|
+
taskResult = ctx;
|
|
373
|
+
}, noProgressBar: noProgressBar }), {
|
|
374
|
+
stdout: process.stderr,
|
|
375
|
+
...renderOptions,
|
|
376
|
+
exitOnCtrlC: false,
|
|
378
377
|
});
|
|
378
|
+
return taskResult;
|
|
379
379
|
}
|
|
380
380
|
/**
|
|
381
381
|
* Awaits a single task and displays a loading bar while it's in progress. The task's result is returned.
|
|
@@ -385,16 +385,18 @@ export async function renderTasks(tasks, { renderOptions, noProgressBar } = {})
|
|
|
385
385
|
* @param options.renderOptions - Optional render configuration
|
|
386
386
|
* @returns The result of the task
|
|
387
387
|
* @example
|
|
388
|
-
* ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
|
389
388
|
* Loading app ...
|
|
390
389
|
*/
|
|
391
390
|
export async function renderSingleTask({ title, task, onAbort, renderOptions, }) {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
391
|
+
let taskResult;
|
|
392
|
+
await render(React.createElement(SingleTask, { title: title, task: task, onComplete: (result) => {
|
|
393
|
+
taskResult = result;
|
|
394
|
+
}, onAbort: onAbort }), {
|
|
395
|
+
stdout: process.stderr,
|
|
396
|
+
...renderOptions,
|
|
397
|
+
exitOnCtrlC: false,
|
|
397
398
|
});
|
|
399
|
+
return taskResult;
|
|
398
400
|
}
|
|
399
401
|
/**
|
|
400
402
|
* Renders a text prompt to the console.
|
|
@@ -1 +1 @@
|
|
|
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,aAAa,EAAE,WAAW,EAAE,WAAW,EAAkB,MAAM,aAAa,CAAA;AACpF,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,EAAC,gBAAgB,EAAwB,MAAM,sDAAsD,CAAA;AAC5G,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,gD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AAA;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 {outputContent, outputDebug, outputToken, TokenizedString} from './output.js'\nimport {terminalSupportsPrompting} from './system.js'\nimport {AbortController} from './abort.js'\nimport {runWithTimer} from './metadata.js'\nimport {ConcurrentOutput, ConcurrentOutputProps} 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 Token,\n tokenItemToString,\n InlineToken,\n LinkToken,\n ListToken,\n TokenItem,\n} from '../../private/node/ui/components/TokenizedText.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 {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 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 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=jh56t9l34kpo35tw8s28hn7s\n * 9s2xvzla01d8cn6j7yq&rlz=1C1GCEU_enUS832US832&oq=jh56t9l34kpo\n * 35tw8s28hn7s9s2xvzla01d8cn6j7yq&aqs=chrome.0.35i39l2j0l4j46j\n * 69i60.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/deploy\n * ments\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 ...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 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 ...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 ...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 * ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n * Installing dependencies ...\n */\n\nexport async function renderTasks<TContext>(\n tasks: Task<TContext>[],\n {renderOptions, noProgressBar}: RenderTasksOptions = {},\n) {\n return new Promise<TContext>((resolve, reject) => {\n render(<Tasks tasks={tasks} onComplete={resolve} noProgressBar={noProgressBar} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n .then(() => {})\n .catch(reject)\n })\n}\n\nexport interface RenderSingleTaskOptions<T> {\n title: TokenizedString\n task: (updateStatus: (status: TokenizedString) => void) => Promise<T>\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.renderOptions - Optional render configuration\n * @returns The result of the task\n * @example\n * ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n * Loading app ...\n */\nexport async function renderSingleTask<T>({\n title,\n task,\n onAbort,\n renderOptions,\n}: RenderSingleTaskOptions<T>): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n render(<SingleTask title={title} task={task} onComplete={resolve} onAbort={onAbort} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n }).catch(reject)\n })\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 ...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 ...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,aAAa,EAAE,WAAW,EAAE,WAAW,EAAkB,MAAM,aAAa,CAAA;AACpF,OAAO,EAAC,yBAAyB,EAAC,MAAM,aAAa,CAAA;AACrD,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAA;AAC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EAAE,CAAC;oBACnC,WAAW,CAAC,wCAAwC,CAAC,CAAA;oBACrD,MAAM,CAAC,IAAI,gBAAgB,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 {outputContent, outputDebug, outputToken, TokenizedString} from './output.js'\nimport {terminalSupportsPrompting} from './system.js'\nimport {AbortController} from './abort.js'\nimport {runWithTimer} from './metadata.js'\nimport {ConcurrentOutput, ConcurrentOutputProps} 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 Token,\n tokenItemToString,\n InlineToken,\n LinkToken,\n ListToken,\n TokenItem,\n} from '../../private/node/ui/components/TokenizedText.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 {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 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 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=jh56t9l34kpo35tw8s28hn7s\n * 9s2xvzla01d8cn6j7yq&rlz=1C1GCEU_enUS832US832&oq=jh56t9l34kpo\n * 35tw8s28hn7s9s2xvzla01d8cn6j7yq&aqs=chrome.0.35i39l2j0l4j46j\n * 69i60.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/deploy\n * ments\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 ...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 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 ...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 ...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 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 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.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 onAbort,\n renderOptions,\n}: RenderSingleTaskOptions<T>): Promise<T> {\n let taskResult: T\n await render(\n <SingleTask\n title={title}\n task={task}\n onComplete={(result) => {\n taskResult = result\n }}\n onAbort={onAbort}\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 ...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 ...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,8 +1,10 @@
|
|
|
1
|
+
import { getAutoUpgradeEnabled, setAutoUpgradeEnabled } from '../../private/node/conf-store.js';
|
|
2
|
+
export { getAutoUpgradeEnabled, setAutoUpgradeEnabled };
|
|
1
3
|
/**
|
|
2
4
|
* Utility function for generating an install command for the user to run
|
|
3
5
|
* to install an updated version of Shopify CLI.
|
|
4
6
|
*
|
|
5
|
-
* @returns A string with the command to run.
|
|
7
|
+
* @returns A string with the command to run, or undefined if the package manager cannot be determined.
|
|
6
8
|
*/
|
|
7
9
|
export declare function cliInstallCommand(): string | undefined;
|
|
8
10
|
/**
|
|
@@ -28,11 +30,14 @@ export declare function versionToAutoUpgrade(): string | undefined;
|
|
|
28
30
|
export declare function warnIfUpgradeAvailable(): Promise<void>;
|
|
29
31
|
/**
|
|
30
32
|
* Generates a message to remind the user to update the CLI.
|
|
33
|
+
* For major version bumps, appends a link to the GitHub release notes so users
|
|
34
|
+
* can review breaking changes before deciding to upgrade.
|
|
31
35
|
*
|
|
32
36
|
* @param version - The version to update to.
|
|
37
|
+
* @param isMajor - Whether the version bump is a major version change.
|
|
33
38
|
* @returns The message to remind the user to update the CLI.
|
|
34
39
|
*/
|
|
35
|
-
export declare function getOutputUpdateCLIReminder(version: string): string;
|
|
40
|
+
export declare function getOutputUpdateCLIReminder(version: string, isMajor?: boolean): string;
|
|
36
41
|
/**
|
|
37
42
|
* Prompts the user to enable or disable automatic upgrades, then persists their choice.
|
|
38
43
|
*
|
|
@@ -8,11 +8,12 @@ import { renderConfirmationPrompt } from './ui.js';
|
|
|
8
8
|
import { isPreReleaseVersion } from './version.js';
|
|
9
9
|
import { getAutoUpgradeEnabled, setAutoUpgradeEnabled, runAtMinimumInterval } from '../../private/node/conf-store.js';
|
|
10
10
|
import { CLI_KIT_VERSION } from '../common/version.js';
|
|
11
|
+
export { getAutoUpgradeEnabled, setAutoUpgradeEnabled };
|
|
11
12
|
/**
|
|
12
13
|
* Utility function for generating an install command for the user to run
|
|
13
14
|
* to install an updated version of Shopify CLI.
|
|
14
15
|
*
|
|
15
|
-
* @returns A string with the command to run.
|
|
16
|
+
* @returns A string with the command to run, or undefined if the package manager cannot be determined.
|
|
16
17
|
*/
|
|
17
18
|
export function cliInstallCommand() {
|
|
18
19
|
const packageManager = inferPackageManagerForGlobalCLI();
|
|
@@ -42,7 +43,7 @@ export async function runCLIUpgrade() {
|
|
|
42
43
|
// Check if we are running in a global context if not, return
|
|
43
44
|
const isGlobal = currentProcessIsGlobal();
|
|
44
45
|
// Don't auto-upgrade for development mode
|
|
45
|
-
if (
|
|
46
|
+
if (isDevelopment()) {
|
|
46
47
|
outputInfo('Skipping upgrade in development mode.');
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
@@ -115,16 +116,25 @@ export async function warnIfUpgradeAvailable() {
|
|
|
115
116
|
}
|
|
116
117
|
/**
|
|
117
118
|
* Generates a message to remind the user to update the CLI.
|
|
119
|
+
* For major version bumps, appends a link to the GitHub release notes so users
|
|
120
|
+
* can review breaking changes before deciding to upgrade.
|
|
118
121
|
*
|
|
119
122
|
* @param version - The version to update to.
|
|
123
|
+
* @param isMajor - Whether the version bump is a major version change.
|
|
120
124
|
* @returns The message to remind the user to update the CLI.
|
|
121
125
|
*/
|
|
122
|
-
export function getOutputUpdateCLIReminder(version) {
|
|
126
|
+
export function getOutputUpdateCLIReminder(version, isMajor = false) {
|
|
123
127
|
const installCommand = cliInstallCommand();
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
+
const base = installCommand
|
|
129
|
+
? outputContent `💡 Version ${version} available! Run ${outputToken.genericShellCommand(installCommand)}`.value
|
|
130
|
+
: outputContent `💡 Version ${version} available!`.value;
|
|
131
|
+
if (isMajor) {
|
|
132
|
+
const releaseUrl = `https://github.com/Shopify/cli/releases/tag/${version}`;
|
|
133
|
+
const majorNotice = outputContent `⚠️ This is a major version — review breaking changes before upgrading:\n ${outputToken.link(releaseUrl, releaseUrl)}`
|
|
134
|
+
.value;
|
|
135
|
+
return `${base}\n\n${majorNotice}`;
|
|
136
|
+
}
|
|
137
|
+
return base;
|
|
128
138
|
}
|
|
129
139
|
/**
|
|
130
140
|
* Prompts the user to enable or disable automatic upgrades, then persists their choice.
|
|
@@ -132,6 +142,9 @@ export function getOutputUpdateCLIReminder(version) {
|
|
|
132
142
|
* @returns Whether the user chose to enable auto-upgrade.
|
|
133
143
|
*/
|
|
134
144
|
export async function promptAutoUpgrade() {
|
|
145
|
+
const current = getAutoUpgradeEnabled();
|
|
146
|
+
if (current !== undefined)
|
|
147
|
+
return current;
|
|
135
148
|
const enabled = await renderConfirmationPrompt({
|
|
136
149
|
message: 'Enable automatic updates for Shopify CLI?',
|
|
137
150
|
confirmationMessage: 'Yes, automatically update',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../../src/public/node/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAC,sBAAsB,EAAE,+BAA+B,EAAE,aAAa,EAAC,MAAM,gBAAgB,CAAA;AACrG,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EAExB,kBAAkB,EAElB,cAAc,EACd,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAC,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAC,MAAM,aAAa,CAAA;AAC3F,OAAO,EAAC,GAAG,EAAE,eAAe,EAAE,YAAY,EAAC,MAAM,WAAW,CAAA;AAC5D,OAAO,EAAC,IAAI,EAAE,IAAI,EAAC,MAAM,aAAa,CAAA;AACtC,OAAO,EAAC,wBAAwB,EAAC,MAAM,SAAS,CAAA;AAChD,OAAO,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAA;AAChD,OAAO,EAAC,qBAAqB,EAAE,qBAAqB,EAAE,oBAAoB,EAAC,MAAM,kCAAkC,CAAA;AACnH,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAA;AAEpD;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,cAAc,GAAG,+BAA+B,EAAE,CAAA;IACxD,IAAI,CAAC,cAAc,IAAI,cAAc,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IAErE,IAAI,cAAc,KAAK,UAAU,EAAE,CA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BAAkB,CAAC,gBAAgB,EAAE;YACzC,cAAc,EAAE,MAAM,iBAAiB,CAAC,SAAS,CAAC;YAClD,IAAI,EAAE,OAAO;YACb,SAAS;YACT,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,kBAAkB,EAAE,iBAAiB;SACtC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,aAAa;IAC1B,OAAO,CAAC,MAAM,mBAAmB,EAAE,CAAC,CAAC,IAAI,CAAA;AAC3C,CAAC;AAED,KAAK,UAAU,YAAY;IACzB,OAAO,CAAC,MAAM,mBAAmB,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,IAAI,EAAE,CAAA;AAC5D,CAAC;AAGD,IAAI,oBAAqD,CAAA;AAEzD,KAAK,UAAU,mBAAmB;IAChC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC1B,MAAM,WAAW,GAAG,MAAM,wBAAwB,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;QACpF,oBAAoB,GAAG,oBAAoB,IAAK,WAAW,CAAC,OAA+B,CAAA;IAC7F,CAAC;IACD,OAAO,oBAAoB,CAAA;AAC7B,CAAC;AAED,SAAS,wBAAwB,CAAC,cAAsB;IACtD,UAAU,CAAC,aAAa,CAAA,iCAAiC,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAA;AACrH,CAAC;AAED,SAAS,oBAAoB,CAAC,cAAsB,EAAE,aAAqB;IACzE,UAAU,CACR,aAAa,CAAA,sBAAsB,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CACnH,CAAA;AACH,CAAC","sourcesContent":["import {isDevelopment} from './context/local.js'\nimport {currentProcessIsGlobal, inferPackageManagerForGlobalCLI, getProjectDir} from './is-global.js'\nimport {\n checkForCachedNewVersion,\n findUpAndReadPackageJson,\n PackageJson,\n checkForNewVersion,\n DependencyType,\n usesWorkspaces,\n addNPMDependencies,\n getPackageManager,\n} from './node-package-manager.js'\nimport {outputContent, outputDebug, outputInfo, outputToken, outputWarn} from './output.js'\nimport {cwd, moduleDirectory, sniffForPath} from './path.js'\nimport {exec, isCI} from './system.js'\nimport {renderConfirmationPrompt} from './ui.js'\nimport {isPreReleaseVersion} from './version.js'\nimport {getAutoUpgradeEnabled, setAutoUpgradeEnabled, runAtMinimumInterval} from '../../private/node/conf-store.js'\nimport {CLI_KIT_VERSION} from '../common/version.js'\n\n/**\n * Utility function for generating an install command for the user to run\n * to install an updated version of Shopify CLI.\n *\n * @returns A string with the command to run.\n */\nexport function cliInstallCommand(): string | undefined {\n const packageManager = inferPackageManagerForGlobalCLI()\n if (!packageManager || packageManager === 'unknown') return undefined\n\n if (packageManager === 'homebrew') {\n return 'brew upgrade shopify-cli'\n } else if (packageManager === 'yarn') {\n return `${packageManager} global add @shopify/cli@latest`\n } else {\n const verb = packageManager === 'pnpm' ? 'add' : 'install'\n return `${packageManager} ${verb} -g @shopify/cli@latest`\n }\n}\n\n/**\n * Runs the CLI upgrade using the appropriate package manager.\n * Determines the install command and executes it.\n *\n * @throws AbortError if the package manager or command cannot be determined.\n */\nexport async function runCLIUpgrade(): Promise<void> {\n // Path where the current project is (app/hydrogen)\n const path = sniffForPath() ?? cwd()\n const projectDir = getProjectDir(path)\n\n // Check if we are running in a global context if not, return\n const isGlobal = currentProcessIsGlobal()\n\n // Don't auto-upgrade for development mode\n if (!isGlobal && isDevelopment()) {\n outputInfo('Skipping upgrade in development mode.')\n return\n }\n\n // Generate the install command for the global CLI and execute it\n if (isGlobal) {\n const installCommand = cliInstallCommand()\n if (!installCommand) {\n throw new Error('Could not determine the package manager')\n }\n const [command, ...args] = installCommand.split(' ')\n if (!command) {\n throw new Error('Could not determine the command to run')\n }\n outputInfo(outputContent`Upgrading Shopify CLI by running: ${outputToken.genericShellCommand(installCommand)}...`)\n await exec(command, args, {stdio: 'inherit'})\n } else if (projectDir) {\n await upgradeLocalShopify(projectDir, CLI_KIT_VERSION)\n } else {\n throw new Error('Could not determine the local project directory')\n }\n}\n\n/**\n * Returns the version to auto-upgrade to, or undefined if auto-upgrade should be skipped.\n * Auto-upgrade is disabled by default and must be enabled via `shopify upgrade`.\n * Also skips for CI, pre-release versions, or when no newer version is available.\n *\n * @returns The version string to upgrade to, or undefined if no upgrade should happen.\n */\nexport function versionToAutoUpgrade(): string | undefined {\n const currentVersion = CLI_KIT_VERSION\n const newerVersion = checkForCachedNewVersion('@shopify/cli', currentVersion)\n if (!newerVersion) {\n outputDebug('Auto-upgrade: No newer version available.')\n return undefined\n }\n if (process.env.SHOPIFY_CLI_FORCE_AUTO_UPGRADE === '1') {\n outputDebug('Auto-upgrade: Forcing auto-upgrade because of SHOPIFY_CLI_FORCE_AUTO_UPGRADE.')\n return newerVersion\n }\n if (!getAutoUpgradeEnabled()) {\n outputDebug('Auto-upgrade: Skipping because auto-upgrade is not enabled.')\n return undefined\n }\n if (isCI()) {\n outputDebug('Auto-upgrade: Skipping auto-upgrade in CI.')\n return undefined\n }\n if (isPreReleaseVersion(currentVersion)) {\n outputDebug('Auto-upgrade: Skipping auto-upgrade for pre-release version.')\n return undefined\n }\n return newerVersion\n}\n\n/**\n * Shows a daily upgrade-available warning for users who have not enabled auto-upgrade.\n * Skipped in CI and for pre-release versions. When auto-upgrade is enabled this is a no-op\n * because the postrun hook will handle the upgrade directly.\n */\nexport async function warnIfUpgradeAvailable(): Promise<void> {\n if (isCI() || isPreReleaseVersion(CLI_KIT_VERSION) || getAutoUpgradeEnabled()) return\n\n const newerVersion = checkForCachedNewVersion('@shopify/cli', CLI_KIT_VERSION)\n if (!newerVersion) return\n\n await runAtMinimumInterval('warn-on-available-upgrade', {days: 1}, async () => {\n outputWarn(getOutputUpdateCLIReminder(newerVersion))\n })\n}\n\n/**\n * Generates a message to remind the user to update the CLI.\n *\n * @param version - The version to update to.\n * @returns The message to remind the user to update the CLI.\n */\nexport function getOutputUpdateCLIReminder(version: string): string {\n const installCommand = cliInstallCommand()\n if (installCommand) {\n return outputContent`💡 Version ${version} available! Run ${outputToken.genericShellCommand(installCommand)}`.value\n }\n return outputContent`💡 Version ${version} available!`.value\n}\n\n/**\n * Prompts the user to enable or disable automatic upgrades, then persists their choice.\n *\n * @returns Whether the user chose to enable auto-upgrade.\n */\nexport async function promptAutoUpgrade(): Promise<boolean> {\n const enabled = await renderConfirmationPrompt({\n message: 'Enable automatic updates for Shopify CLI?',\n confirmationMessage: 'Yes, automatically update',\n cancellationMessage: \"No, I'll update manually\",\n })\n setAutoUpgradeEnabled(enabled)\n return enabled\n}\n\nasync function upgradeLocalShopify(projectDir: string, currentVersion: string) {\n const packageJson = (await findUpAndReadPackageJson(projectDir)).content\n const packageJsonDependencies = packageJson.dependencies ?? {}\n const packageJsonDevDependencies = packageJson.devDependencies ?? {}\n const allDependencies = {...packageJsonDependencies, ...packageJsonDevDependencies}\n\n let resolvedCLIVersion = allDependencies[await cliDependency()]\n if (!resolvedCLIVersion) {\n outputDebug('Auto-upgrade: CLI dependency not found in project dependencies, skipping local upgrade.')\n return\n }\n\n if (resolvedCLIVersion.slice(0, 1).match(/[\\^~]/)) resolvedCLIVersion = currentVersion\n const newestCLIVersion = await checkForNewVersion(await cliDependency(), resolvedCLIVersion)\n\n if (newestCLIVersion) {\n outputUpgradeMessage(resolvedCLIVersion, newestCLIVersion)\n } else {\n outputWontInstallMessage(resolvedCLIVersion)\n }\n\n await installJsonDependencies('prod', packageJsonDependencies, projectDir)\n await installJsonDependencies('dev', packageJsonDevDependencies, projectDir)\n}\n\nasync function installJsonDependencies(\n depsEnv: DependencyType,\n deps: {[key: string]: string},\n directory: string,\n): Promise<void> {\n const packagesToUpdate = [await cliDependency(), ...(await oclifPlugins())]\n .filter((pkg: string): boolean => {\n const pkgRequirement: string | undefined = deps[pkg]\n return Boolean(pkgRequirement)\n })\n .map((pkg) => {\n return {name: pkg, version: 'latest'}\n })\n\n const appUsesWorkspaces = await usesWorkspaces(directory)\n\n if (packagesToUpdate.length > 0) {\n await addNPMDependencies(packagesToUpdate, {\n packageManager: await getPackageManager(directory),\n type: depsEnv,\n directory,\n stdout: process.stdout,\n stderr: process.stderr,\n addToRootDirectory: appUsesWorkspaces,\n })\n }\n}\n\nasync function cliDependency(): Promise<string> {\n return (await packageJsonContents()).name\n}\n\nasync function oclifPlugins(): Promise<string[]> {\n return (await packageJsonContents())?.oclif?.plugins ?? []\n}\n\ntype PackageJsonWithName = Omit<PackageJson, 'name'> & {name: string}\nlet _packageJsonContents: PackageJsonWithName | undefined\n\nasync function packageJsonContents(): Promise<PackageJsonWithName> {\n if (!_packageJsonContents) {\n const packageJson = await findUpAndReadPackageJson(moduleDirectory(import.meta.url))\n _packageJsonContents = _packageJsonContents ?? (packageJson.content as PackageJsonWithName)\n }\n return _packageJsonContents\n}\n\nfunction outputWontInstallMessage(currentVersion: string): void {\n outputInfo(outputContent`You're on the latest version, ${outputToken.yellow(currentVersion)}, no need to upgrade!`)\n}\n\nfunction outputUpgradeMessage(currentVersion: string, newestVersion: string): void {\n outputInfo(\n outputContent`Upgrading CLI from ${outputToken.yellow(currentVersion)} to ${outputToken.yellow(newestVersion)}...`,\n )\n}\n"]}
|
|
1
|
+
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../../src/public/node/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAC,sBAAsB,EAAE,+BAA+B,EAAE,aAAa,EAAC,MAAM,gBAAgB,CAAA;AACrG,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EAExB,kBAAkB,EAElB,cAAc,EACd,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAC,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAC,MAAM,aAAa,CAAA;AAC3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J,CAAC;AACH,CAAC;AAED,KAAK,UAAU,aAAa;IAC1B,OAAO,CAAC,MAAM,mBAAmB,EAAE,CAAC,CAAC,IAAI,CAAA;AAC3C,CAAC;AAED,KAAK,UAAU,YAAY;IACzB,OAAO,CAAC,MAAM,mBAAmB,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,IAAI,EAAE,CAAA;AAC5D,CAAC;AAGD,IAAI,oBAAqD,CAAA;AAEzD,KAAK,UAAU,mBAAmB;IAChC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC1B,MAAM,WAAW,GAAG,MAAM,wBAAwB,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;QACpF,oBAAoB,GAAG,oBAAoB,IAAK,WAAW,CAAC,OAA+B,CAAA;IAC7F,CAAC;IACD,OAAO,oBAAoB,CAAA;AAC7B,CAAC;AAED,SAAS,wBAAwB,CAAC,cAAsB;IACtD,UAAU,CAAC,aAAa,CAAA,iCAAiC,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAA;AACrH,CAAC;AAED,SAAS,oBAAoB,CAAC,cAAsB,EAAE,aAAqB;IACzE,UAAU,CACR,aAAa,CAAA,sBAAsB,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CACnH,CAAA;AACH,CAAC","sourcesContent":["import {isDevelopment} from './context/local.js'\nimport {currentProcessIsGlobal, inferPackageManagerForGlobalCLI, getProjectDir} from './is-global.js'\nimport {\n checkForCachedNewVersion,\n findUpAndReadPackageJson,\n PackageJson,\n checkForNewVersion,\n DependencyType,\n usesWorkspaces,\n addNPMDependencies,\n getPackageManager,\n} from './node-package-manager.js'\nimport {outputContent, outputDebug, outputInfo, outputToken, outputWarn} from './output.js'\nimport {cwd, moduleDirectory, sniffForPath} from './path.js'\nimport {exec, isCI} from './system.js'\nimport {renderConfirmationPrompt} from './ui.js'\nimport {isPreReleaseVersion} from './version.js'\nimport {getAutoUpgradeEnabled, setAutoUpgradeEnabled, runAtMinimumInterval} from '../../private/node/conf-store.js'\nimport {CLI_KIT_VERSION} from '../common/version.js'\n\nexport {getAutoUpgradeEnabled, setAutoUpgradeEnabled}\n\n/**\n * Utility function for generating an install command for the user to run\n * to install an updated version of Shopify CLI.\n *\n * @returns A string with the command to run, or undefined if the package manager cannot be determined.\n */\nexport function cliInstallCommand(): string | undefined {\n const packageManager = inferPackageManagerForGlobalCLI()\n if (!packageManager || packageManager === 'unknown') return undefined\n\n if (packageManager === 'homebrew') {\n return 'brew upgrade shopify-cli'\n } else if (packageManager === 'yarn') {\n return `${packageManager} global add @shopify/cli@latest`\n } else {\n const verb = packageManager === 'pnpm' ? 'add' : 'install'\n return `${packageManager} ${verb} -g @shopify/cli@latest`\n }\n}\n\n/**\n * Runs the CLI upgrade using the appropriate package manager.\n * Determines the install command and executes it.\n *\n * @throws AbortError if the package manager or command cannot be determined.\n */\nexport async function runCLIUpgrade(): Promise<void> {\n // Path where the current project is (app/hydrogen)\n const path = sniffForPath() ?? cwd()\n const projectDir = getProjectDir(path)\n\n // Check if we are running in a global context if not, return\n const isGlobal = currentProcessIsGlobal()\n\n // Don't auto-upgrade for development mode\n if (isDevelopment()) {\n outputInfo('Skipping upgrade in development mode.')\n return\n }\n\n // Generate the install command for the global CLI and execute it\n if (isGlobal) {\n const installCommand = cliInstallCommand()\n if (!installCommand) {\n throw new Error('Could not determine the package manager')\n }\n const [command, ...args] = installCommand.split(' ')\n if (!command) {\n throw new Error('Could not determine the command to run')\n }\n outputInfo(outputContent`Upgrading Shopify CLI by running: ${outputToken.genericShellCommand(installCommand)}...`)\n await exec(command, args, {stdio: 'inherit'})\n } else if (projectDir) {\n await upgradeLocalShopify(projectDir, CLI_KIT_VERSION)\n } else {\n throw new Error('Could not determine the local project directory')\n }\n}\n\n/**\n * Returns the version to auto-upgrade to, or undefined if auto-upgrade should be skipped.\n * Auto-upgrade is disabled by default and must be enabled via `shopify upgrade`.\n * Also skips for CI, pre-release versions, or when no newer version is available.\n *\n * @returns The version string to upgrade to, or undefined if no upgrade should happen.\n */\nexport function versionToAutoUpgrade(): string | undefined {\n const currentVersion = CLI_KIT_VERSION\n const newerVersion = checkForCachedNewVersion('@shopify/cli', currentVersion)\n if (!newerVersion) {\n outputDebug('Auto-upgrade: No newer version available.')\n return undefined\n }\n if (process.env.SHOPIFY_CLI_FORCE_AUTO_UPGRADE === '1') {\n outputDebug('Auto-upgrade: Forcing auto-upgrade because of SHOPIFY_CLI_FORCE_AUTO_UPGRADE.')\n return newerVersion\n }\n if (!getAutoUpgradeEnabled()) {\n outputDebug('Auto-upgrade: Skipping because auto-upgrade is not enabled.')\n return undefined\n }\n if (isCI()) {\n outputDebug('Auto-upgrade: Skipping auto-upgrade in CI.')\n return undefined\n }\n if (isPreReleaseVersion(currentVersion)) {\n outputDebug('Auto-upgrade: Skipping auto-upgrade for pre-release version.')\n return undefined\n }\n return newerVersion\n}\n\n/**\n * Shows a daily upgrade-available warning for users who have not enabled auto-upgrade.\n * Skipped in CI and for pre-release versions. When auto-upgrade is enabled this is a no-op\n * because the postrun hook will handle the upgrade directly.\n */\nexport async function warnIfUpgradeAvailable(): Promise<void> {\n if (isCI() || isPreReleaseVersion(CLI_KIT_VERSION) || getAutoUpgradeEnabled()) return\n\n const newerVersion = checkForCachedNewVersion('@shopify/cli', CLI_KIT_VERSION)\n if (!newerVersion) return\n\n await runAtMinimumInterval('warn-on-available-upgrade', {days: 1}, async () => {\n outputWarn(getOutputUpdateCLIReminder(newerVersion))\n })\n}\n\n/**\n * Generates a message to remind the user to update the CLI.\n * For major version bumps, appends a link to the GitHub release notes so users\n * can review breaking changes before deciding to upgrade.\n *\n * @param version - The version to update to.\n * @param isMajor - Whether the version bump is a major version change.\n * @returns The message to remind the user to update the CLI.\n */\nexport function getOutputUpdateCLIReminder(version: string, isMajor = false): string {\n const installCommand = cliInstallCommand()\n const base = installCommand\n ? outputContent`💡 Version ${version} available! Run ${outputToken.genericShellCommand(installCommand)}`.value\n : outputContent`💡 Version ${version} available!`.value\n\n if (isMajor) {\n const releaseUrl = `https://github.com/Shopify/cli/releases/tag/${version}`\n const majorNotice =\n outputContent`⚠️ This is a major version — review breaking changes before upgrading:\\n ${outputToken.link(releaseUrl, releaseUrl)}`\n .value\n return `${base}\\n\\n${majorNotice}`\n }\n\n return base\n}\n\n/**\n * Prompts the user to enable or disable automatic upgrades, then persists their choice.\n *\n * @returns Whether the user chose to enable auto-upgrade.\n */\nexport async function promptAutoUpgrade(): Promise<boolean> {\n const current = getAutoUpgradeEnabled()\n if (current !== undefined) return current\n\n const enabled = await renderConfirmationPrompt({\n message: 'Enable automatic updates for Shopify CLI?',\n confirmationMessage: 'Yes, automatically update',\n cancellationMessage: \"No, I'll update manually\",\n })\n setAutoUpgradeEnabled(enabled)\n return enabled\n}\n\nasync function upgradeLocalShopify(projectDir: string, currentVersion: string) {\n const packageJson = (await findUpAndReadPackageJson(projectDir)).content\n const packageJsonDependencies = packageJson.dependencies ?? {}\n const packageJsonDevDependencies = packageJson.devDependencies ?? {}\n const allDependencies = {...packageJsonDependencies, ...packageJsonDevDependencies}\n\n let resolvedCLIVersion = allDependencies[await cliDependency()]\n if (!resolvedCLIVersion) {\n outputDebug('Auto-upgrade: CLI dependency not found in project dependencies, skipping local upgrade.')\n return\n }\n\n if (resolvedCLIVersion.slice(0, 1).match(/[\\^~]/)) resolvedCLIVersion = currentVersion\n const newestCLIVersion = await checkForNewVersion(await cliDependency(), resolvedCLIVersion)\n\n if (newestCLIVersion) {\n outputUpgradeMessage(resolvedCLIVersion, newestCLIVersion)\n } else {\n outputWontInstallMessage(resolvedCLIVersion)\n }\n\n await installJsonDependencies('prod', packageJsonDependencies, projectDir)\n await installJsonDependencies('dev', packageJsonDevDependencies, projectDir)\n}\n\nasync function installJsonDependencies(\n depsEnv: DependencyType,\n deps: {[key: string]: string},\n directory: string,\n): Promise<void> {\n const packagesToUpdate = [await cliDependency(), ...(await oclifPlugins())]\n .filter((pkg: string): boolean => {\n const pkgRequirement: string | undefined = deps[pkg]\n return Boolean(pkgRequirement)\n })\n .map((pkg) => {\n return {name: pkg, version: 'latest'}\n })\n\n const appUsesWorkspaces = await usesWorkspaces(directory)\n\n if (packagesToUpdate.length > 0) {\n await addNPMDependencies(packagesToUpdate, {\n packageManager: await getPackageManager(directory),\n type: depsEnv,\n directory,\n stdout: process.stdout,\n stderr: process.stderr,\n addToRootDirectory: appUsesWorkspaces,\n })\n }\n}\n\nasync function cliDependency(): Promise<string> {\n return (await packageJsonContents()).name\n}\n\nasync function oclifPlugins(): Promise<string[]> {\n return (await packageJsonContents())?.oclif?.plugins ?? []\n}\n\ntype PackageJsonWithName = Omit<PackageJson, 'name'> & {name: string}\nlet _packageJsonContents: PackageJsonWithName | undefined\n\nasync function packageJsonContents(): Promise<PackageJsonWithName> {\n if (!_packageJsonContents) {\n const packageJson = await findUpAndReadPackageJson(moduleDirectory(import.meta.url))\n _packageJsonContents = _packageJsonContents ?? (packageJson.content as PackageJsonWithName)\n }\n return _packageJsonContents\n}\n\nfunction outputWontInstallMessage(currentVersion: string): void {\n outputInfo(outputContent`You're on the latest version, ${outputToken.yellow(currentVersion)}, no need to upgrade!`)\n}\n\nfunction outputUpgradeMessage(currentVersion: string, newestVersion: string): void {\n outputInfo(\n outputContent`Upgrading CLI from ${outputToken.yellow(currentVersion)} to ${outputToken.yellow(newestVersion)}...`,\n )\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { assertConnectable, getIpFromHosts } from './network/index.js';
|
|
|
2
2
|
import { assertCompatibleEnvironment } from './env.js';
|
|
3
3
|
import * as ni from 'network-interfaces';
|
|
4
4
|
import fs from 'node:fs';
|
|
5
|
-
const NON_SHOP_PREFIXES = ['app', 'dev', 'shopify'];
|
|
5
|
+
const NON_SHOP_PREFIXES = ['admin', 'app', 'dev', 'shopify'];
|
|
6
6
|
const BACKEND_PORT = 8080;
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-server-2024.js","sourceRoot":"","sources":["../../../../../src/public/node/vendor/dev_server/dev-server-2024.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAA;AACpE,OAAO,EAAC,2BAA2B,EAAC,MAAM,UAAU,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,oBAAoB,CAAA;AACxC,OAAO,EAAE,MAAM,SAAS,CAAA;AAIxB,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"dev-server-2024.js","sourceRoot":"","sources":["../../../../../src/public/node/vendor/dev_server/dev-server-2024.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAA;AACpE,OAAO,EAAC,2BAA2B,EAAC,MAAM,UAAU,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,oBAAoB,CAAA;AACxC,OAAO,EAAE,MAAM,SAAS,CAAA;AAIxB,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;AAC5D,MAAM,YAAY,GAAG,IAAI,CAAA;AAEzB;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,WAAmB;IAC9C,OAAO;QACL,IAAI,EAAE,CAAC,UAAuB,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;QAC/D,GAAG,EAAE,CAAC,UAAuB,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC;KAC9D,CAAA;AACH,CAAC;AAED,SAAS,IAAI,CAAC,WAAmB,EAAE,UAAuB,EAAE;IAC1D,2BAA2B,EAAE,CAC5B;IAAA,CAAC,qBAAqB,IAAI,iBAAiB,CAAC,C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SAAS,kBAAkB,CAAC,IAAY;IACtC,IAAI,IAAY,CAAA;IAChB,IAAI,CAAC;QACH,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,2BAA2B,IAAI,UAAU,CAAC,CAAA;IACnE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,GAAG,GAAG,IAAI,4BAA4B,CAAA;IAC5C,CAAC;IAED,IAAI,CAAC;QACH,OAAO,cAAc,CAAC,IAAI,CAAC,CAAA;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC;AAED,oDAAoD;AACpD,IAAI,qBAA2D,CAAA;AAE/D;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAsC;IACrE,qBAAqB,GAAG,QAAQ,CAAA;AAClC,CAAC","sourcesContent":["import {assertConnectable, getIpFromHosts} from './network/index.js'\nimport {assertCompatibleEnvironment} from './env.js'\nimport * as ni from 'network-interfaces'\nimport fs from 'node:fs'\n\nimport type {HostOptions} from './types.js'\n\nconst NON_SHOP_PREFIXES = ['admin', 'app', 'dev', 'shopify']\nconst BACKEND_PORT = 8080\n\n/**\n *\n * @param projectName\n */\nexport function createServer(projectName: string) {\n return {\n host: (options: HostOptions = {}) => host(projectName, options),\n url: (options: HostOptions = {}) => url(projectName, options),\n }\n}\n\nfunction host(projectName: string, options: HostOptions = {}): string {\n assertCompatibleEnvironment()\n ;(assertRunningOverride || assertRunning2024)(projectName)\n\n const prefix = (options.nonstandardHostPrefix || projectName).replace(/_/g, '-')\n\n if (projectName === 'shopify') {\n if (prefix.endsWith('-dev-api')) {\n const shopName = prefix.replace('-dev-api', '')\n return `${shopName}.dev-api.shop.dev`\n }\n if (!NON_SHOP_PREFIXES.includes(prefix)) {\n return `${prefix}.my.shop.dev`\n }\n }\n return `${prefix}.shop.dev`\n}\n\nfunction url(projectName: string, options: HostOptions = {}): string {\n return `https://${host(projectName, options)}`\n}\n\nfunction assertRunning2024(projectName: string): void {\n assertConnectable({\n projectName,\n addr: getBackendIp(projectName),\n port: BACKEND_PORT,\n })\n}\n\nfunction getBackendIp(projectName: string): string {\n try {\n const backendIp = resolveBackendHost(projectName)\n ni.fromIp(backendIp, {internal: true, ipVersion: 4})\n\n return backendIp\n } catch (error) {\n throw new Error(`DevServer for '${projectName}' is not running: \\`dev up ${projectName}\\` to start it.`)\n }\n}\n\nfunction resolveBackendHost(name: string): string {\n let host: string\n try {\n host = fs.readlinkSync(`/opt/nginx/etc/manifest/${name}/current`)\n } catch (error) {\n host = `${name}.root.shopify.dev.internal`\n }\n\n try {\n return getIpFromHosts(host)\n } catch {\n return host\n }\n}\n\n// Allow overrides for more concise test setup. Meh.\nlet assertRunningOverride: typeof assertRunning2024 | undefined\n\n/**\n *\n * @param override\n */\nexport function setAssertRunning(override: typeof assertRunningOverride) {\n assertRunningOverride = override\n}\n"]}
|
|
@@ -2,12 +2,11 @@ import { InstantaneousMetricReader } from '../../export/InstantaneousMetricReade
|
|
|
2
2
|
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
|
|
3
3
|
import { Resource } from '@opentelemetry/resources';
|
|
4
4
|
import { AggregationTemporality, ConsoleMetricExporter, MeterProvider } from '@opentelemetry/sdk-metrics';
|
|
5
|
-
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
|
|
6
5
|
export class DefaultMeterProvider extends MeterProvider {
|
|
7
6
|
constructor({ serviceName, env, throttleLimit, useXhr, otelEndpoint }) {
|
|
8
7
|
super({
|
|
9
8
|
resource: new Resource({
|
|
10
|
-
[
|
|
9
|
+
['service.name']: serviceName,
|
|
11
10
|
}),
|
|
12
11
|
});
|
|
13
12
|
const opts = {
|
package/dist/public/node/vendor/otel-js/service/DefaultOtelService/DefaultMeterProvider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultMeterProvider.js","sourceRoot":"","sources":["../../../../../../../src/public/node/vendor/otel-js/service/DefaultOtelService/DefaultMeterProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,yBAAyB,EAAC,MAAM,2CAA2C,CAAA;AACnF,OAAO,EAAC,kBAAkB,EAA4B,MAAM,2CAA2C,CAAA;AACvG,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAC,sBAAsB,EAAE,qBAAqB,EAAE,aAAa,EAAC,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"DefaultMeterProvider.js","sourceRoot":"","sources":["../../../../../../../src/public/node/vendor/otel-js/service/DefaultOtelService/DefaultMeterProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,yBAAyB,EAAC,MAAM,2CAA2C,CAAA;AACnF,OAAO,EAAC,kBAAkB,EAA4B,MAAM,2CAA2C,CAAA;AACvG,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAC,sBAAsB,EAAE,qBAAqB,EAAE,aAAa,EAAC,MAAM,4BAA4B,CAAA;AAavG,MAAM,OAAO,oBAAqB,SAAQ,aAAa;IACrD,YAAY,EAAC,WAAW,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAA8B;QAC9F,KAAK,CAAC;YACJ,QAAQ,EAAE,IAAI,QAAQ,CAAC;gBACrB,CAAC,cAAc,CAAC,EAAE,WAAW;aAC9B,CAAC;SACH,CAAC,CAAA;QAEF,MAAM,IAAI,GAA8B;YACtC,mEAAmE;YACnE,eAAe;YACf,GAAG,EAAE,YAAY;YACjB,qBAAqB,EAAE,sBAAsB,CAAC,KAAK;SACpD,CAAA;QAED,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;QACnB,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAA;QAE7C,IAAI,CAAC,eAAe,CAClB,IAAI,yBAAyB,CAAC;YAC5B,QAAQ;YACR,aAAa;SACd,CAAC,CACH,CAAA;QAED,wEAAwE;QACxE,IAAI,GAAG,KAAK,KAAK,EAAE,CAAC;YAClB,IAAI,CAAC,eAAe,CAClB,IAAI,yBAAyB,CAAC;gBAC5B,QAAQ,EAAE,IAAI,qBAAqB,EAAE;gBACrC,aAAa;aACd,CAAC,CACH,CAAA;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import {InstantaneousMetricReader} from '../../export/InstantaneousMetricReader.js'\nimport {OTLPMetricExporter, OTLPMetricExporterOptions} from '@opentelemetry/exporter-metrics-otlp-http'\nimport {Resource} from '@opentelemetry/resources'\nimport {AggregationTemporality, ConsoleMetricExporter, MeterProvider} from '@opentelemetry/sdk-metrics'\n\nexport type Environment = 'production' | 'staging' | 'local'\n\ninterface DefaultMeterProviderOptions {\n serviceName: string\n env: string\n throttleLimit: number\n useXhr: boolean\n // CLI addition\n otelEndpoint: string\n}\n\nexport class DefaultMeterProvider extends MeterProvider {\n constructor({serviceName, env, throttleLimit, useXhr, otelEndpoint}: DefaultMeterProviderOptions) {\n super({\n resource: new Resource({\n ['service.name']: serviceName,\n }),\n })\n\n const opts: OTLPMetricExporterOptions = {\n // url: OTEL_ENDPOINTS[env as Environment] || OTEL_ENDPOINTS.local,\n // CLI addition\n url: otelEndpoint,\n temporalityPreference: AggregationTemporality.DELTA,\n }\n\n if (useXhr) {\n opts.headers = {}\n }\n\n const exporter = new OTLPMetricExporter(opts)\n\n this.addMetricReader(\n new InstantaneousMetricReader({\n exporter,\n throttleLimit,\n }),\n )\n\n // Add a console exporter to see what we are sending in dev environments\n if (env === 'dev') {\n this.addMetricReader(\n new InstantaneousMetricReader({\n exporter: new ConsoleMetricExporter(),\n throttleLimit,\n }),\n )\n }\n }\n}\n"]}
|