@shopify/cli-kit 3.45.0-pre.2 → 3.45.0-pre.4

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 (46) hide show
  1. package/README.md +1 -1
  2. package/assets/cli-ruby/lib/shopify_cli/constants.rb +2 -1
  3. package/assets/cli-ruby/lib/shopify_cli/environment.rb +3 -2
  4. package/dist/private/node/api.js +11 -8
  5. package/dist/private/node/api.js.map +1 -1
  6. package/dist/private/node/themes/generate-theme-name.d.ts +1 -0
  7. package/dist/private/node/themes/generate-theme-name.js +2 -2
  8. package/dist/private/node/themes/generate-theme-name.js.map +1 -1
  9. package/dist/private/node/ui/components/Alert.test.js +7 -4
  10. package/dist/private/node/ui/components/Alert.test.js.map +1 -1
  11. package/dist/private/node/ui/components/Banner.js +32 -5
  12. package/dist/private/node/ui/components/Banner.js.map +1 -1
  13. package/dist/private/node/ui/components/ConcurrentOutput.js +5 -3
  14. package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
  15. package/dist/private/node/ui/components/ConcurrentOutput.test.js +8 -8
  16. package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -1
  17. package/dist/private/node/ui/components/FatalError.test.js +2 -2
  18. package/dist/private/node/ui/components/FatalError.test.js.map +1 -1
  19. package/dist/private/node/ui/components/Link.js +19 -7
  20. package/dist/private/node/ui/components/Link.js.map +1 -1
  21. package/dist/private/node/ui/components/SelectPrompt.js +1 -1
  22. package/dist/private/node/ui/components/SelectPrompt.js.map +1 -1
  23. package/dist/private/node/ui/components/Tasks.d.ts +2 -1
  24. package/dist/private/node/ui/components/Tasks.js +6 -2
  25. package/dist/private/node/ui/components/Tasks.js.map +1 -1
  26. package/dist/private/node/ui/components/Tasks.test.js +16 -0
  27. package/dist/private/node/ui/components/Tasks.test.js.map +1 -1
  28. package/dist/private/node/ui/components/TextPrompt.d.ts +1 -0
  29. package/dist/private/node/ui/components/TextPrompt.js +3 -3
  30. package/dist/private/node/ui/components/TextPrompt.js.map +1 -1
  31. package/dist/private/node/ui/contexts/LinksContext.d.ts +12 -0
  32. package/dist/private/node/ui/contexts/LinksContext.js +3 -0
  33. package/dist/private/node/ui/contexts/LinksContext.js.map +1 -0
  34. package/dist/public/common/version.d.ts +1 -1
  35. package/dist/public/common/version.js +1 -1
  36. package/dist/public/common/version.js.map +1 -1
  37. package/dist/public/node/ruby.js +15 -8
  38. package/dist/public/node/ruby.js.map +1 -1
  39. package/dist/public/node/tcp.d.ts +6 -0
  40. package/dist/public/node/tcp.js +8 -0
  41. package/dist/public/node/tcp.js.map +1 -1
  42. package/dist/public/node/ui.d.ts +26 -18
  43. package/dist/public/node/ui.js +31 -20
  44. package/dist/public/node/ui.js.map +1 -1
  45. package/dist/tsconfig.tsbuildinfo +1 -1
  46. package/package.json +3 -2
package/README.md CHANGED
@@ -36,7 +36,7 @@ To work with themes, the CLI needs to be installed globally with:
36
36
 
37
37
  - `npm install -g @shopify/cli @shopify/theme`
38
38
 
39
- You can also use do it through Homebrew on macOS: `brew install shopify-cli`
39
+ You can also use do it through Homebrew on macOS: `brew tap shopify/shopify && brew install shopify-cli`
40
40
 
