@shopify/cli-kit 3.45.0-pre.3 → 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 (39) hide show
  1. package/README.md +1 -1
  2. package/dist/private/node/ui/components/Alert.test.js +7 -4
  3. package/dist/private/node/ui/components/Alert.test.js.map +1 -1
  4. package/dist/private/node/ui/components/Banner.js +32 -5
  5. package/dist/private/node/ui/components/Banner.js.map +1 -1
  6. package/dist/private/node/ui/components/ConcurrentOutput.js +5 -3
  7. package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
  8. package/dist/private/node/ui/components/ConcurrentOutput.test.js +8 -8
  9. package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -1
  10. package/dist/private/node/ui/components/FatalError.test.js +2 -2
  11. package/dist/private/node/ui/components/FatalError.test.js.map +1 -1
  12. package/dist/private/node/ui/components/Link.js +19 -7
  13. package/dist/private/node/ui/components/Link.js.map +1 -1
  14. package/dist/private/node/ui/components/SelectPrompt.js +1 -1
  15. package/dist/private/node/ui/components/SelectPrompt.js.map +1 -1
  16. package/dist/private/node/ui/components/Tasks.d.ts +2 -1
  17. package/dist/private/node/ui/components/Tasks.js +6 -2
  18. package/dist/private/node/ui/components/Tasks.js.map +1 -1
  19. package/dist/private/node/ui/components/Tasks.test.js +16 -0
  20. package/dist/private/node/ui/components/Tasks.test.js.map +1 -1
  21. package/dist/private/node/ui/components/TextPrompt.d.ts +1 -0
  22. package/dist/private/node/ui/components/TextPrompt.js +3 -3
  23. package/dist/private/node/ui/components/TextPrompt.js.map +1 -1
  24. package/dist/private/node/ui/contexts/LinksContext.d.ts +12 -0
  25. package/dist/private/node/ui/contexts/LinksContext.js +3 -0
  26. package/dist/private/node/ui/contexts/LinksContext.js.map +1 -0
  27. package/dist/public/common/version.d.ts +1 -1
  28. package/dist/public/common/version.js +1 -1
  29. package/dist/public/common/version.js.map +1 -1
  30. package/dist/public/node/ruby.js +10 -7
  31. package/dist/public/node/ruby.js.map +1 -1
  32. package/dist/public/node/tcp.d.ts +6 -0
  33. package/dist/public/node/tcp.js +8 -0
  34. package/dist/public/node/tcp.js.map +1 -1
  35. package/dist/public/node/ui.d.ts +26 -18
  36. package/dist/public/node/ui.js +31 -20
  37. package/dist/public/node/ui.js.map +1 -1
  38. package/dist/tsconfig.tsbuildinfo +1 -1
  39. package/package.json +3 -2
