@shopify/cli-kit 3.56.2 → 3.57.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/assets/cli-ruby/lib/shopify_cli/theme/dev_server/proxy.rb +21 -1
- package/dist/private/node/content-tokens.js +1 -1
- package/dist/private/node/content-tokens.js.map +1 -1
- package/dist/private/node/ui/components/AutocompletePrompt.d.ts +1 -3
- package/dist/private/node/ui/components/AutocompletePrompt.js +2 -2
- package/dist/private/node/ui/components/AutocompletePrompt.js.map +1 -1
- package/dist/private/node/ui/components/AutocompletePrompt.test.js +0 -29
- package/dist/private/node/ui/components/AutocompletePrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/Prompts/PromptLayout.d.ts +1 -3
- package/dist/private/node/ui/components/Prompts/PromptLayout.js +3 -5
- package/dist/private/node/ui/components/Prompts/PromptLayout.js.map +1 -1
- package/dist/private/node/ui/components/Prompts/PromptLayout.test.js +2 -14
- package/dist/private/node/ui/components/Prompts/PromptLayout.test.js.map +1 -1
- package/dist/private/node/ui/components/SelectPrompt.d.ts +1 -3
- package/dist/private/node/ui/components/SelectPrompt.js +2 -2
- package/dist/private/node/ui/components/SelectPrompt.js.map +1 -1
- package/dist/private/node/ui/components/SelectPrompt.test.js +0 -27
- package/dist/private/node/ui/components/SelectPrompt.test.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/partners.d.ts +1 -0
- package/dist/public/node/api/partners.js +1 -2
- package/dist/public/node/api/partners.js.map +1 -1
- package/dist/public/node/ink.d.ts +1 -0
- package/dist/public/node/ink.js +2 -0
- package/dist/public/node/ink.js.map +1 -0
- package/dist/public/node/ui.d.ts +2 -2
- package/dist/public/node/ui.js +1 -2
- package/dist/public/node/ui.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -4
- package/dist/private/node/ui/components/Prompts/GitDiff.d.ts +0 -17
- package/dist/private/node/ui/components/Prompts/GitDiff.js +0 -48
- package/dist/private/node/ui/components/Prompts/GitDiff.js.map +0 -1
- package/dist/private/node/ui/components/Prompts/GitDiff.test.d.ts +0 -1
- package/dist/private/node/ui/components/Prompts/GitDiff.test.js +0 -126
- package/dist/private/node/ui/components/Prompts/GitDiff.test.js.map +0 -1
|
@@ -48,23 +48,17 @@ describe('PromptLayout', async () => {
|
|
|
48
48
|
{ label: 'third', value: 'third' },
|
|
49
49
|
{ label: 'fourth', value: 'fourth' },
|
|
50
50
|
];
|
|
51
|
-
const gitDiff = {
|
|
52
|
-
baselineContent: 'hello',
|
|
53
|
-
updatedContent: 'hello',
|
|
54
|
-
};
|
|
55
51
|
const infoMessage = {
|
|
56
52
|
title: { text: 'some title' },
|
|
57
53
|
body: 'some body',
|
|
58
54
|
};
|
|
59
|
-
const renderInstance = render(React.createElement(PromptLayout, { message: "Associate your project with the org Castile Ventures?", infoTable: [], infoMessage: infoMessage,
|
|
55
|
+
const renderInstance = render(React.createElement(PromptLayout, { message: "Associate your project with the org Castile Ventures?", infoTable: [], infoMessage: infoMessage, state: PromptState.Idle, input: React.createElement(Box, { flexDirection: "column" }, items.map((item) => (React.createElement(Text, { key: item.value }, item.label)))) }));
|
|
60
56
|
expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`
|
|
61
57
|
"? Associate your project with the org Castile Ventures?
|
|
62
58
|
|
|
63
59
|
┃ some title
|
|
64
60
|
┃
|
|
65
61
|
┃ some body
|
|
66
|
-
┃
|
|
67
|
-
┃ No changes.
|
|
68
62
|
|
|
69
63
|
first
|
|
70
64
|
second
|
|
@@ -80,10 +74,6 @@ describe('PromptLayout', async () => {
|
|
|
80
74
|
{ label: 'third', value: 'third' },
|
|
81
75
|
{ label: 'fourth', value: 'fourth' },
|
|
82
76
|
];
|
|
83
|
-
const gitDiff = {
|
|
84
|
-
baselineContent: 'hello',
|
|
85
|
-
updatedContent: 'hello',
|
|
86
|
-
};
|
|
87
77
|
const infoMessage = {
|
|
88
78
|
title: { text: 'some title' },
|
|
89
79
|
body: 'some body',
|
|
@@ -93,7 +83,7 @@ describe('PromptLayout', async () => {
|
|
|
93
83
|
header2: ['item 4', 'item 5', 'item 6'],
|
|
94
84
|
header3: ['item 7', 'item 8', 'item 9'],
|
|
95
85
|
};
|
|
96
|
-
const renderInstance = render(React.createElement(PromptLayout, { message: "Associate your project with the org Castile Ventures?", infoTable: infoTable, infoMessage: infoMessage,
|
|
86
|
+
const renderInstance = render(React.createElement(PromptLayout, { message: "Associate your project with the org Castile Ventures?", infoTable: infoTable, infoMessage: infoMessage, state: PromptState.Idle, input: React.createElement(Box, { flexDirection: "column" }, items.map((item) => (React.createElement(Text, { key: item.value }, item.label)))) }));
|
|
97
87
|
expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`
|
|
98
88
|
"? Associate your project with the org Castile Ventures?
|
|
99
89
|
|
|
@@ -115,8 +105,6 @@ describe('PromptLayout', async () => {
|
|
|
115
105
|
┃ • item 7
|
|
116
106
|
┃ • item 8
|
|
117
107
|
┃ • item 9
|
|
118
|
-
┃
|
|
119
|
-
┃ No changes.
|
|
120
108
|
|
|
121
109
|
first
|
|
122
110
|
second
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromptLayout.test.js","sourceRoot":"","sources":["../../../../../../src/private/node/ui/components/Prompts/PromptLayout.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAC,MAAM,EAAC,MAAM,wBAAwB,CAAA;AAC7C,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAE7B,QAAQ,CAAC,c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IACX,OAAO,EAAC,uDAAuD,EAC/D,SAAS,EAAE,EAAE,EACb,KAAK,EAAE,WAAW,CAAC,IAAI,EACvB,KAAK,EACH,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,IACxB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,oBAAC,IAAI,IAAC,GAAG,EAAE,IAAI,CAAC,KAAK,IAAG,IAAI,CAAC,KAAK,CAAQ,CAC3C,CAAC,CACE,GAER,CACH,CAAA;QAED,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;KAQxD,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,oGAAoG,EAAE,KAAK,IAAI,EAAE;QACpH,MAAM,KAAK,GAAG;YACZ,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAC;YAChC,EAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAC;YAClC,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAC;YAChC,EAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAC;SACnC,CAAA;QAED,MAAM,
|
|
1
|
+
{"version":3,"file":"PromptLayout.test.js","sourceRoot":"","sources":["../../../../../../src/private/node/ui/components/Prompts/PromptLayout.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAC,MAAM,EAAC,MAAM,wBAAwB,CAAA;AAC7C,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAE7B,QAAQ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H,CAAA;QAED,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BxD,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {PromptLayout} from './PromptLayout.js'\nimport {render} from '../../../testing/ui.js'\nimport {PromptState} from '../../hooks/use-prompt.js'\nimport {describe, expect, test} from 'vitest'\nimport React from 'react'\nimport {Box, Text} from 'ink'\n\ndescribe('PromptLayout', async () => {\n test(\"doesn't add unnecessary margins when infoTable is an empty array\", async () => {\n const items = [\n {label: 'first', value: 'first'},\n {label: 'second', value: 'second'},\n {label: 'third', value: 'third'},\n {label: 'fourth', value: 'fourth'},\n ]\n\n const renderInstance = render(\n <PromptLayout\n message=\"Associate your project with the org Castile Ventures?\"\n infoTable={[]}\n state={PromptState.Idle}\n input={\n <Box flexDirection=\"column\">\n {items.map((item) => (\n <Text key={item.value}>{item.label}</Text>\n ))}\n </Box>\n }\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n first\n second\n third\n fourth\n \"\n `)\n })\n\n test(\"doesn't add unnecessary margins when infoTable is an empty object\", async () => {\n const items = [\n {label: 'first', value: 'first'},\n {label: 'second', value: 'second'},\n {label: 'third', value: 'third'},\n {label: 'fourth', value: 'fourth'},\n ]\n\n const renderInstance = render(\n <PromptLayout\n message=\"Associate your project with the org Castile Ventures?\"\n infoTable={{}}\n state={PromptState.Idle}\n input={\n <Box flexDirection=\"column\">\n {items.map((item) => (\n <Text key={item.value}>{item.label}</Text>\n ))}\n </Box>\n }\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n first\n second\n third\n fourth\n \"\n `)\n })\n\n test(\"doesn't add unnecessary margins when infoTable is empty and there are other elements in the header\", async () => {\n const items = [\n {label: 'first', value: 'first'},\n {label: 'second', value: 'second'},\n {label: 'third', value: 'third'},\n {label: 'fourth', value: 'fourth'},\n ]\n\n const infoMessage = {\n title: {text: 'some title'},\n body: 'some body',\n }\n\n const renderInstance = render(\n <PromptLayout\n message=\"Associate your project with the org Castile Ventures?\"\n infoTable={[]}\n infoMessage={infoMessage}\n state={PromptState.Idle}\n input={\n <Box flexDirection=\"column\">\n {items.map((item) => (\n <Text key={item.value}>{item.label}</Text>\n ))}\n </Box>\n }\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n ┃ some title\n ┃\n ┃ some body\n\n first\n second\n third\n fourth\n \"\n `)\n })\n\n test('can have all elements visible in the header at the same time', async () => {\n const items = [\n {label: 'first', value: 'first'},\n {label: 'second', value: 'second'},\n {label: 'third', value: 'third'},\n {label: 'fourth', value: 'fourth'},\n ]\n\n const infoMessage = {\n title: {text: 'some title'},\n body: 'some body',\n }\n\n const infoTable = {\n header1: ['item 1', 'item 2', 'item 3'],\n header2: ['item 4', 'item 5', 'item 6'],\n header3: ['item 7', 'item 8', 'item 9'],\n }\n\n const renderInstance = render(\n <PromptLayout\n message=\"Associate your project with the org Castile Ventures?\"\n infoTable={infoTable}\n infoMessage={infoMessage}\n state={PromptState.Idle}\n input={\n <Box flexDirection=\"column\">\n {items.map((item) => (\n <Text key={item.value}>{item.label}</Text>\n ))}\n </Box>\n }\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n ┃ some title\n ┃\n ┃ some body\n ┃\n ┃ \u001b[1mHeader1\u001b[22m\n ┃ • item 1\n ┃ • item 2\n ┃ • item 3\n ┃\n ┃ \u001b[1mHeader2\u001b[22m\n ┃ • item 4\n ┃ • item 5\n ┃ • item 6\n ┃\n ┃ \u001b[1mHeader3\u001b[22m\n ┃ • item 7\n ┃ • item 8\n ┃ • item 9\n\n first\n second\n third\n fourth\n \"\n `)\n })\n})\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SelectInputProps } from './SelectInput.js';
|
|
2
2
|
import { InfoTableProps } from './Prompts/InfoTable.js';
|
|
3
|
-
import { GitDiffProps } from './Prompts/GitDiff.js';
|
|
4
3
|
import { InfoMessageProps } from './Prompts/InfoMessage.js';
|
|
5
4
|
import { Message } from './Prompts/PromptLayout.js';
|
|
6
5
|
import { AbortSignal } from '../../../../public/node/abort.js';
|
|
@@ -10,10 +9,9 @@ export interface SelectPromptProps<T> {
|
|
|
10
9
|
choices: SelectInputProps<T>['items'];
|
|
11
10
|
onSubmit: (value: T) => void;
|
|
12
11
|
infoTable?: InfoTableProps['table'];
|
|
13
|
-
gitDiff?: GitDiffProps['gitDiff'];
|
|
14
12
|
defaultValue?: T;
|
|
15
13
|
abortSignal?: AbortSignal;
|
|
16
14
|
infoMessage?: InfoMessageProps['message'];
|
|
17
15
|
}
|
|
18
|
-
declare function SelectPrompt<T>({ message, choices, infoTable, infoMessage,
|
|
16
|
+
declare function SelectPrompt<T>({ message, choices, infoTable, infoMessage, onSubmit, defaultValue, abortSignal, }: React.PropsWithChildren<SelectPromptProps<T>>): ReactElement | null;
|
|
19
17
|
export { SelectPrompt };
|
|
@@ -4,7 +4,7 @@ import usePrompt, { PromptState } from '../hooks/use-prompt.js';
|
|
|
4
4
|
import React, { useCallback, useEffect } from 'react';
|
|
5
5
|
import { useApp } from 'ink';
|
|
6
6
|
// eslint-disable-next-line react/function-component-definition
|
|
7
|
-
function SelectPrompt({ message, choices, infoTable, infoMessage,
|
|
7
|
+
function SelectPrompt({ message, choices, infoTable, infoMessage, onSubmit, defaultValue, abortSignal, }) {
|
|
8
8
|
if (choices.length === 0) {
|
|
9
9
|
throw new Error('SelectPrompt requires at least one choice');
|
|
10
10
|
}
|
|
@@ -22,7 +22,7 @@ function SelectPrompt({ message, choices, infoTable, infoMessage, gitDiff, onSub
|
|
|
22
22
|
onSubmit(answer.value);
|
|
23
23
|
}
|
|
24
24
|
}, [answer, onSubmit, promptState, unmountInk]);
|
|
25
|
-
return (React.createElement(PromptLayout, { message: message, state: promptState, submittedAnswerLabel: answer?.label, infoTable: infoTable, infoMessage: infoMessage,
|
|
25
|
+
return (React.createElement(PromptLayout, { message: message, state: promptState, submittedAnswerLabel: answer?.label, infoTable: infoTable, infoMessage: infoMessage, abortSignal: abortSignal, input: React.createElement(SelectInput, { defaultValue: defaultValue, items: choices, onSubmit: submitAnswer }) }));
|
|
26
26
|
}
|
|
27
27
|
export { SelectPrompt };
|
|
28
28
|
//# sourceMappingURL=SelectPrompt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectPrompt.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/SelectPrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAuC,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"SelectPrompt.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/SelectPrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAuC,MAAM,kBAAkB,CAAA;AAGlF,OAAO,EAAU,YAAY,EAAC,MAAM,2BAA2B,CAAA;AAE/D,OAAO,SAAS,EAAE,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAK,EAAE,EAAe,WAAW,EAAE,SAAS,EAAC,MAAM,OAAO,CAAA;AACjE,OAAO,EAAC,MAAM,EAAC,MAAM,KAAK,CAAA;AAY1B,+DAA+D;AAC/D,SAAS,YAAY,CAAI,EACvB,OAAO,EACP,OAAO,EACP,SAAS,EACT,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,WAAW,GACmC;IAC9C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAA;KAC7D;IACD,MAAM,EAAC,IAAI,EAAE,UAAU,EAAC,GAAG,MAAM,EAAE,CAAA;IACnC,MAAM,EAAC,WAAW,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAC,GAAG,SAAS,CAA4B;QAC5F,aAAa,EAAE,SAAS;KACzB,CAAC,CAAA;IAEF,MAAM,YAAY,GAAG,WAAW,CAC9B,CAAC,MAAqB,EAAE,EAAE;QACxB,SAAS,CAAC,MAAM,CAAC,CAAA;QACjB,cAAc,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;IACvC,CAAC,EACD,CAAC,SAAS,EAAE,cAAc,CAAC,CAC5B,CAAA;IAED,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,WAAW,KAAK,WAAW,CAAC,SAAS,IAAI,MAAM,EAAE;YACnD,UAAU,EAAE,CAAA;YACZ,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;SACvB;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAA;IAE/C,OAAO,CACL,oBAAC,YAAY,IACX,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,WAAW,EAClB,oBAAoB,EAAE,MAAM,EAAE,KAAK,EACnC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,oBAAC,WAAW,IAAC,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,GAAI,GAC1F,CACH,CAAA;AACH,CAAC;AAED,OAAO,EAAC,YAAY,EAAC,CAAA","sourcesContent":["import {SelectInput, SelectInputProps, Item as SelectItem} from './SelectInput.js'\nimport {InfoTableProps} from './Prompts/InfoTable.js'\nimport {InfoMessageProps} from './Prompts/InfoMessage.js'\nimport {Message, PromptLayout} from './Prompts/PromptLayout.js'\nimport {AbortSignal} from '../../../../public/node/abort.js'\nimport usePrompt, {PromptState} from '../hooks/use-prompt.js'\nimport React, {ReactElement, useCallback, useEffect} from 'react'\nimport {useApp} from 'ink'\n\nexport interface SelectPromptProps<T> {\n message: Message\n choices: SelectInputProps<T>['items']\n onSubmit: (value: T) => void\n infoTable?: InfoTableProps['table']\n defaultValue?: T\n abortSignal?: AbortSignal\n infoMessage?: InfoMessageProps['message']\n}\n\n// eslint-disable-next-line react/function-component-definition\nfunction SelectPrompt<T>({\n message,\n choices,\n infoTable,\n infoMessage,\n onSubmit,\n defaultValue,\n abortSignal,\n}: React.PropsWithChildren<SelectPromptProps<T>>): ReactElement | null {\n if (choices.length === 0) {\n throw new Error('SelectPrompt requires at least one choice')\n }\n const {exit: unmountInk} = useApp()\n const {promptState, setPromptState, answer, setAnswer} = usePrompt<SelectItem<T> | undefined>({\n initialAnswer: undefined,\n })\n\n const submitAnswer = useCallback(\n (answer: SelectItem<T>) => {\n setAnswer(answer)\n setPromptState(PromptState.Submitted)\n },\n [setAnswer, setPromptState],\n )\n\n useEffect(() => {\n if (promptState === PromptState.Submitted && answer) {\n unmountInk()\n onSubmit(answer.value)\n }\n }, [answer, onSubmit, promptState, unmountInk])\n\n return (\n <PromptLayout\n message={message}\n state={promptState}\n submittedAnswerLabel={answer?.label}\n infoTable={infoTable}\n infoMessage={infoMessage}\n abortSignal={abortSignal}\n input={<SelectInput defaultValue={defaultValue} items={choices} onSubmit={submitAnswer} />}\n />\n )\n}\n\nexport {SelectPrompt}\n"]}
|
|
@@ -125,33 +125,6 @@ describe('SelectPrompt', async () => {
|
|
|
125
125
|
`);
|
|
126
126
|
});
|
|
127
127
|
const runningOnWindows = platformAndArch().platform === 'windows';
|
|
128
|
-
test.skipIf(runningOnWindows)('supports a git diff', async () => {
|
|
129
|
-
const items = [
|
|
130
|
-
{ label: 'first', value: 'first' },
|
|
131
|
-
{ label: 'second', value: 'second' },
|
|
132
|
-
{ label: 'third', value: 'third' },
|
|
133
|
-
{ label: 'fourth', value: 'fourth' },
|
|
134
|
-
];
|
|
135
|
-
const gitDiff = {
|
|
136
|
-
baselineContent: 'hello\n',
|
|
137
|
-
updatedContent: 'world\n',
|
|
138
|
-
};
|
|
139
|
-
const renderInstance = render(React.createElement(SelectPrompt, { message: "Associate your project with the org Castile Ventures?", choices: items, gitDiff: gitDiff, onSubmit: () => { } }));
|
|
140
|
-
expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`
|
|
141
|
-
"? Associate your project with the org Castile Ventures?
|
|
142
|
-
|
|
143
|
-
┃ [31m- hello[m[39m
|
|
144
|
-
┃ [32m+ [m[32mworld[m[0m[39m
|
|
145
|
-
|
|
146
|
-
[36m>[39m [36mfirst[39m
|
|
147
|
-
second
|
|
148
|
-
third
|
|
149
|
-
fourth
|
|
150
|
-
|
|
151
|
-
[2mPress ↑↓ arrows to select, enter to confirm.[22m
|
|
152
|
-
"
|
|
153
|
-
`);
|
|
154
|
-
});
|
|
155
128
|
test('supports an info message', async () => {
|
|
156
129
|
const items = [
|
|
157
130
|
{ label: 'first', value: 'first' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectPrompt.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/SelectPrompt.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAC,wBAAwB,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,EAAC,MAAM,qBAAqB,CAAA;AACvH,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAC1D,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAClC,OAAO,EAAC,eAAe,EAAC,MAAM,kCAAkC,CAAA;AAChE,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,MAAM,QAAQ,CAAA;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,SAAS,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,EAAC,eAAe,EAAC,MAAM,0BAA0B,CAAA;AAExD,EAAE,CAAC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ToBeReady, render} from '../../testing/ui.js'\nimport {unstyled} from '../../../../public/node/output.js'\nimport {Stdout} from '../../ui.js'\nimport {AbortController} from '../../../../public/node/abort.js'\nimport {beforeEach, describe, expect, test, vi} from 'vitest'\nimport React from 'react'\nimport {useStdout} from 'ink'\nimport {platformAndArch} from '@shopify/cli-kit/node/os'\n\nvi.mock('ink', async () => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const original: any = await vi.importActual('ink')\n return {\n ...original,\n useStdout: vi.fn(),\n }\n})\n\nconst ARROW_DOWN = '\\u001B[B'\nconst ARROW_UP = '\\u001B[A'\nconst ENTER = '\\r'\n\nbeforeEach(() => {\n vi.mocked(useStdout).mockReturnValue({\n stdout: new Stdout({\n columns: 80,\n rows: 80,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n }) as any,\n write: () => {},\n })\n})\n\ndescribe('SelectPrompt', async () => {\n test('choose an answer', async () => {\n const onEnter = vi.fn()\n\n const items = [\n {label: 'first', value: 'first'},\n {label: 'second', value: 'second'},\n {label: 'third', value: 'third'},\n ]\n\n const infoTable = {Add: ['new-ext'], Remove: ['integrated-demand-ext', 'order-discount']}\n\n const renderInstance = render(\n <SelectPrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n infoTable={infoTable}\n onSubmit={onEnter}\n />,\n )\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForChange(renderInstance, ARROW_DOWN)\n await sendInputAndWaitForChange(renderInstance, ENTER)\n\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n \u001b[36m✔\u001b[39m \u001b[36msecond\u001b[39m\n \"\n `)\n\n expect(onEnter).toHaveBeenCalledWith(items[1]!.value)\n })\n\n test('renders groups', async () => {\n const items = [\n {label: 'first', value: 'first', group: 'Automations'},\n {label: 'second', value: 'second', group: 'Automations'},\n {label: 'third', value: 'third', group: 'Merchant Admin'},\n {label: 'fourth', value: 'fourth', group: 'Merchant Admin'},\n {label: 'fifth', value: 'fifth'},\n {label: 'sixth', value: 'sixth'},\n {label: 'seventh', value: 'seventh'},\n {label: 'eighth', value: 'eighth'},\n {label: 'ninth', value: 'ninth'},\n {label: 'tenth', value: 'tenth'},\n ]\n\n const renderInstance = render(\n <SelectPrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n onSubmit={() => {}}\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n \u001b[1mAutomations\u001b[22m\n \u001b[36m>\u001b[39m \u001b[36mfirst\u001b[39m\n second\n\n \u001b[1mMerchant Admin\u001b[22m\n third\n fourth\n\n \u001b[1mOther\u001b[22m\n fifth\n sixth\n seventh\n eighth\n ninth\n tenth\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm.\u001b[22m\n \"\n `)\n })\n\n test('supports an info table', async () => {\n const items = [\n {label: 'first', value: 'first'},\n {label: 'second', value: 'second'},\n {label: 'third', value: 'third'},\n {label: 'fourth', value: 'fourth'},\n ]\n\n const infoTable = [\n {\n header: 'Add',\n items: ['new-ext'],\n bullet: '+',\n },\n {\n header: 'Remove',\n items: ['integrated-demand-ext', ['order-discount', {subdued: '(1)'}]],\n bullet: '-',\n },\n ]\n\n const renderInstance = render(\n <SelectPrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n infoTable={infoTable}\n onSubmit={() => {}}\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n ┃ \\u001b[1mAdd\\u001b[22m\n ┃ + new-ext\n ┃\n ┃ \\u001b[1mRemove\\u001b[22m\n ┃ - integrated-demand-ext\n ┃ - order-discount \u001b[2m(1)\u001b[22m\n\n \u001b[36m>\u001b[39m \u001b[36mfirst\u001b[39m\n second\n third\n fourth\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm.\u001b[22m\n \"\n `)\n })\n\n const runningOnWindows = platformAndArch().platform === 'windows'\n\n test.skipIf(runningOnWindows)('supports a git diff', async () => {\n const items = [\n {label: 'first', value: 'first'},\n {label: 'second', value: 'second'},\n {label: 'third', value: 'third'},\n {label: 'fourth', value: 'fourth'},\n ]\n\n const gitDiff = {\n baselineContent: 'hello\\n',\n updatedContent: 'world\\n',\n }\n\n const renderInstance = render(\n <SelectPrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n gitDiff={gitDiff}\n onSubmit={() => {}}\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n ┃ \u001b[31m- hello\u001b[m\u001b[39m\n ┃ \u001b[32m+ \u001b[m\u001b[32mworld\u001b[m\u001b[0m\u001b[39m\n\n \u001b[36m>\u001b[39m \u001b[36mfirst\u001b[39m\n second\n third\n fourth\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm.\u001b[22m\n \"\n `)\n })\n\n test('supports an info message', async () => {\n const items = [\n {label: 'first', value: 'first'},\n {label: 'second', value: 'second'},\n {label: 'third', value: 'third'},\n {label: 'fourth', value: 'fourth'},\n ]\n\n const infoMessage = {\n title: {\n color: 'red',\n text: 'Info message title',\n },\n body: 'Info message body',\n }\n\n const renderInstance = render(\n <SelectPrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n infoMessage={infoMessage}\n onSubmit={() => {}}\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n ┃ \u001b[31mInfo message title\u001b[39m\n ┃\n ┃ Info message body\n\n \u001b[36m>\u001b[39m \u001b[36mfirst\u001b[39m\n second\n third\n fourth\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm.\u001b[22m\n \"\n `)\n })\n\n test(\"it doesn't submit if there are no choices\", async () => {\n const onEnter = vi.fn()\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const items: any[] = []\n\n const renderInstance = render(\n <SelectPrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n onSubmit={onEnter}\n />,\n )\n\n expect(unstyled(getLastFrameAfterUnmount(renderInstance)!)).toContain(\n 'ERROR SelectPrompt requires at least one choice',\n )\n })\n\n test(\"doesn't append a colon to the message if it ends with a question mark\", async () => {\n const {lastFrame} = render(\n <SelectPrompt choices={[{label: 'a', value: 'a'}]} onSubmit={() => {}} message=\"Test question?\" />,\n )\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"? Test question?\n\n > a\n\n\n Press ↑↓ arrows to select, enter to confirm.\n \"\n `)\n })\n\n test('accepts a default value', async () => {\n const onEnter = vi.fn()\n const items = [\n {label: 'a', value: 'a'},\n {label: 'b', value: 'b'},\n ]\n\n const renderInstance = render(\n <SelectPrompt choices={items} onSubmit={onEnter} message=\"Test question?\" defaultValue=\"b\" />,\n )\n\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"? Test question?\n\n a\n > b\n\n Press ↑↓ arrows to select, enter to confirm.\n \"\n `)\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForChange(renderInstance, ENTER)\n\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot(`\n \"? Test question?\n \u001b[36m✔\u001b[39m \u001b[36mb\u001b[39m\n \"\n `)\n expect(onEnter).toHaveBeenCalledWith(items[1]!.value)\n })\n\n test('can submit the initial value', async () => {\n const onEnter = vi.fn()\n const items = [\n {label: 'a', value: 'a'},\n {label: 'b', value: 'b'},\n ]\n\n const renderInstance = render(<SelectPrompt choices={items} onSubmit={onEnter} message=\"Test question?\" />)\n\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"? Test question?\n\n > a\n b\n\n Press ↑↓ arrows to select, enter to confirm.\n \"\n `)\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForChange(renderInstance, ENTER)\n\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot(`\n \"? Test question?\n \u001b[36m✔\u001b[39m \u001b[36ma\u001b[39m\n \"\n `)\n expect(onEnter).toHaveBeenCalledWith(items[0]!.value)\n })\n\n test('allow submitting with a shortcut directly', async () => {\n const onEnter = vi.fn()\n const items = [\n {label: 'a', value: 'a', key: 'a'},\n {label: 'b', value: 'b', key: 'b'},\n ]\n\n const renderInstance = render(<SelectPrompt choices={items} onSubmit={onEnter} message=\"Test question?\" />)\n\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"? Test question?\n\n > (a) a\n (b) b\n\n Press ↑↓ arrows to select, enter or a shortcut to confirm.\n \"\n `)\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForChange(renderInstance, 'b')\n\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot(`\n \"? Test question?\n \u001b[36m✔\u001b[39m \u001b[36mb\u001b[39m\n \"\n `)\n expect(onEnter).toHaveBeenCalledWith(items[1]!.value)\n })\n\n test('adapts to the height of the container', async () => {\n vi.mocked(useStdout).mockReturnValue({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stdout: new Stdout({rows: 10}) as any,\n write: () => {},\n })\n\n const items = [\n {label: 'first', value: 'first', group: 'Automations'},\n {label: 'second', value: 'second', group: 'Automations'},\n {label: 'third', value: 'third', group: 'Merchant Admin'},\n {label: 'fourth', value: 'fourth', group: 'Merchant Admin'},\n {label: 'fifth', value: 'fifth'},\n {label: 'sixth', value: 'sixth'},\n {label: 'seventh', value: 'seventh'},\n {label: 'eighth', value: 'eighth'},\n {label: 'ninth', value: 'ninth'},\n {label: 'tenth', value: 'tenth'},\n ]\n\n const renderInstance = render(\n <SelectPrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n onSubmit={() => {}}\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n \u001b[1mAutomations\u001b[22m \u001b[46m \u001b[49m\n \u001b[36m>\u001b[39m \u001b[36mfirst\u001b[39m \u001b[100m \u001b[49m\n second \u001b[100m \u001b[49m\n \u001b[100m \u001b[49m\n \u001b[1mMerchant Admin\u001b[22m \u001b[100m \u001b[49m\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm.\u001b[22m\n \"\n `)\n })\n\n test('allows passing false as the default value', async () => {\n const items = [\n {label: 'yes', value: true},\n {label: 'no', value: false},\n ]\n\n const renderInstance = render(\n <SelectPrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n onSubmit={() => {}}\n defaultValue={false}\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n yes\n \u001b[36m>\u001b[39m \u001b[36mno\u001b[39m\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm.\u001b[22m\n \"\n `)\n })\n\n test('allows selecting a different option after having selected an option with a falsy value', async () => {\n const items = [\n {label: 'yes', value: true},\n {label: 'no', value: false},\n ]\n\n const renderInstance = render(\n <SelectPrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n onSubmit={() => {}}\n />,\n )\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForChange(renderInstance, ARROW_DOWN)\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n yes\n \u001b[36m>\u001b[39m \u001b[36mno\u001b[39m\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm.\u001b[22m\n \"\n `)\n\n await sendInputAndWaitForChange(renderInstance, ARROW_UP)\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n \u001b[36m>\u001b[39m \u001b[36myes\u001b[39m\n no\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm.\u001b[22m\n \"\n `)\n })\n\n test('abortController can be used to exit the prompt from outside', async () => {\n const items = [\n {label: 'a', value: 'a'},\n {label: 'b', value: 'b'},\n ]\n\n const abortController = new AbortController()\n\n const renderInstance = render(\n <SelectPrompt\n choices={items}\n onSubmit={() => {}}\n message=\"Test question?\"\n abortSignal={abortController.signal}\n />,\n )\n\n const promise = renderInstance.waitUntilExit()\n\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"? Test question?\n\n > a\n b\n\n Press ↑↓ arrows to select, enter to confirm.\n \"\n `)\n\n abortController.abort()\n\n // wait for the onAbort promise to resolve\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n expect(getLastFrameAfterUnmount(renderInstance)).toEqual('')\n await expect(promise).resolves.toEqual(undefined)\n })\n})\n"]}
|
|
1
|
+
{"version":3,"file":"SelectPrompt.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/SelectPrompt.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAC,wBAAwB,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,EAAC,MAAM,qBAAqB,CAAA;AACvH,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAC1D,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAClC,OAAO,EAAC,eAAe,EAAC,MAAM,kCAAkC,CAAA;AAChE,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,MAAM,QAAQ,CAAA;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,SAAS,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,EAAC,eAAe,EAAC,MAAM,0BAA0B,CAAA;AAExD,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,IAAI,EAAE;IACxB,8DAA8D;IAC9D,MAAM,QAAQ,GAAQ,MAAM,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;IAClD,OAAO;QACL,GAAG,QAAQ;QACX,SAAS,EAAE,EAAE,CAAC,EAAE,EAAE;KACnB,CAAA;AACH,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CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QAC5D,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IACnD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {SelectPrompt} from './SelectPrompt.js'\nimport {getLastFrameAfterUnmount, sendInputAndWaitForChange, waitForInputsToBeReady, render} from '../../testing/ui.js'\nimport {unstyled} from '../../../../public/node/output.js'\nimport {Stdout} from '../../ui.js'\nimport {AbortController} from '../../../../public/node/abort.js'\nimport {beforeEach, describe, expect, test, vi} from 'vitest'\nimport React from 'react'\nimport {useStdout} from 'ink'\nimport {platformAndArch} from '@shopify/cli-kit/node/os'\n\nvi.mock('ink', async () => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const original: any = await vi.importActual('ink')\n return {\n ...original,\n useStdout: vi.fn(),\n }\n})\n\nconst ARROW_DOWN = '\\u001B[B'\nconst ARROW_UP = '\\u001B[A'\nconst ENTER = '\\r'\n\nbeforeEach(() => {\n vi.mocked(useStdout).mockReturnValue({\n stdout: new Stdout({\n columns: 80,\n rows: 80,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n }) as any,\n write: () => {},\n })\n})\n\ndescribe('SelectPrompt', async () => {\n test('choose an answer', async () => {\n const onEnter = vi.fn()\n\n const items = [\n {label: 'first', value: 'first'},\n {label: 'second', value: 'second'},\n {label: 'third', value: 'third'},\n ]\n\n const infoTable = {Add: ['new-ext'], Remove: ['integrated-demand-ext', 'order-discount']}\n\n const renderInstance = render(\n <SelectPrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n infoTable={infoTable}\n onSubmit={onEnter}\n />,\n )\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForChange(renderInstance, ARROW_DOWN)\n await sendInputAndWaitForChange(renderInstance, ENTER)\n\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n \u001b[36m✔\u001b[39m \u001b[36msecond\u001b[39m\n \"\n `)\n\n expect(onEnter).toHaveBeenCalledWith(items[1]!.value)\n })\n\n test('renders groups', async () => {\n const items = [\n {label: 'first', value: 'first', group: 'Automations'},\n {label: 'second', value: 'second', group: 'Automations'},\n {label: 'third', value: 'third', group: 'Merchant Admin'},\n {label: 'fourth', value: 'fourth', group: 'Merchant Admin'},\n {label: 'fifth', value: 'fifth'},\n {label: 'sixth', value: 'sixth'},\n {label: 'seventh', value: 'seventh'},\n {label: 'eighth', value: 'eighth'},\n {label: 'ninth', value: 'ninth'},\n {label: 'tenth', value: 'tenth'},\n ]\n\n const renderInstance = render(\n <SelectPrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n onSubmit={() => {}}\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n \u001b[1mAutomations\u001b[22m\n \u001b[36m>\u001b[39m \u001b[36mfirst\u001b[39m\n second\n\n \u001b[1mMerchant Admin\u001b[22m\n third\n fourth\n\n \u001b[1mOther\u001b[22m\n fifth\n sixth\n seventh\n eighth\n ninth\n tenth\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm.\u001b[22m\n \"\n `)\n })\n\n test('supports an info table', async () => {\n const items = [\n {label: 'first', value: 'first'},\n {label: 'second', value: 'second'},\n {label: 'third', value: 'third'},\n {label: 'fourth', value: 'fourth'},\n ]\n\n const infoTable = [\n {\n header: 'Add',\n items: ['new-ext'],\n bullet: '+',\n },\n {\n header: 'Remove',\n items: ['integrated-demand-ext', ['order-discount', {subdued: '(1)'}]],\n bullet: '-',\n },\n ]\n\n const renderInstance = render(\n <SelectPrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n infoTable={infoTable}\n onSubmit={() => {}}\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n ┃ \\u001b[1mAdd\\u001b[22m\n ┃ + new-ext\n ┃\n ┃ \\u001b[1mRemove\\u001b[22m\n ┃ - integrated-demand-ext\n ┃ - order-discount \u001b[2m(1)\u001b[22m\n\n \u001b[36m>\u001b[39m \u001b[36mfirst\u001b[39m\n second\n third\n fourth\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm.\u001b[22m\n \"\n `)\n })\n\n const runningOnWindows = platformAndArch().platform === 'windows'\n\n test('supports an info message', async () => {\n const items = [\n {label: 'first', value: 'first'},\n {label: 'second', value: 'second'},\n {label: 'third', value: 'third'},\n {label: 'fourth', value: 'fourth'},\n ]\n\n const infoMessage = {\n title: {\n color: 'red',\n text: 'Info message title',\n },\n body: 'Info message body',\n }\n\n const renderInstance = render(\n <SelectPrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n infoMessage={infoMessage}\n onSubmit={() => {}}\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n ┃ \u001b[31mInfo message title\u001b[39m\n ┃\n ┃ Info message body\n\n \u001b[36m>\u001b[39m \u001b[36mfirst\u001b[39m\n second\n third\n fourth\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm.\u001b[22m\n \"\n `)\n })\n\n test(\"it doesn't submit if there are no choices\", async () => {\n const onEnter = vi.fn()\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const items: any[] = []\n\n const renderInstance = render(\n <SelectPrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n onSubmit={onEnter}\n />,\n )\n\n expect(unstyled(getLastFrameAfterUnmount(renderInstance)!)).toContain(\n 'ERROR SelectPrompt requires at least one choice',\n )\n })\n\n test(\"doesn't append a colon to the message if it ends with a question mark\", async () => {\n const {lastFrame} = render(\n <SelectPrompt choices={[{label: 'a', value: 'a'}]} onSubmit={() => {}} message=\"Test question?\" />,\n )\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"? Test question?\n\n > a\n\n\n Press ↑↓ arrows to select, enter to confirm.\n \"\n `)\n })\n\n test('accepts a default value', async () => {\n const onEnter = vi.fn()\n const items = [\n {label: 'a', value: 'a'},\n {label: 'b', value: 'b'},\n ]\n\n const renderInstance = render(\n <SelectPrompt choices={items} onSubmit={onEnter} message=\"Test question?\" defaultValue=\"b\" />,\n )\n\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"? Test question?\n\n a\n > b\n\n Press ↑↓ arrows to select, enter to confirm.\n \"\n `)\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForChange(renderInstance, ENTER)\n\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot(`\n \"? Test question?\n \u001b[36m✔\u001b[39m \u001b[36mb\u001b[39m\n \"\n `)\n expect(onEnter).toHaveBeenCalledWith(items[1]!.value)\n })\n\n test('can submit the initial value', async () => {\n const onEnter = vi.fn()\n const items = [\n {label: 'a', value: 'a'},\n {label: 'b', value: 'b'},\n ]\n\n const renderInstance = render(<SelectPrompt choices={items} onSubmit={onEnter} message=\"Test question?\" />)\n\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"? Test question?\n\n > a\n b\n\n Press ↑↓ arrows to select, enter to confirm.\n \"\n `)\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForChange(renderInstance, ENTER)\n\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot(`\n \"? Test question?\n \u001b[36m✔\u001b[39m \u001b[36ma\u001b[39m\n \"\n `)\n expect(onEnter).toHaveBeenCalledWith(items[0]!.value)\n })\n\n test('allow submitting with a shortcut directly', async () => {\n const onEnter = vi.fn()\n const items = [\n {label: 'a', value: 'a', key: 'a'},\n {label: 'b', value: 'b', key: 'b'},\n ]\n\n const renderInstance = render(<SelectPrompt choices={items} onSubmit={onEnter} message=\"Test question?\" />)\n\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"? Test question?\n\n > (a) a\n (b) b\n\n Press ↑↓ arrows to select, enter or a shortcut to confirm.\n \"\n `)\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForChange(renderInstance, 'b')\n\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot(`\n \"? Test question?\n \u001b[36m✔\u001b[39m \u001b[36mb\u001b[39m\n \"\n `)\n expect(onEnter).toHaveBeenCalledWith(items[1]!.value)\n })\n\n test('adapts to the height of the container', async () => {\n vi.mocked(useStdout).mockReturnValue({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stdout: new Stdout({rows: 10}) as any,\n write: () => {},\n })\n\n const items = [\n {label: 'first', value: 'first', group: 'Automations'},\n {label: 'second', value: 'second', group: 'Automations'},\n {label: 'third', value: 'third', group: 'Merchant Admin'},\n {label: 'fourth', value: 'fourth', group: 'Merchant Admin'},\n {label: 'fifth', value: 'fifth'},\n {label: 'sixth', value: 'sixth'},\n {label: 'seventh', value: 'seventh'},\n {label: 'eighth', value: 'eighth'},\n {label: 'ninth', value: 'ninth'},\n {label: 'tenth', value: 'tenth'},\n ]\n\n const renderInstance = render(\n <SelectPrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n onSubmit={() => {}}\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n \u001b[1mAutomations\u001b[22m \u001b[46m \u001b[49m\n \u001b[36m>\u001b[39m \u001b[36mfirst\u001b[39m \u001b[100m \u001b[49m\n second \u001b[100m \u001b[49m\n \u001b[100m \u001b[49m\n \u001b[1mMerchant Admin\u001b[22m \u001b[100m \u001b[49m\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm.\u001b[22m\n \"\n `)\n })\n\n test('allows passing false as the default value', async () => {\n const items = [\n {label: 'yes', value: true},\n {label: 'no', value: false},\n ]\n\n const renderInstance = render(\n <SelectPrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n onSubmit={() => {}}\n defaultValue={false}\n />,\n )\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n yes\n \u001b[36m>\u001b[39m \u001b[36mno\u001b[39m\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm.\u001b[22m\n \"\n `)\n })\n\n test('allows selecting a different option after having selected an option with a falsy value', async () => {\n const items = [\n {label: 'yes', value: true},\n {label: 'no', value: false},\n ]\n\n const renderInstance = render(\n <SelectPrompt\n message=\"Associate your project with the org Castile Ventures?\"\n choices={items}\n onSubmit={() => {}}\n />,\n )\n\n await waitForInputsToBeReady()\n await sendInputAndWaitForChange(renderInstance, ARROW_DOWN)\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n yes\n \u001b[36m>\u001b[39m \u001b[36mno\u001b[39m\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm.\u001b[22m\n \"\n `)\n\n await sendInputAndWaitForChange(renderInstance, ARROW_UP)\n\n expect(renderInstance.lastFrame()).toMatchInlineSnapshot(`\n \"? Associate your project with the org Castile Ventures?\n\n \u001b[36m>\u001b[39m \u001b[36myes\u001b[39m\n no\n\n \u001b[2mPress ↑↓ arrows to select, enter to confirm.\u001b[22m\n \"\n `)\n })\n\n test('abortController can be used to exit the prompt from outside', async () => {\n const items = [\n {label: 'a', value: 'a'},\n {label: 'b', value: 'b'},\n ]\n\n const abortController = new AbortController()\n\n const renderInstance = render(\n <SelectPrompt\n choices={items}\n onSubmit={() => {}}\n message=\"Test question?\"\n abortSignal={abortController.signal}\n />,\n )\n\n const promise = renderInstance.waitUntilExit()\n\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"? Test question?\n\n > a\n b\n\n Press ↑↓ arrows to select, enter to confirm.\n \"\n `)\n\n abortController.abort()\n\n // wait for the onAbort promise to resolve\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n expect(getLastFrameAfterUnmount(renderInstance)).toEqual('')\n await expect(promise).resolves.toEqual(undefined)\n })\n})\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const CLI_KIT_VERSION = "3.
|
|
1
|
+
export declare const CLI_KIT_VERSION = "3.57.0";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const CLI_KIT_VERSION = '3.
|
|
1
|
+
export const CLI_KIT_VERSION = '3.57.0';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/public/common/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAA","sourcesContent":["export const CLI_KIT_VERSION = '3.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/public/common/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAA","sourcesContent":["export const CLI_KIT_VERSION = '3.57.0'\n"]}
|
|
@@ -28,6 +28,7 @@ export interface FunctionUploadUrlGenerateResponse {
|
|
|
28
28
|
* @returns The response of the query.
|
|
29
29
|
*/
|
|
30
30
|
export declare function getFunctionUploadUrl(token: string): Promise<FunctionUploadUrlGenerateResponse>;
|
|
31
|
+
export declare const FunctionUploadUrlGenerateMutation: string;
|
|
31
32
|
/**
|
|
32
33
|
* Sets the next deprecation date from [GraphQL response extensions](https://www.apollographql.com/docs/resources/graphql-glossary/#extensions)
|
|
33
34
|
* if `response.extensions.deprecations` objects contain a `supportedUntilDate` (ISO 8601-formatted string).
|
|
@@ -39,11 +39,10 @@ export async function partnersRequest(query, token, variables) {
|
|
|
39
39
|
* @returns The response of the query.
|
|
40
40
|
*/
|
|
41
41
|
export async function getFunctionUploadUrl(token) {
|
|
42
|
-
const functionUploadUrlGenerateMutation = FunctionUploadUrlGenerateMutation;
|
|
43
42
|
const res = await partnersRequest(FunctionUploadUrlGenerateMutation, token);
|
|
44
43
|
return res;
|
|
45
44
|
}
|
|
46
|
-
const FunctionUploadUrlGenerateMutation = gql `
|
|
45
|
+
export const FunctionUploadUrlGenerateMutation = gql `
|
|
47
46
|
mutation functionUploadUrlGenerateMutation {
|
|
48
47
|
functionUploadUrlGenerate {
|
|
49
48
|
generatedUrlDetails {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partners.js","sourceRoot":"","sources":["../../../../src/public/node/api/partners.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAoC,MAAM,cAAc,CAAA;AAC9E,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAC,sBAAsB,EAAC,MAAM,qDAAqD,CAAA;AAC1F,OAAO,EAAC,GAAG,EAAC,MAAM,iBAAiB,CAAA;AACnC,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC,sEAAsE;AACtE,yEAAyE;AACzE,iDAAiD;AACjD,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC;IAC7B,OAAO,EAAE,GAAG;IACZ,aAAa,EAAE,EAAE;CAClB,CAAC,CAAA;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAI,KAAa,EAAE,KAAa,EAAE,SAA4B;IACjG,MAAM,GAAG,GAAG,UAAU,CAAA;IACtB,MAAM,IAAI,GAAG,MAAM,YAAY,EAAE,CAAA;IACjC,MAAM,GAAG,GAAG,WAAW,IAAI,kBAAkB,CAAA;IAC7C,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAI,GAAG,EAAE,CACtC,cAAc,CAAC;QACb,KAAK;QACL,GAAG;QACH,GAAG;QACH,KAAK;QACL,SAAS;QACT,eAAe,EAAE,EAAC,UAAU,EAAE,kBAAkB,EAAC;KAClD,CAAC,CACH,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAcD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,KAAa;IACtD,MAAM,
|
|
1
|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B,CAAI,QAA4B;IAChE,IAAI,CAAC,QAAQ,CAAC,UAAU;QAAE,OAAM;IAEhC,MAAM,gBAAgB,GAAW,EAAE,CAAA;IACnC,KAAK,MAAM,WAAW,IAAK,QAAQ,CAAC,UAA+B,CAAC,YAAY,EAAE;QAChF,IAAI,WAAW,CAAC,kBAAkB,EAAE;YAClC,gBAAgB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAA;SAChE;KACF;IAED,sBAAsB,CAAC,gBAAgB,CAAC,CAAA;AAC1C,CAAC","sourcesContent":["import {graphqlRequest, GraphQLVariables, GraphQLResponse} from './graphql.js'\nimport {partnersFqdn} from '../context/fqdn.js'\nimport {setNextDeprecationDate} from '../../../private/node/context/deprecations-store.js'\nimport {gql} from 'graphql-request'\nimport Bottleneck from 'bottleneck'\n\n// API Rate limiter for partners API (Limit is 10 requests per second)\n// Jobs are launched every 150ms to add an extra 50ms margin per request.\n// Only 10 requests can be executed concurrently.\nconst limiter = new Bottleneck({\n minTime: 150,\n maxConcurrent: 10,\n})\n\n/**\n * Executes a GraphQL query against the Partners API.\n *\n * @param query - GraphQL query to execute.\n * @param token - Partners token.\n * @param variables - GraphQL variables to pass to the query.\n * @returns The response of the query of generic type <T>.\n */\nexport async function partnersRequest<T>(query: string, token: string, variables?: GraphQLVariables): Promise<T> {\n const api = 'Partners'\n const fqdn = await partnersFqdn()\n const url = `https://${fqdn}/api/cli/graphql`\n const result = limiter.schedule<T>(() =>\n graphqlRequest({\n query,\n api,\n url,\n token,\n variables,\n responseOptions: {onResponse: handleDeprecations},\n }),\n )\n\n return result\n}\n\nexport interface FunctionUploadUrlGenerateResponse {\n functionUploadUrlGenerate: {\n generatedUrlDetails: {\n url: string\n moduleId: string\n headers: {[key: string]: string}\n maxBytes: number\n maxSize: string\n }\n }\n}\n\n/**\n * Request a URL from partners to which we will upload our function.\n *\n * @param token - Partners token.\n * @returns The response of the query.\n */\nexport async function getFunctionUploadUrl(token: string): Promise<FunctionUploadUrlGenerateResponse> {\n const res: FunctionUploadUrlGenerateResponse = await partnersRequest(FunctionUploadUrlGenerateMutation, token)\n return res\n}\n\nexport const FunctionUploadUrlGenerateMutation = gql`\n mutation functionUploadUrlGenerateMutation {\n functionUploadUrlGenerate {\n generatedUrlDetails {\n url\n moduleId\n headers\n maxBytes\n maxSize\n }\n }\n }\n`\n\ninterface Deprecation {\n supportedUntilDate?: string\n}\n\ninterface WithDeprecations {\n deprecations: Deprecation[]\n}\n\n/**\n * Sets the next deprecation date from [GraphQL response extensions](https://www.apollographql.com/docs/resources/graphql-glossary/#extensions)\n * if `response.extensions.deprecations` objects contain a `supportedUntilDate` (ISO 8601-formatted string).\n *\n * @param response - The response of the query.\n */\nexport function handleDeprecations<T>(response: GraphQLResponse<T>): void {\n if (!response.extensions) return\n\n const deprecationDates: Date[] = []\n for (const deprecation of (response.extensions as WithDeprecations).deprecations) {\n if (deprecation.supportedUntilDate) {\n deprecationDates.push(new Date(deprecation.supportedUntilDate))\n }\n }\n\n setNextDeprecationDate(deprecationDates)\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Box, Text, useInput, useStdin } from 'ink';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ink.js","sourceRoot":"","sources":["../../../src/public/node/ink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAC,MAAM,KAAK,CAAA","sourcesContent":["export {Box, Text, useInput, useStdin} from 'ink'\n"]}
|
package/dist/public/node/ui.d.ts
CHANGED
|
@@ -229,7 +229,7 @@ export interface RenderSelectPromptOptions<T> extends Omit<SelectPromptProps<T>,
|
|
|
229
229
|
*
|
|
230
230
|
*/
|
|
231
231
|
export declare function renderSelectPrompt<T>({ renderOptions, isConfirmationPrompt, ...props }: RenderSelectPromptOptions<T>, uiDebugOptions?: UIDebugOptions): Promise<T>;
|
|
232
|
-
export interface RenderConfirmationPromptOptions extends Pick<SelectPromptProps<boolean>, 'message' | 'infoTable' | 'infoMessage' | '
|
|
232
|
+
export interface RenderConfirmationPromptOptions extends Pick<SelectPromptProps<boolean>, 'message' | 'infoTable' | 'infoMessage' | 'abortSignal'> {
|
|
233
233
|
confirmationMessage?: string;
|
|
234
234
|
cancellationMessage?: string;
|
|
235
235
|
renderOptions?: RenderOptions;
|
|
@@ -254,7 +254,7 @@ export interface RenderConfirmationPromptOptions extends Pick<SelectPromptProps<
|
|
|
254
254
|
* confirm.
|
|
255
255
|
*
|
|
256
256
|
*/
|
|
257
|
-
export declare function renderConfirmationPrompt({ message, infoTable,
|
|
257
|
+
export declare function renderConfirmationPrompt({ message, infoTable, confirmationMessage, cancellationMessage, renderOptions, defaultValue, abortSignal, infoMessage, }: RenderConfirmationPromptOptions): Promise<boolean>;
|
|
258
258
|
export interface RenderAutocompleteOptions<T> extends PartialBy<Omit<AutocompletePromptProps<T>, 'onSubmit'>, 'search'> {
|
|
259
259
|
renderOptions?: RenderOptions;
|
|
260
260
|
}
|
package/dist/public/node/ui.js
CHANGED
|
@@ -275,7 +275,7 @@ export async function renderSelectPrompt({ renderOptions, isConfirmationPrompt,
|
|
|
275
275
|
* confirm.
|
|
276
276
|
*
|
|
277
277
|
*/
|
|
278
|
-
export async function renderConfirmationPrompt({ message, infoTable,
|
|
278
|
+
export async function renderConfirmationPrompt({ message, infoTable, confirmationMessage = 'Yes, confirm', cancellationMessage = 'No, cancel', renderOptions, defaultValue = true, abortSignal, infoMessage, }) {
|
|
279
279
|
// eslint-disable-next-line prefer-rest-params
|
|
280
280
|
recordUIEvent({ type: 'confirmationPrompt', properties: arguments[0] });
|
|
281
281
|
const choices = [
|
|
@@ -294,7 +294,6 @@ export async function renderConfirmationPrompt({ message, infoTable, gitDiff, co
|
|
|
294
294
|
choices,
|
|
295
295
|
message,
|
|
296
296
|
infoTable,
|
|
297
|
-
gitDiff,
|
|
298
297
|
renderOptions,
|
|
299
298
|
defaultValue,
|
|
300
299
|
isConfirmationPrompt: true,
|