41
41
  Learn more in the docs: [Shopify CLI for themes](https://shopify.dev/docs/themes/tools/cli)
42
42
 
@@ -32,6 +32,7 @@ module ShopifyCLI
32
32
  STACKTRACE = "SHOPIFY_CLI_STACKTRACE"
33
33
  TTY = "SHOPIFY_CLI_TTY"
34
34
  RUN_AS_SUBPROCESS = "SHOPIFY_CLI_RUN_AS_SUBPROCESS"
35
+ RUBY_BIN = "SHOPIFY_CLI_RUBY_BIN"
35
36
 
36
37
  # When true the CLI points to a local instance of
37
38
  # the partners dashboard and identity.
@@ -67,7 +68,7 @@ module ShopifyCLI
67
68
  module SupportedVersions
68
69
  module Ruby
69
70
  FROM = "2.7.5"
70
- TO = "3.2.0"
71
+ TO = "3.2.10"
71
72
  end
72
73
 
73
74
  module Node
@@ -13,8 +13,9 @@ module ShopifyCLI
13
13
  # https://github.com/Shopify/themekit-access/blob/4c3c917d78443160dcf24376a8b5ac6b9bef0bcd/app/models/password_token.rb#L8
14
14
  THEME_ACCESS_PASSWORD_PREFIX = "shptka_"
15
15
 
16
- def self.ruby_version(context: Context.new)
17
- output, status = context.capture2e("ruby", "--version")
16
+ def self.ruby_version(context: Context.new, env_variables: ENV)
17
+ ruby_bin = env_variables[Constants::EnvironmentVariables::RUBY_BIN] || "ruby"
18
+ output, status = context.capture2e(ruby_bin, "--version")
18
19
  raise ShopifyCLI::Abort, context.message("core.errors.missing_ruby") unless status.success?
19
20
  version = output.match(/ruby (\d+\.\d+\.\d+)/)[1]
20
21
  ::Semantic::Version.new(version)
@@ -6,15 +6,23 @@ export const allAPIs = ['admin', 'storefront-renderer', 'partners'];
6
6
  const interestingResponseHeaders = new Set(['cache-control', 'content-type', 'etag', 'x-request-id']);
7
7
  export async function debugLogResponseInfo({ request, url }, errorHandler) {
8
8
  const t0 = performance.now();
9
- let headers = new Headers();
9
+ const responseHeaders = {};
10
10
  let response = {};
11
11
  try {
12
12
  response = await request;
13
- headers = response.headers;
13
+ response.headers.forEach((value, key) => {
14
+ if (interestingResponseHeaders.has(key))
15
+ responseHeaders[key] = value;
16
+ });
14
17
  }
15
18
  catch (err) {
16
19
  if (err instanceof ClientError) {
17
- headers = err.response?.headers;
20
+ if (err.response?.headers) {
21
+ for (const [key, value] of err.response?.headers) {
22
+ if (interestingResponseHeaders.has(key))
23
+ responseHeaders[key] = value;
24
+ }
25
+ }
18
26
  }
19
27
  if (errorHandler) {
20
28
  throw errorHandler(err);
@@ -25,11 +33,6 @@ export async function debugLogResponseInfo({ request, url }, errorHandler) {
25
33
  }
26
34
  finally {
27
35
  const t1 = performance.now();
28
- const responseHeaders = {};
29
- headers.forEach((value, key) => {
30
- if (interestingResponseHeaders.has(key))
31
- responseHeaders[key] = value;
32
- });
33
36
  outputDebug(`Request to ${url} completed in ${Math.round(t1 - t0)} ms
34
37
  With response headers:
35
38
  ${sanitizedHeadersOutput(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I,0BAA0B,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,eAAe,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;QACvE,CAAC,CAAC,CAAA;QACF,WAAW,CAAC,cAAc,GAAG,iBAAiB,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;;EAEnE,sBAAsB,CAAC,eAAe,CAAC;KACpC,CAAC,CAAA;KACH;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC","sourcesContent":["import {sanitizedHeadersOutput} from './api/headers.js'\nimport {outputDebug} from '@shopify/cli-kit/node/output'\nimport {ClientError} from 'graphql-request'\nimport {performance} from 'perf_hooks'\n\nexport type API = 'admin' | 'storefront-renderer' | 'partners'\n\nexport const allAPIs: API[] = ['admin', 'storefront-renderer', 'partners']\n\ninterface RequestOptions<T> {\n request: Promise<T>\n url: string\n}\n\nconst interestingResponseHeaders = new Set(['cache-control', 'content-type', 'etag', 'x-request-id'])\n\nexport async function debugLogResponseInfo<T extends {headers: Headers; status: number}>(\n {request, url}: RequestOptions<T>,\n errorHandler?: (error: unknown) => Error | unknown,\n): Promise<T> {\n const t0 = performance.now()\n let headers: Headers = new Headers()\n let response: T = {} as T\n try {\n response = await request\n headers = response.headers\n } catch (err) {\n if (err instanceof ClientError) {\n headers = err.response?.headers as Headers\n }\n if (errorHandler) {\n throw errorHandler(err)\n } else {\n throw err\n }\n } finally {\n const t1 = performance.now()\n const responseHeaders: {[key: string]: string} = {}\n headers.forEach((value, key) => {\n if (interestingResponseHeaders.has(key)) responseHeaders[key] = value\n })\n outputDebug(`Request to ${url} completed in ${Math.round(t1 - t0)} ms\nWith response headers:\n${sanitizedHeadersOutput(responseHeaders)}\n `)\n }\n return response\n}\n"]}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/private/node/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAC,WAAW,EAAC,MAAM,8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AAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;QAC5B,WAAW,CAAC,cAAc,GAAG,iBAAiB,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;;EAEnE,sBAAsB,CAAC,eAAe,CAAC;KACpC,CAAC,CAAA;KACH;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC","sourcesContent":["import {sanitizedHeadersOutput} from './api/headers.js'\nimport {outputDebug} from '@shopify/cli-kit/node/output'\nimport {ClientError} from 'graphql-request'\nimport {performance} from 'perf_hooks'\n\nexport type API = 'admin' | 'storefront-renderer' | 'partners'\n\nexport const allAPIs: API[] = ['admin', 'storefront-renderer', 'partners']\n\ninterface RequestOptions<T> {\n request: Promise<T>\n url: string\n}\n\nconst interestingResponseHeaders = new Set(['cache-control', 'content-type', 'etag', 'x-request-id'])\n\nexport async function debugLogResponseInfo<T extends {headers: Headers; status: number}>(\n {request, url}: RequestOptions<T>,\n errorHandler?: (error: unknown) => Error | unknown,\n): Promise<T> {\n const t0 = performance.now()\n const responseHeaders: {[key: string]: string} = {}\n let response: T = {} as T\n try {\n response = await request\n response.headers.forEach((value, key) => {\n if (interestingResponseHeaders.has(key)) responseHeaders[key] = value\n })\n } catch (err) {\n if (err instanceof ClientError) {\n if (err.response?.headers) {\n for (const [key, value] of err.response?.headers as Iterable<[string, string]>) {\n if (interestingResponseHeaders.has(key)) responseHeaders[key] = value\n }\n }\n }\n if (errorHandler) {\n throw errorHandler(err)\n } else {\n throw err\n }\n } finally {\n const t1 = performance.now()\n outputDebug(`Request to ${url} completed in ${Math.round(t1 - t0)} ms\nWith response headers:\n${sanitizedHeadersOutput(responseHeaders)}\n `)\n }\n return response\n}\n"]}
@@ -1 +1,2 @@
1
+ export declare const API_NAME_LIMIT = 50;
1
2
  export declare function generateThemeName(context: string): string;
@@ -1,12 +1,12 @@
1
1
  import { replaceInvalidCharacters } from './replace-invalid-characters.js';
2
2
  import { randomBytes } from 'crypto';
3
3
  import { hostname } from 'os';
4
- const API_NAME_LIMIT = 50;
4
+ export const API_NAME_LIMIT = 50;
5
5
  export function generateThemeName(context) {
6
6
  const hostNameWithoutDomain = hostname().split('.')[0];
7
7
  const hash = randomBytes(3).toString('hex');
8
8
  const name = `${context} ()`;
9
- const hostNameCharacterLimit = API_NAME_LIMIT - name.length - hash.length;
9
+ const hostNameCharacterLimit = API_NAME_LIMIT - name.length - hash.length - 1;
10
10
  const identifier = replaceInvalidCharacters(`${hash}-${hostNameWithoutDomain.substring(0, hostNameCharacterLimit)}`);
11
11
  return `${context} (${identifier})`;
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generate-theme-name.js","sourceRoot":"","sources":["../../../../src/private/node/themes/generate-theme-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,wBAAwB,EAAC,MAAM,iCAAiC,CAAA;AACxE,OAAO,EAAC,WAAW,EAAC,MAAM,QAAQ,CAAA;AAClC,OAAO,EAAC,QAAQ,EAAC,MAAM,IAAI,CAAA;AAE3B,MAAM,cAAc,GAAG,EAAE,CAAA;AAEzB,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,MAAM,qBAAqB,GAAG,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAA;IACvD,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE3C,MAAM,IAAI,GAAG,GAAG,OAAO,KAAK,CAAA;IAC5B,MAAM,sBAAsB,GAAG,cAAc,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IACzE,MAAM,UAAU,GAAG,wBAAwB,CAAC,GAAG,IAAI,IAAI,qBAAqB,CAAC,SAAS,CAAC,CAAC,EAAE,sBAAsB,CAAC,EAAE,CAAC,CAAA;IACpH,OAAO,GAAG,OAAO,KAAK,UAAU,GAAG,CAAA;AACrC,CAAC","sourcesContent":["import {replaceInvalidCharacters} from './replace-invalid-characters.js'\nimport {randomBytes} from 'crypto'\nimport {hostname} from 'os'\n\nconst API_NAME_LIMIT = 50\n\nexport function generateThemeName(context: string): string {\n const hostNameWithoutDomain = hostname().split('.')[0]!\n const hash = randomBytes(3).toString('hex')\n\n const name = `${context} ()`\n const hostNameCharacterLimit = API_NAME_LIMIT - name.length - hash.length\n const identifier = replaceInvalidCharacters(`${hash}-${hostNameWithoutDomain.substring(0, hostNameCharacterLimit)}`)\n return `${context} (${identifier})`\n}\n"]}
1
+ {"version":3,"file":"generate-theme-name.js","sourceRoot":"","sources":["../../../../src/private/node/themes/generate-theme-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,wBAAwB,EAAC,MAAM,iCAAiC,CAAA;AACxE,OAAO,EAAC,WAAW,EAAC,MAAM,QAAQ,CAAA;AAClC,OAAO,EAAC,QAAQ,EAAC,MAAM,IAAI,CAAA;AAE3B,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAA;AAEhC,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,MAAM,qBAAqB,GAAG,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAA;IACvD,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE3C,MAAM,IAAI,GAAG,GAAG,OAAO,KAAK,CAAA;IAC5B,MAAM,sBAAsB,GAAG,cAAc,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAA;IAC7E,MAAM,UAAU,GAAG,wBAAwB,CAAC,GAAG,IAAI,IAAI,qBAAqB,CAAC,SAAS,CAAC,CAAC,EAAE,sBAAsB,CAAC,EAAE,CAAC,CAAA;IACpH,OAAO,GAAG,OAAO,KAAK,UAAU,GAAG,CAAA;AACrC,CAAC","sourcesContent":["import {replaceInvalidCharacters} from './replace-invalid-characters.js'\nimport {randomBytes} from 'crypto'\nimport {hostname} from 'os'\n\nexport const API_NAME_LIMIT = 50\n\nexport function generateThemeName(context: string): string {\n const hostNameWithoutDomain = hostname().split('.')[0]!\n const hash = randomBytes(3).toString('hex')\n\n const name = `${context} ()`\n const hostNameCharacterLimit = API_NAME_LIMIT - name.length - hash.length - 1\n const identifier = replaceInvalidCharacters(`${hash}-${hostNameWithoutDomain.substring(0, hostNameCharacterLimit)}`)\n return `${context} (${identifier})`\n}\n"]}
@@ -48,7 +48,7 @@ describe('Alert', async () => {
48
48
  ],
49
49
  link: {
50
50
  label: 'Link',
51
- url: 'https://shopify.com',
51
+ url: 'https://www.google.com/search?q=jh56t9l34kpo35tw8s28hn7s9s2xvzla01d8cn6j7yq&rlz=1C1GCEU_enUS832US832&oq=jh56t9l34kpo35tw8s28hn7s9s2xvzla01d8cn6j7yq&aqs=chrome.0.35i39l2j0l4j46j69i60.2711j0j7&sourceid=chrome&ie=UTF-8',
52
52
  },
53
53
  customSections: [
54
54
  {
@@ -84,10 +84,9 @@ describe('Alert', async () => {
84
84
  │ │
85
85
  │ Reference │
86
86
  │ • Run \`npm shopify help\` │
87
- │ • Press 'return' to open the really amazing and clean dev docs (
88
- │ https://shopify.dev ) │
87
+ │ • Press 'return' to open the really amazing and clean dev docs [1]
89
88
  │ │
90
- │ Link ( https://shopify.com )
89
+ │ Link [2]
91
90
  │ │
92
91
  │ Custom section │
93
92
  │ • Item 1 │
@@ -100,6 +99,10 @@ describe('Alert', async () => {
100
99
  │ • Item 3 │
101
100
  │ │
102
101
  ╰──────────────────────────────────────────────────────────────────────────────╯
102
+ [1] https://shopify.dev
103
+ [2] https://www.google.com/search?q=jh56t9l34kpo35tw8s28hn7s9s2xvzla01d8cn6j7yq&rlz=1C1GCEU_enUS832U
104
+ S832&oq=jh56t9l34kpo35tw8s28hn7s9s2xvzla01d8cn6j7yq&aqs=chrome.0.35i39l2j0l4j46j69i60.2711j0j7&sourc
105
+ eid=chrome&ie=UTF-8
103
106
  "
104
107
  `);
105
108
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Alert.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAChC,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAC1D,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAE1C,QAAQ,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE;IAC3B,IAAI,CAAC,wCAAwC,EAAE,KAAK,IAAI,EAAE;QACxD,MAAM,OAAO,GAAG;YACd,QAAQ,EAAE,CAAC,EAAC,SAAS,EAAE,QAAQ,EAAC,EAAE,iCAAiC,CAAC;YACpE,IAAI,EAAE,CAAC,qCAAqC,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,EAAE,SAAS,CAAC;YAC5E,SAAS,EAAE;gBACT;oBACE,KAAK;oBACL;wBACE,OAAO,EAAE,oBAAoB;qBAC9B;iBACF;gBACD;oBACE,8BAA8B;oBAC9B;wBACE,OAAO,EAAE,aAAa;qBACvB;iBACF;gBACD;oBACE,wBAAwB;oBACxB;wBACE,OAAO,EAAE,wBAAwB;qBAClC;iBACF;aACF;YACD,SAAS,EAAE;gBACT;oBACE,KAAK;oBACL;wBACE,OAAO,EAAE,kBAAkB;qBAC5B;iBACF;gBACD;oBACE,iCAAiC;oBACjC,qDAAqD;oBACrD;wBACE,IAAI,EAAE;4BACJ,KAAK,EAAE,UAAU;4BACjB,GAAG,EAAE,qBAAqB;yBAC3B;qBACF;iBACF;aACF;YACD,IAAI,EAAE;gBACJ,KAAK,EAAE,MAAM;gBACb,GAAG,EAAE,qBAAqB;aAC3B;YACD,cAAc,EAAE;gBACd;oBACE,KAAK,EAAE,gBAAgB;oBACvB,IA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AC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {Alert} from './Alert.js'\nimport {unstyled} from '../../../../public/node/output.js'\nimport {describe, expect, test} from 'vitest'\nimport React from 'react'\nimport {render} from 'ink-testing-library'\n\ndescribe('Alert', async () => {\n test('renders correctly with all the options', async () => {\n const options = {\n headline: [{userInput: 'my-app'}, 'initialized and ready to build.'],\n body: ['You can find the build files in the', {filePath: 'dist'}, 'folder.'],\n nextSteps: [\n [\n 'Run',\n {\n command: 'cd santorini-goods',\n },\n ],\n [\n 'To preview your project, run',\n {\n command: 'npm app dev',\n },\n ],\n [\n 'To add extensions, run',\n {\n command: 'npm generate extension',\n },\n ],\n ],\n reference: [\n [\n 'Run',\n {\n command: 'npm shopify help',\n },\n ],\n [\n // testing link wrapping behavior\n \"Press 'return' to open the really amazing and clean\",\n {\n link: {\n label: 'dev docs',\n url: 'https://shopify.dev',\n },\n },\n ],\n ],\n link: {\n label: 'Link',\n url: 'https://shopify.com',\n },\n customSections: [\n {\n title: 'Custom section',\n body: {\n list: {\n items: ['Item 1', 'Item 2', 'Item 3'],\n },\n },\n },\n {\n title: 'Custom section 2',\n body: {\n list: {\n items: ['Item 1', 'Item 2', 'Item 3'],\n },\n },\n },\n ],\n }\n\n const {lastFrame} = render(<Alert type=\"info\" {...options} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ info ───────────────────────────────────────────────────────────────────────╮\n │ │\n │ my-app initialized and ready to build. │\n │ │\n │ You can find the build files in the dist folder. │\n │ │\n │ Next steps │\n │ • Run \\`cd santorini-goods\\` │\n │ • To preview your project, run \\`npm app dev\\` │\n │ • To add extensions, run \\`npm generate extension\\` │\n │ │\n │ Reference │\n │ • Run \\`npm shopify help\\` │\n │ • Press 'return' to open the really amazing and clean dev docs ( │\n │ https://shopify.dev ) │\n │ │\n │ Link ( https://shopify.com ) │\n │ │\n │ Custom section │\n │ • Item 1 │\n │ • Item 2 │\n │ • Item 3 │\n │ │\n │ Custom section 2 │\n │ • Item 1 │\n │ • Item 2 │\n │ • Item 3 │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n \"\n `)\n })\n\n test('allows passing just a body', async () => {\n const options = {\n body: 'Title',\n }\n\n const {lastFrame} = render(<Alert type=\"info\" {...options} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ info ───────────────────────────────────────────────────────────────────────╮\n │ │\n │ Title │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n \"\n `)\n })\n\n test('has the headline in bold', async () => {\n const options = {\n headline: 'Title',\n }\n\n const {lastFrame} = render(<Alert type=\"info\" {...options} />)\n\n expect(lastFrame()).toMatchInlineSnapshot(`\n \"\u001b[2m╭─\u001b[22m info \u001b[2m───────────────────────────────────────────────────────────────────────╮\u001b[22m\n \u001b[2m│\u001b[22m \u001b[2m│\u001b[22m\n \u001b[2m│\u001b[22m \u001b[1mTitle\u001b[22m \u001b[2m│\u001b[22m\n \u001b[2m│\u001b[22m \u001b[2m│\u001b[22m\n \u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[22m\n \"\n `)\n })\n})\n"]}
1
+ {"version":3,"file":"Alert.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Alert.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAChC,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAC1D,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAE1C,QAAQ,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE;IAC3B,IAAI,CAAC,wCAAwC,EAAE,KAAK,IAAI,EAAE;QACxD,MAAM,OAAO,GAAG;YACd,QAAQ,EAAE,CAAC,EAAC,SAAS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AAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,OAAO,GAAG;YACd,IAAI,EAAE,OAAO;SACd,CAAA;QAED,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,KAAK,IAAC,IAAI,EAAC,MAAM,KAAK,OAAO,GAAI,CAAC,CAAA;QAE9D,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;KAOpD,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,0BAA0B,EAAE,KAAK,IAAI,EAAE;QAC1C,MAAM,OAAO,GAAG;YACd,QAAQ,EAAE,OAAO;SAClB,CAAA;QAED,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,KAAK,IAAC,IAAI,EAAC,MAAM,KAAK,OAAO,GAAI,CAAC,CAAA;QAE9D,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,qBAAqB,CAAC;;;;;;;KAOzC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {Alert} from './Alert.js'\nimport {unstyled} from '../../../../public/node/output.js'\nimport {describe, expect, test} from 'vitest'\nimport React from 'react'\nimport {render} from 'ink-testing-library'\n\ndescribe('Alert', async () => {\n test('renders correctly with all the options', async () => {\n const options = {\n headline: [{userInput: 'my-app'}, 'initialized and ready to build.'],\n body: ['You can find the build files in the', {filePath: 'dist'}, 'folder.'],\n nextSteps: [\n [\n 'Run',\n {\n command: 'cd santorini-goods',\n },\n ],\n [\n 'To preview your project, run',\n {\n command: 'npm app dev',\n },\n ],\n [\n 'To add extensions, run',\n {\n command: 'npm generate extension',\n },\n ],\n ],\n reference: [\n [\n 'Run',\n {\n command: 'npm shopify help',\n },\n ],\n [\n // testing link wrapping behavior\n \"Press 'return' to open the really amazing and clean\",\n {\n link: {\n label: 'dev docs',\n url: 'https://shopify.dev',\n },\n },\n ],\n ],\n link: {\n label: 'Link',\n url: 'https://www.google.com/search?q=jh56t9l34kpo35tw8s28hn7s9s2xvzla01d8cn6j7yq&rlz=1C1GCEU_enUS832US832&oq=jh56t9l34kpo35tw8s28hn7s9s2xvzla01d8cn6j7yq&aqs=chrome.0.35i39l2j0l4j46j69i60.2711j0j7&sourceid=chrome&ie=UTF-8',\n },\n customSections: [\n {\n title: 'Custom section',\n body: {\n list: {\n items: ['Item 1', 'Item 2', 'Item 3'],\n },\n },\n },\n {\n title: 'Custom section 2',\n body: {\n list: {\n items: ['Item 1', 'Item 2', 'Item 3'],\n },\n },\n },\n ],\n }\n\n const {lastFrame} = render(<Alert type=\"info\" {...options} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ info ───────────────────────────────────────────────────────────────────────╮\n │ │\n │ my-app initialized and ready to build. │\n │ │\n │ You can find the build files in the dist folder. │\n │ │\n │ Next steps │\n │ • Run \\`cd santorini-goods\\` │\n │ • To preview your project, run \\`npm app dev\\` │\n │ • To add extensions, run \\`npm generate extension\\` │\n │ │\n │ Reference │\n │ • Run \\`npm shopify help\\` │\n │ • Press 'return' to open the really amazing and clean dev docs [1] │\n │ │\n │ Link [2] │\n │ │\n │ Custom section │\n │ • Item 1 │\n │ • Item 2 │\n │ • Item 3 │\n │ │\n │ Custom section 2 │\n │ • Item 1 │\n │ • Item 2 │\n │ • Item 3 │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n [1] https://shopify.dev\n [2] https://www.google.com/search?q=jh56t9l34kpo35tw8s28hn7s9s2xvzla01d8cn6j7yq&rlz=1C1GCEU_enUS832U\n S832&oq=jh56t9l34kpo35tw8s28hn7s9s2xvzla01d8cn6j7yq&aqs=chrome.0.35i39l2j0l4j46j69i60.2711j0j7&sourc\n eid=chrome&ie=UTF-8\n \"\n `)\n })\n\n test('allows passing just a body', async () => {\n const options = {\n body: 'Title',\n }\n\n const {lastFrame} = render(<Alert type=\"info\" {...options} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ info ───────────────────────────────────────────────────────────────────────╮\n │ │\n │ Title │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n \"\n `)\n })\n\n test('has the headline in bold', async () => {\n const options = {\n headline: 'Title',\n }\n\n const {lastFrame} = render(<Alert type=\"info\" {...options} />)\n\n expect(lastFrame()).toMatchInlineSnapshot(`\n \"\u001b[2m╭─\u001b[22m info \u001b[2m───────────────────────────────────────────────────────────────────────╮\u001b[22m\n \u001b[2m│\u001b[22m \u001b[2m│\u001b[22m\n \u001b[2m│\u001b[22m \u001b[1mTitle\u001b[22m \u001b[2m│\u001b[22m\n \u001b[2m│\u001b[22m \u001b[2m│\u001b[22m\n \u001b[2m╰──────────────────────────────────────────────────────────────────────────────╯\u001b[22m\n \"\n `)\n })\n})\n"]}
@@ -1,6 +1,7 @@
1
1
  import useLayout from '../hooks/use-layout.js';
2
+ import { LinksContext } from '../contexts/LinksContext.js';
2
3
  import { Box, Text } from 'ink';
3
- import React from 'react';
4
+ import React, { useContext, useRef } from 'react';
4
5
  function typeToColor(type) {
5
6
  return {
6
7
  success: 'green',
@@ -10,12 +11,38 @@ function typeToColor(type) {
10
11
  external_error: 'red',
11
12
  }[type];
12
13
  }
14
+ const Footnotes = () => {
15
+ const linksContext = useContext(LinksContext);
16
+ if (linksContext === null || linksContext.links.current === null) {
17
+ return null;
18
+ }
19
+ const links = linksContext.links.current;
20
+ const linkIds = Object.keys(links);
21
+ return linkIds.length > 0 ? (React.createElement(Box, { marginBottom: 1, marginTop: -1, flexDirection: "column" }, linkIds.map((id) => (React.createElement(Text, { key: id }, `[${id}] ${links[id]?.url}`))))) : null;
22
+ };
13
23
  const BoxWithBorder = ({ type, children }) => {
14
24
  const { twoThirds } = useLayout();
15
- return (React.createElement(Box, { width: twoThirds, paddingY: 1, paddingX: 2, marginBottom: 1, borderStyle: "round", flexDirection: "column", borderColor: typeToColor(type) },
16
- React.createElement(Box, { marginTop: -2, marginBottom: 1, marginLeft: -1 },
17
- React.createElement(Text, null, ` ${type.replace(/_/g, ' ')} `)),
18
- children));
25
+ const links = useRef({});
26
+ return (React.createElement(LinksContext.Provider, { value: {
27
+ links,
28
+ addLink: (label, url) => {
29
+ const id = Object.keys(links.current).find((id) => links.current[id].url === url);
30
+ if (id) {
31
+ return id;
32
+ }
33
+ const newId = (Object.keys(links.current).length + 1).toString();
34
+ links.current = {
35
+ ...links.current,
36
+ [newId]: { label, url },
37
+ };
38
+ return newId;
39
+ },
40
+ } },
41
+ React.createElement(Box, { width: twoThirds, paddingY: 1, paddingX: 2, marginBottom: 1, borderStyle: "round", flexDirection: "column", borderColor: typeToColor(type) },
42
+ React.createElement(Box, { marginTop: -2, marginBottom: 1, marginLeft: -1 },
43
+ React.createElement(Text, null, ` ${type.replace(/_/g, ' ')} `)),
44
+ children),
45
+ React.createElement(Footnotes, null)));
19
46
  };
20
47
  const BoxWithTopBottomLines = ({ type, children }) => {
21
48
  const { twoThirds } = useLayout();
@@ -1 +1 @@
1
- {"version":3,"file":"Banner.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Banner.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,KAA0B,MAAM,OAAO,CAAA;AAQ9C,SAAS,WAAW,CAAC,IAAyB;IAC5C,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,QAAQ;QACjB,IAAI,EAAE,KAAK;QACX,cAAc,EAAE,KAAK;KACtB,CAAC,IAAI,CAAC,CAAA;AACT,CAAC;AAED,MAAM,aAAa,GAAmC,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAE,EAAE;IACzE,MAAM,EAAC,SAAS,EAAC,GAAG,SAA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,CAAQ,CACtE,CACH;QAEL,QAAQ;QAET,oBAAC,GAAG,IAAC,SAAS,EAAE,CAAC;YACf,oBAAC,IAAI,IAAC,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,IAAG,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAQ,CAC1D,CACF,CACP,CAAA;AACH,CAAC,CAAA;AAED,MAAM,MAAM,GAAmC,CAAC,EAAC,QAAQ,EAAE,GAAG,KAAK,EAAC,EAAE,EAAE;IACtE,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,EAAE;QACnC,OAAO,KAAK,CAAC,aAAa,CAAC,qBAAqB,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAA;KACnE;SAAM;QACL,OAAO,KAAK,CAAC,aAAa,CAAC,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAA;KAC3D;AACH,CAAC,CAAA;AAED,OAAO,EAAC,MAAM,EAAC,CAAA","sourcesContent":["import useLayout from '../hooks/use-layout.js'\nimport {Box, Text} from 'ink'\nimport React, {FunctionComponent} from 'react'\n\nexport type BannerType = 'success' | 'error' | 'warning' | 'info' | 'external_error'\n\ninterface BannerProps {\n type: BannerType\n}\n\nfunction typeToColor(type: BannerProps['type']) {\n return {\n success: 'green',\n error: 'red',\n warning: 'yellow',\n info: 'dim',\n external_error: 'red',\n }[type]\n}\n\nconst BoxWithBorder: FunctionComponent<BannerProps> = ({type, children}) => {\n const {twoThirds} = useLayout()\n\n return (\n <Box\n width={twoThirds}\n paddingY={1}\n paddingX={2}\n marginBottom={1}\n borderStyle=\"round\"\n flexDirection=\"column\"\n borderColor={typeToColor(type)}\n >\n <Box marginTop={-2} marginBottom={1} marginLeft={-1}>\n <Text>{` ${type.replace(/_/g, ' ')} `}</Text>\n </Box>\n {children}\n </Box>\n )\n}\n\nconst BoxWithTopBottomLines: FunctionComponent<BannerProps> = ({type, children}) => {\n const {twoThirds} = useLayout()\n // 2 initial dashes + 2 spaces surrounding the type\n let topLineAfterTypeLength = twoThirds - 2 - type.length - 2\n if (topLineAfterTypeLength < 0) topLineAfterTypeLength = 0\n\n return (\n <Box flexDirection=\"column\" marginBottom={1}>\n <Box marginBottom={1}>\n <Text>\n <Text color={typeToColor(type)}>{'─'.repeat(2)}</Text>\n <Text>{` ${type.replace(/_/g, ' ')} `}</Text>\n <Text color={typeToColor(type)}>{'─'.repeat(topLineAfterTypeLength)}</Text>\n </Text>\n </Box>\n\n {children}\n\n <Box marginTop={1}>\n <Text color={typeToColor(type)}>{'─'.repeat(twoThirds)}</Text>\n </Box>\n </Box>\n )\n}\n\nconst Banner: FunctionComponent<BannerProps> = ({children, ...props}) => {\n if (props.type === 'external_error') {\n return React.createElement(BoxWithTopBottomLines, props, children)\n } else {\n return React.createElement(BoxWithBorder, props, children)\n }\n}\n\nexport {Banner}\n"]}
1
+ {"version":3,"file":"Banner.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Banner.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAO,YAAY,EAAC,MAAM,6BAA6B,CAAA;AAC9D,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,KAAK,EAAE,EAAoB,UAAU,EAAE,MAAM,EAAC,MAAM,OAAO,CAAA;AAQlE,SAAS,WAAW,CAAC,IAAyB;IAC5C,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,QAAQ;QACjB,IAAI,EAAE,KAAK;QACX,cAAc,EAAE,KAAK;KACtB,CAAC,IAAI,CAAC,CAAA;AACT,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,CAAA;IAE7C,IAAI,YAAY,KAAK,IAAI,IAAI,YAAY,CAAC,KAAK,CAAC,OAAO,KAAK,IAAI,EAAE;QAChE,OAAO,IAAI,CAAA;KACZ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IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAQ;gBAC7C,oBAAC,IAAI,IAAC,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,IAAG,GAAG,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAQ,CACtE,CACH;QAEL,QAAQ;QAET,oBAAC,GAAG,IAAC,SAAS,EAAE,CAAC;YACf,oBAAC,IAAI,IAAC,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,IAAG,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAQ,CAC1D,CACF,CACP,CAAA;AACH,CAAC,CAAA;AAED,MAAM,MAAM,GAAmC,CAAC,EAAC,QAAQ,EAAE,GAAG,KAAK,EAAC,EAAE,EAAE;IACtE,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,EAAE;QACnC,OAAO,KAAK,CAAC,aAAa,CAAC,qBAAqB,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAA;KACnE;SAAM;QACL,OAAO,KAAK,CAAC,aAAa,CAAC,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAA;KAC3D;AACH,CAAC,CAAA;AAED,OAAO,EAAC,MAAM,EAAC,CAAA","sourcesContent":["import useLayout from '../hooks/use-layout.js'\nimport {Link, LinksContext} from '../contexts/LinksContext.js'\nimport {Box, Text} from 'ink'\nimport React, {FunctionComponent, useContext, useRef} from 'react'\n\nexport type BannerType = 'success' | 'error' | 'warning' | 'info' | 'external_error'\n\ninterface BannerProps {\n type: BannerType\n}\n\nfunction typeToColor(type: BannerProps['type']) {\n return {\n success: 'green',\n error: 'red',\n warning: 'yellow',\n info: 'dim',\n external_error: 'red',\n }[type]\n}\n\nconst Footnotes = () => {\n const linksContext = useContext(LinksContext)\n\n if (linksContext === null || linksContext.links.current === null) {\n return null\n }\n\n const links = linksContext.links.current\n const linkIds = Object.keys(links)\n\n return linkIds.length > 0 ? (\n <Box marginBottom={1} marginTop={-1} flexDirection=\"column\">\n {linkIds.map((id) => (\n <Text key={id}>{`[${id}] ${links[id]?.url}`}</Text>\n ))}\n </Box>\n ) : null\n}\n\nconst BoxWithBorder: FunctionComponent<BannerProps> = ({type, children}) => {\n const {twoThirds} = useLayout()\n const links = useRef<{[key: string]: Link}>({})\n\n return (\n <LinksContext.Provider\n value={{\n links,\n addLink: (label, url) => {\n const id: string | undefined = Object.keys(links.current).find((id) => links.current[id]!.url === url)\n if (id) {\n return id\n }\n const newId = (Object.keys(links.current).length + 1).toString()\n links.current = {\n ...links.current,\n [newId]: {label, url},\n }\n return newId\n },\n }}\n >\n <Box\n width={twoThirds}\n paddingY={1}\n paddingX={2}\n marginBottom={1}\n borderStyle=\"round\"\n flexDirection=\"column\"\n borderColor={typeToColor(type)}\n >\n <Box marginTop={-2} marginBottom={1} marginLeft={-1}>\n <Text>{` ${type.replace(/_/g, ' ')} `}</Text>\n </Box>\n {children}\n </Box>\n <Footnotes />\n </LinksContext.Provider>\n )\n}\n\nconst BoxWithTopBottomLines: FunctionComponent<BannerProps> = ({type, children}) => {\n const {twoThirds} = useLayout()\n // 2 initial dashes + 2 spaces surrounding the type\n let topLineAfterTypeLength = twoThirds - 2 - type.length - 2\n if (topLineAfterTypeLength < 0) topLineAfterTypeLength = 0\n\n return (\n <Box flexDirection=\"column\" marginBottom={1}>\n <Box marginBottom={1}>\n <Text>\n <Text color={typeToColor(type)}>{'─'.repeat(2)}</Text>\n <Text>{` ${type.replace(/_/g, ' ')} `}</Text>\n <Text color={typeToColor(type)}>{'─'.repeat(topLineAfterTypeLength)}</Text>\n </Text>\n </Box>\n\n {children}\n\n <Box marginTop={1}>\n <Text color={typeToColor(type)}>{'─'.repeat(twoThirds)}</Text>\n </Box>\n </Box>\n )\n}\n\nconst Banner: FunctionComponent<BannerProps> = ({children, ...props}) => {\n if (props.type === 'external_error') {\n return React.createElement(BoxWithTopBottomLines, props, children)\n } else {\n return React.createElement(BoxWithBorder, props, children)\n }\n}\n\nexport {Banner}\n"]}
@@ -81,10 +81,10 @@ const ConcurrentOutput = ({ processes, abortController, showTimestamps = true, o
81
81
  showTimestamps ? (React.createElement(Box, null,
82
82
  React.createElement(Box, { marginRight: 1 },
83
83
  React.createElement(Text, { color: chunk.color }, new Date().toISOString().replace(/T/, ' ').replace(/\..+/, ''))),
84
- React.createElement(Text, { bold: true, color: chunk.color }, "|"))) : null,
84
+ React.createElement(Text, { bold: true, color: chunk.color }, figures.lineVertical))) : null,
85
85
  React.createElement(Box, { width: prefixColumnSize, marginX: 1 },
86
86
  React.createElement(Text, { color: chunk.color }, chunk.prefix)),
87
- React.createElement(Text, { bold: true, color: chunk.color }, "|"),
87
+ React.createElement(Text, { bold: true, color: chunk.color }, figures.lineVertical),
88
88
  React.createElement(Box, { flexGrow: 1, paddingLeft: 1 },
89
89
  React.createElement(Text, { color: chunk.color }, line)))))));
90
90
  }),
@@ -93,7 +93,9 @@ const ConcurrentOutput = ({ processes, abortController, showTimestamps = true, o
93
93
  figures.pointerSmall,
94
94
  " Press ",
95
95
  React.createElement(Text, { bold: true }, shortcut.key),
96
- " | ",
96
+ " ",
97
+ figures.lineVertical,
98
+ " ",
97
99
  shortcut.action)))),
98
100
  footer.subTitle ? (React.createElement(Box, { marginTop: 1 },
99
101
  React.createElement(Text, null, footer.subTitle))) : null)) : null));