@@ -1 +1 @@
1
- {"version":3,"file":"Tasks.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Tasks.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,EAAC,MAAM,YAAY,CAAA;AACtC,OAAO,EAAC,wBAAwB,EAAC,MAAM,qBAAqB,CAAA;AAC5D,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;AAE1C,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,IAAI,CAAC,oCAAoC,EAAE,KAAK,IAAI,EAAE;QACpD,QAAQ;QACR,MAAM,iBAAiB,GAAG,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE;YACzC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;QAC3D,CAAC,CAAC,CAAA;QAEF,MAAM,SAAS,GAAG;YAChB,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,iBAAiB;SACxB,CAAA;QAED,OAAO;QACP,MAAM,cAAc,GAAG,MAAM,CAAC,oBAAC,KAAK,IAAC,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,GAAI,CAAC,CAAA;QAC3E,qBA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AC,cAAc,CAAC,SAAS,EAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;KAGnE,CAAC,CAAA;QACF,MAAM,CAAC,iBAAiB,CAAC,CAAC,gBAAgB,EAAE,CAAA;IAC9C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {Task, Tasks} from './Tasks.js'\nimport {getLastFrameAfterUnmount} from '../../testing/ui.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'\n\ndescribe('Tasks', () => {\n test('shows a loading state at the start', async () => {\n // Given\n const firstTaskFunction = vi.fn(async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const firstTask = {\n title: 'task 1',\n task: firstTaskFunction,\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask]} silent={false} />)\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n task 1 ...\"\n `)\n expect(firstTaskFunction).toHaveBeenCalled()\n })\n\n test('shows nothing at the end in case of success', async () => {\n // Given\n const firstTaskFunction = vi.fn(async () => {})\n const secondTaskFunction = vi.fn(async () => {})\n\n const firstTask = {\n title: 'task 1',\n task: firstTaskFunction,\n }\n\n const secondTask = {\n title: 'task 2',\n task: secondTaskFunction,\n }\n // When\n\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot('\"\"')\n })\n\n test('shows nothing at the end in case of success', async () => {\n // Given\n const secondTaskFunction = vi.fn(async () => {})\n\n const firstTask: Task = {\n title: 'task 1',\n task: async () => {\n throw new Error('something went wrong')\n },\n }\n\n const secondTask = {\n title: 'task 2',\n task: secondTaskFunction,\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot('\"\"')\n expect(secondTaskFunction).toHaveBeenCalledTimes(0)\n })\n\n test('it supports subtasks', async () => {\n // Given\n const firstSubtaskFunction = vi.fn(async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const firstTask = {\n title: 'task 1',\n task: async () => {\n return [\n {\n title: 'subtask 1',\n task: firstSubtaskFunction,\n },\n {\n title: 'subtask 2',\n task: async () => {},\n },\n ]\n },\n }\n\n const secondTask = {\n title: 'task 2',\n task: async () => {},\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n subtask 1 ...\"\n `)\n\n expect(firstSubtaskFunction).toHaveBeenCalled()\n })\n\n test('supports skipping', async () => {\n // Given\n const firstTaskFunction = vi.fn(async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const firstTask = {\n title: 'task 1',\n task: firstTaskFunction,\n skip: () => true,\n }\n\n const secondTask = {\n title: 'task 2',\n task: async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n },\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n task 2 ...\"\n `)\n expect(firstTaskFunction).toHaveBeenCalledTimes(0)\n })\n\n test('supports skipping a subtask', async () => {\n // Given\n const firstSubTaskFunction = vi.fn(async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const secondSubTaskFunction = vi.fn(async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const firstTask = {\n title: 'task 1',\n task: async () => {\n return [\n {\n title: 'subtask 1',\n task: firstSubTaskFunction,\n skip: () => true,\n },\n {\n title: 'subtask 2',\n task: secondSubTaskFunction,\n },\n ]\n },\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n subtask 2 ...\"\n `)\n\n expect(firstSubTaskFunction).toHaveBeenCalledTimes(0)\n expect(secondSubTaskFunction).toHaveBeenCalled()\n })\n\n test('supports retrying', async () => {\n // Given\n const firstTaskFunction = vi.fn(async (_ctx, task) => {\n if (task.retryCount < task.retry) {\n throw new Error(`something went wrong${task.retryCount}`)\n }\n\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const firstTask: Task = {\n title: 'task 1',\n task: firstTaskFunction,\n retry: 3,\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n task 1 ...\"\n `)\n expect(firstTask.retryCount).toBe(3)\n expect(firstTask.errors).toEqual([\n Error('something went wrong0'),\n Error('something went wrong1'),\n Error('something went wrong2'),\n ])\n })\n\n test('supports retrying up to a limit', async () => {\n // Given\n const firstTaskFunction = vi.fn(async (_ctx, task) => {\n if (task.retryCount <= task.retry) {\n throw new Error(`something went wrong${task.retryCount}`)\n }\n\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const secondTaskFunction = vi.fn(async () => {})\n\n const firstTask: Task = {\n title: 'task 1',\n task: firstTaskFunction,\n retry: 3,\n }\n\n const secondTask: Task = {\n title: 'task 2',\n task: secondTaskFunction,\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(getLastFrameAfterUnmount(renderInstance)!)).toMatchInlineSnapshot('\"\"')\n expect(firstTask.retryCount).toBe(3)\n expect(firstTask.errors).toEqual([\n Error('something went wrong0'),\n Error('something went wrong1'),\n Error('something went wrong2'),\n ])\n expect(secondTaskFunction).toHaveBeenCalledTimes(0)\n })\n\n test('supports retrying a subtask', async () => {\n // Given\n const firstSubTaskFunction = vi.fn(async (_ctx, task) => {\n if (task.retryCount < task.retry) {\n throw new Error(`something went wrong${task.retryCount}`)\n }\n\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const firstSubTask: Task = {\n title: 'subtask 1',\n task: firstSubTaskFunction,\n retry: 3,\n }\n\n const firstTask: Task = {\n title: 'task 1',\n task: async () => {\n return [firstSubTask]\n },\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n subtask 1 ...\"\n `)\n expect(firstSubTask.retryCount).toBe(3)\n expect(firstSubTask.errors).toEqual([\n Error('something went wrong0'),\n Error('something went wrong1'),\n Error('something went wrong2'),\n ])\n })\n\n test('supports retrying a subtask up to a limit', async () => {\n // Given\n const firstSubTaskFunction = vi.fn(async (_ctx, task) => {\n if (task.retryCount <= task.retry) {\n throw new Error(`something went wrong${task.retryCount}`)\n }\n\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const secondSubTaskFunction = vi.fn(async () => {})\n\n const firstSubTask: Task = {\n title: 'subtask 1',\n task: firstSubTaskFunction,\n retry: 3,\n }\n\n const secondSubTask: Task = {\n title: 'subtask 2',\n task: secondSubTaskFunction,\n }\n\n const firstTask: Task = {\n title: 'task 1',\n task: async () => {\n return [firstSubTask, secondSubTask]\n },\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(getLastFrameAfterUnmount(renderInstance)!)).toMatchInlineSnapshot('\"\"')\n expect(firstSubTask.retryCount).toBe(3)\n expect(firstSubTask.errors).toEqual([\n Error('something went wrong0'),\n Error('something went wrong1'),\n Error('something went wrong2'),\n ])\n expect(secondSubTaskFunction).toHaveBeenCalledTimes(0)\n })\n\n test('has a context', async () => {\n // Given\n const firstTaskFunction = vi.fn(async (ctx) => {\n ctx.foo = 'bar'\n })\n\n const firstTask: Task<{foo: string}> = {\n title: 'task 1',\n task: firstTaskFunction,\n }\n\n const secondTask: Task<{foo: string}> = {\n title: 'task 2',\n task: async (ctx) => {\n if (ctx.foo !== 'bar') {\n throw new Error('context is not shared')\n }\n },\n }\n\n const thirdTaskFunction = vi.fn(async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const thirdTask: Task<{foo: string}> = {\n title: 'task 3',\n task: thirdTaskFunction,\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask, thirdTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n task 3 ...\"\n `)\n expect(thirdTaskFunction).toHaveBeenCalled()\n })\n})\n"]}
1
+ {"version":3,"file":"Tasks.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Tasks.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,EAAC,MAAM,YAAY,CAAA;AACtC,OAAO,EAAC,wBAAwB,EAAC,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAA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AAC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;YACrD,MAAM,CAAC,oBAAC,KAAK,IAAC,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,GAAI,CAAC,CAAA;QACtE,CAAC,CAAC,CAAA;QAEF,OAAO;QACP,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAC,GAAG,EAAE,KAAK,EAAC,CAAC,CAAA;IACvC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {Task, Tasks} from './Tasks.js'\nimport {getLastFrameAfterUnmount} from '../../testing/ui.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'\n\ndescribe('Tasks', () => {\n test('shows a loading state at the start', async () => {\n // Given\n const firstTaskFunction = vi.fn(async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const firstTask = {\n title: 'task 1',\n task: firstTaskFunction,\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask]} silent={false} />)\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n task 1 ...\"\n `)\n expect(firstTaskFunction).toHaveBeenCalled()\n })\n\n test('shows nothing at the end in case of success', async () => {\n // Given\n const firstTaskFunction = vi.fn(async () => {})\n const secondTaskFunction = vi.fn(async () => {})\n\n const firstTask = {\n title: 'task 1',\n task: firstTaskFunction,\n }\n\n const secondTask = {\n title: 'task 2',\n task: secondTaskFunction,\n }\n // When\n\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot('\"\"')\n })\n\n test('shows nothing at the end in case of success', async () => {\n // Given\n const secondTaskFunction = vi.fn(async () => {})\n\n const firstTask: Task = {\n title: 'task 1',\n task: async () => {\n throw new Error('something went wrong')\n },\n }\n\n const secondTask = {\n title: 'task 2',\n task: secondTaskFunction,\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(getLastFrameAfterUnmount(renderInstance)).toMatchInlineSnapshot('\"\"')\n expect(secondTaskFunction).toHaveBeenCalledTimes(0)\n })\n\n test('it supports subtasks', async () => {\n // Given\n const firstSubtaskFunction = vi.fn(async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const firstTask = {\n title: 'task 1',\n task: async () => {\n return [\n {\n title: 'subtask 1',\n task: firstSubtaskFunction,\n },\n {\n title: 'subtask 2',\n task: async () => {},\n },\n ]\n },\n }\n\n const secondTask = {\n title: 'task 2',\n task: async () => {},\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n subtask 1 ...\"\n `)\n\n expect(firstSubtaskFunction).toHaveBeenCalled()\n })\n\n test('supports skipping', async () => {\n // Given\n const firstTaskFunction = vi.fn(async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const firstTask = {\n title: 'task 1',\n task: firstTaskFunction,\n skip: () => true,\n }\n\n const secondTask = {\n title: 'task 2',\n task: async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n },\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n task 2 ...\"\n `)\n expect(firstTaskFunction).toHaveBeenCalledTimes(0)\n })\n\n test('supports skipping a subtask', async () => {\n // Given\n const firstSubTaskFunction = vi.fn(async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const secondSubTaskFunction = vi.fn(async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const firstTask = {\n title: 'task 1',\n task: async () => {\n return [\n {\n title: 'subtask 1',\n task: firstSubTaskFunction,\n skip: () => true,\n },\n {\n title: 'subtask 2',\n task: secondSubTaskFunction,\n },\n ]\n },\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n subtask 2 ...\"\n `)\n\n expect(firstSubTaskFunction).toHaveBeenCalledTimes(0)\n expect(secondSubTaskFunction).toHaveBeenCalled()\n })\n\n test('supports retrying', async () => {\n // Given\n const firstTaskFunction = vi.fn(async (_ctx, task) => {\n if (task.retryCount < task.retry) {\n throw new Error(`something went wrong${task.retryCount}`)\n }\n\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const firstTask: Task = {\n title: 'task 1',\n task: firstTaskFunction,\n retry: 3,\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n task 1 ...\"\n `)\n expect(firstTask.retryCount).toBe(3)\n expect(firstTask.errors).toEqual([\n Error('something went wrong0'),\n Error('something went wrong1'),\n Error('something went wrong2'),\n ])\n })\n\n test('supports retrying up to a limit', async () => {\n // Given\n const firstTaskFunction = vi.fn(async (_ctx, task) => {\n if (task.retryCount <= task.retry) {\n throw new Error(`something went wrong${task.retryCount}`)\n }\n\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const secondTaskFunction = vi.fn(async () => {})\n\n const firstTask: Task = {\n title: 'task 1',\n task: firstTaskFunction,\n retry: 3,\n }\n\n const secondTask: Task = {\n title: 'task 2',\n task: secondTaskFunction,\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(getLastFrameAfterUnmount(renderInstance)!)).toMatchInlineSnapshot('\"\"')\n expect(firstTask.retryCount).toBe(3)\n expect(firstTask.errors).toEqual([\n Error('something went wrong0'),\n Error('something went wrong1'),\n Error('something went wrong2'),\n ])\n expect(secondTaskFunction).toHaveBeenCalledTimes(0)\n })\n\n test('supports retrying a subtask', async () => {\n // Given\n const firstSubTaskFunction = vi.fn(async (_ctx, task) => {\n if (task.retryCount < task.retry) {\n throw new Error(`something went wrong${task.retryCount}`)\n }\n\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const firstSubTask: Task = {\n title: 'subtask 1',\n task: firstSubTaskFunction,\n retry: 3,\n }\n\n const firstTask: Task = {\n title: 'task 1',\n task: async () => {\n return [firstSubTask]\n },\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n subtask 1 ...\"\n `)\n expect(firstSubTask.retryCount).toBe(3)\n expect(firstSubTask.errors).toEqual([\n Error('something went wrong0'),\n Error('something went wrong1'),\n Error('something went wrong2'),\n ])\n })\n\n test('supports retrying a subtask up to a limit', async () => {\n // Given\n const firstSubTaskFunction = vi.fn(async (_ctx, task) => {\n if (task.retryCount <= task.retry) {\n throw new Error(`something went wrong${task.retryCount}`)\n }\n\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const secondSubTaskFunction = vi.fn(async () => {})\n\n const firstSubTask: Task = {\n title: 'subtask 1',\n task: firstSubTaskFunction,\n retry: 3,\n }\n\n const secondSubTask: Task = {\n title: 'subtask 2',\n task: secondSubTaskFunction,\n }\n\n const firstTask: Task = {\n title: 'task 1',\n task: async () => {\n return [firstSubTask, secondSubTask]\n },\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(getLastFrameAfterUnmount(renderInstance)!)).toMatchInlineSnapshot('\"\"')\n expect(firstSubTask.retryCount).toBe(3)\n expect(firstSubTask.errors).toEqual([\n Error('something went wrong0'),\n Error('something went wrong1'),\n Error('something went wrong2'),\n ])\n expect(secondSubTaskFunction).toHaveBeenCalledTimes(0)\n })\n\n test('has a context', async () => {\n // Given\n const firstTaskFunction = vi.fn(async (ctx) => {\n ctx.foo = 'bar'\n })\n\n const firstTask: Task<{foo: string}> = {\n title: 'task 1',\n task: firstTaskFunction,\n }\n\n const secondTask: Task<{foo: string}> = {\n title: 'task 2',\n task: async (ctx) => {\n if (ctx.foo !== 'bar') {\n throw new Error('context is not shared')\n }\n },\n }\n\n const thirdTaskFunction = vi.fn(async () => {\n await new Promise((resolve) => setTimeout(resolve, 2000))\n })\n\n const thirdTask: Task<{foo: string}> = {\n title: 'task 3',\n task: thirdTaskFunction,\n }\n\n // When\n const renderInstance = render(<Tasks tasks={[firstTask, secondTask, thirdTask]} silent={false} />)\n\n // wait for next tick\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n // Then\n expect(unstyled(renderInstance.lastFrame()!)).toMatchInlineSnapshot(`\n \"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n task 3 ...\"\n `)\n expect(thirdTaskFunction).toHaveBeenCalled()\n })\n\n test('has an onComplete function that is called with the context', async () => {\n // Given\n const taskFunction = vi.fn(async (ctx) => {\n ctx.foo = 'bar'\n })\n\n const task: Task<{foo: string}> = {\n title: 'task 1',\n task: taskFunction,\n }\n\n // When\n const context = await new Promise((resolve, _reject) => {\n render(<Tasks tasks={[task]} silent={false} onComplete={resolve} />)\n })\n\n // Then\n expect(context).toEqual({foo: 'bar'})\n })\n})\n"]}
@@ -5,6 +5,7 @@ export interface TextPromptProps {
5
5
  defaultValue?: string;
6
6
  password?: boolean;
7
7
  validate?: (value: string) => string | undefined;
8
+ allowEmpty?: boolean;
8
9
  }
9
10
  declare const TextPrompt: FunctionComponent<TextPromptProps>;
10
11
  export { TextPrompt };
@@ -6,7 +6,7 @@ import { messageWithPunctuation } from '../utilities.js';
6
6
  import React, { useCallback, useState } from 'react';
7
7
  import { Box, useApp, useInput, Text } from 'ink';
8
8
  import figures from 'figures';
9
- const TextPrompt = ({ message, onSubmit, validate, defaultValue = '', password = false, }) => {
9
+ const TextPrompt = ({ message, onSubmit, validate, defaultValue = '', password = false, allowEmpty = false, }) => {
10
10
  if (password && defaultValue) {
11
11
  throw new Error("Can't use defaultValue with password");
12
12
  }
@@ -14,10 +14,10 @@ const TextPrompt = ({ message, onSubmit, validate, defaultValue = '', password =
14
14
  if (validate) {
15
15
  return validate(value);
16
16
  }
17
- if (value.length === 0)
17
+ if (value.length === 0 && !allowEmpty)
18
18
  return 'Type an answer to the prompt.';
19
19
  return undefined;
20
- }, [validate]);
20
+ }, [allowEmpty, validate]);
21
21
  const { oneThird } = useLayout();
22
22
  const [answer, setAnswer] = useState('');
23
23
  const answerOrDefault = answer.length > 0 ? answer : defaultValue;
