@shopify/cli-kit 3.30.2 → 3.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/environment/fqdn.d.ts +6 -0
- package/dist/environment/fqdn.js +13 -2
- package/dist/environment/fqdn.js.map +1 -1
- package/dist/file.js +2 -2
- package/dist/file.js.map +1 -1
- package/dist/path.d.ts +2 -4
- package/dist/path.js +4 -5
- package/dist/path.js.map +1 -1
- package/dist/private/node/ui/components/Alert.test.js +3 -3
- package/dist/private/node/ui/components/Alert.test.js.map +1 -1
- package/dist/private/node/ui/components/Banner.js +5 -21
- package/dist/private/node/ui/components/Banner.js.map +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.d.ts +0 -1
- package/dist/private/node/ui/components/ConcurrentOutput.js +6 -16
- package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.test.js +3 -2
- package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -1
- package/dist/private/node/ui/components/FatalError.js +2 -2
- package/dist/private/node/ui/components/FatalError.js.map +1 -1
- package/dist/private/node/ui/components/FatalError.test.js +10 -10
- package/dist/private/node/ui/components/FatalError.test.js.map +1 -1
- package/dist/private/node/ui/components/Link.js +1 -1
- package/dist/private/node/ui/components/Link.js.map +1 -1
- package/dist/private/node/ui/components/Link.test.js +1 -1
- package/dist/private/node/ui/components/Link.test.js.map +1 -1
- package/dist/private/node/ui/components/Prompt.js +1 -1
- package/dist/private/node/ui/components/Prompt.js.map +1 -1
- package/dist/private/node/ui/components/Prompt.test.js +4 -2
- package/dist/private/node/ui/components/Prompt.test.js.map +1 -1
- package/dist/private/node/ui/components/Tasks.d.ts +10 -0
- package/dist/private/node/ui/components/Tasks.js +27 -0
- package/dist/private/node/ui/components/Tasks.js.map +1 -0
- package/dist/private/node/ui/components/Tasks.test.d.ts +1 -0
- package/dist/private/node/ui/components/Tasks.test.js +50 -0
- package/dist/private/node/ui/components/Tasks.test.js.map +1 -0
- package/dist/private/node/ui/components/TextAnimation.d.ts +2 -4
- package/dist/private/node/ui/components/TextAnimation.js +24 -35
- package/dist/private/node/ui/components/TextAnimation.js.map +1 -1
- package/dist/private/node/ui/components/TokenizedText.test.js +1 -1
- package/dist/private/node/ui/components/TokenizedText.test.js.map +1 -1
- package/dist/private/node/ui/hooks/use-async-and-unmount.d.ts +6 -0
- package/dist/private/node/ui/hooks/use-async-and-unmount.js +17 -0
- package/dist/private/node/ui/hooks/use-async-and-unmount.js.map +1 -0
- package/dist/private/node/ui/hooks/use-layout.d.ts +3 -0
- package/dist/private/node/ui/hooks/use-layout.js +21 -0
- package/dist/private/node/ui/hooks/use-layout.js.map +1 -0
- package/dist/private/node/ui.d.ts +11 -0
- package/dist/private/node/ui.js +1 -1
- package/dist/private/node/ui.js.map +1 -1
- package/dist/public/node/ui.d.ts +5 -0
- package/dist/public/node/ui.js +7 -0
- package/dist/public/node/ui.js.map +1 -1
- package/dist/session.js +8 -5
- package/dist/session.js.map +1 -1
- package/dist/string.d.ts +0 -6
- package/dist/string.js +0 -11
- package/dist/string.js.map +1 -1
- package/dist/testing/ui.d.ts +1 -0
- package/dist/testing/ui.js +4 -0
- package/dist/testing/ui.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -5
|
@@ -21,3 +21,9 @@ export declare function identity(): Promise<string>;
|
|
|
21
21
|
export declare function shopify(options?: {
|
|
22
22
|
storeFqdn?: string;
|
|
23
23
|
}): Promise<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Given a store, returns a valid store fqdn removing protocol and adding the proper domain in case is missing
|
|
26
|
+
* @param store - Original store name provided by the user
|
|
27
|
+
* @returns a valid store fqdn
|
|
28
|
+
*/
|
|
29
|
+
export declare function normalizeStoreName(store: string): Promise<string>;
|
package/dist/environment/fqdn.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { fqdn as spinFqdn } from './spin.js';
|
|
2
|
-
import { serviceEnvironment } from './service.js';
|
|
1
|
+
import { fqdn, fqdn as spinFqdn } from './spin.js';
|
|
2
|
+
import { isSpinEnvironment, serviceEnvironment } from './service.js';
|
|
3
3
|
import { Abort } from '../error.js';
|
|
4
4
|
export const CouldntObtainPartnersSpinFQDNError = new Abort("Couldn't obtain the Spin FQDN for Partners when the CLI is not running from a Spin environment.");
|
|
5
5
|
export const CouldntObtainIdentitySpinFQDNError = new Abort("Couldn't obtain the Spin FQDN for Identity when the CLI is not running from a Spin environment.");
|
|
@@ -58,4 +58,15 @@ export async function shopify(options = {}) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Given a store, returns a valid store fqdn removing protocol and adding the proper domain in case is missing
|
|
63
|
+
* @param store - Original store name provided by the user
|
|
64
|
+
* @returns a valid store fqdn
|
|
65
|
+
*/
|
|
66
|
+
export async function normalizeStoreName(store) {
|
|
67
|
+
const storeFqdn = store.replace(/^https?:\/\//, '').replace(/\/$/, '');
|
|
68
|
+
const addDomain = async (storeFqdn) => isSpinEnvironment() ? `${storeFqdn}.shopify.${await fqdn()}` : `${storeFqdn}.myshopify.com`;
|
|
69
|
+
const containDomain = (storeFqdn) => storeFqdn.includes('.myshopify.com') || storeFqdn.includes('spin.dev');
|
|
70
|
+
return containDomain(storeFqdn) ? storeFqdn : addDomain(storeFqdn);
|
|
71
|
+
}
|
|
61
72
|
//# sourceMappingURL=fqdn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fqdn.js","sourceRoot":"","sources":["../../src/environment/fqdn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,IAAI,QAAQ,EAAC,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"fqdn.js","sourceRoot":"","sources":["../../src/environment/fqdn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,IAAI,IAAI,QAAQ,EAAC,MAAM,WAAW,C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CAAA;QAC/B,KAAK,MAAM;YACT,OAAO,YAAY,MAAM,QAAQ,EAAE,EAAE,CAAA;QACvC;YACE,IAAI,OAAO,CAAC,SAAS,EAAE;gBACrB,OAAO,OAAO,CAAC,SAAS,CAAA;aACzB;iBAAM;gBACL,MAAM,yBAAyB,CAAA;aAChC;KACJ;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,KAAa;IACpD,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IACtE,MAAM,SAAS,GAAG,KAAK,EAAE,SAAiB,EAAE,EAAE,CAC5C,iBAAiB,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,YAAY,MAAM,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,gBAAgB,CAAA;IAC7F,MAAM,aAAa,GAAG,CAAC,SAAiB,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;IACnH,OAAO,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;AACpE,CAAC","sourcesContent":["import {fqdn, fqdn as spinFqdn} from './spin.js'\nimport {isSpinEnvironment, serviceEnvironment} from './service.js'\nimport {Abort} from '../error.js'\n\nexport const CouldntObtainPartnersSpinFQDNError = new Abort(\n \"Couldn't obtain the Spin FQDN for Partners when the CLI is not running from a Spin environment.\",\n)\nexport const CouldntObtainIdentitySpinFQDNError = new Abort(\n \"Couldn't obtain the Spin FQDN for Identity when the CLI is not running from a Spin environment.\",\n)\nexport const CouldntObtainShopifySpinFQDNError = new Abort(\n \"Couldn't obtain the Spin FQDN for Shopify when the CLI is not running from a Spin environment.\",\n)\nexport const NotProvidedStoreFQDNError = new Abort(\n \"Couldn't obtain the Shopify FQDN because the store FQDN was not provided.\",\n)\n\n/**\n * It returns the Partners' API service we should interact with.\n * @returns Fully-qualified domain of the partners service we should interact with.\n */\nexport async function partners(): Promise<string> {\n const environment = serviceEnvironment()\n const productionFqdn = 'partners.shopify.com'\n switch (environment) {\n case 'local':\n return 'partners.myshopify.io'\n case 'spin':\n return `partners.${await spinFqdn()}`\n default:\n return productionFqdn\n }\n}\n\n/**\n * It returns the Identity service we should interact with.\n * @returns Fully-qualified domain of the Identity service we should interact with.\n */\nexport async function identity(): Promise<string> {\n const environment = serviceEnvironment()\n const productionFqdn = 'accounts.shopify.com'\n switch (environment) {\n case 'local':\n return 'identity.myshopify.io'\n case 'spin':\n return `identity.${await spinFqdn()}`\n default:\n return productionFqdn\n }\n}\n\n/**\n * It returns the Shopify service we should interact with.\n * Note the same fqdn is sued for the Admin and the Storefront Renderer APIs.\n * @returns Fully-qualified domain of the Shopify service we should interact with.\n */\nexport async function shopify(options: {storeFqdn?: string} = {}): Promise<string> {\n const environment = serviceEnvironment()\n switch (environment) {\n case 'local':\n return 'shopify.myshopify.io'\n case 'spin':\n return `identity.${await spinFqdn()}`\n default:\n if (options.storeFqdn) {\n return options.storeFqdn\n } else {\n throw NotProvidedStoreFQDNError\n }\n }\n}\n\n/**\n * Given a store, returns a valid store fqdn removing protocol and adding the proper domain in case is missing\n * @param store - Original store name provided by the user\n * @returns a valid store fqdn\n */\nexport async function normalizeStoreName(store: string) {\n const storeFqdn = store.replace(/^https?:\\/\\//, '').replace(/\\/$/, '')\n const addDomain = async (storeFqdn: string) =>\n isSpinEnvironment() ? `${storeFqdn}.shopify.${await fqdn()}` : `${storeFqdn}.myshopify.com`\n const containDomain = (storeFqdn: string) => storeFqdn.includes('.myshopify.com') || storeFqdn.includes('spin.dev')\n return containDomain(storeFqdn) ? storeFqdn : addDomain(storeFqdn)\n}\n"]}
|
package/dist/file.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { content as outputContent, token, debug } from './output.js';
|
|
2
2
|
import fs from 'fs-extra';
|
|
3
|
-
import del from 'del';
|
|
4
3
|
import { temporaryDirectoryTask } from 'tempy';
|
|
5
4
|
import { sep, join, extname } from 'pathe';
|
|
6
|
-
import prettier from 'prettier';
|
|
7
5
|
const DEFAULT_PRETTIER_CONFIG = {
|
|
8
6
|
arrowParens: 'always',
|
|
9
7
|
singleQuote: true,
|
|
@@ -102,6 +100,7 @@ export function removeSync(path) {
|
|
|
102
100
|
fs.removeSync(path);
|
|
103
101
|
}
|
|
104
102
|
export async function rmdir(path, { force } = {}) {
|
|
103
|
+
const { default: del } = await import('del');
|
|
105
104
|
debug(outputContent `Removing directory at ${token.path(path)}...`);
|
|
106
105
|
await del(path, { force });
|
|
107
106
|
}
|
|
@@ -199,6 +198,7 @@ export async function exists(path) {
|
|
|
199
198
|
* Format a string using prettier. Return the formatted content.
|
|
200
199
|
*/
|
|
201
200
|
export async function format(content, options) {
|
|
201
|
+
const { default: prettier } = await import('prettier');
|
|
202
202
|
const ext = extname(options.path);
|
|
203
203
|
const prettierConfig = {
|
|
204
204
|
...DEFAULT_PRETTIER_CONFIG,
|
package/dist/file.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,aAAa,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAClE,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,EAAC,sBAAsB,EAAC,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,OAAO,CAAA;AACxC,OAAO,QAAQ,MAAM,UAAU,CAAA;AAG/B,MAAM,uBAAuB,GAAY;IACvC,WAAW,EAAE,QAAQ;IACrB,WAAW,EAAE,IAAI;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AI;QACF,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAC9B,OAAO,IAAI,CAAA;QACX,qDAAqD;KACtD;IAAC,MAAM;QACN,OAAO,KAAK,CAAA;KACb;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAAe,EAAE,OAAuB;IACnE,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACjC,MAAM,cAAc,GAAY;QAC9B,GAAG,uBAAuB;QAC1B,MAAM,EAAE,OAAO;KAChB,CAAA;IAED,QAAQ,GAAG,EAAE;QACX,KAAK,OAAO,CAAC;QACb,KAAK,MAAM;YACT,cAAc,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;YACpC,MAAK;KACR;IAED,MAAM,gBAAgB,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;IAEvE,OAAO,gBAAgB,CAAA;AACzB,CAAC","sourcesContent":["import {content as outputContent, token, debug} from './output.js'\nimport fs from 'fs-extra'\nimport del from 'del'\nimport {temporaryDirectoryTask} from 'tempy'\nimport {sep, join, extname} from 'pathe'\nimport prettier from 'prettier'\nimport type {Options} from 'prettier'\n\nconst DEFAULT_PRETTIER_CONFIG: Options = {\n arrowParens: 'always',\n singleQuote: true,\n bracketSpacing: false,\n trailingComma: 'all',\n}\n\nexport function stripUp(path: string, strip: number) {\n const parts = path.split(sep)\n return join(...parts.slice(strip))\n}\n\n/**\n * Creates a temporary directory and ties its lifecycle to the lifecycle of the callback.\n * @param callback - The callback that receives the temporary directory.\n */\nexport async function inTemporaryDirectory<T>(callback: (tmpDir: string) => T | Promise<T>): Promise<T> {\n return temporaryDirectoryTask(callback)\n}\n\n/**\n * It reads a file and returns its content as a string using the\n * utf-8 encoding\n * @param path - Path to the file to read.\n * @returns A promise that resolves with the content of the file.\n */\nexport async function read(path: string, options: object = {encoding: 'utf-8'}): Promise<string> {\n debug(outputContent`Reading the content of file at ${token.path(path)}...`)\n const content = await fs.readFile(path, options)\n return content\n}\n\n/**\n * Given a path, it determines the actual path. This is useful when working\n * with paths that represent symlinks.\n * @param path - Path whose real path will be returned.\n */\nexport async function realpath(path: string): Promise<string> {\n return fs.promises.realpath(path)\n}\n\nexport function readSync(path: string, options: object = {encoding: 'utf-8'}): string {\n debug(outputContent`Sync-reading the content of file at ${token.path(path)}...`)\n const content = fs.readFileSync(path, options)\n return content.toString()\n}\n\n/**\n * Copies a file\n * @param from - Path to the directory or file to be copied.\n * @param to - Destination path.\n */\nexport async function copy(from: string, to: string): Promise<void> {\n debug(outputContent`Copying file from ${token.path(from)} to ${token.path(to)}...`)\n await fs.copy(from, to)\n}\n\nexport async function touch(path: string): Promise<void> {\n debug(outputContent`Creating an empty file at ${token.path(path)}...`)\n await fs.ensureFile(path)\n}\n\nexport async function appendFile(path: string, content: string): Promise<void> {\n debug(outputContent`Appending the following content to ${token.path(path)}:\n ${content\n .split('\\n')\n .map((line) => ` ${line}`)\n .join('\\n')}\n `)\n await fs.appendFile(path, content)\n}\n\nexport function touchSync(path: string) {\n debug(outputContent`Creating an empty file at ${token.path(path)}...`)\n fs.ensureFileSync(path)\n}\n\nexport async function write(path: string, data: string): Promise<void> {\n debug(outputContent`Writing some content to file at ${token.path(path)}...`)\n await fs.writeFile(path, data)\n}\n\nexport function writeSync(path: string, data: string): void {\n debug(outputContent`File-writing some content to file at ${token.path(path)}...`)\n fs.writeFileSync(path, data)\n}\n\nexport async function append(path: string, data: string): Promise<void> {\n await fs.appendFile(path, data)\n}\n\nexport function appendSync(path: string, data: string): void {\n fs.appendFileSync(path, data)\n}\n\nexport async function mkdir(path: string): Promise<void> {\n debug(outputContent`Creating directory at ${token.path(path)}...`)\n await fs.mkdirp(path)\n}\n\nexport function mkdirSync(path: string): void {\n debug(outputContent`Sync-creating directory at ${token.path(path)}...`)\n fs.mkdirpSync(path)\n}\n\nexport async function remove(path: string): Promise<void> {\n debug(outputContent`Removing file at ${token.path(path)}...`)\n await fs.remove(path)\n}\n\nexport function removeSync(path: string) {\n debug(outputContent`Sync-removing file at ${token.path(path)}...`)\n fs.removeSync(path)\n}\n\nexport async function rmdir(path: string, {force}: {force?: boolean} = {}): Promise<void> {\n debug(outputContent`Removing directory at ${token.path(path)}...`)\n await del(path, {force})\n}\n\nexport async function mkTmpDir(): Promise<string> {\n debug(outputContent`Creating a temporary directory...`)\n const directory = await fs.mkdtemp('tmp-')\n return directory\n}\n\nexport async function isDirectory(path: string): Promise<boolean> {\n debug(outputContent`Checking if ${token.path(path)} is a directory...`)\n return (await fs.promises.lstat(path)).isDirectory()\n}\n\nexport async function size(path: string): Promise<number> {\n debug(outputContent`Getting the size of file file at ${token.path(path)}...`)\n return (await fs.stat(path)).size\n}\n\nexport function sizeSync(path: string): number {\n debug(outputContent`Sync-getting the size of file file at ${token.path(path)}...`)\n return fs.statSync(path).size\n}\n\nexport function createReadStream(path: string) {\n return fs.createReadStream(path)\n}\n\n/**\n * Returns the Date object for the last modification of a file.\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function lastUpdated(path: string): Promise<Date> {\n debug(outputContent`Getting last updated timestamp for file at ${token.path(path)}...`)\n return (await fs.stat(path)).ctime\n}\n\n/**\n * Returns the unix timestamp of the last modification of a file.\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function lastUpdatedTimestamp(path: string): Promise<number | undefined> {\n try {\n const lastUpdatedDateTime = await lastUpdated(path)\n return lastUpdatedDateTime.getTime()\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return undefined\n }\n}\n\n/**\n * Moves a file.\n * @param src - File to be moved.\n * @param dest - Path to be moved to.\n * @param options - Moving options.\n */\nexport async function move(src: string, dest: string, options: {overwrite?: boolean} = {}): Promise<void> {\n await fs.move(src, dest, options)\n}\n\n/**\n * Changes the permissions of a directory or file.\n * @param path - Path to the file or directory whose permissions will be modified.\n * @param mode - Permissions to set to the file or directory.\n */\nexport async function chmod(path: string, mode: number | string): Promise<void> {\n await fs.promises.chmod(path, mode)\n}\n\n/**\n * Checks if a file has executable permissions.\n * @param path - Path to the file whose permissions will be checked.\n */\nexport async function hasExecutablePermissions(path: string): Promise<boolean> {\n try {\n await fs.promises.access(path, fs.constants.X_OK)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * Returns true if a file or directory exists\n * @param path - Path to the directory or file.\n * @returns True if it exists.\n */\nexport async function exists(path: string): Promise<boolean> {\n try {\n await fs.promises.access(path)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * Format a string using prettier. Return the formatted content.\n */\nexport async function format(content: string, options: {path: string}) {\n const ext = extname(options.path)\n const prettierConfig: Options = {\n ...DEFAULT_PRETTIER_CONFIG,\n parser: 'babel',\n }\n\n switch (ext) {\n case '.html':\n case '.css':\n prettierConfig.parser = ext.slice(1)\n break\n }\n\n const formattedContent = await prettier.format(content, prettierConfig)\n\n return formattedContent\n}\n"]}
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,aAAa,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAClE,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,EAAC,sBAAsB,EAAC,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,OAAO,CAAA;AAGxC,MAAM,uBAAuB,GAAY;IACvC,WAAW,EAAE,QAAQ;IACrB,WAAW,EAAE,IAAI;IACjB,cAAc,EAAE,KAAK;IACrB,aAAa,EAAE,KAAK;CACrB,CAAA;AAED,MAAM,UAAU,OAAO,CAAC,IAAY,EAAE,KAAa;IACjD,MAAM,KAAK,GAAG,IAAI,CAAC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,CAAC,CAAA;QAC9B,OAAO,IAAI,CAAA;QACX,qDAAqD;KACtD;IAAC,MAAM;QACN,OAAO,KAAK,CAAA;KACb;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAAe,EAAE,OAAuB;IACnE,MAAM,EAAC,OAAO,EAAE,QAAQ,EAAC,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,CAAA;IAEpD,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACjC,MAAM,cAAc,GAAY;QAC9B,GAAG,uBAAuB;QAC1B,MAAM,EAAE,OAAO;KAChB,CAAA;IAED,QAAQ,GAAG,EAAE;QACX,KAAK,OAAO,CAAC;QACb,KAAK,MAAM;YACT,cAAc,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;YACpC,MAAK;KACR;IAED,MAAM,gBAAgB,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;IAEvE,OAAO,gBAAgB,CAAA;AACzB,CAAC","sourcesContent":["import {content as outputContent, token, debug} from './output.js'\nimport fs from 'fs-extra'\nimport {temporaryDirectoryTask} from 'tempy'\nimport {sep, join, extname} from 'pathe'\nimport type {Options} from 'prettier'\n\nconst DEFAULT_PRETTIER_CONFIG: Options = {\n arrowParens: 'always',\n singleQuote: true,\n bracketSpacing: false,\n trailingComma: 'all',\n}\n\nexport function stripUp(path: string, strip: number) {\n const parts = path.split(sep)\n return join(...parts.slice(strip))\n}\n\n/**\n * Creates a temporary directory and ties its lifecycle to the lifecycle of the callback.\n * @param callback - The callback that receives the temporary directory.\n */\nexport async function inTemporaryDirectory<T>(callback: (tmpDir: string) => T | Promise<T>): Promise<T> {\n return temporaryDirectoryTask(callback)\n}\n\n/**\n * It reads a file and returns its content as a string using the\n * utf-8 encoding\n * @param path - Path to the file to read.\n * @returns A promise that resolves with the content of the file.\n */\nexport async function read(path: string, options: object = {encoding: 'utf-8'}): Promise<string> {\n debug(outputContent`Reading the content of file at ${token.path(path)}...`)\n const content = await fs.readFile(path, options)\n return content\n}\n\n/**\n * Given a path, it determines the actual path. This is useful when working\n * with paths that represent symlinks.\n * @param path - Path whose real path will be returned.\n */\nexport async function realpath(path: string): Promise<string> {\n return fs.promises.realpath(path)\n}\n\nexport function readSync(path: string, options: object = {encoding: 'utf-8'}): string {\n debug(outputContent`Sync-reading the content of file at ${token.path(path)}...`)\n const content = fs.readFileSync(path, options)\n return content.toString()\n}\n\n/**\n * Copies a file\n * @param from - Path to the directory or file to be copied.\n * @param to - Destination path.\n */\nexport async function copy(from: string, to: string): Promise<void> {\n debug(outputContent`Copying file from ${token.path(from)} to ${token.path(to)}...`)\n await fs.copy(from, to)\n}\n\nexport async function touch(path: string): Promise<void> {\n debug(outputContent`Creating an empty file at ${token.path(path)}...`)\n await fs.ensureFile(path)\n}\n\nexport async function appendFile(path: string, content: string): Promise<void> {\n debug(outputContent`Appending the following content to ${token.path(path)}:\n ${content\n .split('\\n')\n .map((line) => ` ${line}`)\n .join('\\n')}\n `)\n await fs.appendFile(path, content)\n}\n\nexport function touchSync(path: string) {\n debug(outputContent`Creating an empty file at ${token.path(path)}...`)\n fs.ensureFileSync(path)\n}\n\nexport async function write(path: string, data: string): Promise<void> {\n debug(outputContent`Writing some content to file at ${token.path(path)}...`)\n await fs.writeFile(path, data)\n}\n\nexport function writeSync(path: string, data: string): void {\n debug(outputContent`File-writing some content to file at ${token.path(path)}...`)\n fs.writeFileSync(path, data)\n}\n\nexport async function append(path: string, data: string): Promise<void> {\n await fs.appendFile(path, data)\n}\n\nexport function appendSync(path: string, data: string): void {\n fs.appendFileSync(path, data)\n}\n\nexport async function mkdir(path: string): Promise<void> {\n debug(outputContent`Creating directory at ${token.path(path)}...`)\n await fs.mkdirp(path)\n}\n\nexport function mkdirSync(path: string): void {\n debug(outputContent`Sync-creating directory at ${token.path(path)}...`)\n fs.mkdirpSync(path)\n}\n\nexport async function remove(path: string): Promise<void> {\n debug(outputContent`Removing file at ${token.path(path)}...`)\n await fs.remove(path)\n}\n\nexport function removeSync(path: string) {\n debug(outputContent`Sync-removing file at ${token.path(path)}...`)\n fs.removeSync(path)\n}\n\nexport async function rmdir(path: string, {force}: {force?: boolean} = {}): Promise<void> {\n const {default: del} = await import('del')\n debug(outputContent`Removing directory at ${token.path(path)}...`)\n await del(path, {force})\n}\n\nexport async function mkTmpDir(): Promise<string> {\n debug(outputContent`Creating a temporary directory...`)\n const directory = await fs.mkdtemp('tmp-')\n return directory\n}\n\nexport async function isDirectory(path: string): Promise<boolean> {\n debug(outputContent`Checking if ${token.path(path)} is a directory...`)\n return (await fs.promises.lstat(path)).isDirectory()\n}\n\nexport async function size(path: string): Promise<number> {\n debug(outputContent`Getting the size of file file at ${token.path(path)}...`)\n return (await fs.stat(path)).size\n}\n\nexport function sizeSync(path: string): number {\n debug(outputContent`Sync-getting the size of file file at ${token.path(path)}...`)\n return fs.statSync(path).size\n}\n\nexport function createReadStream(path: string) {\n return fs.createReadStream(path)\n}\n\n/**\n * Returns the Date object for the last modification of a file.\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function lastUpdated(path: string): Promise<Date> {\n debug(outputContent`Getting last updated timestamp for file at ${token.path(path)}...`)\n return (await fs.stat(path)).ctime\n}\n\n/**\n * Returns the unix timestamp of the last modification of a file.\n * @param path - Path to the directory or file.\n * @returns A unix timestamp.\n */\nexport async function lastUpdatedTimestamp(path: string): Promise<number | undefined> {\n try {\n const lastUpdatedDateTime = await lastUpdated(path)\n return lastUpdatedDateTime.getTime()\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return undefined\n }\n}\n\n/**\n * Moves a file.\n * @param src - File to be moved.\n * @param dest - Path to be moved to.\n * @param options - Moving options.\n */\nexport async function move(src: string, dest: string, options: {overwrite?: boolean} = {}): Promise<void> {\n await fs.move(src, dest, options)\n}\n\n/**\n * Changes the permissions of a directory or file.\n * @param path - Path to the file or directory whose permissions will be modified.\n * @param mode - Permissions to set to the file or directory.\n */\nexport async function chmod(path: string, mode: number | string): Promise<void> {\n await fs.promises.chmod(path, mode)\n}\n\n/**\n * Checks if a file has executable permissions.\n * @param path - Path to the file whose permissions will be checked.\n */\nexport async function hasExecutablePermissions(path: string): Promise<boolean> {\n try {\n await fs.promises.access(path, fs.constants.X_OK)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * Returns true if a file or directory exists\n * @param path - Path to the directory or file.\n * @returns True if it exists.\n */\nexport async function exists(path: string): Promise<boolean> {\n try {\n await fs.promises.access(path)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch {\n return false\n }\n}\n\n/**\n * Format a string using prettier. Return the formatted content.\n */\nexport async function format(content: string, options: {path: string}) {\n const {default: prettier} = await import('prettier')\n\n const ext = extname(options.path)\n const prettierConfig: Options = {\n ...DEFAULT_PRETTIER_CONFIG,\n parser: 'babel',\n }\n\n switch (ext) {\n case '.html':\n case '.css':\n prettierConfig.parser = ext.slice(1)\n break\n }\n\n const formattedContent = await prettier.format(content, prettierConfig)\n\n return formattedContent\n}\n"]}
|
package/dist/path.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { OverloadParameters } from './typing/overloaded-parameters.js';
|
|
2
2
|
import { relative, dirname, join, normalize, resolve, basename, extname, isAbsolute, parse } from 'pathe';
|
|
3
3
|
import { findUp as internalFindUp } from 'find-up';
|
|
4
|
-
import
|
|
4
|
+
import type { Pattern, Options } from 'fast-glob';
|
|
5
5
|
export { join, relative, dirname, normalize, resolve, basename, extname, isAbsolute, parse };
|
|
6
|
-
declare
|
|
7
|
-
declare type FastGlobOutput = ReturnType<typeof fastGlob>;
|
|
8
|
-
export declare function glob(...args: FastGlobOptions): FastGlobOutput;
|
|
6
|
+
export declare function glob(pattern: Pattern | Pattern[], options?: Options): Promise<string[]>;
|
|
9
7
|
export { pathToFileURL } from 'node:url';
|
|
10
8
|
export declare function findUp(matcher: OverloadParameters<typeof internalFindUp>[0], options: OverloadParameters<typeof internalFindUp>[1]): ReturnType<typeof internalFindUp>;
|
|
11
9
|
/**
|
package/dist/path.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import commondir from 'commondir';
|
|
2
2
|
import { relative, dirname, join, normalize, resolve, basename, extname, isAbsolute, parse } from 'pathe';
|
|
3
3
|
import { findUp as internalFindUp } from 'find-up';
|
|
4
|
-
import fastGlob from 'fast-glob';
|
|
5
4
|
import { fileURLToPath } from 'url';
|
|
6
5
|
export { join, relative, dirname, normalize, resolve, basename, extname, isAbsolute, parse };
|
|
7
|
-
export async function glob(
|
|
8
|
-
|
|
9
|
-
let
|
|
6
|
+
export async function glob(pattern, options) {
|
|
7
|
+
const { default: fastGlob } = await import('fast-glob');
|
|
8
|
+
let overridenOptions = options;
|
|
10
9
|
if (options?.dot == null) {
|
|
11
|
-
|
|
10
|
+
overridenOptions = { ...options, dot: true };
|
|
12
11
|
}
|
|
13
12
|
return fastGlob(pattern, options);
|
|
14
13
|
}
|
package/dist/path.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.js","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,OAAO,CAAA;AACvG,OAAO,EAAC,MAAM,IAAI,cAAc,
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,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AAkB,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,MAAM,CAAA;IACnG,IAAI,MAAM,KAAK,GAAG,IAAI,YAAY,KAAK,EAAE,IAAI,kBAAkB,GAAG,CAAC,EAAE;QACnE,OAAO,IAAI,CAAA;KACZ;SAAM;QACL,OAAO,YAAY,CAAA;KACpB;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,SAAuB;IACrD,OAAO,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAA;AAC1C,CAAC","sourcesContent":["import {OverloadParameters} from './typing/overloaded-parameters.js'\nimport commondir from 'commondir'\nimport {relative, dirname, join, normalize, resolve, basename, extname, isAbsolute, parse} from 'pathe'\nimport {findUp as internalFindUp} from 'find-up'\nimport {fileURLToPath} from 'url'\nimport type {Pattern, Options} from 'fast-glob'\n\nexport {join, relative, dirname, normalize, resolve, basename, extname, isAbsolute, parse}\n\nexport async function glob(pattern: Pattern | Pattern[], options?: Options): Promise<string[]> {\n const {default: fastGlob} = await import('fast-glob')\n let overridenOptions = options\n if (options?.dot == null) {\n overridenOptions = {...options, dot: true}\n }\n return fastGlob(pattern, options)\n}\nexport {pathToFileURL} from 'node:url'\n\nexport async function findUp(\n matcher: OverloadParameters<typeof internalFindUp>[0],\n options: OverloadParameters<typeof internalFindUp>[1],\n): ReturnType<typeof internalFindUp> {\n // findUp has odd typing\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const got = await internalFindUp(matcher as any, options)\n return got ? normalize(got) : undefined\n}\n\n/**\n * Given an absolute filesystem path, it makes it relative to\n * the current working directory. This is useful when logging paths\n * to allow the users to click on the file and let the OS open it\n * in the editor of choice.\n * @param path - Path to relativize\n * @returns Relativized path.\n */\nexport function relativize(path: string): string {\n const result = commondir([path, process.cwd()])\n const relativePath = relative(process.cwd(), path)\n const relativeComponents = relativePath.split('/').filter((component) => component === '..').length\n if (result === '/' || relativePath === '' || relativeComponents > 2) {\n return path\n } else {\n return relativePath\n }\n}\n\n/**\n * Given a module's import.meta.url it returns the directory containing the module.\n * @param moduleURL - The value of import.meta.url in the context of the caller module.\n * @returns The path to the directory containing the caller module.\n */\nexport function moduleDirectory(moduleURL: string | URL): string {\n return dirname(fileURLToPath(moduleURL))\n}\n"]}
|
|
@@ -67,10 +67,10 @@ describe('Alert', async () => {
|
|
|
67
67
|
│ │
|
|
68
68
|
│ Reference │
|
|
69
69
|
│ • Run \`npm shopify help\` │
|
|
70
|
-
│ • Press 'return' to open the really amazing and clean dev docs
|
|
71
|
-
│
|
|
70
|
+
│ • Press 'return' to open the really amazing and clean dev docs ( │
|
|
71
|
+
│ https://shopify.dev ) │
|
|
72
72
|
│ │
|
|
73
|
-
│ Link (https://shopify.com)
|
|
73
|
+
│ Link ( https://shopify.com ) │
|
|
74
74
|
│ │
|
|
75
75
|
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
76
76
|
"
|
|
@@ -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,YAAY,EAAC,MAAM,aAAa,CAAA;AACxC,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,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;YACp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CAAC,CAAA","sourcesContent":["import {Alert} from './Alert.js'\nimport {renderString} from '../../ui.js'\nimport {unstyled} from '../../../../output.js'\nimport {describe, expect, test} from 'vitest'\nimport React from 'react'\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 }\n\n const {output} = renderString(<Alert type=\"info\" {...options} />)\n\n expect(unstyled(output!)).toMatchInlineSnapshot(`\n \"\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
|
+
{"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,YAAY,EAAC,MAAM,aAAa,CAAA;AACxC,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,I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AAE,OAAO;SAClB,CAAA;QAED,MAAM,EAAC,MAAM,EAAC,GAAG,YAAY,CAAC,oBAAC,KAAK,IAAC,IAAI,EAAC,MAAM,KAAK,OAAO,GAAI,CAAC,CAAA;QAEjE,MAAM,CAAC,QAAQ,CAAC,MAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;KAQ/C,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {Alert} from './Alert.js'\nimport {renderString} from '../../ui.js'\nimport {unstyled} from '../../../../output.js'\nimport {describe, expect, test} from 'vitest'\nimport React from 'react'\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 }\n\n const {output} = renderString(<Alert type=\"info\" {...options} />)\n\n expect(unstyled(output!)).toMatchInlineSnapshot(`\n \"\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 ╰──────────────────────────────────────────────────────────────────────────────╯\n \"\n `)\n })\n\n test('renders correctly with only required options', async () => {\n const options = {\n headline: 'Title',\n }\n\n const {output} = renderString(<Alert type=\"info\" {...options} />)\n\n expect(unstyled(output!)).toMatchInlineSnapshot(`\n \"\n ╭─ info ───────────────────────────────────────────────────────────────────────╮\n │ │\n │ Title │\n │ │\n ╰──────────────────────────────────────────────────────────────────────────────╯\n \"\n `)\n })\n})\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import useLayout from '../hooks/use-layout.js';
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
function typeToColor(type) {
|
|
4
5
|
return {
|
|
@@ -9,32 +10,15 @@ function typeToColor(type) {
|
|
|
9
10
|
external_error: 'red',
|
|
10
11
|
}[type];
|
|
11
12
|
}
|
|
12
|
-
const BANNER_MIN_WIDTH = 80;
|
|
13
|
-
function calculateWidth(stdout) {
|
|
14
|
-
const fullWidth = stdout?.columns ?? BANNER_MIN_WIDTH;
|
|
15
|
-
const twoThirdsOfWidth = Math.floor((fullWidth / 3) * 2);
|
|
16
|
-
let width;
|
|
17
|
-
if (fullWidth <= BANNER_MIN_WIDTH) {
|
|
18
|
-
width = fullWidth;
|
|
19
|
-
}
|
|
20
|
-
else if (twoThirdsOfWidth < BANNER_MIN_WIDTH) {
|
|
21
|
-
width = BANNER_MIN_WIDTH;
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
width = twoThirdsOfWidth;
|
|
25
|
-
}
|
|
26
|
-
return width;
|
|
27
|
-
}
|
|
28
13
|
const BoxWithBorder = ({ type, marginY, children }) => {
|
|
29
|
-
const {
|
|
30
|
-
return (React.createElement(Box, { width:
|
|
14
|
+
const { width } = useLayout();
|
|
15
|
+
return (React.createElement(Box, { width: width, paddingY: 1, paddingX: 2, marginY: marginY, borderStyle: "round", flexDirection: "column", borderColor: typeToColor(type) },
|
|
31
16
|
React.createElement(Box, { marginTop: -2, marginBottom: 1, marginLeft: -1 },
|
|
32
17
|
React.createElement(Text, null, ` ${type.replace(/_/g, ' ')} `)),
|
|
33
18
|
children));
|
|
34
19
|
};
|
|
35
20
|
const BoxWithTopBottomLines = ({ type, marginY, children }) => {
|
|
36
|
-
const {
|
|
37
|
-
const width = calculateWidth(stdout);
|
|
21
|
+
const { width } = useLayout();
|
|
38
22
|
return (React.createElement(Box, { marginY: marginY, flexDirection: "column" },
|
|
39
23
|
React.createElement(Box, { marginBottom: 1 },
|
|
40
24
|
React.createElement(Text, null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Banner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,IAAI,
|
|
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,KAAK,MAAM,OAAO,CAAA;AASzB,SAAS,WAAW,CAAC,IAAmB;IACtC,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,GAAoB,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAC,EAAE,EAAE;IACnE,MAAM,EAAC,KAAK,EAAC,GAAG,SAAS,EAAE,CAAA;IAE3B,OAAO,CACL,oBAAC,GAAG,IACF,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE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GAAoB,CAAC,EAAC,QAAQ,EAAE,GAAG,KAAK,EAAC,EAAE,EAAE;IACvD,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 from 'react'\n\nexport type BannerType = 'success' | 'error' | 'warning' | 'info' | 'external_error'\n\ninterface Props {\n type: BannerType\n marginY?: number\n}\n\nfunction typeToColor(type: Props['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: React.FC<Props> = ({type, marginY, children}) => {\n const {width} = useLayout()\n\n return (\n <Box\n width={width}\n paddingY={1}\n paddingX={2}\n marginY={marginY}\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: React.FC<Props> = ({type, marginY, children}) => {\n const {width} = useLayout()\n\n return (\n <Box marginY={marginY} flexDirection=\"column\">\n <Box marginBottom={1}>\n <Text>\n <Text color={typeToColor(type)}>{'─'.repeat(2)}</Text>\n <Text>{` ${type.replace(/_/g, ' ')} `}</Text>\n {/* 2 initial dashes + 2 spaces surrounding the type */}\n <Text color={typeToColor(type)}>{'─'.repeat(width - 2 - type.length - 2)}</Text>\n </Text>\n </Box>\n\n {children}\n\n <Box marginTop={1}>\n <Text color={typeToColor(type)}>{'─'.repeat(width)}</Text>\n </Box>\n </Box>\n )\n}\n\nconst Banner: React.FC<Props> = ({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"]}
|
|
@@ -4,7 +4,6 @@ import { FunctionComponent } from 'react';
|
|
|
4
4
|
import AbortController from 'abort-controller';
|
|
5
5
|
import { Writable } from 'node:stream';
|
|
6
6
|
export declare type WritableStream = (process: OutputProcess, index: number) => Writable;
|
|
7
|
-
export declare type RunProcesses = (writableStream: WritableStream, unmountInk: (error?: Error | undefined) => void) => Promise<void>;
|
|
8
7
|
interface Props {
|
|
9
8
|
processes: OutputProcess[];
|
|
10
9
|
abortController: AbortController;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, {
|
|
3
|
-
import { Box, Static, Text
|
|
1
|
+
import useAsyncAndUnmount from '../hooks/use-async-and-unmount.js';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { Box, Static, Text } from 'ink';
|
|
4
4
|
import stripAnsi from 'strip-ansi';
|
|
5
5
|
import { Writable } from 'node:stream';
|
|
6
6
|
/**
|
|
@@ -41,7 +41,6 @@ const ConcurrentOutput = ({ processes, abortController, showTimestamps = true })
|
|
|
41
41
|
const [processOutput, setProcessOutput] = useState([]);
|
|
42
42
|
const concurrentColors = ['yellow', 'cyan', 'magenta', 'green', 'blue'];
|
|
43
43
|
const prefixColumnSize = Math.max(...processes.map((process) => process.prefix.length));
|
|
44
|
-
const { exit: unmountInk } = useApp();
|
|
45
44
|
function lineColor(index) {
|
|
46
45
|
const colorIndex = index < concurrentColors.length ? index : index % concurrentColors.length;
|
|
47
46
|
return concurrentColors[colorIndex];
|
|
@@ -62,23 +61,14 @@ const ConcurrentOutput = ({ processes, abortController, showTimestamps = true })
|
|
|
62
61
|
},
|
|
63
62
|
});
|
|
64
63
|
};
|
|
65
|
-
const runProcesses =
|
|
66
|
-
|
|
64
|
+
const runProcesses = () => {
|
|
65
|
+
return Promise.all(processes.map(async (process, index) => {
|
|
67
66
|
const stdout = writableStream(process, index);
|
|
68
67
|
const stderr = writableStream(process, index);
|
|
69
68
|
await process.action(stdout, stderr, abortController.signal);
|
|
70
69
|
}));
|
|
71
|
-
// This is a workaround needed because Ink behaves differently in CI when
|
|
72
|
-
// unmounting. See https://github.com/vadimdemedes/ink/pull/266
|
|
73
|
-
if (!isTruthy(process.env.CI))
|
|
74
|
-
unmountInk();
|
|
75
70
|
};
|
|
76
|
-
|
|
77
|
-
runProcesses().catch((error) => {
|
|
78
|
-
abortController.abort();
|
|
79
|
-
unmountInk(error);
|
|
80
|
-
});
|
|
81
|
-
}, []);
|
|
71
|
+
useAsyncAndUnmount(runProcesses, { onRejected: () => abortController.abort() });
|
|
82
72
|
return (React.createElement(Static, { items: processOutput }, (chunk, index) => {
|
|
83
73
|
return (React.createElement(Box, { flexDirection: "column", key: index }, chunk.lines.map((line, index) => (React.createElement(Box, { key: index, flexDirection: "row" },
|
|
84
74
|
showTimestamps && (React.createElement(Box, null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConcurrentOutput.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/ConcurrentOutput.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"ConcurrentOutput.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/ConcurrentOutput.tsx"],"names":[],"mappings":"AACA,OAAO,kBAAkB,MAAM,mCAAmC,CAAA;AAClE,OAAO,KAAK,EAAE,EAAoB,QAAQ,EAAC,MAAM,OAAO,CAAA;AACxD,OAAO,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AACrC,OAAO,SAAS,MAAM,YAAY,CAAA;AAElC,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAA;AAepC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MA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AAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC;gBACtC,oBAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,IAAG,KAAK,CAAC,MAAM,CAAQ,CAC3C;YAEN,oBAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAE,KAAK,CAAC,KAAK,QAEtB;YAEP,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC;gBAC9B,oBAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,IAAG,IAAI,CAAQ,CACnC,CACF,CACP,CAAC,CACE,CACP,CAAA;IACH,CAAC,CACM,CACV,CAAA;AACH,CAAC,CAAA;AAED,eAAe,gBAAgB,CAAA","sourcesContent":["import {OutputProcess} from '../../../../output.js'\nimport useAsyncAndUnmount from '../hooks/use-async-and-unmount.js'\nimport React, {FunctionComponent, useState} from 'react'\nimport {Box, Static, Text} from 'ink'\nimport stripAnsi from 'strip-ansi'\nimport AbortController from 'abort-controller'\nimport {Writable} from 'node:stream'\n\nexport type WritableStream = (process: OutputProcess, index: number) => Writable\n\ninterface Props {\n processes: OutputProcess[]\n abortController: AbortController\n showTimestamps?: boolean\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 | [nodemon] 2.0.19\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<Props> = ({processes, abortController, showTimestamps = true}) => {\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('ascii').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 useAsyncAndUnmount(runProcesses, {onRejected: () => abortController.abort()})\n\n return (\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}>{new Date().toISOString().replace(/T/, ' ').replace(/\\..+/, '')}</Text>\n </Box>\n\n <Text bold color={chunk.color}>\n |\n </Text>\n </Box>\n )}\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 )\n}\n\nexport default ConcurrentOutput\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import ConcurrentOutput from './ConcurrentOutput.js';
|
|
2
2
|
import { unstyled } from '../../../../output.js';
|
|
3
|
+
import { getLastFrame } from '../../../../testing/ui.js';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { describe, expect, test } from 'vitest';
|
|
5
6
|
import { AbortController } from 'abort-controller';
|
|
@@ -35,11 +36,11 @@ describe('ConcurrentOutput', () => {
|
|
|
35
36
|
},
|
|
36
37
|
};
|
|
37
38
|
// When
|
|
38
|
-
const
|
|
39
|
+
const renderInstance = render(React.createElement(ConcurrentOutput, { processes: [backendProcess, frontendProcess], abortController: new AbortController() }));
|
|
39
40
|
// wait for all output to be rendered
|
|
40
41
|
await frontendPromise;
|
|
41
42
|
// Then
|
|
42
|
-
expect(unstyled(
|
|
43
|
+
expect(unstyled(getLastFrame(renderInstance)).replace(/\d/g, '0')).toMatchInlineSnapshot(`
|
|
43
44
|
"0000-00-00 00:00:00 | backend | first backend message
|
|
44
45
|
0000-00-00 00:00:00 | backend | second backend message
|
|
45
46
|
0000-00-00 00:00:00 | backend | third backend message
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConcurrentOutput.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/ConcurrentOutput.test.tsx"],"names":[],"mappings":"AAAA,O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,CAAA;gBACtC,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAA;gBACvC,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAA;gBAEtC,sBAAsB,EAAE,CAAA;YAC1B,CAAC;SACF,CAAA;QACD,OAAO;QAEP,MAAM,
|
|
1
|
+
{"version":3,"file":"ConcurrentOutput.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/ConcurrentOutput.test.tsx"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,uBAAuB,CAAA;AAEpD,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAC,YAAY,EAAC,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAA;AAChD,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,OAAO,CAAO,UAAU,OAAO,EAAE,OAAO;YACjE,qBAAqB,GAAG,OAAO,CAAA;QACjC,CAAC,CAAC,CAAA;QAEF,MAAM,eAAe,GAAG,IAAI,OAAO,CAAO,UAAU,OAAO,EAAE,OAAO;YAClE,sBAAsB,GAAG,OAAO,CAAA;QAClC,CAAC,CAAC,CAAA;QAEF,MAAM,cAAc,GAAG;YACrB,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,KAAK,EAAE,MAAgB,EAAE,OAAiB,EAAE,OAAe,EAAE,EAAE;gBACrE,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAA;gBACrC,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAA;gBACtC,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAA;gBAErC,qBAAqB,EAAE,CAAA;YACzB,CAAC;SACF,CAAA;QAED,MAAM,eAAe,GAAG;YACtB,MAAM,EAAE,UAAU;YAClB,MAAM,EAAE,KAAK,EAAE,MAAgB,EAAE,OAAiB,EAAE,OAAe,EAAE,EAAE;gBACrE,MAAM,cAAc,CAAA;gBAEpB,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAA;gBACtC,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAA;gBACvC,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAA;gBAEtC,sBAAsB,EAAE,CAAA;YAC1B,CAAC;SACF,CAAA;QACD,OAAO;QAEP,MAAM,cAAc,GAAG,MAAM,CAC3B,oBAAC,gBAAgB,IAAC,SAAS,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC,EAAE,eAAe,EAAE,IAAI,eAAe,EAAE,GAAI,CAC3G,CAAA;QAED,qCAAqC;QACrC,MAAM,eAAe,CAAA;QAErB,OAAO;QACP,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,cAAc,CAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;KAQzF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import ConcurrentOutput from './ConcurrentOutput.js'\nimport {Signal} from '../../../../abort.js'\nimport {unstyled} from '../../../../output.js'\nimport {getLastFrame} from '../../../../testing/ui.js'\nimport React from 'react'\nimport {describe, expect, test} from 'vitest'\nimport {AbortController} from 'abort-controller'\nimport {render} from 'ink-testing-library'\nimport {Writable} from 'node: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: Signal) => {\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: Signal) => {\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 processes={[backendProcess, frontendProcess]} abortController={new AbortController()} />,\n )\n\n // wait for all output to be rendered\n await frontendPromise\n\n // Then\n expect(unstyled(getLastFrame(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 `)\n })\n})\n"]}
|
|
@@ -42,12 +42,12 @@ const FatalError = ({ error }) => {
|
|
|
42
42
|
React.createElement(List, { title: "Next steps", items: error.nextSteps }))),
|
|
43
43
|
stack && stack.items.length !== 0 && (React.createElement(Box, { marginTop: 1, flexDirection: "column" },
|
|
44
44
|
React.createElement(Text, null, "To investigate the issue, examine this stack trace:"),
|
|
45
|
-
stack.items.map((item, index) => (React.createElement(Box, { flexDirection: "column", key: index },
|
|
45
|
+
stack.items.map((item, index) => (React.createElement(Box, { flexDirection: "column", key: index, paddingLeft: 2 },
|
|
46
46
|
React.createElement(Text, null,
|
|
47
47
|
"at",
|
|
48
48
|
item.calleeShort && React.createElement(Text, { color: "yellow" }, ` ${item.calleeShort}`),
|
|
49
49
|
item.fileShort && ` (${item.fileShort}:${item.line})`),
|
|
50
|
-
React.createElement(Box, { paddingLeft:
|
|
50
|
+
React.createElement(Box, { paddingLeft: 2 },
|
|
51
51
|
React.createElement(Text, { dimColor: true }, item.sourceLine?.trim())))))))));
|
|
52
52
|
};
|
|
53
53
|
export { FatalError };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FatalError.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/FatalError.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAClC,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAA;AACpC,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAC,GAAG,EAAE,yBAAyB,EAAE,aAAa,EAAQ,MAAM,sBAAsB,CAAA;AACzF,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,WAAW,MAAM,aAAa,CAAA;AAMrC,MAAM,UAAU,GAA8B,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE;IACxD,IAAI,KAAK,CAAA;IACT,IAAI,IAAI,CAAA;IAER,IAAI,KAAK,YAAY,GAAG,EAAE;QACxB,KAAK,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,CAAA;QAC9B,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAC3B,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAClD,CAAC,CAAC,CAAA;QAEF,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAA;QAC3B,KAAK,GAAG,KAAK;aACV,MAAM,CAAC,CAAC,KAA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C,SAAS,EAAE,CAAC;YACf,oBAAC,IAAI,IAAC,KAAK,EAAC,YAAY,EAAC,KAAK,EAAE,KAAK,CAAC,SAAS,GAAI,CAC/C,CACP;QAEA,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CACpC,oBAAC,GAAG,IAAC,SAAS,EAAE,CAAC,EAAE,aAAa,EAAC,QAAQ;YACvC,oBAAC,IAAI,8DAA2D;YAC/D,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAChC,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;gBACpD,oBAAC,IAAI;;oBACA,IAAI,CAAC,WAAW,IAAI,oBAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,IAAE,IAAI,IAAI,CAAC,WAAW,EAAE,CAAQ;oBAC1E,IAAI,CAAC,SAAS,IAAI,KAAK,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,GAAG,CACjD;gBACP,oBAAC,GAAG,IAAC,WAAW,EAAE,CAAC;oBACjB,oBAAC,IAAI,IAAC,QAAQ,UAAE,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,CAAQ,CAC3C,CACF,CACP,CAAC,CACE,CACP,CACM,CACV,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAC,UAAU,EAAC,CAAA","sourcesContent":["import {Banner} from './Banner.js'\nimport {TokenizedText} from './TokenizedText.js'\nimport {Command} from './Command.js'\nimport {List} from './List.js'\nimport {Bug, cleanSingleStackTracePath, ExternalError, Fatal} from '../../../../error.js'\nimport {Box, Text} from 'ink'\nimport React from 'react'\nimport StackTracey from 'stacktracey'\n\nexport interface FatalErrorProps {\n error: Fatal\n}\n\nconst FatalError: React.FC<FatalErrorProps> = ({error}) => {\n let stack\n let tool\n\n if (error instanceof Bug) {\n stack = new StackTracey(error)\n stack.items.forEach((item) => {\n item.file = cleanSingleStackTracePath(item.file)\n })\n\n stack = stack.withSources()\n stack = stack\n .filter((entry) => {\n return !entry.file.includes('@oclif/core')\n })\n .map((item) => {\n /** We make the paths relative to the packages/ directory */\n const fileShortComponents = item.fileShort.split('packages/')\n item.fileShort = fileShortComponents.length === 2 ? fileShortComponents[1]! : fileShortComponents[0]!\n return item\n })\n }\n\n if (error instanceof ExternalError) {\n tool = `${error.command} ${error.args.join(' ')}`\n }\n\n return (\n <Banner type={tool ? 'external_error' : 'error'} marginY={1}>\n {tool && (\n <Box marginBottom={1}>\n <Text>\n Error coming from <Command command={tool} />\n </Text>\n </Box>\n )}\n\n <Box>\n <Text>{error.message}</Text>\n </Box>\n\n {error.tryMessage && (\n <Box marginTop={1}>\n <TokenizedText item={error.tryMessage} />\n </Box>\n )}\n\n {error.nextSteps && (\n <Box marginTop={1}>\n <List title=\"Next steps\" items={error.nextSteps} />\n </Box>\n )}\n\n {stack && stack.items.length !== 0 && (\n <Box marginTop={1} flexDirection=\"column\">\n <Text>To investigate the issue, examine this stack trace:</Text>\n {stack.items.map((item, index) => (\n <Box flexDirection=\"column\" key={index} paddingLeft={2}>\n <Text>\n at{item.calleeShort && <Text color=\"yellow\">{` ${item.calleeShort}`}</Text>}\n {item.fileShort && ` (${item.fileShort}:${item.line})`}\n </Text>\n <Box paddingLeft={2}>\n <Text dimColor>{item.sourceLine?.trim()}</Text>\n </Box>\n </Box>\n ))}\n </Box>\n )}\n </Banner>\n )\n}\n\nexport {FatalError}\n"]}
|
|
@@ -37,10 +37,10 @@ describe('FatalError', async () => {
|
|
|
37
37
|
│ Unexpected error │
|
|
38
38
|
│ │
|
|
39
39
|
│ To investigate the issue, examine this stack trace: │
|
|
40
|
-
│
|
|
41
|
-
│
|
|
42
|
-
│
|
|
43
|
-
│
|
|
40
|
+
│ at _compile (internal/modules/cjs/loader.js:1137) │
|
|
41
|
+
│ at js (internal/modules/cjs/loader.js:1157) │
|
|
42
|
+
│ at load (internal/modules/cjs/loader.js:985) │
|
|
43
|
+
│ at _load (internal/modules/cjs/loader.js:878) │
|
|
44
44
|
│ │
|
|
45
45
|
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
46
46
|
"
|
|
@@ -84,17 +84,17 @@ describe('FatalError', async () => {
|
|
|
84
84
|
│ Unexpected error │
|
|
85
85
|
│ │
|
|
86
86
|
│ Next steps │
|
|
87
|
-
│ • Have you created a Shopify Partners organization
|
|
88
|
-
│
|
|
87
|
+
│ • Have you created a Shopify Partners organization ( │
|
|
88
|
+
│ https://partners.shopify.com/signup )? │
|
|
89
89
|
│ • Have you confirmed your accounts from the emails you received? │
|
|
90
90
|
│ • Need to connect to a different App or organization? Run the command │
|
|
91
91
|
│ again with \`--reset\` │
|
|
92
92
|
│ │
|
|
93
93
|
│ To investigate the issue, examine this stack trace: │
|
|
94
|
-
│
|
|
95
|
-
│
|
|
96
|
-
│
|
|
97
|
-
│
|
|
94
|
+
│ at _compile (internal/modules/cjs/loader.js:1137) │
|
|
95
|
+
│ at js (internal/modules/cjs/loader.js:1157) │
|
|
96
|
+
│ at load (internal/modules/cjs/loader.js:985) │
|
|
97
|
+
│ at _load (internal/modules/cjs/loader.js:878) │
|
|
98
98
|
│ │
|
|
99
99
|
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
100
100
|
"
|