@shopify/cli-kit 3.23.0 → 3.25.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 (110) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +1 -1
  3. package/dist/api/graphql/functions/app_function_set.d.ts +1 -0
  4. package/dist/api/graphql/functions/app_function_set.js +2 -0
  5. package/dist/api/graphql/functions/app_function_set.js.map +1 -1
  6. package/dist/error.d.ts +9 -7
  7. package/dist/error.js +5 -4
  8. package/dist/error.js.map +1 -1
  9. package/dist/index.d.ts +0 -1
  10. package/dist/index.js +0 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/output.d.ts +1 -0
  13. package/dist/output.js +2 -15
  14. package/dist/output.js.map +1 -1
  15. package/dist/path.d.ts +0 -1
  16. package/dist/plugins.d.ts +3 -3
  17. package/dist/plugins.js +1 -1
  18. package/dist/plugins.js.map +1 -1
  19. package/dist/private/node/ui/components/Alert.d.ts +5 -5
  20. package/dist/private/node/ui/components/Alert.js +3 -3
  21. package/dist/private/node/ui/components/Alert.js.map +1 -1
  22. package/dist/private/node/ui/components/Alert.test.d.ts +1 -0
  23. package/dist/private/node/ui/components/Alert.test.js +95 -0
  24. package/dist/private/node/ui/components/Alert.test.js.map +1 -0
  25. package/dist/private/node/ui/components/Banner.d.ts +1 -0
  26. package/dist/private/node/ui/components/Banner.js +12 -13
  27. package/dist/private/node/ui/components/Banner.js.map +1 -1
  28. package/dist/private/node/ui/components/Banner.test.d.ts +1 -0
  29. package/dist/private/node/ui/components/Banner.test.js +52 -0
  30. package/dist/private/node/ui/components/Banner.test.js.map +1 -0
  31. package/dist/private/node/ui/components/Command.test.d.ts +1 -0
  32. package/dist/private/node/ui/components/Command.test.js +11 -0
  33. package/dist/private/node/ui/components/Command.test.js.map +1 -0
  34. package/dist/private/node/ui/components/ConcurrentOutput.js +11 -17
  35. package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
  36. package/dist/private/node/ui/components/FatalError.js +5 -2
  37. package/dist/private/node/ui/components/FatalError.js.map +1 -1
  38. package/dist/private/node/ui/components/FatalError.test.d.ts +1 -0
  39. package/dist/private/node/ui/components/FatalError.test.js +119 -0
  40. package/dist/private/node/ui/components/FatalError.test.js.map +1 -0
  41. package/dist/private/node/ui/components/FilePath.d.ts +9 -0
  42. package/dist/private/node/ui/components/FilePath.js +13 -0
  43. package/dist/private/node/ui/components/FilePath.js.map +1 -0
  44. package/dist/private/node/ui/components/FilePath.test.d.ts +1 -0
  45. package/dist/private/node/ui/components/FilePath.test.js +11 -0
  46. package/dist/private/node/ui/components/FilePath.test.js.map +1 -0
  47. package/dist/private/node/ui/components/Link.js +6 -5
  48. package/dist/private/node/ui/components/Link.js.map +1 -1
  49. package/dist/private/node/ui/components/Link.test.d.ts +1 -0
  50. package/dist/private/node/ui/components/Link.test.js +22 -0
  51. package/dist/private/node/ui/components/Link.test.js.map +1 -0
  52. package/dist/private/node/ui/components/List.d.ts +3 -3
  53. package/dist/private/node/ui/components/List.js +2 -2
  54. package/dist/private/node/ui/components/List.js.map +1 -1
  55. package/dist/private/node/ui/components/List.test.d.ts +1 -0
  56. package/dist/private/node/ui/components/List.test.js +34 -0
  57. package/dist/private/node/ui/components/List.test.js.map +1 -0
  58. package/dist/private/node/ui/components/TokenizedText.d.ts +18 -3
  59. package/dist/private/node/ui/components/TokenizedText.js +49 -5
  60. package/dist/private/node/ui/components/TokenizedText.js.map +1 -1
  61. package/dist/private/node/ui/components/TokenizedText.test.d.ts +1 -0
  62. package/dist/private/node/ui/components/TokenizedText.test.js +44 -0
  63. package/dist/private/node/ui/components/TokenizedText.test.js.map +1 -0
  64. package/dist/private/node/ui/components/UserInput.d.ts +10 -0
  65. package/dist/private/node/ui/components/UserInput.js +11 -0
  66. package/dist/private/node/ui/components/UserInput.js.map +1 -0
  67. package/dist/private/node/ui/components/UserInput.test.d.ts +1 -0
  68. package/dist/private/node/ui/components/UserInput.test.js +11 -0
  69. package/dist/private/node/ui/components/UserInput.test.js.map +1 -0
  70. package/dist/private/node/ui/error.d.ts +0 -2
  71. package/dist/private/node/ui/error.js +0 -4
  72. package/dist/private/node/ui/error.js.map +1 -1
  73. package/dist/private/node/ui.d.ts +2 -1
  74. package/dist/private/node/ui.js +3 -2
  75. package/dist/private/node/ui.js.map +1 -1
  76. package/dist/public/common/string.d.ts +4 -2
  77. package/dist/public/common/string.js +54 -5
  78. package/dist/public/common/string.js.map +1 -1
  79. package/dist/public/node/fs.d.ts +3 -0
  80. package/dist/public/node/fs.js +2 -2
  81. package/dist/public/node/fs.js.map +1 -1
  82. package/dist/public/node/github.d.ts +50 -0
  83. package/dist/{github.js → public/node/github.js} +29 -14
  84. package/dist/public/node/github.js.map +1 -0
  85. package/dist/public/node/node-package-manager.d.ts +4 -1
  86. package/dist/public/node/node-package-manager.js +3 -1
  87. package/dist/public/node/node-package-manager.js.map +1 -1
  88. package/dist/public/node/plugins/tunnel.d.ts +1 -1
  89. package/dist/public/node/plugins/tunnel.js +1 -1
  90. package/dist/public/node/plugins/tunnel.js.map +1 -1
  91. package/dist/public/{common → node}/result.d.ts +12 -6
  92. package/dist/public/{common → node}/result.js +28 -5
  93. package/dist/public/node/result.js.map +1 -0
  94. package/dist/public/node/ui.d.ts +3 -16
  95. package/dist/public/node/ui.js +3 -20
  96. package/dist/public/node/ui.js.map +1 -1
  97. package/dist/session/exchange.d.ts +1 -1
  98. package/dist/session/exchange.js +4 -4
  99. package/dist/session/exchange.js.map +1 -1
  100. package/dist/tsconfig.tsbuildinfo +1 -1
  101. package/dist/ui.d.ts +13 -2
  102. package/dist/ui.js.map +1 -1
  103. package/dist/version.d.ts +0 -1
  104. package/package.json +56 -55
  105. package/dist/github.d.ts +0 -33
  106. package/dist/github.js.map +0 -1
  107. package/dist/private/node/ui/components/Error.d.ts +0 -8
  108. package/dist/private/node/ui/components/Error.js +0 -13
  109. package/dist/private/node/ui/components/Error.js.map +0 -1
  110. package/dist/public/common/result.js.map +0 -1