@@ -1 +1 @@
1
- {"version":3,"file":"TextPrompt.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/TextPrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAA;AACvC,OAAO,SAAS,MAAM,wBAAwB,CA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AC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,eAAe,CAAQ,CAC9E,CACF,CACP,CAAC,CAAC,CAAC,CACF,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ;YACzB,oBAAC,GAAG;gBACF,oBAAC,GAAG,IAAC,WAAW,EAAE,CAAC;oBACjB,oBAAC,IAAI,IAAC,KAAK,EAAE,KAAK,IAAG,GAAG,CAAQ,CAC5B;gBACN,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC;oBACd,oBAAC,SAAS,IACR,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE;4BACnB,SAAS,CAAC,MAAM,CAAC,CAAA;4BACjB,YAAY,CAAC,KAAK,CAAC,CAAA;wBACrB,CAAC,EACD,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,GAClB,CACE,CACF;YACN,oBAAC,GAAG,IAAC,UAAU,EAAE,CAAC;gBAChB,oBAAC,IAAI,IAAC,KAAK,EAAE,KAAK,IAAG,SAAS,CAAQ,CAClC;YACL,eAAe,CAAC,CAAC,CAAC,CACjB,oBAAC,GAAG,IAAC,UAAU,EAAE,CAAC;gBAChB,oBAAC,IAAI,IAAC,KAAK,EAAE,KAAK,IAAG,KAAK,CAAQ,CAC9B,CACP,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CACG,CACP,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAC,UAAU,EAAC,CAAA","sourcesContent":["import {TextInput} from './TextInput.js'\nimport {TokenizedText} from './TokenizedText.js'\nimport {handleCtrlC} from '../../ui.js'\nimport useLayout from '../hooks/use-layout.js'\nimport {messageWithPunctuation} from '../utilities.js'\nimport React, {FunctionComponent, useCallback, useState} from 'react'\nimport {Box, useApp, useInput, Text} from 'ink'\nimport figures from 'figures'\n\nexport interface TextPromptProps {\n message: string\n onSubmit: (value: string) => void\n defaultValue?: string\n password?: boolean\n validate?: (value: string) => string | undefined\n}\n\nconst TextPrompt: FunctionComponent<TextPromptProps> = ({\n message,\n onSubmit,\n validate,\n defaultValue = '',\n password = false,\n}) => {\n if (password && defaultValue) {\n throw new Error(\"Can't use defaultValue with password\")\n }\n\n const validateAnswer = useCallback(\n (value: string): string | undefined => {\n if (validate) {\n return validate(value)\n }\n\n if (value.length === 0) return 'Type an answer to the prompt.'\n\n return undefined\n },\n [validate],\n )\n\n const {oneThird} = useLayout()\n const [answer, setAnswer] = useState<string>('')\n const answerOrDefault = answer.length > 0 ? answer : defaultValue\n const {exit: unmountInk} = useApp()\n const [submitted, setSubmitted] = useState(false)\n const [error, setError] = useState<string | undefined>(undefined)\n const shouldShowError = submitted && error\n const color = shouldShowError ? 'red' : 'cyan'\n const underline = new Array(oneThird - 3).fill('▔')\n\n useInput((input, key) => {\n handleCtrlC(input, key)\n\n if (key.return) {\n setSubmitted(true)\n const error = validateAnswer(answerOrDefault)\n setError(error)\n\n if (!error) {\n onSubmit(answerOrDefault)\n unmountInk()\n }\n }\n })\n\n return (\n <Box flexDirection=\"column\" marginBottom={1} width={oneThird}>\n <Box>\n <Box marginRight={2}>\n <Text>?</Text>\n </Box>\n <TokenizedText item={messageWithPunctuation(message)} />\n </Box>\n {submitted && !error ? (\n <Box>\n <Box marginRight={2}>\n <Text color=\"cyan\">{figures.tick}</Text>\n </Box>\n\n <Box flexGrow={1}>\n <Text color=\"cyan\">{password ? '*'.repeat(answer.length) : answerOrDefault}</Text>\n </Box>\n </Box>\n ) : (\n <Box flexDirection=\"column\">\n <Box>\n <Box marginRight={2}>\n <Text color={color}>{`>`}</Text>\n </Box>\n <Box flexGrow={1}>\n <TextInput\n value={answer}\n onChange={(answer) => {\n setAnswer(answer)\n setSubmitted(false)\n }}\n defaultValue={defaultValue}\n color={color}\n password={password}\n />\n </Box>\n </Box>\n <Box marginLeft={3}>\n <Text color={color}>{underline}</Text>\n </Box>\n {shouldShowError ? (\n <Box marginLeft={3}>\n <Text color={color}>{error}</Text>\n </Box>\n ) : null}\n </Box>\n )}\n </Box>\n )\n}\n\nexport {TextPrompt}\n"]}
1
+ {"version":3,"file":"TextPrompt.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/TextPrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAA;AACvC,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAC,sBAAsB,EAAC,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,EAAoB,WAAW,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAA;AACrE,OAAO,EAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC/C,OAAO,OAAO,MAAM,SAAS,CAAA;AAW7B,MAAM,UAAU,GAAuC,CAAC,EACtD,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,YAAY,GAAG,EAAE,EACjB,QAAQ,GAAG,KAAK,EAChB,UAAU,GAAG,KAAK,GACnB,EAAE,EAAE;IACH,IAAI,QAAQ,IAAI,YAAY,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;KACxD;IAED,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,KAAa,EAAsB,EAAE;QACpC,IAAI,QAAQ,EAAE;YACZ,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAA;SACvB;QAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,UAAU;YAAE,OAAO,+BAA+B,CAAA;QAE7E,OAAO,SAAS,CAAA;IAClB,CAAC,EACD,CAAC,UAAU,EAAE,QAAQ,CAAC,CACvB,CAAA;IAED,MAAM,EAAC,QAAQ,EAAC,GAAG,SAAS,EAAE,CAAA;IAC9B,MAAM,CAAC,MAA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P,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CACG,CACP,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAC,UAAU,EAAC,CAAA","sourcesContent":["import {TextInput} from './TextInput.js'\nimport {TokenizedText} from './TokenizedText.js'\nimport {handleCtrlC} from '../../ui.js'\nimport useLayout from '../hooks/use-layout.js'\nimport {messageWithPunctuation} from '../utilities.js'\nimport React, {FunctionComponent, useCallback, useState} from 'react'\nimport {Box, useApp, useInput, Text} from 'ink'\nimport figures from 'figures'\n\nexport interface TextPromptProps {\n message: string\n onSubmit: (value: string) => void\n defaultValue?: string\n password?: boolean\n validate?: (value: string) => string | undefined\n allowEmpty?: boolean\n}\n\nconst TextPrompt: FunctionComponent<TextPromptProps> = ({\n message,\n onSubmit,\n validate,\n defaultValue = '',\n password = false,\n allowEmpty = false,\n}) => {\n if (password && defaultValue) {\n throw new Error(\"Can't use defaultValue with password\")\n }\n\n const validateAnswer = useCallback(\n (value: string): string | undefined => {\n if (validate) {\n return validate(value)\n }\n\n if (value.length === 0 && !allowEmpty) return 'Type an answer to the prompt.'\n\n return undefined\n },\n [allowEmpty, validate],\n )\n\n const {oneThird} = useLayout()\n const [answer, setAnswer] = useState<string>('')\n const answerOrDefault = answer.length > 0 ? answer : defaultValue\n const {exit: unmountInk} = useApp()\n const [submitted, setSubmitted] = useState(false)\n const [error, setError] = useState<string | undefined>(undefined)\n const shouldShowError = submitted && error\n const color = shouldShowError ? 'red' : 'cyan'\n const underline = new Array(oneThird - 3).fill('▔')\n\n useInput((input, key) => {\n handleCtrlC(input, key)\n\n if (key.return) {\n setSubmitted(true)\n const error = validateAnswer(answerOrDefault)\n setError(error)\n\n if (!error) {\n onSubmit(answerOrDefault)\n unmountInk()\n }\n }\n })\n\n return (\n <Box flexDirection=\"column\" marginBottom={1} width={oneThird}>\n <Box>\n <Box marginRight={2}>\n <Text>?</Text>\n </Box>\n <TokenizedText item={messageWithPunctuation(message)} />\n </Box>\n {submitted && !error ? (\n <Box>\n <Box marginRight={2}>\n <Text color=\"cyan\">{figures.tick}</Text>\n </Box>\n\n <Box flexGrow={1}>\n <Text color=\"cyan\">{password ? '*'.repeat(answer.length) : answerOrDefault}</Text>\n </Box>\n </Box>\n ) : (\n <Box flexDirection=\"column\">\n <Box>\n <Box marginRight={2}>\n <Text color={color}>{`>`}</Text>\n </Box>\n <Box flexGrow={1}>\n <TextInput\n value={answer}\n onChange={(answer) => {\n setAnswer(answer)\n setSubmitted(false)\n }}\n defaultValue={defaultValue}\n color={color}\n password={password}\n />\n </Box>\n </Box>\n <Box marginLeft={3}>\n <Text color={color}>{underline}</Text>\n </Box>\n {shouldShowError ? (\n <Box marginLeft={3}>\n <Text color={color}>{error}</Text>\n </Box>\n ) : null}\n </Box>\n )}\n </Box>\n )\n}\n\nexport {TextPrompt}\n"]}
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export interface Link {
3
+ label: string | undefined;
4
+ url: string;
5
+ }
6
+ export interface ContextValue {
7
+ links: React.RefObject<{
8
+ [key: string]: Link;
9
+ }>;
10
+ addLink: (label: string | undefined, url: string) => string;
11
+ }
12
+ export declare const LinksContext: React.Context<ContextValue | null>;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export const LinksContext = React.createContext(null);
3
+ //# sourceMappingURL=LinksContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinksContext.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/contexts/LinksContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAYzB,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,aAAa,CAAsB,IAAI,CAAC,CAAA","sourcesContent":["import React from 'react'\n\nexport interface Link {\n label: string | undefined\n url: string\n}\n\nexport interface ContextValue {\n links: React.RefObject<{[key: string]: Link}>\n addLink: (label: string | undefined, url: string) => string\n}\n\nexport const LinksContext = React.createContext<ContextValue | null>(null)\n"]}
@@ -1 +1 @@
1
- export declare const CLI_KIT_VERSION = "3.45.0-pre.3";
1
+ export declare const CLI_KIT_VERSION = "3.45.0-pre.4";
@@ -1,2 +1,2 @@
1
- export const CLI_KIT_VERSION = '3.45.0-pre.3';
1
+ export const CLI_KIT_VERSION = '3.45.0-pre.4';
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,cAAc,CAAA","sourcesContent":["export const CLI_KIT_VERSION = '3.45.0-pre.3'\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/public/common/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAA","sourcesContent":["export const CLI_KIT_VERSION = '3.45.0-pre.4'\n"]}
@@ -9,6 +9,7 @@ import { pathConstants } from '../../private/node/constants.js';
9
9
  import { outputContent, outputToken } from '../../public/node/output.js';
