@shopify/cli-kit 3.38.0 → 3.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/private/common/json.d.ts +2 -2
- package/dist/private/common/lodash.d.ts +4 -4
- package/dist/private/common/ts/overloaded-parameters.d.ts +5 -5
- package/dist/private/node/api/headers.d.ts +1 -1
- package/dist/private/node/api.d.ts +1 -1
- package/dist/private/node/constants.d.ts +2 -2
- package/dist/private/node/environment/service.d.ts +1 -1
- package/dist/private/node/error-handler.d.ts +2 -0
- package/dist/private/node/error-handler.js +5 -0
- package/dist/private/node/error-handler.js.map +1 -0
- package/dist/private/node/session/exchange.d.ts +1 -1
- package/dist/private/node/session/redirect-listener.d.ts +1 -1
- package/dist/private/node/session/redirect-listener.js +5 -5
- package/dist/private/node/session/redirect-listener.js.map +1 -1
- package/dist/private/node/session/schema.d.ts +3 -3
- package/dist/private/node/session/validate.d.ts +1 -1
- package/dist/private/node/session.d.ts +4 -4
- package/dist/private/node/ui/components/AutocompletePrompt.d.ts +9 -2
- package/dist/private/node/ui/components/AutocompletePrompt.js +8 -4
- package/dist/private/node/ui/components/AutocompletePrompt.js.map +1 -1
- package/dist/private/node/ui/components/AutocompletePrompt.test.js +62 -8
- package/dist/private/node/ui/components/AutocompletePrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/Banner.d.ts +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.d.ts +2 -2
- package/dist/private/node/ui/components/SelectInput.d.ts +3 -1
- package/dist/private/node/ui/components/SelectInput.js +8 -2
- package/dist/private/node/ui/components/SelectInput.js.map +1 -1
- package/dist/private/node/ui/components/SelectInput.test.js +26 -0
- package/dist/private/node/ui/components/SelectInput.test.js.map +1 -1
- package/dist/private/node/ui/components/Table/Row.d.ts +1 -1
- package/dist/private/node/ui/components/Table/ScalarDict.d.ts +1 -1
- package/dist/private/node/ui/components/Table/Table.d.ts +1 -1
- package/dist/private/node/ui/components/Tasks.d.ts +5 -1
- package/dist/private/node/ui/components/Tasks.js +31 -6
- package/dist/private/node/ui/components/Tasks.js.map +1 -1
- package/dist/private/node/ui/components/Tasks.test.js +259 -19
- package/dist/private/node/ui/components/Tasks.test.js.map +1 -1
- package/dist/private/node/ui/components/TokenizedText.d.ts +2 -2
- package/dist/private/node/ui.d.ts +1 -1
- package/dist/public/common/string.d.ts +1 -1
- package/dist/{private → public}/common/ts/deep-required.d.ts +2 -1
- package/dist/{private → public}/common/ts/deep-required.js +0 -0
- package/dist/public/common/ts/deep-required.js.map +1 -0
- package/dist/public/common/ts/pick-by-prefix.d.ts +2 -1
- package/dist/public/common/ts/pick-by-prefix.js.map +1 -1
- package/dist/public/common/version.d.ts +1 -1
- package/dist/public/common/version.js +1 -1
- package/dist/public/common/version.js.map +1 -1
- package/dist/public/node/api/http.d.ts +1 -0
- package/dist/public/node/api/http.js +1 -1
- package/dist/public/node/archiver.d.ts +20 -6
- package/dist/public/node/archiver.js +14 -13
- package/dist/public/node/archiver.js.map +1 -1
- package/dist/public/node/crypto.d.ts +1 -1
- package/dist/public/node/dot-env.js +2 -0
- package/dist/public/node/dot-env.js.map +1 -1
- package/dist/public/node/environment/local.d.ts +1 -1
- package/dist/public/node/environment/spin.d.ts +1 -1
- package/dist/public/node/error-handler.d.ts +1 -2
- package/dist/public/node/error-handler.js +12 -2
- package/dist/public/node/error-handler.js.map +1 -1
- package/dist/public/node/fs.d.ts +24 -4
- package/dist/public/node/fs.js +31 -2
- package/dist/public/node/fs.js.map +1 -1
- package/dist/public/node/git.d.ts +9 -1
- package/dist/public/node/git.js +31 -1
- package/dist/public/node/git.js.map +1 -1
- package/dist/public/node/http.d.ts +9 -1
- package/dist/public/node/http.js +34 -0
- package/dist/public/node/http.js.map +1 -1
- package/dist/public/node/metadata.d.ts +7 -7
- package/dist/public/node/monorail.d.ts +6 -6
- package/dist/public/node/monorail.js.map +1 -1
- package/dist/public/node/node-package-manager.d.ts +5 -5
- package/dist/public/node/os.d.ts +2 -2
- package/dist/public/node/output.d.ts +4 -4
- package/dist/public/node/path.d.ts +1 -1
- package/dist/public/node/plugins/tunnel.d.ts +5 -5
- package/dist/public/node/plugins.d.ts +4 -4
- package/dist/public/node/result.d.ts +1 -1
- package/dist/public/node/ruby.d.ts +1 -1
- package/dist/public/node/session.d.ts +1 -1
- package/dist/public/node/system.d.ts +1 -1
- package/dist/public/node/ui.d.ts +10 -5
- package/dist/public/node/ui.js +4 -3
- package/dist/public/node/ui.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui.d.ts +6 -20
- package/dist/ui.js +1 -21
- package/dist/ui.js.map +1 -1
- package/package.json +6 -7
- package/dist/private/common/ts/deep-required.js.map +0 -1
- package/dist/private/node/simple-definitions.d.ts +0 -4
- package/dist/private/node/simple-definitions.js +0 -2
- package/dist/private/node/simple-definitions.js.map +0 -1
package/dist/ui.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { Listr as OriginalListr, ListrTask, ListrBaseClassOptions } from 'listr2';
|
|
2
|
-
export declare function newListr(tasks: ListrTask[], options?: object | ListrBaseClassOptions): OriginalListr<any, any, "verbose">;
|
|
3
|
-
export declare type ListrTasks = ConstructorParameters<typeof OriginalListr>[0];
|
|
4
|
-
export type { ListrTaskWrapper, ListrDefaultRenderer, ListrTask } from 'listr2';
|
|
5
1
|
export interface PromptAnswer {
|
|
6
2
|
name: string;
|
|
7
3
|
value: string;
|
|
8
4
|
}
|
|
9
|
-
export
|
|
5
|
+
export type FilterFunction = (answers: PromptAnswer[], input: string) => Promise<PromptAnswer[]>;
|
|
10
6
|
interface BaseQuestion<TName extends string> {
|
|
11
7
|
name: TName;
|
|
12
8
|
message: string;
|
|
@@ -17,18 +13,18 @@ interface BaseQuestion<TName extends string> {
|
|
|
17
13
|
choices?: QuestionChoiceType[];
|
|
18
14
|
source?: (filter: FilterFunction) => FilterFunction;
|
|
19
15
|
}
|
|
20
|
-
|
|
16
|
+
type TextQuestion<TName extends string> = BaseQuestion<TName> & {
|
|
21
17
|
type: 'input';
|
|
22
18
|
default: string;
|
|
23
19
|
};
|
|
24
|
-
|
|
20
|
+
type PasswordQuestion<TName extends string> = BaseQuestion<TName> & {
|
|
25
21
|
type: 'password';
|
|
26
22
|
};
|
|
27
|
-
|
|
23
|
+
type SelectableQuestion<TName extends string> = BaseQuestion<TName> & {
|
|
28
24
|
type: 'select' | 'autocomplete';
|
|
29
25
|
choices: QuestionChoiceType[];
|
|
30
26
|
};
|
|
31
|
-
export
|
|
27
|
+
export type Question<TName extends string = string> = TextQuestion<TName> | SelectableQuestion<TName> | PasswordQuestion<TName>;
|
|
32
28
|
export interface QuestionChoiceType {
|
|
33
29
|
name: string;
|
|
34
30
|
value: string;
|
|
@@ -37,18 +33,8 @@ export interface QuestionChoiceType {
|
|
|
37
33
|
order: number;
|
|
38
34
|
};
|
|
39
35
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Performs a task with the title kept up to date and stdout available to the
|
|
42
|
-
* task while it runs (there is no re-writing stdout while the task runs).
|
|
43
|
-
*/
|
|
44
|
-
export interface TaskOptions {
|
|
45
|
-
title: string;
|
|
46
|
-
task: () => Promise<void | {
|
|
47
|
-
successMessage: string;
|
|
48
|
-
}>;
|
|
49
|
-
}
|
|
50
|
-
export declare const task: ({ title, task }: TaskOptions) => Promise<void>;
|
|
51
36
|
export declare const prompt: <TName extends string & keyof TAnswers, TAnswers extends { [key in TName]: string; } = { [key_1 in TName]: string; }>(questions: readonly Question<TName>[]) => Promise<TAnswers>;
|
|
52
37
|
export declare function nonEmptyDirectoryPrompt(directory: string): Promise<void>;
|
|
53
38
|
export declare function terminateBlockingPortProcessPrompt(port: number, stepDescription?: string): Promise<boolean>;
|
|
54
39
|
export declare const keypress: () => Promise<unknown>;
|
|
40
|
+
export {};
|
package/dist/ui.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { CancelExecution, AbortError, AbortSilentError } from './public/node/error.js';
|
|
2
2
|
import { removeFile, fileExists } from './public/node/fs.js';
|
|
3
|
-
import { outputInfo,
|
|
3
|
+
import { outputInfo, outputContent, outputToken, stringifyMessage, outputDebug, } from './public/node/output.js';
|
|
4
4
|
import colors from './public/node/colors.js';
|
|
5
5
|
import { relativizePath } from './public/node/path.js';
|
|
6
6
|
import { isTerminalInteractive } from './public/node/environment/local.js';
|
|
7
7
|
import { run as executorUI } from './ui/executor.js';
|
|
8
|
-
import { Listr as OriginalListr } from 'listr2';
|
|
9
8
|
import findProcess from 'find-process';
|
|
10
|
-
export function newListr(tasks, options) {
|
|
11
|
-
const listr = new OriginalListr(tasks, options);
|
|
12
|
-
return listr;
|
|
13
|
-
}
|
|
14
9
|
const started = (content, logger) => {
|
|
15
10
|
const message = `${colors.yellow('❯')} ${stringifyMessage(content)}`;
|
|
16
11
|
outputInfo(message, logger);
|
|
@@ -19,21 +14,6 @@ const failed = (content, logger) => {
|
|
|
19
14
|
const message = `${colors.red('✖')} ${stringifyMessage(content)}`;
|
|
20
15
|
outputInfo(message, logger);
|
|
21
16
|
};
|
|
22
|
-
export const task = async ({ title, task }) => {
|
|
23
|
-
let success;
|
|
24
|
-
started(title, logUpdate);
|
|
25
|
-
try {
|
|
26
|
-
const result = await task();
|
|
27
|
-
success = result?.successMessage || title;
|
|
28
|
-
}
|
|
29
|
-
catch (err) {
|
|
30
|
-
failed(title, logUpdate);
|
|
31
|
-
logUpdate.done();
|
|
32
|
-
throw err;
|
|
33
|
-
}
|
|
34
|
-
outputCompleted(success, logUpdate);
|
|
35
|
-
logUpdate.done();
|
|
36
|
-
};
|
|
37
17
|
export const prompt = async (questions) => {
|
|
38
18
|
if (!isTerminalInteractive() && questions.length !== 0) {
|
|
39
19
|
throw new AbortError(outputContent `
|
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,UAAU,E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YACb,OAAO,EAAE,GAAG,sBAAsB,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,WAAW,CAAC,wCAAwC,CAAC,CAAA;gBACrD,MAAM,CAAC,IAAI,gBAAgB,EAAE,CAAC,CAAA;aAC/B;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, AbortError, AbortSilentError} from './public/node/error.js'\nimport {removeFile, fileExists} from './public/node/fs.js'\nimport {\n outputInfo,\n outputCompleted,\n outputContent,\n outputToken,\n logUpdate,\n OutputMessage,\n Logger,\n stringifyMessage,\n outputDebug,\n} from './public/node/output.js'\nimport colors from './public/node/colors.js'\nimport {relativizePath} from './public/node/path.js'\nimport {isTerminalInteractive} from './public/node/environment/local.js'\nimport {run as executorUI} from './ui/executor.js'\nimport {Listr as OriginalListr, ListrTask, 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 return listr\n}\n\nexport type ListrTasks = ConstructorParameters<typeof OriginalListr>[0]\nexport type {ListrTaskWrapper, ListrDefaultRenderer, ListrTask} from 'listr2'\n\nexport interface PromptAnswer {\n name: string\n value: string\n}\nexport type FilterFunction = (answers: PromptAnswer[], input: string) => Promise<PromptAnswer[]>\n\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 source?: (filter: FilterFunction) => FilterFunction\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: OutputMessage, logger: Logger) => {\n const message = `${colors.yellow('❯')} ${stringifyMessage(content)}`\n outputInfo(message, logger)\n}\n\nconst failed = (content: OutputMessage, logger: Logger) => {\n const message = `${colors.red('✖')} ${stringifyMessage(content)}`\n outputInfo(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 outputCompleted(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 AbortError(outputContent`\nThe CLI prompted in a non-interactive terminal with the following questions:\n${outputToken.json(questions)}\n `)\n }\n\n const value = {} as TAnswers\n for (const question of questions) {\n if (question.preface) {\n outputInfo(question.preface)\n }\n\n // eslint-disable-next-line no-await-in-loop\n value[question.name] = (await executorUI(question)) as TAnswers[TName]\n }\n return value\n}\n\nexport async function nonEmptyDirectoryPrompt(directory: string) {\n if (await fileExists(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 = relativizePath(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 removeFile(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 ? ` ${outputContent`${outputToken.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 outputDebug('Canceled keypress, User pressed CTRL+C')\n reject(new AbortSilentError())\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,UAAU,EAAE,gBAAgB,EAAC,MAAM,wBAAwB,CAAA;AACpF,OAAO,EAAC,UAAU,EAAE,UAAU,EAAC,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EACL,UAAU,EACV,aAAa,EACb,WAAW,EAGX,gBAAgB,EAChB,WAAW,GACZ,MAAM,yBAAyB,CAAA;AAChC,OAAO,MAAM,MAAM,yBAAyB,CAAA;AAC5C,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAC,qBAAqB,EAAC,MAAM,oCAAoC,CAAA;AACxE,OAAO,EAAC,GAAG,IAAI,UAAU,EAAC,MAAM,kBAAkB,CAAA;AAClD,OAAO,WAAW,MAAM,cAAc,CAAA;AA6CtC,MAAM,OAAO,GAAG,CAAC,OAAsB,EAAE,MAAc,EAAE,EAAE;IACzD,MAAM,OAAO,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAA;IACpE,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;AAC7B,CAAC,CAAA;AAED,MAAM,MAAM,GAAG,CAAC,OAAsB,EAAE,MAAc,EAAE,EAAE;IACxD,MAAM,OAAO,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,gBAAgB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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,WAAW,CAAC,wCAAwC,CAAC,CAAA;gBACrD,MAAM,CAAC,IAAI,gBAAgB,EAAE,CAAC,CAAA;aAC/B;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, AbortError, AbortSilentError} from './public/node/error.js'\nimport {removeFile, fileExists} from './public/node/fs.js'\nimport {\n outputInfo,\n outputContent,\n outputToken,\n OutputMessage,\n Logger,\n stringifyMessage,\n outputDebug,\n} from './public/node/output.js'\nimport colors from './public/node/colors.js'\nimport {relativizePath} from './public/node/path.js'\nimport {isTerminalInteractive} from './public/node/environment/local.js'\nimport {run as executorUI} from './ui/executor.js'\nimport findProcess from 'find-process'\n\nexport interface PromptAnswer {\n name: string\n value: string\n}\nexport type FilterFunction = (answers: PromptAnswer[], input: string) => Promise<PromptAnswer[]>\n\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 source?: (filter: FilterFunction) => FilterFunction\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: OutputMessage, logger: Logger) => {\n const message = `${colors.yellow('❯')} ${stringifyMessage(content)}`\n outputInfo(message, logger)\n}\n\nconst failed = (content: OutputMessage, logger: Logger) => {\n const message = `${colors.red('✖')} ${stringifyMessage(content)}`\n outputInfo(message, logger)\n}\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 AbortError(outputContent`\nThe CLI prompted in a non-interactive terminal with the following questions:\n${outputToken.json(questions)}\n `)\n }\n\n const value = {} as TAnswers\n for (const question of questions) {\n if (question.preface) {\n outputInfo(question.preface)\n }\n\n // eslint-disable-next-line no-await-in-loop\n value[question.name] = (await executorUI(question)) as TAnswers[TName]\n }\n return value\n}\n\nexport async function nonEmptyDirectoryPrompt(directory: string) {\n if (await fileExists(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 = relativizePath(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 removeFile(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 ? ` ${outputContent`${outputToken.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 outputDebug('Canceled keypress, User pressed CTRL+C')\n reject(new AbortSilentError())\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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopify/cli-kit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.39.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": [
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
"archiver": "5.3.1",
|
|
85
85
|
"chalk": "5.1.0",
|
|
86
86
|
"change-case": "4.1.2",
|
|
87
|
-
"color-json": "
|
|
87
|
+
"color-json": "3.0.0",
|
|
88
88
|
"commondir": "1.0.1",
|
|
89
|
-
"conf": "
|
|
89
|
+
"conf": "11.0.1",
|
|
90
90
|
"cross-zip": "4.0.0",
|
|
91
91
|
"deepmerge": "4.2.2",
|
|
92
92
|
"del": "6.0.0",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"form-data": "4.0.0",
|
|
102
102
|
"fs-extra": "11.1.0",
|
|
103
103
|
"fuzzy": "0.1.3",
|
|
104
|
-
"get-port-please": "
|
|
104
|
+
"get-port-please": "3.0.1",
|
|
105
105
|
"gradient-string": "2.0.2",
|
|
106
106
|
"graphql": "16.4.0",
|
|
107
107
|
"graphql-request": "4.3.0",
|
|
@@ -113,7 +113,6 @@
|
|
|
113
113
|
"kill-port-process": "3.1.0",
|
|
114
114
|
"latest-version": "7.0.0",
|
|
115
115
|
"liquidjs": "9.36.0",
|
|
116
|
-
"listr2": "4.0.5",
|
|
117
116
|
"lodash": "4.17.21",
|
|
118
117
|
"log-update": "4.0.0",
|
|
119
118
|
"macaddress": "0.5.3",
|
|
@@ -124,7 +123,7 @@
|
|
|
124
123
|
"prettier": "2.7.1",
|
|
125
124
|
"react": "17.0.2",
|
|
126
125
|
"semver": "7.3.6",
|
|
127
|
-
"simple-git": "3.
|
|
126
|
+
"simple-git": "3.16.0",
|
|
128
127
|
"source-map-support": "0.5.21",
|
|
129
128
|
"stacktracey": "2.1.8",
|
|
130
129
|
"strip-ansi": "7.0.1",
|
|
@@ -143,7 +142,7 @@
|
|
|
143
142
|
"@types/fs-extra": "9.0.13",
|
|
144
143
|
"@types/gradient-string": "^1.1.2",
|
|
145
144
|
"@types/lodash": "4.14.191",
|
|
146
|
-
"@types/node": "14.
|
|
145
|
+
"@types/node": "14.18.36",
|
|
147
146
|
"@types/react": "17.0.2",
|
|
148
147
|
"@types/semver": "^7.3.9",
|
|
149
148
|
"@vitest/coverage-istanbul": "^0.26.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deep-required.js","sourceRoot":"","sources":["../../../../src/private/common/ts/deep-required.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Converts a mapping type to be non-optional.\n *\n * ```ts\n * type T = DeepRequired<{optionalKey?: string, nullableValue: string | null, undefinableValue: string | undefined}>\n * T = {optionalKey: string, nullableValue: string, undefinableValue: string}\n * ```\n *.\n */\nexport type DeepRequired<T> = {\n [TKey in keyof Required<T>]: NonNullable<Required<T>[TKey]>\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simple-definitions.js","sourceRoot":"","sources":["../../../src/private/node/simple-definitions.ts"],"names":[],"mappings":"","sourcesContent":["declare module 'color-json' {\n function colour(content: string | object): string\n export default colour\n}\n"]}
|