package/dist/ui.d.ts CHANGED
@@ -2,16 +2,27 @@ import { Listr as OriginalListr, ListrTask, ListrBaseClassOptions } from 'listr2
2
2
  export declare function newListr(tasks: ListrTask[], options?: object | ListrBaseClassOptions): OriginalListr<any, any, "verbose">;
3
3
  export declare type ListrTasks = ConstructorParameters<typeof OriginalListr>[0];
4
4
  export type { ListrTaskWrapper, ListrDefaultRenderer, ListrTask } from 'listr2';
5
- export interface Question<TName extends string = string> {
5
+ interface BaseQuestion<TName extends string> {
6
6
  name: TName;
7
7
  message: string;
8
8
  preface?: string;
9
9
  validate?: (value: string) => string | true;
10
10
  default?: string;
11
11
  result?: (value: string) => string | boolean;
12
- type: 'input' | 'select' | 'autocomplete' | 'password';
13
12
  choices?: QuestionChoiceType[];
14
13
  }
14
+ declare type TextQuestion<TName extends string> = BaseQuestion<TName> & {
15
+ type: 'input';
16
+ default: string;
17
+ };
18
+ declare type PasswordQuestion<TName extends string> = BaseQuestion<TName> & {
19
+ type: 'password';
20
+ };
21
+ declare type SelectableQuestion<TName extends string> = BaseQuestion<TName> & {
22
+ type: 'select' | 'autocomplete';
23
+ choices: QuestionChoiceType[];
24
+ };
25
+ export declare type Question<TName extends string = string> = TextQuestion<TName> | SelectableQuestion<TName> | PasswordQuestion<TName>;
15
26
  export interface QuestionChoiceType {
16
27
  name: string;
17
28
  value: string;
package/dist/ui.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,KAAK,EAAE,WAAW,EAAC,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,WAAW,CAAA;AACxC,OAAO,EAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAmB,gBAAgB,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAChH,OAAO,MAAM,MAAM,yBAAyB,CAAA;AAC5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AAsB,oBAAoB,IAAI,2DAA2D,oBAAoB,4BAA4B;YACrK,OAAO,EAAE,OAAO;SACjB;KACF,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,CAAA;AAClC,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,IAAI,EAAE;IACjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,CAAC,MAAc,EAAE,EAAE;YACjC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;YAC/B,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;YAErB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YAEhC,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE;gBAClC,KAAK,CAAC,wCAAwC,CAAC,CAAA;gBAC/C,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC,CAAA;aAC1B;YACD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QAC3B,CAAC,CAAA;QAED,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAA;QACtB,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QAC9B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import {CancelExecution, Abort, AbortSilent} from './error.js'\nimport {remove, exists} from './file.js'\nimport {info, completed, content, token, logUpdate, Message, Logger, stringifyMessage, debug} from './output.js'\nimport colors from './public/node/colors.js'\nimport {relative} from './path.js'\nimport {isTerminalInteractive} from './environment/local.js'\nimport {mapper as mapperUI, run as executorUI} from './ui/executor.js'\nimport {logToFile} from './log.js'\nimport {Listr as OriginalListr, ListrTask, ListrEvent, ListrTaskState, ListrBaseClassOptions} from 'listr2'\nimport findProcess from 'find-process'\n\nexport function newListr(tasks: ListrTask[], options?: object | ListrBaseClassOptions) {\n const listr = new OriginalListr(tasks, options)\n listr.tasks.forEach((task) => {\n const loggedSubtaskTitles: string[] = []\n task.subscribe((event: ListrEvent) => {\n if (event.type === 'TITLE' && typeof event.data === 'string') {\n logToFile(event.data, 'INFO')\n }\n })\n task.renderHook$.subscribe(() => {\n if (task.hasSubtasks()) {\n const activeSubtasks = task.subtasks.filter((subtask) => {\n return [ListrTaskState.PENDING, ListrTaskState.COMPLETED].includes(subtask.state as ListrTaskState)\n })\n activeSubtasks.forEach((subtask) => {\n if (subtask.title && !loggedSubtaskTitles.includes(subtask.title)) {\n loggedSubtaskTitles.push(subtask.title)\n logToFile(subtask.title, 'INFO')\n }\n })\n }\n })\n })\n return listr\n}\n\nexport type ListrTasks = ConstructorParameters<typeof OriginalListr>[0]\nexport type {ListrTaskWrapper, ListrDefaultRenderer, ListrTask} from 'listr2'\n\nexport interface Question<TName extends string = string> {\n name: TName\n message: string\n preface?: string\n validate?: (value: string) => string | true\n default?: string\n result?: (value: string) => string | boolean\n type: 'input' | 'select' | 'autocomplete' | 'password'\n choices?: QuestionChoiceType[]\n}\n\nexport interface QuestionChoiceType {\n name: string\n value: string\n group?: {name: string; order: number}\n}\n\nconst started = (content: Message, logger: Logger) => {\n const message = `${colors.yellow('❯')} ${stringifyMessage(content)}`\n info(message, logger)\n}\n\nconst failed = (content: Message, logger: Logger) => {\n const message = `${colors.red('✖')} ${stringifyMessage(content)}`\n info(message, logger)\n}\n\n/**\n * Performs a task with the title kept up to date and stdout available to the\n * task while it runs (there is no re-writing stdout while the task runs).\n */\nexport interface TaskOptions {\n title: string\n task: () => Promise<void | {successMessage: string}>\n}\nexport const task = async ({title, task}: TaskOptions) => {\n let success\n started(title, logUpdate)\n try {\n const result = await task()\n success = result?.successMessage || title\n } catch (err) {\n failed(title, logUpdate)\n logUpdate.done()\n throw err\n }\n completed(success, logUpdate)\n logUpdate.done()\n}\nexport const prompt = async <\n TName extends string & keyof TAnswers,\n TAnswers extends {[key in TName]: string} = {[key in TName]: string},\n>(\n questions: ReadonlyArray<Question<TName>>,\n): Promise<TAnswers> => {\n if (!isTerminalInteractive() && questions.length !== 0) {\n throw new Abort(content`\nThe CLI prompted in a non-interactive terminal with the following questions:\n${token.json(questions)}\n `)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const mappedQuestions: any[] = questions.map(mapperUI)\n const value = {} as TAnswers\n for (const question of mappedQuestions) {\n if (question.preface) {\n info(question.preface)\n }\n\n // eslint-disable-next-line no-await-in-loop\n value[question.name as TName] = await executorUI(question)\n\n logPromptResults(question.message, value[question.name as TName])\n }\n return value\n}\n\nfunction logPromptResults(questionName: string, answer: string) {\n logToFile([questionName, answer].join(' '), 'INFO')\n}\n\nexport async function nonEmptyDirectoryPrompt(directory: string) {\n if (await exists(directory)) {\n const options = [\n {name: 'No, don’t delete the files', value: 'abort'},\n {name: 'Yes, delete the files', value: 'overwrite'},\n ]\n\n const relativeDirectory = relative(process.cwd(), directory)\n\n const questions: Question<'value'> = {\n type: 'select',\n name: 'value',\n message: `${relativeDirectory} is not an empty directory. Do you want to delete the existing files and continue?`,\n choices: options,\n }\n\n const choice = await prompt([questions])\n\n if (choice.value === 'abort') {\n throw new CancelExecution()\n }\n\n await remove(directory)\n }\n}\n\nexport async function terminateBlockingPortProcessPrompt(port: number, stepDescription?: string): Promise<boolean> {\n const stepDescriptionContent = stepDescription ?? 'current step'\n\n const processInfo = await findProcess('port', port)\n const formattedProcessName =\n processInfo && processInfo.length > 0 && processInfo[0]?.name\n ? ` ${content`${token.italic(`(${processInfo[0].name})`)}`.value}`\n : ''\n\n const options = [\n {name: 'Yes, terminate process in order to log in now', value: 'finish'},\n {name: `No, cancel command and try later`, value: 'cancel'},\n ]\n\n const choice = await prompt([\n {\n type: 'select',\n name: 'value',\n message: `${stepDescriptionContent} requires a port ${port} that's unavailable because it's running another process${formattedProcessName}. Terminate that process? `,\n choices: options,\n },\n ])\n return choice.value === 'finish'\n}\n\nexport const keypress = async () => {\n return new Promise((resolve, reject) => {\n const handler = (buffer: Buffer) => {\n process.stdin.setRawMode(false)\n process.stdin.pause()\n\n const bytes = Array.from(buffer)\n\n if (bytes.length && bytes[0] === 3) {\n debug('Canceled keypress, User pressed CTRL+C')\n reject(new AbortSilent())\n }\n process.nextTick(resolve)\n }\n\n process.stdin.resume()\n process.stdin.setRawMode(true)\n process.stdin.once('data', handler)\n })\n}\n"]}
1
+ {"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,KAAK,EAAE,WAAW,EAAC,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,WAAW,CAAA;AACxC,OAAO,EAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAmB,gBAAgB,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAChH,OAAO,MAAM,MAAM,yBAAyB,CAAA;AAC5C,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAA;AAClC,OAAO,EAAC,qBAAqB,EAAC,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAC,MAAM,IAAI,QAAQ,EAAE,GAAG,IAAI,UAAU,EAAC,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAA;AAClC,OAAO,EAAC,KAAK,IAAI,aAAa,EAAyB,cAAc,EAAwB,MAAM,QAAQ,CAAA;AAC3G,OAAO,WAAW,MAAM,cAAc,CAAA;AAEtC,MAAM,UAAU,QAAQ,CAAC,KAAkB,EAAE,OAAwC;IACnF,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAC/C,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CA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C,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE;gBAClC,KAAK,CAAC,wCAAwC,CAAC,CAAA;gBAC/C,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC,CAAA;aAC1B;YACD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QAC3B,CAAC,CAAA;QAED,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAA;QACtB,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QAC9B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import {CancelExecution, Abort, AbortSilent} from './error.js'\nimport {remove, exists} from './file.js'\nimport {info, completed, content, token, logUpdate, Message, Logger, stringifyMessage, debug} from './output.js'\nimport colors from './public/node/colors.js'\nimport {relative} from './path.js'\nimport {isTerminalInteractive} from './environment/local.js'\nimport {mapper as mapperUI, run as executorUI} from './ui/executor.js'\nimport {logToFile} from './log.js'\nimport {Listr as OriginalListr, ListrTask, ListrEvent, ListrTaskState, ListrBaseClassOptions} from 'listr2'\nimport findProcess from 'find-process'\n\nexport function newListr(tasks: ListrTask[], options?: object | ListrBaseClassOptions) {\n const listr = new OriginalListr(tasks, options)\n listr.tasks.forEach((task) => {\n const loggedSubtaskTitles: string[] = []\n task.subscribe((event: ListrEvent) => {\n if (event.type === 'TITLE' && typeof event.data === 'string') {\n logToFile(event.data, 'INFO')\n }\n })\n task.renderHook$.subscribe(() => {\n if (task.hasSubtasks()) {\n const activeSubtasks = task.subtasks.filter((subtask) => {\n return [ListrTaskState.PENDING, ListrTaskState.COMPLETED].includes(subtask.state as ListrTaskState)\n })\n activeSubtasks.forEach((subtask) => {\n if (subtask.title && !loggedSubtaskTitles.includes(subtask.title)) {\n loggedSubtaskTitles.push(subtask.title)\n logToFile(subtask.title, 'INFO')\n }\n })\n }\n })\n })\n return listr\n}\n\nexport type ListrTasks = ConstructorParameters<typeof OriginalListr>[0]\nexport type {ListrTaskWrapper, ListrDefaultRenderer, ListrTask} from 'listr2'\ninterface BaseQuestion<TName extends string> {\n name: TName\n message: string\n preface?: string\n validate?: (value: string) => string | true\n default?: string\n result?: (value: string) => string | boolean\n choices?: QuestionChoiceType[]\n}\n\ntype TextQuestion<TName extends string> = BaseQuestion<TName> & {\n type: 'input'\n // a default is required, otherwise we'd show a prompt like 'undefined'\n default: string\n}\n\ntype PasswordQuestion<TName extends string> = BaseQuestion<TName> & {\n type: 'password'\n}\n\ntype SelectableQuestion<TName extends string> = BaseQuestion<TName> & {\n type: 'select' | 'autocomplete'\n choices: QuestionChoiceType[]\n}\n\nexport type Question<TName extends string = string> =\n | TextQuestion<TName>\n | SelectableQuestion<TName>\n | PasswordQuestion<TName>\n\nexport interface QuestionChoiceType {\n name: string\n value: string\n group?: {name: string; order: number}\n}\n\nconst started = (content: Message, logger: Logger) => {\n const message = `${colors.yellow('❯')} ${stringifyMessage(content)}`\n info(message, logger)\n}\n\nconst failed = (content: Message, logger: Logger) => {\n const message = `${colors.red('✖')} ${stringifyMessage(content)}`\n info(message, logger)\n}\n\n/**\n * Performs a task with the title kept up to date and stdout available to the\n * task while it runs (there is no re-writing stdout while the task runs).\n */\nexport interface TaskOptions {\n title: string\n task: () => Promise<void | {successMessage: string}>\n}\nexport const task = async ({title, task}: TaskOptions) => {\n let success\n started(title, logUpdate)\n try {\n const result = await task()\n success = result?.successMessage || title\n } catch (err) {\n failed(title, logUpdate)\n logUpdate.done()\n throw err\n }\n completed(success, logUpdate)\n logUpdate.done()\n}\nexport const prompt = async <\n TName extends string & keyof TAnswers,\n TAnswers extends {[key in TName]: string} = {[key in TName]: string},\n>(\n questions: ReadonlyArray<Question<TName>>,\n): Promise<TAnswers> => {\n if (!isTerminalInteractive() && questions.length !== 0) {\n throw new Abort(content`\nThe CLI prompted in a non-interactive terminal with the following questions:\n${token.json(questions)}\n `)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const mappedQuestions: any[] = questions.map(mapperUI)\n const value = {} as TAnswers\n for (const question of mappedQuestions) {\n if (question.preface) {\n info(question.preface)\n }\n\n // eslint-disable-next-line no-await-in-loop\n value[question.name as TName] = await executorUI(question)\n\n logPromptResults(question.message, value[question.name as TName])\n }\n return value\n}\n\nfunction logPromptResults(questionName: string, answer: string) {\n logToFile([questionName, answer].join(' '), 'INFO')\n}\n\nexport async function nonEmptyDirectoryPrompt(directory: string) {\n if (await exists(directory)) {\n const options = [\n {name: 'No, don’t delete the files', value: 'abort'},\n {name: 'Yes, delete the files', value: 'overwrite'},\n ]\n\n const relativeDirectory = relative(process.cwd(), directory)\n\n const questions: Question<'value'> = {\n type: 'select',\n name: 'value',\n message: `${relativeDirectory} is not an empty directory. Do you want to delete the existing files and continue?`,\n choices: options,\n }\n\n const choice = await prompt([questions])\n\n if (choice.value === 'abort') {\n throw new CancelExecution()\n }\n\n await remove(directory)\n }\n}\n\nexport async function terminateBlockingPortProcessPrompt(port: number, stepDescription?: string): Promise<boolean> {\n const stepDescriptionContent = stepDescription ?? 'current step'\n\n const processInfo = await findProcess('port', port)\n const formattedProcessName =\n processInfo && processInfo.length > 0 && processInfo[0]?.name\n ? ` ${content`${token.italic(`(${processInfo[0].name})`)}`.value}`\n : ''\n\n const options = [\n {name: 'Yes, terminate process in order to log in now', value: 'finish'},\n {name: `No, cancel command and try later`, value: 'cancel'},\n ]\n\n const choice = await prompt([\n {\n type: 'select',\n name: 'value',\n message: `${stepDescriptionContent} requires a port ${port} that's unavailable because it's running another process${formattedProcessName}. Terminate that process? `,\n choices: options,\n },\n ])\n return choice.value === 'finish'\n}\n\nexport const keypress = async () => {\n return new Promise((resolve, reject) => {\n const handler = (buffer: Buffer) => {\n process.stdin.setRawMode(false)\n process.stdin.pause()\n\n const bytes = Array.from(buffer)\n\n if (bytes.length && bytes[0] === 3) {\n debug('Canceled keypress, User pressed CTRL+C')\n reject(new AbortSilent())\n }\n process.nextTick(resolve)\n }\n\n process.stdin.resume()\n process.stdin.setRawMode(true)\n process.stdin.once('data', handler)\n })\n}\n"]}
package/dist/version.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  /**
3
2
  * Returns the latest available version of an NPM package.
4
3
  * @param name - The name of the NPM package.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopify/cli-kit",
3
- "version": "3.23.0",
3
+ "version": "3.25.0",
4
4
  "private": false,
5
5
  "description": "A set of utilities, interfaces, and models that are common across all the platform features",
6
6
  "keywords": [
@@ -63,63 +63,64 @@
63
63
  "win32"
64
64
  ],
65
65
  "dependencies": {
66
- "@bugsnag/js": "^7.16.7",
67
- "@iarna/toml": "^2.2.5",
66
+ "@bugsnag/js": "7.16.7",
67
+ "@iarna/toml": "2.2.5",
68
68
  "@oclif/core": "1.9.2",
69
- "@types/archiver": "^5.3.1",
70
- "abort-controller": "^3.0.0",
71
- "archiver": "^5.3.1",
72
- "chalk": "^5.1.0",
73
- "chalk-animation": "^2.0.3",
74
- "change-case": "^4.1.2",
75
- "color-json": "^2.0.1",
76
- "commondir": "^1.0.1",
77
- "conf": "^10.1.2",
78
- "cross-zip": "^4.0.0",
69
+ "@types/archiver": "5.3.1",
70
+ "abort-controller": "3.0.0",
71
+ "archiver": "5.3.1",
72
+ "chalk": "5.1.0",
73
+ "chalk-animation": "2.0.3",
74
+ "change-case": "4.1.2",
75
+ "color-json": "2.0.1",
76
+ "commondir": "1.0.1",
77
+ "conf": "10.1.2",
78
+ "cross-zip": "4.0.0",
79
79
  "deepmerge": "4.2.2",
80
- "del": "^6.0.0",
81
- "env-paths": "^3.0.0",
82
- "envfile": "^6.18.0",
83
- "execa": "^6.0.0",
84
- "fast-glob": "^3.2.11",
85
- "find-process": "^1.4.7",
86
- "find-up": "^6.2.0",
87
- "find-versions": "^5.0.0",
88
- "form-data": "^4.0.0",
89
- "fs-extra": "^10.0.0",
90
- "fuzzy": "^0.1.3",
91
- "get-port-please": "^2.5.0",
92
- "graphql": "^16.4.0",
93
- "graphql-request": "^4.3.0",
94
- "h3": "^0.7.21",
95
- "ink": "^3.2.0",
96
- "inquirer": "^8.2.4",
97
- "inquirer-autocomplete-prompt": "^2.0.0",
98
- "is-interactive": "^2.0.0",
99
- "keytar": "^7.9.0",
100
- "kill-port-process": "^3.1.0",
101
- "latest-version": "^6.0.0",
102
- "liquidjs": "^9.36.0",
103
- "listr2": "^4.0.5",
104
- "log-update": "^4.0.0",
105
- "macaddress": "^0.5.3",
106
- "md5-file": "^5.0.0",
107
- "node-fetch": "^3.2.4",
108
- "open": "^8.4.0",
80
+ "del": "6.0.0",
81
+ "env-paths": "3.0.0",
82
+ "envfile": "6.18.0",
83
+ "execa": "6.0.0",
84
+ "fast-glob": "3.2.11",
85
+ "find-process": "1.4.7",
86
+ "find-up": "6.2.0",
87
+ "find-versions": "5.0.0",
88
+ "form-data": "4.0.0",
89
+ "fs-extra": "10.0.0",
90
+ "fuzzy": "0.1.3",
91
+ "get-port-please": "2.5.0",
92
+ "graphql": "16.4.0",
93
+ "graphql-request": "4.3.0",
94
+ "h3": "0.7.21",
95
+ "ink": "3.2.0",
96
+ "inquirer": "8.2.4",
97
+ "inquirer-autocomplete-prompt": "2.0.0",
98
+ "is-interactive": "2.0.0",
99
+ "js-yaml": "4.1.0",
100
+ "keytar": "7.9.0",
101
+ "kill-port-process": "3.1.0",
102
+ "latest-version": "6.0.0",
103
+ "liquidjs": "9.36.0",
104
+ "listr2": "4.0.5",
105
+ "log-update": "4.0.0",
106
+ "macaddress": "0.5.3",
107
+ "md5-file": "5.0.0",
108
+ "node-fetch": "3.2.4",
109
+ "open": "8.4.0",
109
110
  "pathe": "0.2.0",
110
- "prettier": "^2.7.1",
111
- "react": "^17.0.2",
112
- "semver": "^7.3.6",
113
- "simple-git": "^3.5.0",
114
- "source-map-support": "^0.5.21",
115
- "stacktracey": "^2.1.8",
116
- "strip-ansi": "^7.0.1",
117
- "tempy": "^3.0.0",
118
- "term-size": "^3.0.1",
119
- "terminal-link": "^3.0.0",
120
- "ts-error": "^1.0.6",
121
- "unique-string": "^3.0.0",
122
- "zod": "^3.17.3"
111
+ "prettier": "2.7.1",
112
+ "react": "17.0.2",
113
+ "semver": "7.3.6",
114
+ "simple-git": "3.5.0",
115
+ "source-map-support": "0.5.21",
116
+ "stacktracey": "2.1.8",
117
+ "strip-ansi": "7.0.1",
118
+ "tempy": "3.0.0",
119
+ "term-size": "3.0.1",
120
+ "terminal-link": "3.0.0",
121
+ "ts-error": "1.0.6",
122
+ "unique-string": "3.0.0",
123
+ "zod": "3.17.3"
123
124
  },
124
125
  "devDependencies": {
125
126
  "@types/commondir": "^1.0.0",
package/dist/github.d.ts DELETED
@@ -1,33 +0,0 @@
1
- export interface GithubRelease {
2
- id: number;
3
- url: string;
4
- tag_name: string;
5
- name: string;
6
- body: string;
7
- draft: boolean;
8
- prerelease: boolean;
9
- created_at: string;
10
- published_at: string;
11
- tarball_url: string;
12
- }
13
- interface Options {
14
- filter: (release: GithubRelease) => boolean;
15
- }
16
- export declare function getLatestRelease(user: string, repo: string, { filter }?: Options): Promise<GithubRelease>;
17
- export declare function parseRepoUrl(src: string): {
18
- full: string;
19
- site: string;
20
- user: string;
21
- name: string;
22
- ref: string;
23
- subDirectory: string;
24
- ssh: string;
25
- http: string;
26
- };
27
- export interface GithubRepoReference {
28
- repoBaseUrl: string;
29
- branch?: string;
30
- filePath?: string;
31
- }
32
- export declare function parseGithubRepoReference(src: string): GithubRepoReference;
33
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAChC,OAAO,EAAC,OAAO,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAE1C,MAAM,iBA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AM,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC5D,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAErE,OAAO;QACL,WAAW,EAAE,GAAG,GAAG,CAAC,MAAM,IAAI,IAAI,IAAI,IAAI,EAAE;QAC5C,MAAM;QACN,QAAQ;KACT,CAAA;AACH,CAAC","sourcesContent":["import {fetch} from './http.js'\nimport {Abort} from './error.js'\nimport {content, debug} from './output.js'\n\nclass GitHubClientError extends Error {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(url: string, statusCode: number, bodyJson: any) {\n super(\n `The request to GitHub API URL ${url} failed with status code ${statusCode} and the following error message: ${bodyJson.message}`,\n )\n }\n}\n\nexport interface GithubRelease {\n id: number\n url: string\n tag_name: string\n name: string\n body: string\n draft: boolean\n prerelease: boolean\n created_at: string\n published_at: string\n tarball_url: string\n}\n\ninterface Options {\n filter: (release: GithubRelease) => boolean\n}\n\nexport async function getLatestRelease(\n user: string,\n repo: string,\n {filter}: Options = {filter: () => true},\n): Promise<GithubRelease> {\n debug(content`Getting the latest release of GitHub repository ${user}/${repo}...`)\n const url = `https://api.github.com/repos/${user}/${repo}/releases`\n const fetchResult = await fetch(url)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const jsonBody: any = await fetchResult.json()\n\n if (fetchResult.status !== 200) {\n throw new GitHubClientError(url, fetchResult.status, jsonBody)\n }\n\n return jsonBody.find(filter)\n}\n\nexport function parseRepoUrl(src: string) {\n const match =\n /^(?:(?:https:\\/\\/)?([^:/]+\\.[^:/]+)\\/|git@([^:/]+)[:/]|([^/]+):)?([^/\\s]+)\\/([^/\\s#]+)(?:((?:\\/[^/\\s#]+)+))?(?:\\/)?(?:#(.+))?/.exec(\n src,\n )\n\n if (!match) {\n const exampleFormats = [\n 'github:user/repo',\n 'user/repo/subdirectory',\n 'git@github.com:user/repo',\n 'user/repo#dev',\n 'https://github.com/user/repo',\n ]\n\n throw new Abort(`Parsing the url ${src} failed. Supported formats are ${exampleFormats.join(', ')}.`)\n }\n\n const site = match[1] || match[2] || match[3] || 'github.com'\n const normalizedSite = site === 'github' ? 'github.com' : site\n const user = match[4]!\n const name = match[5]!.replace(/\\.git$/, '')\n const subDirectory = match[6]?.slice(1)!\n const ref = match[7]!\n const branch = ref ? `#${ref}` : ''\n const ssh = `git@${normalizedSite}:${user}/${name}`\n const http = `https://${normalizedSite}/${user}/${name}`\n const full = ['https:/', normalizedSite, user, name, subDirectory].join('/').concat(branch)\n\n return {full, site: normalizedSite, user, name, ref, subDirectory, ssh, http}\n}\n\nexport interface GithubRepoReference {\n repoBaseUrl: string\n branch?: string\n filePath?: string\n}\n\nexport function parseGithubRepoReference(src: string): GithubRepoReference {\n const url = new URL(src)\n const branch = url.hash ? url.hash.slice(1) : undefined\n const [_, user, repo, ...repoPath] = url.pathname.split('/')\n const filePath = repoPath.length > 0 ? repoPath.join('/') : undefined\n\n return {\n repoBaseUrl: `${url.origin}/${user}/${repo}`,\n branch,\n filePath,\n }\n}\n"]}
@@ -1,8 +0,0 @@
1
- import { TextTokenItem } from './TokenizedText.js';
2
- import React from 'react';
3
- export interface ErrorProps {
4
- headline: string;
5
- tryMessage?: TextTokenItem;
6
- }
7
- declare const Error: React.FC<ErrorProps>;
8
- export { Error };
@@ -1,13 +0,0 @@
1
- import { Banner } from './Banner.js';
2
- import { TokenizedText } from './TokenizedText.js';
3
- import { Box, Text } from 'ink';
4
- import React from 'react';
5
- const Error = ({ headline, tryMessage }) => {
6
- return (React.createElement(Banner, { type: "error" },
7
- React.createElement(Box, null,
8
- React.createElement(Text, null, headline)),
9
- tryMessage && (React.createElement(Box, { marginTop: 1 },
10
- React.createElement(TokenizedText, { item: tryMessage })))));
11
- };
12
- export { Error };
13
- //# sourceMappingURL=Error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Error.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Error.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAClC,OAAO,EAAgB,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,MAAM,KAAK,GAAyB,CAAC,EAAC,QAAQ,EAAE,UAAU,EAAC,EAAE,EAAE;IAC7D,OAAO,CACL,oBAAC,MAAM,IAAC,IAAI,EAAC,OAAO;QAClB,oBAAC,GAAG;YACF,oBAAC,IAAI,QAAE,QAAQ,CAAQ,CACnB;QAEL,UAAU,IAAI,CACb,oBAAC,GAAG,IAAC,SAAS,EAAE,CAAC;YACf,oBAAC,aAAa,IAAC,IAAI,EAAE,UAAU,GAAI,CAC/B,CACP,CACM,CACV,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAC,KAAK,EAAC,CAAA","sourcesContent":["import {Banner} from './Banner.js'\nimport {TextTokenItem, TokenizedText} from './TokenizedText.js'\nimport {Box, Text} from 'ink'\nimport React from 'react'\n\nexport interface ErrorProps {\n headline: string\n tryMessage?: TextTokenItem\n}\n\nconst Error: React.FC<ErrorProps> = ({headline, tryMessage}) => {\n return (\n <Banner type=\"error\">\n <Box>\n <Text>{headline}</Text>\n </Box>\n\n {tryMessage && (\n <Box marginTop={1}>\n <TokenizedText item={tryMessage} />\n </Box>\n )}\n </Banner>\n )\n}\n\nexport {Error}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"result.js","sourceRoot":"","sources":["../../../src/public/common/result.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,EAAE,GAAG,CAAyB,KAAa,EAAsB,EAAE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,CAAe,MAAuC;QAC5D,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IAChC,CAAC;CACF","sourcesContent":["/* eslint-disable node/handle-callback-err */\nexport type Result<TValue, TError> = Ok<TValue, TError> | Err<TValue, TError>\n\n/**\n * Utility metho to create an `Ok` result from a `value`\n *\n * @param value - `value` used to crete the `Result`\n * @returns an instance of a `Ok` `Result` inferring its type\n */\nexport const ok = <TValue, TError = never>(value: TValue): Ok<TValue, TError> => new Ok(value)\n\n/**\n * Utility method to create an `Error` result from an `error`\n *\n * @param err - `error` used to crete the `Result`\n * @returns an instance of an `Error` `Result` inferring its type\n */\nexport const err = <TValue = never, TError = unknown>(err: TError): Err<TValue, TError> => new Err(err)\n\nexport class Ok<TValue, TError> {\n constructor(readonly value: TValue) {}\n\n /**\n * Check if a `Result` is an `Err` inferring its type. `!isErr()` should be used before accessing the `value`\n *\n * @returns `false` as the `Resul` is `OK`\n */\n isErr(): this is Err<TValue, TError> {\n return false\n }\n\n /**\n * Runs the `handler` method an return the same an unaltered copy of the `Result`. It could be used to log an\n * output when the result is `Ok` without breaking the flow\n *\n * @param handler - method to be run when the result is `Ok`\n * @returns a copy of the same `Result`\n */\n doOnOk(handler: (value: TValue) => void): Result<TValue, TError> {\n handler(this.value)\n return ok(this.value)\n }\n\n /**\n * A safe mode to get the `value` of the `Result`\n *\n * @returns the `value` of the `Result`\n */\n valueOrThrow(): TValue {\n return this.value\n }\n\n /**\n * Maps the value to another one with a different type. It leaves the `Error` type unaltered\n *\n * @param mapper - The mapper method to apply an `OK` value\n * @returns a new result with the new mapped value\n */\n map<TMappedValue>(mapper: (value: TValue) => TMappedValue): Result<TMappedValue, TError> {\n return ok(mapper(this.value))\n }\n\n /**\n * Maps the error type to another one. It leaves the `Ok` type and value unaltered\n *\n * @param _mapper - This mapper method is not used for an `Ok` value\n * @returns a new result with the new mapped error type and an value\n */\n mapError<TMappedError>(_mapper: (error: TError) => TMappedError): Result<TValue, TMappedError> {\n return ok(this.value)\n }\n}\n\nexport class Err<TValue, TError> {\n constructor(readonly error: TError) {}\n\n /**\n * Check if a `Result` is an `Err` inferring its type. `!isErr()` should be used before accessing the `value`\n *\n * @returns `false` as the `Resul` is `OK`\n */\n isErr(): this is Err<TValue, TError> {\n return true\n }\n\n /**\n * Return an unaltered copy of the `Error` without doing anything.\n *\n * @param _handler - This handler method is not used for an `Error`\n * @returns a copy of the same `Error`\n */\n doOnOk(_handler: (value: TValue) => void): Result<TValue, TError> {\n return err(this.error)\n }\n\n /**\n * A safe mode to throw the `error` of the `Result`\n */\n valueOrThrow(): TValue {\n throw this.error\n }\n\n /**\n * Maps the value type to another one. It leaves the `Error` unaltered\n *\n * @param _mapper - This mapper method is not used for an `Error` value\n * @returns a new result with the new value type and an unaltered error\n */\n map<TMappedValue>(_mapper: (valueOrThrow: TValue) => TMappedValue): Result<TMappedValue, TError> {\n return err(this.error)\n }\n\n /**\n * Maps the error to another one with a different type. It leaves the value type unaltered\n *\n * @param mapper - The mapper method to apply an `Error` value\n * @returns a new result with the new mapped error\n */\n mapError<TMappedError>(mapper: (error: TError) => TMappedError): Result<TValue, TMappedError> {\n return err(mapper(this.error))\n }\n}\n"]}