10
10
  import { isTruthy } from '../../private/node/context/utilities.js';
11
11
  import { coerceSemverVersion } from '../../private/node/semver.js';
12
+ import envPaths from 'env-paths';
12
13
  import { Writable } from 'stream';
13
14
  import { fileURLToPath } from 'url';
14
15
  export const RubyCLIVersion = '2.35.0';
@@ -16,6 +17,7 @@ const ThemeCheckVersion = '1.14.0';
16
17
  const MinBundlerVersion = '2.3.11';
17
18
  const MinRubyVersion = '2.7.5';
18
19
  export const MinWdmWindowsVersion = '0.1.0';
20
+ const shopifyGems = envPaths('shopify-gems');
19
21
  /**
20
22
  * Execute CLI 2.0 commands.
21
23
  * Installs a version of RubyCLI as a vendor dependency in a hidden folder in the system.
@@ -216,7 +218,7 @@ async function createThemeCheckGemfile() {
216
218
  */
217
219
  async function bundleInstallLocalShopifyCLI(directory) {
218
220
  await addContentToGemfile(directory, getWindowsDependencies());
219
- await localBundleInstall(directory);
221
+ await shopifyBundleInstall(directory);
220
222
  }
221
223
  /**
222
224
  * Build the list of lines with the base content of the Gemfile.
@@ -259,13 +261,13 @@ async function addContentToGemfile(gemfileDirectory, content) {
259
261
  * It runs bundle install for the CLI-managed copy of the Ruby CLI.
260
262
  */
261
263
  async function bundleInstallShopifyCLI() {
262
- await localBundleInstall(await shopifyCLIDirectory());
264
+ await shopifyBundleInstall(await shopifyCLIDirectory());
263
265
  }
264
266
  /**
265
267
  * It runs bundle install for the CLI-managed copy of theme-check.
266
268
  */
267
269
  async function bundleInstallThemeCheck() {
268
- await localBundleInstall(themeCheckDirectory());
270
+ await shopifyBundleInstall(themeCheckDirectory());
269
271
  }
270
272
  /**
271
273
  * It returns the directory where the Ruby CLI is located.
@@ -358,14 +360,15 @@ async function getSpinEnvironmentVariables() {
358
360
  };
359
361
  }
360
362
  /**
361
- * It sets bundler's path to the given directory and runs bundle install.
362
- * This is desirable because the gems will be isolated from the system gems.
363
+ * It sets bundler's path to a directory dedicated to shopify gems and runs bundle install.
364
+ * This is desirable because these gems will be isolated from the system gems.
363
365
  *
364
366
  * @param directory - Directory where the Gemfile is located.
365
367
  */