@@ -1 +1 @@
1
- {"version":3,"file":"ConcurrentOutput.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/ConcurrentOutput.tsx"],"names":[],"mappings":"AACA,OAAO,kBAAkB,MAAM,mCAAmC,CAAA;AAElE,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,EAAoB,QAAQ,EAAC,MAAM,OAAO,CAAA;AACxD,OAAO,EAAC,GAAG,EAAO,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAC,MAAM,KAAK,CAAA;AACpD,OAAO,SAAS,MAAM,YAAY,CAAA;AAClC,OAAO,QAAQ,MAAM,WAAW,CAAA;AACh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AO,CAAC,YAAY;;gBAAQ,oBAAC,IAAI,IAAC,IAAI,UAAE,QAAQ,CAAC,GAAG,CAAQ;;gBAAI,QAAQ,CAAC,MAAM,CAC3E,CACR,CAAC,CACE;YACL,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CACjB,oBAAC,GAAG,IAAC,SAAS,EAAE,CAAC;gBACf,oBAAC,IAAI,QAAE,MAAM,CAAC,QAAQ,CAAQ,CAC1B,CACP,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CAAC,CAAC,CAAC,IAAI,CACP,CACJ,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAC,gBAAgB,EAAC,CAAA","sourcesContent":["import {OutputProcess} from '../../../../public/node/output.js'\nimport useAsyncAndUnmount from '../hooks/use-async-and-unmount.js'\nimport {AbortController} from '../../../../public/node/abort.js'\nimport {handleCtrlC} from '../../ui.js'\nimport React, {FunctionComponent, useState} from 'react'\nimport {Box, Key, Static, Text, useInput} from 'ink'\nimport stripAnsi from 'strip-ansi'\nimport treeKill from 'tree-kill'\nimport figures from 'figures'\nimport {Writable} from 'stream'\n\nexport type WritableStream = (process: OutputProcess, index: number) => Writable\n\ninterface Shortcut {\n key: string\n action: string\n}\nexport interface ConcurrentOutputProps {\n processes: OutputProcess[]\n abortController: AbortController\n showTimestamps?: boolean\n onInput?: (input: string, key: Key, exit: () => void) => void\n footer?: {\n shortcuts: Shortcut[]\n subTitle?: string\n }\n}\ninterface Chunk {\n color: string\n prefix: string\n lines: string[]\n}\n\n/**\n * Renders output from concurrent processes to the terminal.\n * Output will be divided in a three column layout\n * with the left column containing the timestamp,\n * the right column containing the output,\n * and the middle column containing the process prefix.\n * Every process will be rendered with a different color, up to 4 colors.\n *\n * For example running `shopify app dev`:\n *\n * ```shell\n * 2022-10-10 13:11:03 | backend | npm\n * 2022-10-10 13:11:03 | backend | WARN ignoring workspace config at ...\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | backend | > shopify-app-template-node@0.1.0 dev\n * 2022-10-10 13:11:03 | backend | > cross-env NODE_ENV=development nodemon backend/index.js --watch ./backend\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | frontend |\n * 2022-10-10 13:11:03 | frontend | > starter-react-frontend-app@0.1.0 dev\n * 2022-10-10 13:11:03 | frontend | > cross-env NODE_ENV=development node vite-server.js\n * 2022-10-10 13:11:03 | frontend |\n * 2022-10-10 13:11:03 | frontend |\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | backend | [nodemon] to restart at any time, enter `rs`\n * 2022-10-10 13:11:03 | backend | [nodemon] watching path(s): backend/\n * 2022-10-10 13:11:03 | backend | [nodemon] watching extensions: js,mjs,json\n * 2022-10-10 13:11:03 | backend | [nodemon] starting `node backend/index.js`\n * 2022-10-10 13:11:03 | backend |\n *\n * ```\n */\nconst ConcurrentOutput: FunctionComponent<ConcurrentOutputProps> = ({\n processes,\n abortController,\n showTimestamps = true,\n onInput,\n footer,\n}) => {\n const [processOutput, setProcessOutput] = useState<Chunk[]>([])\n const concurrentColors = ['yellow', 'cyan', 'magenta', 'green', 'blue']\n const prefixColumnSize = Math.max(...processes.map((process) => process.prefix.length))\n\n function lineColor(index: number) {\n const colorIndex = index < concurrentColors.length ? index : index % concurrentColors.length\n return concurrentColors[colorIndex]!\n }\n\n const writableStream = (process: OutputProcess, index: number) => {\n return new Writable({\n write(chunk, _encoding, next) {\n const lines = stripAnsi(chunk.toString('utf8').replace(/(\\n)$/, '')).split(/\\n/)\n\n setProcessOutput((previousProcessOutput) => [\n ...previousProcessOutput,\n {\n color: lineColor(index),\n prefix: process.prefix,\n lines,\n },\n ])\n\n next()\n },\n })\n }\n\n const runProcesses = () => {\n return Promise.all(\n processes.map(async (process, index) => {\n const stdout = writableStream(process, index)\n const stderr = writableStream(process, index)\n\n await process.action(stdout, stderr, abortController.signal)\n }),\n )\n }\n\n useInput(\n (input, key) => {\n handleCtrlC(input, key)\n\n onInput!(input, key, () => treeKill(process.pid, 'SIGINT'))\n },\n {isActive: typeof onInput !== 'undefined'},\n )\n\n useAsyncAndUnmount(runProcesses, {onRejected: () => abortController.abort()})\n\n return (\n <>\n <Static items={processOutput}>\n {(chunk, index) => {\n return (\n <Box flexDirection=\"column\" key={index}>\n {chunk.lines.map((line, index) => (\n <Box key={index} flexDirection=\"row\">\n {showTimestamps ? (\n <Box>\n <Box marginRight={1}>\n <Text color={chunk.color}>\n {new Date().toISOString().replace(/T/, ' ').replace(/\\..+/, '')}\n </Text>\n </Box>\n\n <Text bold color={chunk.color}>\n |\n </Text>\n </Box>\n ) : null}\n\n <Box width={prefixColumnSize} marginX={1}>\n <Text color={chunk.color}>{chunk.prefix}</Text>\n </Box>\n\n <Text bold color={chunk.color}>\n |\n </Text>\n\n <Box flexGrow={1} paddingLeft={1}>\n <Text color={chunk.color}>{line}</Text>\n </Box>\n </Box>\n ))}\n </Box>\n )\n }}\n </Static>\n {footer ? (\n <Box marginY={1} flexDirection=\"column\" flexGrow={1}>\n <Box flexDirection=\"column\">\n {footer.shortcuts.map((shortcut, index) => (\n <Text key={index}>\n {figures.pointerSmall} Press <Text bold>{shortcut.key}</Text> | {shortcut.action}\n </Text>\n ))}\n </Box>\n {footer.subTitle ? (\n <Box marginTop={1}>\n <Text>{footer.subTitle}</Text>\n </Box>\n ) : null}\n </Box>\n ) : null}\n </>\n )\n}\n\nexport {ConcurrentOutput}\n"]}
1
+ {"version":3,"file":"ConcurrentOutput.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/ConcurrentOutput.tsx"],"names":[],"mappings":"AACA,OAAO,kBAAkB,MAAM,mCAAmC,CAAA;AAElE,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,EAAoB,QAAQ,EAAC,MAAM,OAAO,CAAA;AACxD,OAAO,EAAC,GAAG,EAAO,MAAM,EAAE,IAAI,EAAE,QAA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a,EAAC,QAAQ,IACxB,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,CACzC,oBAAC,IAAI,IAAC,GAAG,EAAE,KAAK;gBACb,OAAO,CAAC,YAAY;;gBAAQ,oBAAC,IAAI,IAAC,IAAI,UAAE,QAAQ,CAAC,GAAG,CAAQ;;gBAAE,OAAO,CAAC,YAAY;;gBAAG,QAAQ,CAAC,MAAM,CAChG,CACR,CAAC,CACE;YACL,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CACjB,oBAAC,GAAG,IAAC,SAAS,EAAE,CAAC;gBACf,oBAAC,IAAI,QAAE,MAAM,CAAC,QAAQ,CAAQ,CAC1B,CACP,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CAAC,CAAC,CAAC,IAAI,CACP,CACJ,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAC,gBAAgB,EAAC,CAAA","sourcesContent":["import {OutputProcess} from '../../../../public/node/output.js'\nimport useAsyncAndUnmount from '../hooks/use-async-and-unmount.js'\nimport {AbortController} from '../../../../public/node/abort.js'\nimport {handleCtrlC} from '../../ui.js'\nimport React, {FunctionComponent, useState} from 'react'\nimport {Box, Key, Static, Text, useInput} from 'ink'\nimport stripAnsi from 'strip-ansi'\nimport treeKill from 'tree-kill'\nimport figures from 'figures'\nimport {Writable} from 'stream'\n\nexport type WritableStream = (process: OutputProcess, index: number) => Writable\n\ninterface Shortcut {\n key: string\n action: string\n}\nexport interface ConcurrentOutputProps {\n processes: OutputProcess[]\n abortController: AbortController\n showTimestamps?: boolean\n onInput?: (input: string, key: Key, exit: () => void) => void\n footer?: {\n shortcuts: Shortcut[]\n subTitle?: string\n }\n}\ninterface Chunk {\n color: string\n prefix: string\n lines: string[]\n}\n\n/**\n * Renders output from concurrent processes to the terminal.\n * Output will be divided in a three column layout\n * with the left column containing the timestamp,\n * the right column containing the output,\n * and the middle column containing the process prefix.\n * Every process will be rendered with a different color, up to 4 colors.\n *\n * For example running `shopify app dev`:\n *\n * ```shell\n * 2022-10-10 13:11:03 | backend | npm\n * 2022-10-10 13:11:03 | backend | WARN ignoring workspace config at ...\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | backend | > shopify-app-template-node@0.1.0 dev\n * 2022-10-10 13:11:03 | backend | > cross-env NODE_ENV=development nodemon backend/index.js --watch ./backend\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | frontend |\n * 2022-10-10 13:11:03 | frontend | > starter-react-frontend-app@0.1.0 dev\n * 2022-10-10 13:11:03 | frontend | > cross-env NODE_ENV=development node vite-server.js\n * 2022-10-10 13:11:03 | frontend |\n * 2022-10-10 13:11:03 | frontend |\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | backend | [nodemon] to restart at any time, enter `rs`\n * 2022-10-10 13:11:03 | backend | [nodemon] watching path(s): backend/\n * 2022-10-10 13:11:03 | backend | [nodemon] watching extensions: js,mjs,json\n * 2022-10-10 13:11:03 | backend | [nodemon] starting `node backend/index.js`\n * 2022-10-10 13:11:03 | backend |\n *\n * ```\n */\nconst ConcurrentOutput: FunctionComponent<ConcurrentOutputProps> = ({\n processes,\n abortController,\n showTimestamps = true,\n onInput,\n footer,\n}) => {\n const [processOutput, setProcessOutput] = useState<Chunk[]>([])\n const concurrentColors = ['yellow', 'cyan', 'magenta', 'green', 'blue']\n const prefixColumnSize = Math.max(...processes.map((process) => process.prefix.length))\n\n function lineColor(index: number) {\n const colorIndex = index < concurrentColors.length ? index : index % concurrentColors.length\n return concurrentColors[colorIndex]!\n }\n\n const writableStream = (process: OutputProcess, index: number) => {\n return new Writable({\n write(chunk, _encoding, next) {\n const lines = stripAnsi(chunk.toString('utf8').replace(/(\\n)$/, '')).split(/\\n/)\n\n setProcessOutput((previousProcessOutput) => [\n ...previousProcessOutput,\n {\n color: lineColor(index),\n prefix: process.prefix,\n lines,\n },\n ])\n\n next()\n },\n })\n }\n\n const runProcesses = () => {\n return Promise.all(\n processes.map(async (process, index) => {\n const stdout = writableStream(process, index)\n const stderr = writableStream(process, index)\n\n await process.action(stdout, stderr, abortController.signal)\n }),\n )\n }\n\n useInput(\n (input, key) => {\n handleCtrlC(input, key)\n\n onInput!(input, key, () => treeKill(process.pid, 'SIGINT'))\n },\n {isActive: typeof onInput !== 'undefined'},\n )\n\n useAsyncAndUnmount(runProcesses, {onRejected: () => abortController.abort()})\n\n return (\n <>\n <Static items={processOutput}>\n {(chunk, index) => {\n return (\n <Box flexDirection=\"column\" key={index}>\n {chunk.lines.map((line, index) => (\n <Box key={index} flexDirection=\"row\">\n {showTimestamps ? (\n <Box>\n <Box marginRight={1}>\n <Text color={chunk.color}>\n {new Date().toISOString().replace(/T/, ' ').replace(/\\..+/, '')}\n </Text>\n </Box>\n\n <Text bold color={chunk.color}>\n {figures.lineVertical}\n </Text>\n </Box>\n ) : null}\n\n <Box width={prefixColumnSize} marginX={1}>\n <Text color={chunk.color}>{chunk.prefix}</Text>\n </Box>\n\n <Text bold color={chunk.color}>\n {figures.lineVertical}\n </Text>\n\n <Box flexGrow={1} paddingLeft={1}>\n <Text color={chunk.color}>{line}</Text>\n </Box>\n </Box>\n ))}\n </Box>\n )\n }}\n </Static>\n {footer ? (\n <Box marginY={1} flexDirection=\"column\" flexGrow={1}>\n <Box flexDirection=\"column\">\n {footer.shortcuts.map((shortcut, index) => (\n <Text key={index}>\n {figures.pointerSmall} Press <Text bold>{shortcut.key}</Text> {figures.lineVertical} {shortcut.action}\n </Text>\n ))}\n </Box>\n {footer.subTitle ? (\n <Box marginTop={1}>\n <Text>{footer.subTitle}</Text>\n </Box>\n ) : null}\n </Box>\n ) : null}\n </>\n )\n}\n\nexport {ConcurrentOutput}\n"]}
@@ -53,15 +53,15 @@ describe('ConcurrentOutput', () => {
53
53
  await frontendPromise;
54
54
  // Then
55
55
  expect(unstyled(getLastFrameAfterUnmount(renderInstance).replace(/\d/g, '0'))).toMatchInlineSnapshot(`
56
- "0000-00-00 00:00:00 | backend | first backend message
57
- 0000-00-00 00:00:00 | backend | second backend message
58
- 0000-00-00 00:00:00 | backend | third backend message
59
- 0000-00-00 00:00:00 | frontend | first frontend message
60
- 0000-00-00 00:00:00 | frontend | second frontend message
61
- 0000-00-00 00:00:00 | frontend | third frontend message
56
+ "0000-00-00 00:00:00 backend first backend message
57
+ 0000-00-00 00:00:00 backend second backend message
58
+ 0000-00-00 00:00:00 backend third backend message
59
+ 0000-00-00 00:00:00 frontend first frontend message
60
+ 0000-00-00 00:00:00 frontend second frontend message
61
+ 0000-00-00 00:00:00 frontend third frontend message
62
62
 
63
- › Press p | open your browser
64
- › Press q | quit
63
+ › Press p open your browser
64
+ › Press q quit
65
65
 
66
66
  Preview URL: https://shopify.com
67
67
  "
@@ -1 +1 @@
1
- {"version":3,"file":"ConcurrentOutput.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/ConcurrentOutput.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAC,wBAAwB,EAAE,sBAAsB,EAAC,MAAM,qBAAqB,CAAA;AACpF,OAAO,EAAC,eAAe,EAAc,MAAM,kCAAkC,CAAA;AAC7E,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,MAAM,QAAQ,CAAA;AACjD,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAG1C,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,CAAC,2DAA2D,EAAE,KAAK,IAAI,EAAE;QAC3E,QAAQ;QACR,IAAI,qBAAiC,CAAA;QACrC,IAAI,sBAAkC,CAAA;QAEtC,MAAM,cAAc,GA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C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {ConcurrentOutput} from './ConcurrentOutput.js'\nimport {getLastFrameAfterUnmount, waitForInputsToBeReady} from '../../testing/ui.js'\nimport {AbortController, AbortSignal} from '../../../../public/node/abort.js'\nimport {unstyled} from '../../../../public/node/output.js'\nimport React from 'react'\nimport {describe, expect, test, vi} from 'vitest'\nimport {render} from 'ink-testing-library'\nimport {Writable} from 'stream'\n\ndescribe('ConcurrentOutput', () => {\n test('renders a stream of concurrent outputs from sub-processes', async () => {\n // Given\n let backendPromiseResolve: () => void\n let frontendPromiseResolve: () => void\n\n const backendPromise = new Promise<void>(function (resolve, _reject) {\n backendPromiseResolve = resolve\n })\n\n const frontendPromise = new Promise<void>(function (resolve, _reject) {\n frontendPromiseResolve = resolve\n })\n\n const backendProcess = {\n prefix: 'backend',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('first backend message')\n stdout.write('second backend message')\n stdout.write('third backend message')\n\n backendPromiseResolve()\n },\n }\n\n const frontendProcess = {\n prefix: 'frontend',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n await backendPromise\n\n stdout.write('first frontend message')\n stdout.write('second frontend message')\n stdout.write('third frontend message')\n\n frontendPromiseResolve()\n },\n }\n // When\n\n const renderInstance = render(\n <ConcurrentOutput\n processes={[backendProcess, frontendProcess]}\n abortController={new AbortController()}\n footer={{\n shortcuts: [\n {\n key: 'p',\n action: 'open your browser',\n },\n {\n key: 'q',\n action: 'quit',\n },\n ],\n subTitle: `Preview URL: https://shopify.com`,\n }}\n />,\n )\n\n // wait for all output to be rendered\n await frontendPromise\n\n // Then\n expect(unstyled(getLastFrameAfterUnmount(renderInstance)!.replace(/\\d/g, '0'))).toMatchInlineSnapshot(`\n \"0000-00-00 00:00:00 | backend | first backend message\n 0000-00-00 00:00:00 | backend | second backend message\n 0000-00-00 00:00:00 | backend | third backend message\n 0000-00-00 00:00:00 | frontend | first frontend message\n 0000-00-00 00:00:00 | frontend | second frontend message\n 0000-00-00 00:00:00 | frontend | third frontend message\n\n › Press p | open your browser\n › Press q | quit\n\n Preview URL: https://shopify.com\n \"\n `)\n })\n\n test('accepts a onInput function that fires when a key is pressed', async () => {\n const neverEndingPromise = new Promise<void>(function (_resolve, _reject) {})\n\n const neverEndingProcess = {\n prefix: 'never-ending-process',\n action: async () => {\n await neverEndingPromise\n },\n }\n\n const onInput = vi.fn()\n\n const renderInstance = render(\n <ConcurrentOutput\n processes={[neverEndingProcess]}\n abortController={new AbortController()}\n onInput={(input, key) => onInput(input, key)}\n />,\n )\n\n await waitForInputsToBeReady()\n expect(onInput).toHaveBeenCalledTimes(0)\n\n renderInstance.stdin.write('a')\n expect(onInput).toHaveBeenCalledTimes(1)\n expect(onInput.mock.calls[0]![0]).toBe('a')\n })\n})\n"]}
1
+ {"version":3,"file":"ConcurrentOutput.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/ConcurrentOutput.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAC,wBAAwB,EAAE,sBAAsB,EAAC,MAAM,qBAAqB,CAAA;AACpF,OAAO,EAAC,eAAe,EAAc,MAAM,kCAAkC,CAAA;AAC7E,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,MAAM,QAAQ,CAAA;AACjD,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAG1C,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,CAAC,2DAA2D,EAAE,KAAK,IAAI,EAAE;QAC3E,QAAQ;QACR,IAAI,qBAAiC,CAAA;QACrC,IAAI,sBAAkC,CAAA;QAEtC,MAAM,cAAc,GAAG,IAAI,OA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C,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {ConcurrentOutput} from './ConcurrentOutput.js'\nimport {getLastFrameAfterUnmount, waitForInputsToBeReady} from '../../testing/ui.js'\nimport {AbortController, AbortSignal} from '../../../../public/node/abort.js'\nimport {unstyled} from '../../../../public/node/output.js'\nimport React from 'react'\nimport {describe, expect, test, vi} from 'vitest'\nimport {render} from 'ink-testing-library'\nimport {Writable} from 'stream'\n\ndescribe('ConcurrentOutput', () => {\n test('renders a stream of concurrent outputs from sub-processes', async () => {\n // Given\n let backendPromiseResolve: () => void\n let frontendPromiseResolve: () => void\n\n const backendPromise = new Promise<void>(function (resolve, _reject) {\n backendPromiseResolve = resolve\n })\n\n const frontendPromise = new Promise<void>(function (resolve, _reject) {\n frontendPromiseResolve = resolve\n })\n\n const backendProcess = {\n prefix: 'backend',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n stdout.write('first backend message')\n stdout.write('second backend message')\n stdout.write('third backend message')\n\n backendPromiseResolve()\n },\n }\n\n const frontendProcess = {\n prefix: 'frontend',\n action: async (stdout: Writable, _stderr: Writable, _signal: AbortSignal) => {\n await backendPromise\n\n stdout.write('first frontend message')\n stdout.write('second frontend message')\n stdout.write('third frontend message')\n\n frontendPromiseResolve()\n },\n }\n // When\n\n const renderInstance = render(\n <ConcurrentOutput\n processes={[backendProcess, frontendProcess]}\n abortController={new AbortController()}\n footer={{\n shortcuts: [\n {\n key: 'p',\n action: 'open your browser',\n },\n {\n key: 'q',\n action: 'quit',\n },\n ],\n subTitle: `Preview URL: https://shopify.com`,\n }}\n />,\n )\n\n // wait for all output to be rendered\n await frontendPromise\n\n // Then\n expect(unstyled(getLastFrameAfterUnmount(renderInstance)!.replace(/\\d/g, '0'))).toMatchInlineSnapshot(`\n \"0000-00-00 00:00:00 backend first backend message\n 0000-00-00 00:00:00 backend second backend message\n 0000-00-00 00:00:00 backend third backend message\n 0000-00-00 00:00:00 frontend first frontend message\n 0000-00-00 00:00:00 frontend second frontend message\n 0000-00-00 00:00:00 frontend third frontend message\n\n › Press p open your browser\n › Press q quit\n\n Preview URL: https://shopify.com\n \"\n `)\n })\n\n test('accepts a onInput function that fires when a key is pressed', async () => {\n const neverEndingPromise = new Promise<void>(function (_resolve, _reject) {})\n\n const neverEndingProcess = {\n prefix: 'never-ending-process',\n action: async () => {\n await neverEndingPromise\n },\n }\n\n const onInput = vi.fn()\n\n const renderInstance = render(\n <ConcurrentOutput\n processes={[neverEndingProcess]}\n abortController={new AbortController()}\n onInput={(input, key) => onInput(input, key)}\n />,\n )\n\n await waitForInputsToBeReady()\n expect(onInput).toHaveBeenCalledTimes(0)\n\n renderInstance.stdin.write('a')\n expect(onInput).toHaveBeenCalledTimes(1)\n expect(onInput.mock.calls[0]![0]).toBe('a')\n })\n})\n"]}
@@ -81,8 +81,7 @@ describe('FatalError', async () => {
81
81
  │ Unexpected error │
82
82
  │ │
83
83
  │ Next steps │
84
- │ • Have you created a Shopify Partners organization (
85
- │ https://partners.shopify.com/signup )? │
84
+ │ • Have you created a Shopify Partners organization [1]?
86
85
  │ • Have you confirmed your accounts from the emails you received? │
87
86
  │ • Need to connect to a different App or organization? Run the command │
88
87
  │ again with \`--reset\` │
@@ -94,6 +93,7 @@ describe('FatalError', async () => {
94
93
  │ at _load (internal/modules/cjs/loader.js:878) │
95
94
  │ │
96
95
  ╰──────────────────────────────────────────────────────────────────────────────╯
96
+ [1] https://partners.shopify.com/signup
97
97
  "
98
98
  `);
99
99
  });
@@ -1 +1 @@
1
- {"version":3,"file":"FatalError.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/FatalError.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAC1D,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAC,MAAM,kCAAkC,CAAA;AACpF,OAAO,EAAC,QA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AqC;qBAC3C;iBACF;gBACD;oBACE,IAAI,EAAE,GAAG;iBACV;aACF;YACD,gEAAgE;YAChE;gBACE,gFAAgF;gBAChF;oBACE,OAAO,EAAE,SAAS;iBACnB;aACF;SACF,CAAA;QAED,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,UAAU,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC,CAAA;QAExD,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;KAoBpD,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,qCAAqC,EAAE,KAAK,IAAI,EAAE;QACrD,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;QAExE,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,UAAU,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC,CAAA;QAExD,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;KASpD,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {FatalError} from './FatalError.js'\nimport {unstyled} from '../../../../public/node/output.js'\nimport {AbortError, BugError, ExternalError} from '../../../../public/node/error.js'\nimport {describe, expect, test} from 'vitest'\nimport React from 'react'\nimport {render} from 'ink-testing-library'\n\ndescribe('FatalError', async () => {\n test('renders correctly with a just a message and tryMessage', async () => {\n const error = new AbortError('test', 'try this')\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ error ──────────────────────────────────────────────────────────────────────╮\n │ │\n │ test │\n │ │\n │ try this │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n \"\n `)\n })\n\n test('renders correctly with a message and a stack', async () => {\n const error = new BugError('Unexpected error')\n error.stack = `\n Error: Unexpected error\n at Module._compile (internal/modules/cjs/loader.js:1137:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)\n at Module.load (internal/modules/cjs/loader.js:985:32)\n at Function.Module._load (internal/modules/cjs/loader.js:878:14)\n `\n\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ error ──────────────────────────────────────────────────────────────────────╮\n │ │\n │ Unexpected error │\n │ │\n │ To investigate the issue, examine this stack trace: │\n │ at _compile (internal/modules/cjs/loader.js:1137) │\n │ at js (internal/modules/cjs/loader.js:1157) │\n │ at load (internal/modules/cjs/loader.js:985) │\n │ at _load (internal/modules/cjs/loader.js:878) │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n \"\n `)\n })\n\n test('renders correctly with a message, a stack, and next steps', async () => {\n const error = new BugError('Unexpected error')\n error.stack = `\n Error: Unexpected error\n at Module._compile (internal/modules/cjs/loader.js:1137:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)\n at Module.load (internal/modules/cjs/loader.js:985:32)\n at Function.Module._load (internal/modules/cjs/loader.js:878:14)\n `\n\n error.nextSteps = [\n [\n 'Have you',\n {\n link: {\n label: 'created a Shopify Partners organization',\n url: 'https://partners.shopify.com/signup',\n },\n },\n {\n char: '?',\n },\n ],\n 'Have you confirmed your accounts from the emails you received?',\n [\n 'Need to connect to a different App or organization? Run the command again with',\n {\n command: '--reset',\n },\n ],\n ]\n\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ error ──────────────────────────────────────────────────────────────────────╮\n │ │\n │ Unexpected error │\n │ │\n │ Next steps │\n │ • Have you created a Shopify Partners organization ( │\n │ https://partners.shopify.com/signup )? │\n │ • Have you confirmed your accounts from the emails you received? │\n │ • Need to connect to a different App or organization? Run the command │\n │ again with \\`--reset\\` │\n │ │\n │ To investigate the issue, examine this stack trace: │\n │ at _compile (internal/modules/cjs/loader.js:1137) │\n │ at js (internal/modules/cjs/loader.js:1157) │\n │ at load (internal/modules/cjs/loader.js:985) │\n │ at _load (internal/modules/cjs/loader.js:878) │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n \"\n `)\n })\n\n test('renders correctly an external error', async () => {\n const error = new ExternalError('Unexpected error', 'yarn', ['install'])\n\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"── external error ──────────────────────────────────────────────────────────────\n\n Error coming from \\`yarn install\\`\n\n Unexpected error\n\n ────────────────────────────────────────────────────────────────────────────────\n \"\n `)\n })\n})\n"]}
1
+ {"version":3,"file":"FatalError.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/FatalError.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAC1D,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAC,MAAM,kCAAkC,CAAA;AACpF,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAE1C,QAAQ,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;IAChC,IAAI,CAAC,wDAAwD,EAAE,KAAK,IAAI,EAAE;QACxE,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;QAChD,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,UAAU,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC,CAAA;QAExD,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAG,CAAC,CAAC,C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AAa,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;QAExE,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,UAAU,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC,CAAA;QAExD,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;KASpD,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {FatalError} from './FatalError.js'\nimport {unstyled} from '../../../../public/node/output.js'\nimport {AbortError, BugError, ExternalError} from '../../../../public/node/error.js'\nimport {describe, expect, test} from 'vitest'\nimport React from 'react'\nimport {render} from 'ink-testing-library'\n\ndescribe('FatalError', async () => {\n test('renders correctly with a just a message and tryMessage', async () => {\n const error = new AbortError('test', 'try this')\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ error ──────────────────────────────────────────────────────────────────────╮\n │ │\n │ test │\n │ │\n │ try this │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n \"\n `)\n })\n\n test('renders correctly with a message and a stack', async () => {\n const error = new BugError('Unexpected error')\n error.stack = `\n Error: Unexpected error\n at Module._compile (internal/modules/cjs/loader.js:1137:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)\n at Module.load (internal/modules/cjs/loader.js:985:32)\n at Function.Module._load (internal/modules/cjs/loader.js:878:14)\n `\n\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ error ──────────────────────────────────────────────────────────────────────╮\n │ │\n │ Unexpected error │\n │ │\n │ To investigate the issue, examine this stack trace: │\n │ at _compile (internal/modules/cjs/loader.js:1137) │\n │ at js (internal/modules/cjs/loader.js:1157) │\n │ at load (internal/modules/cjs/loader.js:985) │\n │ at _load (internal/modules/cjs/loader.js:878) │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n \"\n `)\n })\n\n test('renders correctly with a message, a stack, and next steps', async () => {\n const error = new BugError('Unexpected error')\n error.stack = `\n Error: Unexpected error\n at Module._compile (internal/modules/cjs/loader.js:1137:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)\n at Module.load (internal/modules/cjs/loader.js:985:32)\n at Function.Module._load (internal/modules/cjs/loader.js:878:14)\n `\n\n error.nextSteps = [\n [\n 'Have you',\n {\n link: {\n label: 'created a Shopify Partners organization',\n url: 'https://partners.shopify.com/signup',\n },\n },\n {\n char: '?',\n },\n ],\n 'Have you confirmed your accounts from the emails you received?',\n [\n 'Need to connect to a different App or organization? Run the command again with',\n {\n command: '--reset',\n },\n ],\n ]\n\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"╭─ error ──────────────────────────────────────────────────────────────────────╮\n │ │\n │ Unexpected error │\n │ │\n │ Next steps │\n │ • Have you created a Shopify Partners organization [1]? │\n │ • Have you confirmed your accounts from the emails you received? │\n │ • Need to connect to a different App or organization? Run the command │\n │ again with \\`--reset\\` │\n │ │\n │ To investigate the issue, examine this stack trace: │\n │ at _compile (internal/modules/cjs/loader.js:1137) │\n │ at js (internal/modules/cjs/loader.js:1157) │\n │ at load (internal/modules/cjs/loader.js:985) │\n │ at _load (internal/modules/cjs/loader.js:878) │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n [1] https://partners.shopify.com/signup\n \"\n `)\n })\n\n test('renders correctly an external error', async () => {\n const error = new ExternalError('Unexpected error', 'yarn', ['install'])\n\n const {lastFrame} = render(<FatalError error={error} />)\n\n expect(unstyled(lastFrame()!)).toMatchInlineSnapshot(`\n \"── external error ──────────────────────────────────────────────────────────────\n\n Error coming from \\`yarn install\\`\n\n Unexpected error\n\n ────────────────────────────────────────────────────────────────────────────────\n \"\n `)\n })\n})\n"]}
@@ -1,15 +1,27 @@
1
- import chalk from 'chalk';
1
+ import { LinksContext } from '../contexts/LinksContext.js';
2
2
  import { Text } from 'ink';
3
- import React from 'react';
4
- import terminalLink from 'terminal-link';
5
- function fallback(text, url) {
6
- return `${text} ${chalk.dim(`( ${url} )`)}`;
3
+ import React, { useContext } from 'react';
4
+ import ansiEscapes from 'ansi-escapes';
5
+ import supportsHyperlinks from 'supports-hyperlinks';
6
+ import chalk from 'chalk';
7
+ function link(label, url, linksContext) {
8
+ if (!supportsHyperlinks.stdout) {
9
+ if (linksContext === null) {
10
+ return label ? `${label} ${chalk.dim(`( ${url} )`)}` : url;
11
+ }
12
+ else {
13
+ const linkId = linksContext.addLink(label, url);
14
+ return label ? `${label} [${linkId}]` : `[${linkId}]]`;
15
+ }
16
+ }
17
+ return ansiEscapes.link(label ?? url, url);
7
18
  }
8
19
  /**
9
20
  * `Link` displays a clickable link when supported by the terminal.
10
21
  */
11
- const Link = ({ url, label }) => {
12
- return React.createElement(Text, null, terminalLink(label ?? url, url, { fallback: label ? fallback : false }));
22
+ const Link = ({ label, url }) => {
23
+ const linksContext = useContext(LinksContext);
24
+ return React.createElement(Text, null, link(label, url, linksContext));
13
25
  };
14
26
  export { Link };
15
27
  //# sourceMappingURL=Link.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAA;AACxB,OAAO,KAA0B,MAAM,OAAO,CAAA;AAC9C,OAAO,YAAY,MAAM,eAAe,CAAA;AAOxC,SAAS,QAAQ,CAAC,IAAY,EAAE,GAAW;IACzC,OAAO,GAAG,IAAI,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAA;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM,IAAI,GAAiC,CAAC,EAAC,GAAG,EAAE,KAAK,EAAC,EAAe,EAAE;IACvE,OAAO,oBAAC,IAAI,QAAE,YAAY,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,EAAE,EAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,EAAC,CAAC,CAAQ,CAAA;AAC7F,CAAC,CAAA;AAED,OAAO,EAAC,IAAI,EAAC,CAAA","sourcesContent":["import chalk from 'chalk'\nimport {Text} from 'ink'\nimport React, {FunctionComponent} from 'react'\nimport terminalLink from 'terminal-link'\n\ninterface LinkProps {\n url: string\n label?: string\n}\n\nfunction fallback(text: string, url: string) {\n return `${text} ${chalk.dim(`( ${url} )`)}`\n}\n\n/**\n * `Link` displays a clickable link when supported by the terminal.\n */\nconst Link: FunctionComponent<LinkProps> = ({url, label}): JSX.Element => {\n return <Text>{terminalLink(label ?? url, url, {fallback: label ? fallback : false})}</Text>\n}\n\nexport {Link}\n"]}
1
+ {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAoC,MAAM,6BAA6B,CAAA;AAC3F,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAA;AACxB,OAAO,KAAK,EAAE,EAAoB,UAAU,EAAC,MAAM,OAAO,CAAA;AAC1D,OAAO,WAAW,MAAM,cAAc,CAAA;AACtC,OAAO,kBAAkB,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,SAAS,IAAI,CAAC,KAAyB,EAAE,GAAW,EAAE,YAAsC;IAC1F,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE;QAC9B,IAAI,YAAY,KAAK,IAAI,EAAE;YACzB,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA;SAC3D;aAAM;YACL,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;YAC/C,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,MAAM,IAAI,CAAA;SACvD;KACF;IAED,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,CAAA;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,IAAI,GAAiC,CAAC,EAAC,KAAK,EAAE,GAAG,EAAC,EAAe,EAAE;IACvE,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,CAAA;IAE7C,OAAO,oBAAC,IAAI,QAAE,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,YAAY,CAAC,CAAQ,CAAA;AACtD,CAAC,CAAA;AAED,OAAO,EAAC,IAAI,EAAC,CAAA","sourcesContent":["import {LinksContext, ContextValue as LinksContextValue} from '../contexts/LinksContext.js'\nimport {Text} from 'ink'\nimport React, {FunctionComponent, useContext} from 'react'\nimport ansiEscapes from 'ansi-escapes'\nimport supportsHyperlinks from 'supports-hyperlinks'\nimport chalk from 'chalk'\n\ninterface LinkProps {\n url: string\n label?: string\n}\n\nfunction link(label: string | undefined, url: string, linksContext: LinksContextValue | null) {\n if (!supportsHyperlinks.stdout) {\n if (linksContext === null) {\n return label ? `${label} ${chalk.dim(`( ${url} )`)}` : url\n } else {\n const linkId = linksContext.addLink(label, url)\n return label ? `${label} [${linkId}]` : `[${linkId}]]`\n }\n }\n\n return ansiEscapes.link(label ?? url, url)\n}\n\n/**\n * `Link` displays a clickable link when supported by the terminal.\n */\nconst Link: FunctionComponent<LinkProps> = ({label, url}): JSX.Element => {\n const linksContext = useContext(LinksContext)\n\n return <Text>{link(label, url, linksContext)}</Text>\n}\n\nexport {Link}\n"]}
@@ -49,7 +49,7 @@ function SelectPrompt({ message, choices, infoTable, onSubmit, defaultValue, sub
49
49
  return () => {
50
50
  stdout.off('resize', onResize);
51
51
  };
52
- }, [wrapperHeight, selectInputHeight, choices.length, stdout.rows, numberOfGroups]);
52
+ }, [wrapperHeight, selectInputHeight, choices.length, numberOfGroups, stdout, limit]);
53
53
  const submitAnswer = useCallback((answer) => {
54
54
  if (stdout && wrapperHeight >= stdout.rows) {
55
55
  stdout.write(ansiEscapes.clearTerminal);