366
- async function localBundleInstall(directory) {
368
+ async function shopifyBundleInstall(directory) {
367
369
  const bundle = bundleExecutable();
368
- await exec(bundle, ['config', 'set', '--local', 'path', directory], {
370
+ const shopifyGemsPath = shopifyGems.data;
371
+ await exec(bundle, ['config', 'set', '--local', 'path', shopifyGemsPath], {
369
372
  cwd: directory,
370
373
  });
371
374
  await exec(bundle, ['config', 'set', '--local', 'without', 'development:test'], {
@@ -1 +1 @@
1
- {"version":3,"file":"ruby.js","sourceRoot":"","sources":["../../../src/public/node/ruby.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAA;AACvC,OAAO,EAAC,aAAa,EAAE,IAAI,EAAC,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,IAAI,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAC,MAAM,WAAW,CAAA;AAChD,OAAO,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AAE,CAAC,SAAS,CAAC,EAAE,EAAC,GAAG,EAAE,SAAS,EAAC,CAAC,CAAA;AACnD,CAAC","sourcesContent":["import {AbortSignal} from './abort.js'\nimport {platformAndArch} from './os.js'\nimport {captureOutput, exec} from './system.js'\nimport * as file from './fs.js'\nimport {joinPath, dirname, cwd} from './path.js'\nimport {AbortError, AbortSilentError} from './error.js'\nimport {getEnvironmentVariables} from './environment.js'\nimport {isSpinEnvironment, spinFqdn} from './context/spin.js'\nimport {pathConstants} from '../../private/node/constants.js'\nimport {AdminSession} from '../../public/node/session.js'\nimport {outputContent, outputToken} from '../../public/node/output.js'\nimport {isTruthy} from '../../private/node/context/utilities.js'\nimport {coerceSemverVersion} from '../../private/node/semver.js'\nimport {Writable} from 'stream'\nimport {fileURLToPath} from 'url'\n\nexport const RubyCLIVersion = '2.35.0'\nconst ThemeCheckVersion = '1.14.0'\nconst MinBundlerVersion = '2.3.11'\nconst MinRubyVersion = '2.7.5'\nexport const MinWdmWindowsVersion = '0.1.0'\n\ninterface ExecCLI2Options {\n // Contains token and store to pass to CLI 2.0, which will be set as environment variables\n adminSession?: AdminSession\n // Contains token for storefront access to pass to CLI 2.0 as environment variable\n storefrontToken?: string\n // Contains token for partners access to pass to CLI 2.0 as environment variable\n token?: string\n // Directory in which to execute the command. Otherwise the current directory will be used.\n directory?: string\n // A signal to stop the process execution.\n signal?: AbortSignal\n // Stream to pipe the command's stdout to.\n stdout?: Writable\n // Stream to pipe the command's stdout to.\n stderr?: Writable\n}\n/**\n * Execute CLI 2.0 commands.\n * Installs a version of RubyCLI as a vendor dependency in a hidden folder in the system.\n * User must have a valid ruby+bundler environment to run any command.\n *\n * @param args - List of argumets to execute. (ex: ['theme', 'pull']).\n * @param options - Options to customize the execution of cli2.\n */\nexport async function execCLI2(args: string[], options: ExecCLI2Options = {}): Promise<void> {\n const currentEnv = getEnvironmentVariables()\n const embedded = !isTruthy(currentEnv.SHOPIFY_CLI_BUNDLED_THEME_CLI) && !currentEnv.SHOPIFY_CLI_2_0_DIRECTORY\n\n await installCLIDependencies(options.stdout ?? process.stdout, embedded)\n const env: NodeJS.ProcessEnv = {\n ...currentEnv,\n SHOPIFY_CLI_STOREFRONT_RENDERER_AUTH_TOKEN: options.storefrontToken,\n SHOPIFY_CLI_ADMIN_AUTH_TOKEN: options.adminSession?.token,\n SHOPIFY_SHOP: options.adminSession?.storeFqdn,\n SHOPIFY_CLI_AUTH_TOKEN: options.token,\n SHOPIFY_CLI_RUN_AS_SUBPROCESS: 'true',\n SHOPIFY_CLI_RUBY_BIN: rubyExecutable(),\n // Bundler uses this Gemfile to understand which gems are available in the\n // environment. We use this to specify our own Gemfile for CLI2, which exists\n // outside the user's project directory.\n BUNDLE_GEMFILE: joinPath(await shopifyCLIDirectory(embedded), 'Gemfile'),\n ...(await getSpinEnvironmentVariables()),\n }\n\n try {\n const shopifyExecutable = embedded ? [rubyExecutable(), await embeddedCLIExecutable()] : ['shopify']\n await exec(bundleExecutable(), ['exec', ...shopifyExecutable, ...args], {\n ...(options.stdout === undefined && {stdio: 'inherit'}),\n cwd: options.directory ?? cwd(),\n env,\n ...(options.stdout !== undefined && {stdout: options.stdout, stderr: options.stderr}),\n signal: options.signal,\n })\n } catch (error) {\n // CLI2 will show it's own errors, we don't need to show an additional CLI3 error\n throw new AbortSilentError()\n }\n}\n\ninterface ExecThemeCheckCLIOptions {\n /** A list of directories in which theme-check should run. */\n directories: string[]\n /** Arguments to pass to the theme-check CLI. */\n args?: string[]\n /** Writable to send standard output content through. */\n stdout: Writable\n /** Writable to send standard error content through. */\n stderr: Writable\n}\n\n/**\n * A function that installs (if needed) and runs the theme-check CLI.\n *\n * @param options - Options to customize the execution of theme-check.\n * @returns A promise that resolves or rejects depending on the result of the underlying theme-check process.\n */\nexport async function execThemeCheckCLI(options: ExecThemeCheckCLIOptions): Promise<void[]> {\n await installThemeCheckCLIDependencies(options.stdout)\n\n const processes = options.directories.map(async (directory): Promise<void> => {\n // Check that there are files aside from the extension TOML config file,\n // otherwise theme-check will return a false failure.\n const files = await file.glob(joinPath(directory, '/**/*'))\n const fileCount = files.filter((file) => !file.match(/\\.toml$/)).length\n if (fileCount === 0) return\n\n const customStderr = new Writable({\n write(chunk, ...args) {\n // For some reason, theme-check reports this initial status line to stderr\n // See https://github.com/Shopify/theme-check/blob/1092737cfb58a73ca397ffb1371665dc55df2976/lib/theme_check/language_server/diagnostics_engine.rb#L31\n // which leads to https://github.com/Shopify/theme-check/blob/1092737cfb58a73ca397ffb1371665dc55df2976/lib/theme_check/language_server/io_messenger.rb#L65\n if (chunk.toString('ascii').match(/^Checking/)) {\n options.stdout.write(chunk, ...args)\n } else {\n options.stderr.write(chunk, ...args)\n }\n },\n })\n await exec(bundleExecutable(), ['exec', 'theme-check'].concat([directory, ...(options.args || [])]), {\n stdout: options.stdout,\n stderr: customStderr,\n cwd: themeCheckDirectory(),\n })\n })\n return Promise.all(processes)\n}\n\n/**\n * Validate Ruby Enviroment\n * Install Theme Check CLI and its dependencies\n * Shows a loading message if it's the first time installing dependencies\n * or if we are installing a new version of Theme Check CLI.\n *\n * @param stdout - The Writable stream on which to write the standard output.\n */\nasync function installThemeCheckCLIDependencies(stdout: Writable) {\n const exists = await file.fileExists(themeCheckDirectory())\n\n if (!exists) stdout.write('Installing theme dependencies...')\n await validateRubyEnv()\n await createThemeCheckCLIWorkingDirectory()\n await createThemeCheckGemfile()\n await bundleInstallThemeCheck()\n if (!exists) stdout.write('Installed theme dependencies!')\n}\n\n/**\n * Validate Ruby Enviroment\n * Install RubyCLI and its dependencies\n * Shows a loading spinner if it's the first time installing dependencies\n * or if we are installing a new version of RubyCLI.\n *\n * @param stdout - The Writable stream on which to write the standard output.\n * @param embedded - True when embebbed codebase of CLI should be used.\n */\nasync function installCLIDependencies(stdout: Writable, embedded = false) {\n const localCLI = await shopifyCLIDirectory(embedded)\n const exists = await file.fileExists(localCLI)\n\n if (!exists) stdout.write('Installing theme dependencies...')\n const usingLocalCLI2 = embedded || isTruthy(getEnvironmentVariables().SHOPIFY_CLI_2_0_DIRECTORY)\n await validateRubyEnv()\n if (usingLocalCLI2) {\n await bundleInstallLocalShopifyCLI(localCLI)\n } else {\n await createShopifyCLIWorkingDirectory()\n await createShopifyCLIGemfile()\n await bundleInstallShopifyCLI()\n }\n\n if (!exists) stdout.write('Installed theme dependencies!')\n}\n\n/**\n * A function that validates if the environment in which the CLI is running is set up with Ruby and Bundler.\n */\nasync function validateRubyEnv() {\n await validateRuby()\n await validateBundler()\n}\n\n/**\n * A function that validates if the environment in which the CLI is running is set up with Ruby.\n */\nasync function validateRuby() {\n let version\n try {\n const stdout = await captureOutput(rubyExecutable(), ['-v'])\n version = coerceSemverVersion(stdout)\n } catch {\n throw new AbortError(\n 'Ruby environment not found',\n `Make sure you have Ruby installed on your system. ${\n outputContent`${outputToken.link('Documentation.', 'https://www.ruby-lang.org/en/documentation/installation/')}`\n .value\n }`,\n )\n }\n\n const isValid = version?.compare(MinRubyVersion)\n if (isValid === -1 || isValid === undefined) {\n throw new AbortError(\n `Ruby version ${outputContent`${outputToken.yellow(version.raw)}`.value} is not supported`,\n `Make sure you have at least Ruby ${\n outputContent`${outputToken.yellow(MinRubyVersion)}`.value\n } installed on your system. ${\n outputContent`${outputToken.link('Documentation.', 'https://www.ruby-lang.org/en/documentation/installation/')}`\n .value\n }`,\n )\n }\n}\n\n/**\n * A function that validates if the environment in which the CLI is running is set up with Bundler.\n */\nasync function validateBundler() {\n let version\n try {\n const stdout = await captureOutput(bundleExecutable(), ['-v'])\n version = coerceSemverVersion(stdout)\n } catch {\n throw new AbortError(\n 'Bundler not found',\n `To install the latest version of Bundler, run ${\n outputContent`${outputToken.genericShellCommand(`${gemExecutable()} install bundler`)}`.value\n }`,\n )\n }\n\n const isValid = version?.compare(MinBundlerVersion)\n if (isValid === -1 || isValid === undefined) {\n throw new AbortError(\n `Bundler version ${outputContent`${outputToken.yellow(version.raw)}`.value} is not supported`,\n `To update to the latest version of Bundler, run ${\n outputContent`${outputToken.genericShellCommand(`${gemExecutable()} install bundler`)}`.value\n }`,\n )\n }\n}\n\n/**\n * It creates the directory where the Ruby CLI will be downloaded along its dependencies.\n */\nasync function createShopifyCLIWorkingDirectory(): Promise<void> {\n return file.mkdir(await shopifyCLIDirectory())\n}\n\n/**\n * It creates the directory where the theme-check CLI will be downloaded along its dependencies.\n */\nasync function createThemeCheckCLIWorkingDirectory(): Promise<void> {\n return file.mkdir(themeCheckDirectory())\n}\n\n/**\n * It creates the Gemfile to install The Ruby CLI and the dependencies.\n */\nasync function createShopifyCLIGemfile(): Promise<void> {\n const directory = await shopifyCLIDirectory()\n const gemfileContent = getBaseGemfileContent().concat(getWindowsDependencies())\n await addContentToGemfile(directory, gemfileContent)\n}\n\n/**\n * It creates the Gemfile to install theme-check and its dependencies.\n */\nasync function createThemeCheckGemfile(): Promise<void> {\n const gemPath = joinPath(themeCheckDirectory(), 'Gemfile')\n await file.writeFile(gemPath, `source 'https://rubygems.org'\\ngem 'theme-check', '${ThemeCheckVersion}'`)\n}\n\n/**\n * It runs bundle install for the dev-managed copy of the Ruby CLI.\n *\n * @param directory - Directory where CLI2 Gemfile is located.\n */\nasync function bundleInstallLocalShopifyCLI(directory: string): Promise<void> {\n await addContentToGemfile(directory, getWindowsDependencies())\n await localBundleInstall(directory)\n}\n\n/**\n * Build the list of lines with the base content of the Gemfile.\n *\n * @returns List of lines with base content.\n */\nfunction getBaseGemfileContent() {\n return [\"source 'https://rubygems.org'\", `gem 'shopify-cli', '${RubyCLIVersion}'`]\n}\n\n/**\n * Build the list of Windows dependencies.\n *\n * @returns List of Windows dependencies.\n */\nfunction getWindowsDependencies() {\n if (platformAndArch().platform === 'windows') {\n // 'wdm' is required by 'listen', see https://github.com/Shopify/cli/issues/780\n // Because it's a Windows-only dependency, it's not included in the `.gemspec` or `Gemfile`.\n // Otherwise it would be installed in non-Windows environments too, where it is not needed.\n return [`gem 'wdm', '>= ${MinWdmWindowsVersion}'`]\n }\n return []\n}\n\n/**\n * Append contente to a Gemfile located in the given directory.\n *\n * @param gemfileDirectory - Directory where Gemfile is located.\n * @param content - Content to append to the Gemfile.\n */\nasync function addContentToGemfile(gemfileDirectory: string, content: string[]) {\n const gemfilePath = joinPath(gemfileDirectory, 'Gemfile')\n if (!(await file.fileExists(gemfilePath))) await file.touchFile(gemfilePath)\n const gemContent = await file.readFile(gemfilePath, {encoding: 'utf8'})\n const contentNoExisting = content.filter((line) => !gemContent.includes(line)).join('\\n')\n if (contentNoExisting) await file.appendFile(gemfilePath, contentNoExisting.concat('\\n'))\n}\n\n/**\n * It runs bundle install for the CLI-managed copy of the Ruby CLI.\n */\nasync function bundleInstallShopifyCLI() {\n await localBundleInstall(await shopifyCLIDirectory())\n}\n\n/**\n * It runs bundle install for the CLI-managed copy of theme-check.\n */\nasync function bundleInstallThemeCheck() {\n await localBundleInstall(themeCheckDirectory())\n}\n\n/**\n * It returns the directory where the Ruby CLI is located.\n *\n * @param embedded - True when embebbed codebase of CLI should be used.\n * @returns The absolute path to the directory.\n */\nasync function shopifyCLIDirectory(embedded = false): Promise<string> {\n const embeddedDirectory = (await file.findPathUp('assets/cli-ruby', {\n type: 'directory',\n cwd: dirname(fileURLToPath(import.meta.url)),\n })) as string\n const bundledDirectory = joinPath(pathConstants.directories.cache.vendor.path(), 'ruby-cli', RubyCLIVersion)\n\n return embedded ? embeddedDirectory : getEnvironmentVariables().SHOPIFY_CLI_2_0_DIRECTORY ?? bundledDirectory\n}\n\n/**\n * It returns the path to the directory containing the theme-check CLI.\n *\n * @returns The absolute path to the theme-check directory.\n */\nfunction themeCheckDirectory(): string {\n return joinPath(pathConstants.directories.cache.vendor.path(), 'theme-check', ThemeCheckVersion)\n}\n\n/**\n * It returns the Ruby version present in the envirronment.\n */\nexport async function version(): Promise<string | undefined> {\n const parseOutput = (version: string) => version.match(/ruby (\\d+\\.\\d+\\.\\d+)/)?.[1]\n return captureOutput(rubyExecutable(), ['-v'])\n .then(parseOutput)\n .catch(() => undefined)\n}\n\n/**\n * It returns the Ruby binary path set through the environment variable SHOPIFY_RUBY_BINDIR.\n * This is useful when the CLI is managed by an installer like a Homebrew where we need to\n * point the CLI to the Ruby installation managed by Homebrew.\n *\n * @returns The value of the environment variable.\n */\nfunction getRubyBinDir(): string | undefined {\n return getEnvironmentVariables().SHOPIFY_RUBY_BINDIR\n}\n\n/**\n * It returns the path to the \"ruby\" executable.\n *\n * @returns The path to the executable.\n */\nfunction rubyExecutable(): string {\n const rubyBinDir = getRubyBinDir()\n return rubyBinDir ? joinPath(rubyBinDir, 'ruby') : 'ruby'\n}\n\n/**\n * It returns the path to the \"bundle\" executable.\n *\n * @returns The path to the executable.\n */\nfunction bundleExecutable(): string {\n const rubyBinDir = getRubyBinDir()\n return rubyBinDir ? joinPath(rubyBinDir, 'bundle') : 'bundle'\n}\n\n/**\n * It returns the path to the \"gem\"\" executable.\n *\n * @returns The path to the executable.\n */\nfunction gemExecutable(): string {\n const rubyBinDir = getRubyBinDir()\n return rubyBinDir ? joinPath(rubyBinDir, 'gem') : 'gem'\n}\n\n/**\n * It returns the path to the \"bundle\" executable.\n *\n * @returns The path to the executable.\n */\nasync function embeddedCLIExecutable(): Promise<string> {\n const cliDirectory = await shopifyCLIDirectory(true)\n return joinPath(cliDirectory, 'bin', 'shopify')\n}\n\n/**\n * Get environment variables required by the CLI2 in case the CLI3 is running in a Spin environment.\n *\n * @returns The environment variables to set.\n */\nasync function getSpinEnvironmentVariables() {\n if (!isSpinEnvironment()) return {}\n\n return {\n SPIN_FQDN: await spinFqdn(),\n SPIN: '1',\n }\n}\n\n/**\n * It sets bundler's path to the given directory and runs bundle install.\n * This is desirable because the gems will be isolated from the system gems.\n *\n * @param directory - Directory where the Gemfile is located.\n */\nasync function localBundleInstall(directory: string): Promise<void> {\n const bundle = bundleExecutable()\n await exec(bundle, ['config', 'set', '--local', 'path', directory], {\n cwd: directory,\n })\n await exec(bundle, ['config', 'set', '--local', 'without', 'development:test'], {\n cwd: directory,\n })\n await exec(bundle, ['install'], {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;GAKG;AACH,KAAK,UAAU,oBAAoB,CAAC,SAAiB;IACnD,MAAM,MAAM,GAAG,gBAAgB,EAAE,CAAA;IACjC,MAAM,eAAe,GAAG,WAAW,CAAC,IAAI,CAAA;IAExC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE;QACxE,GAAG,EAAE,SAAS;KACf,CAAC,CAAA;IAEF,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,kBAAkB,CAAC,EAAE;QAC9E,GAAG,EAAE,SAAS;KACf,CAAC,CAAA;IACF,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,EAAE,EAAC,GAAG,EAAE,SAAS,EAAC,CAAC,CAAA;AACnD,CAAC","sourcesContent":["import {AbortSignal} from './abort.js'\nimport {platformAndArch} from './os.js'\nimport {captureOutput, exec} from './system.js'\nimport * as file from './fs.js'\nimport {joinPath, dirname, cwd} from './path.js'\nimport {AbortError, AbortSilentError} from './error.js'\nimport {getEnvironmentVariables} from './environment.js'\nimport {isSpinEnvironment, spinFqdn} from './context/spin.js'\nimport {pathConstants} from '../../private/node/constants.js'\nimport {AdminSession} from '../../public/node/session.js'\nimport {outputContent, outputToken} from '../../public/node/output.js'\nimport {isTruthy} from '../../private/node/context/utilities.js'\nimport {coerceSemverVersion} from '../../private/node/semver.js'\nimport envPaths from 'env-paths'\nimport {Writable} from 'stream'\nimport {fileURLToPath} from 'url'\n\nexport const RubyCLIVersion = '2.35.0'\nconst ThemeCheckVersion = '1.14.0'\nconst MinBundlerVersion = '2.3.11'\nconst MinRubyVersion = '2.7.5'\nexport const MinWdmWindowsVersion = '0.1.0'\nconst shopifyGems = envPaths('shopify-gems')\n\ninterface ExecCLI2Options {\n // Contains token and store to pass to CLI 2.0, which will be set as environment variables\n adminSession?: AdminSession\n // Contains token for storefront access to pass to CLI 2.0 as environment variable\n storefrontToken?: string\n // Contains token for partners access to pass to CLI 2.0 as environment variable\n token?: string\n // Directory in which to execute the command. Otherwise the current directory will be used.\n directory?: string\n // A signal to stop the process execution.\n signal?: AbortSignal\n // Stream to pipe the command's stdout to.\n stdout?: Writable\n // Stream to pipe the command's stdout to.\n stderr?: Writable\n}\n/**\n * Execute CLI 2.0 commands.\n * Installs a version of RubyCLI as a vendor dependency in a hidden folder in the system.\n * User must have a valid ruby+bundler environment to run any command.\n *\n * @param args - List of argumets to execute. (ex: ['theme', 'pull']).\n * @param options - Options to customize the execution of cli2.\n */\nexport async function execCLI2(args: string[], options: ExecCLI2Options = {}): Promise<void> {\n const currentEnv = getEnvironmentVariables()\n const embedded = !isTruthy(currentEnv.SHOPIFY_CLI_BUNDLED_THEME_CLI) && !currentEnv.SHOPIFY_CLI_2_0_DIRECTORY\n\n await installCLIDependencies(options.stdout ?? process.stdout, embedded)\n const env: NodeJS.ProcessEnv = {\n ...currentEnv,\n SHOPIFY_CLI_STOREFRONT_RENDERER_AUTH_TOKEN: options.storefrontToken,\n SHOPIFY_CLI_ADMIN_AUTH_TOKEN: options.adminSession?.token,\n SHOPIFY_SHOP: options.adminSession?.storeFqdn,\n SHOPIFY_CLI_AUTH_TOKEN: options.token,\n SHOPIFY_CLI_RUN_AS_SUBPROCESS: 'true',\n SHOPIFY_CLI_RUBY_BIN: rubyExecutable(),\n // Bundler uses this Gemfile to understand which gems are available in the\n // environment. We use this to specify our own Gemfile for CLI2, which exists\n // outside the user's project directory.\n BUNDLE_GEMFILE: joinPath(await shopifyCLIDirectory(embedded), 'Gemfile'),\n ...(await getSpinEnvironmentVariables()),\n }\n\n try {\n const shopifyExecutable = embedded ? [rubyExecutable(), await embeddedCLIExecutable()] : ['shopify']\n await exec(bundleExecutable(), ['exec', ...shopifyExecutable, ...args], {\n ...(options.stdout === undefined && {stdio: 'inherit'}),\n cwd: options.directory ?? cwd(),\n env,\n ...(options.stdout !== undefined && {stdout: options.stdout, stderr: options.stderr}),\n signal: options.signal,\n })\n } catch (error) {\n // CLI2 will show it's own errors, we don't need to show an additional CLI3 error\n throw new AbortSilentError()\n }\n}\n\ninterface ExecThemeCheckCLIOptions {\n /** A list of directories in which theme-check should run. */\n directories: string[]\n /** Arguments to pass to the theme-check CLI. */\n args?: string[]\n /** Writable to send standard output content through. */\n stdout: Writable\n /** Writable to send standard error content through. */\n stderr: Writable\n}\n\n/**\n * A function that installs (if needed) and runs the theme-check CLI.\n *\n * @param options - Options to customize the execution of theme-check.\n * @returns A promise that resolves or rejects depending on the result of the underlying theme-check process.\n */\nexport async function execThemeCheckCLI(options: ExecThemeCheckCLIOptions): Promise<void[]> {\n await installThemeCheckCLIDependencies(options.stdout)\n\n const processes = options.directories.map(async (directory): Promise<void> => {\n // Check that there are files aside from the extension TOML config file,\n // otherwise theme-check will return a false failure.\n const files = await file.glob(joinPath(directory, '/**/*'))\n const fileCount = files.filter((file) => !file.match(/\\.toml$/)).length\n if (fileCount === 0) return\n\n const customStderr = new Writable({\n write(chunk, ...args) {\n // For some reason, theme-check reports this initial status line to stderr\n // See https://github.com/Shopify/theme-check/blob/1092737cfb58a73ca397ffb1371665dc55df2976/lib/theme_check/language_server/diagnostics_engine.rb#L31\n // which leads to https://github.com/Shopify/theme-check/blob/1092737cfb58a73ca397ffb1371665dc55df2976/lib/theme_check/language_server/io_messenger.rb#L65\n if (chunk.toString('ascii').match(/^Checking/)) {\n options.stdout.write(chunk, ...args)\n } else {\n options.stderr.write(chunk, ...args)\n }\n },\n })\n await exec(bundleExecutable(), ['exec', 'theme-check'].concat([directory, ...(options.args || [])]), {\n stdout: options.stdout,\n stderr: customStderr,\n cwd: themeCheckDirectory(),\n })\n })\n return Promise.all(processes)\n}\n\n/**\n * Validate Ruby Enviroment\n * Install Theme Check CLI and its dependencies\n * Shows a loading message if it's the first time installing dependencies\n * or if we are installing a new version of Theme Check CLI.\n *\n * @param stdout - The Writable stream on which to write the standard output.\n */\nasync function installThemeCheckCLIDependencies(stdout: Writable) {\n const exists = await file.fileExists(themeCheckDirectory())\n\n if (!exists) stdout.write('Installing theme dependencies...')\n await validateRubyEnv()\n await createThemeCheckCLIWorkingDirectory()\n await createThemeCheckGemfile()\n await bundleInstallThemeCheck()\n if (!exists) stdout.write('Installed theme dependencies!')\n}\n\n/**\n * Validate Ruby Enviroment\n * Install RubyCLI and its dependencies\n * Shows a loading spinner if it's the first time installing dependencies\n * or if we are installing a new version of RubyCLI.\n *\n * @param stdout - The Writable stream on which to write the standard output.\n * @param embedded - True when embebbed codebase of CLI should be used.\n */\nasync function installCLIDependencies(stdout: Writable, embedded = false) {\n const localCLI = await shopifyCLIDirectory(embedded)\n const exists = await file.fileExists(localCLI)\n\n if (!exists) stdout.write('Installing theme dependencies...')\n const usingLocalCLI2 = embedded || isTruthy(getEnvironmentVariables().SHOPIFY_CLI_2_0_DIRECTORY)\n await validateRubyEnv()\n if (usingLocalCLI2) {\n await bundleInstallLocalShopifyCLI(localCLI)\n } else {\n await createShopifyCLIWorkingDirectory()\n await createShopifyCLIGemfile()\n await bundleInstallShopifyCLI()\n }\n\n if (!exists) stdout.write('Installed theme dependencies!')\n}\n\n/**\n * A function that validates if the environment in which the CLI is running is set up with Ruby and Bundler.\n */\nasync function validateRubyEnv() {\n await validateRuby()\n await validateBundler()\n}\n\n/**\n * A function that validates if the environment in which the CLI is running is set up with Ruby.\n */\nasync function validateRuby() {\n let version\n try {\n const stdout = await captureOutput(rubyExecutable(), ['-v'])\n version = coerceSemverVersion(stdout)\n } catch {\n throw new AbortError(\n 'Ruby environment not found',\n `Make sure you have Ruby installed on your system. ${\n outputContent`${outputToken.link('Documentation.', 'https://www.ruby-lang.org/en/documentation/installation/')}`\n .value\n }`,\n )\n }\n\n const isValid = version?.compare(MinRubyVersion)\n if (isValid === -1 || isValid === undefined) {\n throw new AbortError(\n `Ruby version ${outputContent`${outputToken.yellow(version.raw)}`.value} is not supported`,\n `Make sure you have at least Ruby ${\n outputContent`${outputToken.yellow(MinRubyVersion)}`.value\n } installed on your system. ${\n outputContent`${outputToken.link('Documentation.', 'https://www.ruby-lang.org/en/documentation/installation/')}`\n .value\n }`,\n )\n }\n}\n\n/**\n * A function that validates if the environment in which the CLI is running is set up with Bundler.\n */\nasync function validateBundler() {\n let version\n try {\n const stdout = await captureOutput(bundleExecutable(), ['-v'])\n version = coerceSemverVersion(stdout)\n } catch {\n throw new AbortError(\n 'Bundler not found',\n `To install the latest version of Bundler, run ${\n outputContent`${outputToken.genericShellCommand(`${gemExecutable()} install bundler`)}`.value\n }`,\n )\n }\n\n const isValid = version?.compare(MinBundlerVersion)\n if (isValid === -1 || isValid === undefined) {\n throw new AbortError(\n `Bundler version ${outputContent`${outputToken.yellow(version.raw)}`.value} is not supported`,\n `To update to the latest version of Bundler, run ${\n outputContent`${outputToken.genericShellCommand(`${gemExecutable()} install bundler`)}`.value\n }`,\n )\n }\n}\n\n/**\n * It creates the directory where the Ruby CLI will be downloaded along its dependencies.\n */\nasync function createShopifyCLIWorkingDirectory(): Promise<void> {\n return file.mkdir(await shopifyCLIDirectory())\n}\n\n/**\n * It creates the directory where the theme-check CLI will be downloaded along its dependencies.\n */\nasync function createThemeCheckCLIWorkingDirectory(): Promise<void> {\n return file.mkdir(themeCheckDirectory())\n}\n\n/**\n * It creates the Gemfile to install The Ruby CLI and the dependencies.\n */\nasync function createShopifyCLIGemfile(): Promise<void> {\n const directory = await shopifyCLIDirectory()\n const gemfileContent = getBaseGemfileContent().concat(getWindowsDependencies())\n await addContentToGemfile(directory, gemfileContent)\n}\n\n/**\n * It creates the Gemfile to install theme-check and its dependencies.\n */\nasync function createThemeCheckGemfile(): Promise<void> {\n const gemPath = joinPath(themeCheckDirectory(), 'Gemfile')\n await file.writeFile(gemPath, `source 'https://rubygems.org'\\ngem 'theme-check', '${ThemeCheckVersion}'`)\n}\n\n/**\n * It runs bundle install for the dev-managed copy of the Ruby CLI.\n *\n * @param directory - Directory where CLI2 Gemfile is located.\n */\nasync function bundleInstallLocalShopifyCLI(directory: string): Promise<void> {\n await addContentToGemfile(directory, getWindowsDependencies())\n await shopifyBundleInstall(directory)\n}\n\n/**\n * Build the list of lines with the base content of the Gemfile.\n *\n * @returns List of lines with base content.\n */\nfunction getBaseGemfileContent() {\n return [\"source 'https://rubygems.org'\", `gem 'shopify-cli', '${RubyCLIVersion}'`]\n}\n\n/**\n * Build the list of Windows dependencies.\n *\n * @returns List of Windows dependencies.\n */\nfunction getWindowsDependencies() {\n if (platformAndArch().platform === 'windows') {\n // 'wdm' is required by 'listen', see https://github.com/Shopify/cli/issues/780\n // Because it's a Windows-only dependency, it's not included in the `.gemspec` or `Gemfile`.\n // Otherwise it would be installed in non-Windows environments too, where it is not needed.\n return [`gem 'wdm', '>= ${MinWdmWindowsVersion}'`]\n }\n return []\n}\n\n/**\n * Append contente to a Gemfile located in the given directory.\n *\n * @param gemfileDirectory - Directory where Gemfile is located.\n * @param content - Content to append to the Gemfile.\n */\nasync function addContentToGemfile(gemfileDirectory: string, content: string[]) {\n const gemfilePath = joinPath(gemfileDirectory, 'Gemfile')\n if (!(await file.fileExists(gemfilePath))) await file.touchFile(gemfilePath)\n const gemContent = await file.readFile(gemfilePath, {encoding: 'utf8'})\n const contentNoExisting = content.filter((line) => !gemContent.includes(line)).join('\\n')\n if (contentNoExisting) await file.appendFile(gemfilePath, contentNoExisting.concat('\\n'))\n}\n\n/**\n * It runs bundle install for the CLI-managed copy of the Ruby CLI.\n */\nasync function bundleInstallShopifyCLI() {\n await shopifyBundleInstall(await shopifyCLIDirectory())\n}\n\n/**\n * It runs bundle install for the CLI-managed copy of theme-check.\n */\nasync function bundleInstallThemeCheck() {\n await shopifyBundleInstall(themeCheckDirectory())\n}\n\n/**\n * It returns the directory where the Ruby CLI is located.\n *\n * @param embedded - True when embebbed codebase of CLI should be used.\n * @returns The absolute path to the directory.\n */\nasync function shopifyCLIDirectory(embedded = false): Promise<string> {\n const embeddedDirectory = (await file.findPathUp('assets/cli-ruby', {\n type: 'directory',\n cwd: dirname(fileURLToPath(import.meta.url)),\n })) as string\n const bundledDirectory = joinPath(pathConstants.directories.cache.vendor.path(), 'ruby-cli', RubyCLIVersion)\n\n return embedded ? embeddedDirectory : getEnvironmentVariables().SHOPIFY_CLI_2_0_DIRECTORY ?? bundledDirectory\n}\n\n/**\n * It returns the path to the directory containing the theme-check CLI.\n *\n * @returns The absolute path to the theme-check directory.\n */\nfunction themeCheckDirectory(): string {\n return joinPath(pathConstants.directories.cache.vendor.path(), 'theme-check', ThemeCheckVersion)\n}\n\n/**\n * It returns the Ruby version present in the envirronment.\n */\nexport async function version(): Promise<string | undefined> {\n const parseOutput = (version: string) => version.match(/ruby (\\d+\\.\\d+\\.\\d+)/)?.[1]\n return captureOutput(rubyExecutable(), ['-v'])\n .then(parseOutput)\n .catch(() => undefined)\n}\n\n/**\n * It returns the Ruby binary path set through the environment variable SHOPIFY_RUBY_BINDIR.\n * This is useful when the CLI is managed by an installer like a Homebrew where we need to\n * point the CLI to the Ruby installation managed by Homebrew.\n *\n * @returns The value of the environment variable.\n */\nfunction getRubyBinDir(): string | undefined {\n return getEnvironmentVariables().SHOPIFY_RUBY_BINDIR\n}\n\n/**\n * It returns the path to the \"ruby\" executable.\n *\n * @returns The path to the executable.\n */\nfunction rubyExecutable(): string {\n const rubyBinDir = getRubyBinDir()\n return rubyBinDir ? joinPath(rubyBinDir, 'ruby') : 'ruby'\n}\n\n/**\n * It returns the path to the \"bundle\" executable.\n *\n * @returns The path to the executable.\n */\nfunction bundleExecutable(): string {\n const rubyBinDir = getRubyBinDir()\n return rubyBinDir ? joinPath(rubyBinDir, 'bundle') : 'bundle'\n}\n\n/**\n * It returns the path to the \"gem\"\" executable.\n *\n * @returns The path to the executable.\n */\nfunction gemExecutable(): string {\n const rubyBinDir = getRubyBinDir()\n return rubyBinDir ? joinPath(rubyBinDir, 'gem') : 'gem'\n}\n\n/**\n * It returns the path to the \"bundle\" executable.\n *\n * @returns The path to the executable.\n */\nasync function embeddedCLIExecutable(): Promise<string> {\n const cliDirectory = await shopifyCLIDirectory(true)\n return joinPath(cliDirectory, 'bin', 'shopify')\n}\n\n/**\n * Get environment variables required by the CLI2 in case the CLI3 is running in a Spin environment.\n *\n * @returns The environment variables to set.\n */\nasync function getSpinEnvironmentVariables() {\n if (!isSpinEnvironment()) return {}\n\n return {\n SPIN_FQDN: await spinFqdn(),\n SPIN: '1',\n }\n}\n\n/**\n * It sets bundler's path to a directory dedicated to shopify gems and runs bundle install.\n * This is desirable because these gems will be isolated from the system gems.\n *\n * @param directory - Directory where the Gemfile is located.\n */\nasync function shopifyBundleInstall(directory: string): Promise<void> {\n const bundle = bundleExecutable()\n const shopifyGemsPath = shopifyGems.data\n\n await exec(bundle, ['config', 'set', '--local', 'path', shopifyGemsPath], {\n cwd: directory,\n })\n\n await exec(bundle, ['config', 'set', '--local', 'without', 'development:test'], {\n cwd: directory,\n })\n await exec(bundle, ['install'], {cwd: directory})\n}\n"]}
@@ -5,3 +5,9 @@
5
5
  * @example
6
6
  */
7
7
  export declare function getAvailableTCPPort(): Promise<number>;
8
+ /**
9
+ * Checks if a port is available.
10
+ *
11
+ * @param portNumber - The port number to check.
12
+ */
13
+ export declare function checkPortAvailability(portNumber: number): Promise<boolean>;
@@ -14,6 +14,14 @@ export async function getAvailableTCPPort() {
14
14
  outputDebug(outputContent `Random port obtained: ${outputToken.raw(`${randomPort}`)}`);
15
15
  return randomPort;
16
16
  }
17
+ /**
18
+ * Checks if a port is available.
19
+ *
20
+ * @param portNumber - The port number to check.
21
+ */
22
+ export async function checkPortAvailability(portNumber) {
23
+ return (await port.checkPort(portNumber)) === portNumber;
24
+ }
17
25
  /**
18
26
  * Given a function, it runs it and retries in case of failiure up to the provided number of times.
19
27
  *
@@ -1 +1 @@
1
- {"version":3,"file":"tcp.js","sourceRoot":"","sources":["../../../src/public/node/tcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,EAAC,WAAW,EAAE,aAAa,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAA;AACnF,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,WAAW,CAAC,aAAa,CAAA,0BAA0B,CAAC,CAAA;IACpD,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAA;IACjE,WAAW,CAAC,aAAa,CAAA,yBAAyB,WAAW,CAAC,GAAG,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,CAAC,CAAA;IACrF,OAAO,UAAU,CAAA;AACnB,CAAC;AAED;;;;;;GAMG;AACH,KAAK,UAAU,YAAY,CAAI,OAAgB,EAAE,QAAQ,GAAG,CAAC,EAAE,iBAAiB,GAAG,CAAC;IAClF,IAAI,UAAU,GAAG,CAAC,CAAA;IAClB,OAAO,IAAI,EAAE;QACX,IAAI;YACF,4CAA4C;YAC5C,OAAO,MAAM,OAAO,EAAE,CAAA;YACtB,8DAA8D;SAC/D;QAAC,OAAO,KAAU,EAAE;YACnB,IAAI,UAAU,EAAE,GAAG,QAAQ,EAAE;gBAC3B,WAAW,CAAC,aAAa,CAAA,0CAA0C,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;gBACnF,4CAA4C;gBAC5C,MAAM,KAAK,CAAC,iBAAiB,CAAC,CAAA;aAC/B;iBAAM;gBACL,MAAM,IAAI,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;aACpC;SACF;KACF;AACH,CAAC","sourcesContent":["import {sleep} from './system.js'\nimport {AbortError} from './error.js'\nimport {outputDebug, outputContent, outputToken} from '../../public/node/output.js'\nimport * as port from 'get-port-please'\n\n/**\n * Returns an available port in the current environment.\n *\n * @returns A promise that resolves with an availabe port.\n * @example\n */\nexport async function getAvailableTCPPort(): Promise<number> {\n outputDebug(outputContent`Getting a random port...`)\n const randomPort = await retryOnError(() => port.getRandomPort())\n outputDebug(outputContent`Random port obtained: ${outputToken.raw(`${randomPort}`)}`)\n return randomPort\n}\n\n/**\n * Given a function, it runs it and retries in case of failiure up to the provided number of times.\n *\n * @param execute - The function to execute.\n * @param maxTries - The maximum retries.\n * @param waitTimeInSeconds - The time to wait between retries.\n */\nasync function retryOnError<T>(execute: () => T, maxTries = 5, waitTimeInSeconds = 1) {\n let retryCount = 1\n while (true) {\n try {\n // eslint-disable-next-line no-await-in-loop\n return await execute()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n if (retryCount++ < maxTries) {\n outputDebug(outputContent`Unknown problem getting a random port: ${error.message}`)\n // eslint-disable-next-line no-await-in-loop\n await sleep(waitTimeInSeconds)\n } else {\n throw new AbortError(error.message)\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"tcp.js","sourceRoot":"","sources":["../../../src/public/node/tcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AACjC,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,EAAC,WAAW,EAAE,aAAa,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAA;AACnF,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,WAAW,CAAC,aAAa,CAAA,0BAA0B,CAAC,CAAA;IACpD,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAA;IACjE,WAAW,CAAC,aAAa,CAAA,yBAAyB,WAAW,CAAC,GAAG,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,CAAC,CAAA;IACrF,OAAO,UAAU,CAAA;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,UAAkB;IAC5D,OAAO,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,KAAK,UAAU,CAAA;AAC1D,CAAC;AAED;;;;;;GAMG;AACH,KAAK,UAAU,YAAY,CAAI,OAAgB,EAAE,QAAQ,GAAG,CAAC,EAAE,iBAAiB,GAAG,CAAC;IAClF,IAAI,UAAU,GAAG,CAAC,CAAA;IAClB,OAAO,IAAI,EAAE;QACX,IAAI;YACF,4CAA4C;YAC5C,OAAO,MAAM,OAAO,EAAE,CAAA;YACtB,8DAA8D;SAC/D;QAAC,OAAO,KAAU,EAAE;YACnB,IAAI,UAAU,EAAE,GAAG,QAAQ,EAAE;gBAC3B,WAAW,CAAC,aAAa,CAAA,0CAA0C,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;gBACnF,4CAA4C;gBAC5C,MAAM,KAAK,CAAC,iBAAiB,CAAC,CAAA;aAC/B;iBAAM;gBACL,MAAM,IAAI,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;aACpC;SACF;KACF;AACH,CAAC","sourcesContent":["import {sleep} from './system.js'\nimport {AbortError} from './error.js'\nimport {outputDebug, outputContent, outputToken} from '../../public/node/output.js'\nimport * as port from 'get-port-please'\n\n/**\n * Returns an available port in the current environment.\n *\n * @returns A promise that resolves with an availabe port.\n * @example\n */\nexport async function getAvailableTCPPort(): Promise<number> {\n outputDebug(outputContent`Getting a random port...`)\n const randomPort = await retryOnError(() => port.getRandomPort())\n outputDebug(outputContent`Random port obtained: ${outputToken.raw(`${randomPort}`)}`)\n return randomPort\n}\n\n/**\n * Checks if a port is available.\n *\n * @param portNumber - The port number to check.\n */\nexport async function checkPortAvailability(portNumber: number): Promise<boolean> {\n return (await port.checkPort(portNumber)) === portNumber\n}\n\n/**\n * Given a function, it runs it and retries in case of failiure up to the provided number of times.\n *\n * @param execute - The function to execute.\n * @param maxTries - The maximum retries.\n * @param waitTimeInSeconds - The time to wait between retries.\n */\nasync function retryOnError<T>(execute: () => T, maxTries = 5, waitTimeInSeconds = 1) {\n let retryCount = 1\n while (true) {\n try {\n // eslint-disable-next-line no-await-in-loop\n return await execute()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n if (retryCount++ < maxTries) {\n outputDebug(outputContent`Unknown problem getting a random port: ${error.message}`)\n // eslint-disable-next-line no-await-in-loop\n await sleep(waitTimeInSeconds)\n } else {\n throw new AbortError(error.message)\n }\n }\n }\n}\n"]}
@@ -18,15 +18,15 @@ export interface RenderConcurrentOptions extends PartialBy<ConcurrentOutputProps
18
18
  /**
19
19
  * Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.
20
20
  * @example
21
- * 0000-00-00 00:00:00 | backend | first backend message
22
- * 0000-00-00 00:00:00 | backend | second backend message
23
- * 0000-00-00 00:00:00 | backend | third backend message
24
- * 0000-00-00 00:00:00 | frontend | first frontend message
25
- * 0000-00-00 00:00:00 | frontend | second frontend message
26
- * 0000-00-00 00:00:00 | frontend | third frontend message
21
+ * 0000-00-00 00:00:00 backend first backend message
22
+ * 0000-00-00 00:00:00 backend second backend message
23
+ * 0000-00-00 00:00:00 backend third backend message
24
+ * 0000-00-00 00:00:00 frontend first frontend message
25
+ * 0000-00-00 00:00:00 frontend second frontend message
26
+ * 0000-00-00 00:00:00 frontend third frontend message
27
27
  *
28
- * › Press p | open your browser
29
- * › Press q | quit.
28
+ * › Press p open your browser
29
+ * › Press q quit.
30
30
  *
31
31
  * Preview URL: https://shopify.com
32
32
  *
@@ -57,14 +57,20 @@ export type RenderAlertOptions = Omit<AlertOptions, 'type'>;
57
57
  * │ │
58
58
  * │ Reference │
59
59
  * │ • Run `npm shopify help` │
60
- * │ • Dev docs ( https://shopify.dev )
60
+ * │ • Dev docs [1]
61
61
  * │ │
62
62
  * │ Custom section │
63
- * │ • Item 1
63
+ * │ • Item 1 [2]
64
64
  * │ • Item 2 │
65
- * │ • Item 3
65
+ * │ • Item 3 [3]
66
66
  * │ │
67
67
  * ╰──────────────────────────────────────────────────────────╯
68
+ * [1] https://shopify.dev
69
+ * [2] https://www.google.com/search?q=jh56t9l34kpo35tw8s28hn7s
70
+ * 9s2xvzla01d8cn6j7yq&rlz=1C1GCEU_enUS832US832&oq=jh56t9l34kpo
71
+ * 35tw8s28hn7s9s2xvzla01d8cn6j7yq&aqs=chrome.0.35i39l2j0l4j46j
72
+ * 69i60.2711j0j7&sourceid=chrome&ie=UTF-8
73
+ * [3] https://shopify.com
68
74
  *
69
75
  */
70
76
  export declare function renderInfo(options: RenderAlertOptions): string | undefined;
@@ -88,11 +94,11 @@ export declare function renderInfo(options: RenderAlertOptions): string | undefi
88
94
  * │ Partners Dashboard. │
89
95
  * │ │
90
96
  * │ Next steps │
91
- * │ • See your deployment and set it live ( https://part
92
- * │ ners.shopify.com/1797046/apps/4523695/deployments │
93
- * │ ) │
97
+ * │ • See your deployment and set it live [1]
94
98
  * │ │
95
99
  * ╰──────────────────────────────────────────────────────────╯
100
+ * [1] https://partners.shopify.com/1797046/apps/4523695/deploy
101
+ * ments
96
102
  *
97
103
  */
98
104
  export declare function renderSuccess(options: RenderAlertOptions): string | undefined;
@@ -118,9 +124,10 @@ export declare function renderSuccess(options: RenderAlertOptions): string | und
118
124
  * │ 1, 2022. │
119
125
  * │ │
120
126
  * │ Reference │
121
- * │ • Dev docs ( https://shopify.dev/app/scopes )
127
+ * │ • Dev docs [1]
122
128
  * │ │
123
129
  * ╰──────────────────────────────────────────────────────────╯
130
+ * [1] https://shopify.dev/app/scopes
124
131
  *
125
132
  */
126
133
  export declare function renderWarning(options: RenderAlertOptions): string | undefined;
@@ -148,14 +155,15 @@ interface RenderFatalErrorOptions {
148
155
  * │ No Organization found │
149
156
  * │ │
150
157
  * │ Next steps │
151
- * │ • Have you created a Shopify Partners organization (
152
- * │ https://partners.shopify.com/signup )?
158
+ * │ • Have you created a Shopify Partners organization
159
+ * │ [1]?
153
160
  * │ • Have you confirmed your accounts from the emails │
154
161
  * │ you received? │
155
162
  * │ • Need to connect to a different App or │
156
163
  * │ organization? Run the command again with `--reset` │
157
164
  * │ │
158
165
  * ╰──────────────────────────────────────────────────────────╯
166
+ * [1] https://partners.shopify.com/signup
159
167
  *
160
168
  */
161
169
  export declare function renderFatalError(error: Fatal, { renderOptions }?: RenderFatalErrorOptions): string | undefined;
@@ -272,7 +280,7 @@ interface RenderTasksOptions {
272
280
  * ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
273
281
  * Installing dependencies ...
274
282
  */
275
- export declare function renderTasks<TContext>(tasks: Task<TContext>[], { renderOptions }?: RenderTasksOptions): Promise<void>;
283
+ export declare function renderTasks<TContext>(tasks: Task<TContext>[], { renderOptions }?: RenderTasksOptions): Promise<TContext>;
276
284
  export interface RenderTextPromptOptions extends Omit<TextPromptProps, 'onSubmit'> {
277
285
  renderOptions?: RenderOptions;
278
286
  }