@shopify/cli-kit 3.37.0 → 3.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/private/common/json.d.ts +2 -2
- package/dist/private/common/lodash.d.ts +4 -4
- package/dist/private/common/ts/overloaded-parameters.d.ts +5 -5
- package/dist/private/node/api/graphql.js +7 -7
- package/dist/private/node/api/graphql.js.map +1 -1
- package/dist/private/node/api/headers.d.ts +1 -1
- package/dist/private/node/api.d.ts +2 -0
- package/dist/{network → private/node}/api.js +0 -0
- package/dist/private/node/api.js.map +1 -0
- package/dist/private/node/conf-store.js +4 -4
- package/dist/private/node/conf-store.js.map +1 -1
- package/dist/private/node/constants.d.ts +2 -2
- package/dist/{content-tokens.d.ts → private/node/content-tokens.d.ts} +11 -11
- package/dist/{content-tokens.js → private/node/content-tokens.js} +3 -3
- package/dist/private/node/content-tokens.js.map +1 -0
- package/dist/private/node/environment/service.d.ts +1 -1
- package/dist/private/node/error-handler.d.ts +2 -0
- package/dist/private/node/error-handler.js +5 -0
- package/dist/private/node/error-handler.js.map +1 -0
- package/dist/private/node/secure-store.js +4 -4
- package/dist/private/node/secure-store.js.map +1 -1
- package/dist/private/node/session/authorize.js +3 -3
- package/dist/private/node/session/authorize.js.map +1 -1
- package/dist/private/node/session/device-authorization.js +6 -6
- package/dist/private/node/session/device-authorization.js.map +1 -1
- package/dist/private/node/session/exchange.d.ts +1 -1
- package/dist/private/node/session/exchange.js.map +1 -1
- package/dist/private/node/session/identity-token-validation.js +5 -5
- package/dist/private/node/session/identity-token-validation.js.map +1 -1
- package/dist/private/node/session/identity.d.ts +1 -1
- package/dist/private/node/session/identity.js.map +1 -1
- package/dist/private/node/session/redirect-listener.d.ts +1 -1
- package/dist/private/node/session/redirect-listener.js +7 -7
- package/dist/private/node/session/redirect-listener.js.map +1 -1
- package/dist/private/node/session/schema.d.ts +3 -3
- package/dist/private/node/session/scopes.d.ts +1 -1
- package/dist/private/node/session/scopes.js +1 -1
- package/dist/private/node/session/scopes.js.map +1 -1
- package/dist/private/node/session/store.js +4 -4
- package/dist/private/node/session/store.js.map +1 -1
- package/dist/private/node/session/validate.d.ts +1 -1
- package/dist/private/node/session/validate.js +2 -2
- package/dist/private/node/session/validate.js.map +1 -1
- package/dist/private/node/session.d.ts +4 -4
- package/dist/private/node/session.js +19 -19
- package/dist/private/node/session.js.map +1 -1
- package/dist/private/node/ui/alert.js +1 -1
- package/dist/private/node/ui/alert.js.map +1 -1
- package/dist/private/node/ui/components/Alert.test.js +1 -1
- package/dist/private/node/ui/components/Alert.test.js.map +1 -1
- package/dist/private/node/ui/components/AutocompletePrompt.d.ts +9 -2
- package/dist/private/node/ui/components/AutocompletePrompt.js +8 -4
- package/dist/private/node/ui/components/AutocompletePrompt.js.map +1 -1
- package/dist/private/node/ui/components/AutocompletePrompt.test.js +62 -8
- package/dist/private/node/ui/components/AutocompletePrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/Banner.d.ts +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.d.ts +3 -3
- package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.test.js +1 -1
- package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -1
- package/dist/private/node/ui/components/FatalError.test.js +1 -1
- package/dist/private/node/ui/components/FatalError.test.js.map +1 -1
- package/dist/private/node/ui/components/List.test.js +1 -1
- package/dist/private/node/ui/components/List.test.js.map +1 -1
- package/dist/private/node/ui/components/SelectInput.d.ts +3 -1
- package/dist/private/node/ui/components/SelectInput.js +8 -2
- package/dist/private/node/ui/components/SelectInput.js.map +1 -1
- package/dist/private/node/ui/components/SelectInput.test.js +26 -0
- package/dist/private/node/ui/components/SelectInput.test.js.map +1 -1
- package/dist/private/node/ui/components/SelectPrompt.test.js +1 -1
- package/dist/private/node/ui/components/SelectPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/Table/Row.d.ts +1 -1
- package/dist/private/node/ui/components/Table/ScalarDict.d.ts +1 -1
- package/dist/private/node/ui/components/Table/Table.d.ts +1 -1
- package/dist/private/node/ui/components/Tasks.d.ts +5 -1
- package/dist/private/node/ui/components/Tasks.js +31 -6
- package/dist/private/node/ui/components/Tasks.js.map +1 -1
- package/dist/private/node/ui/components/Tasks.test.js +260 -20
- package/dist/private/node/ui/components/Tasks.test.js.map +1 -1
- package/dist/private/node/ui/components/TextPrompt.test.js +1 -1
- package/dist/private/node/ui/components/TextPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/TokenizedText.d.ts +2 -2
- 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.d.ts +2 -2
- package/dist/private/node/ui.js +1 -1
- package/dist/private/node/ui.js.map +1 -1
- package/dist/public/common/string.d.ts +1 -1
- package/dist/public/common/string.js +1 -1
- package/dist/public/common/string.js.map +1 -1
- package/dist/{private → public}/common/ts/deep-required.d.ts +2 -1
- package/dist/{private → public}/common/ts/deep-required.js +0 -0
- package/dist/public/common/ts/deep-required.js.map +1 -0
- package/dist/public/common/ts/pick-by-prefix.d.ts +2 -1
- package/dist/public/common/ts/pick-by-prefix.js.map +1 -1
- package/dist/public/common/version.d.ts +1 -1
- package/dist/public/common/version.js +1 -1
- package/dist/public/common/version.js.map +1 -1
- package/dist/public/node/analytics.js +5 -5
- package/dist/public/node/analytics.js.map +1 -1
- package/dist/public/node/api/admin.js +2 -2
- package/dist/public/node/api/admin.js.map +1 -1
- package/dist/public/node/api/http.d.ts +1 -0
- package/dist/public/node/api/http.js +1 -1
- package/dist/public/node/archiver.d.ts +20 -6
- package/dist/public/node/archiver.js +16 -15
- package/dist/public/node/archiver.js.map +1 -1
- package/dist/public/node/base-command.js +4 -4
- package/dist/public/node/base-command.js.map +1 -1
- package/dist/public/node/crypto.d.ts +1 -1
- package/dist/public/node/dot-env.js +4 -2
- package/dist/public/node/dot-env.js.map +1 -1
- package/dist/public/node/environment/local.d.ts +1 -1
- package/dist/public/node/environment/spin.d.ts +1 -1
- package/dist/public/node/environment/spin.js +2 -2
- package/dist/public/node/environment/spin.js.map +1 -1
- package/dist/public/node/error-handler.d.ts +1 -2
- package/dist/public/node/error-handler.js +15 -5
- package/dist/public/node/error-handler.js.map +1 -1
- package/dist/public/node/error.d.ts +5 -5
- package/dist/public/node/error.js +1 -1
- package/dist/public/node/error.js.map +1 -1
- package/dist/public/node/fs.d.ts +24 -4
- package/dist/public/node/fs.js +50 -21
- package/dist/public/node/fs.js.map +1 -1
- package/dist/public/node/git.d.ts +9 -1
- package/dist/public/node/git.js +39 -9
- package/dist/public/node/git.js.map +1 -1
- package/dist/public/node/github.js +2 -2
- package/dist/public/node/github.js.map +1 -1
- package/dist/public/node/hooks/postrun.js +2 -2
- package/dist/public/node/hooks/postrun.js.map +1 -1
- package/dist/public/node/hooks/prerun.js +2 -2
- package/dist/public/node/hooks/prerun.js.map +1 -1
- package/dist/public/node/http.d.ts +9 -1
- package/dist/public/node/http.js +37 -3
- package/dist/public/node/http.js.map +1 -1
- package/dist/public/node/liquid.js +2 -2
- package/dist/public/node/liquid.js.map +1 -1
- package/dist/public/node/metadata.d.ts +7 -7
- package/dist/public/node/monorail.d.ts +6 -6
- package/dist/public/node/monorail.js +4 -4
- package/dist/public/node/monorail.js.map +1 -1
- package/dist/public/node/node-package-manager.d.ts +5 -5
- package/dist/public/node/node-package-manager.js +9 -9
- package/dist/public/node/node-package-manager.js.map +1 -1
- package/dist/public/node/os.d.ts +2 -2
- package/dist/public/node/os.js +2 -2
- package/dist/public/node/os.js.map +1 -1
- package/dist/public/node/output.d.ts +188 -0
- package/dist/{output.js → public/node/output.js} +129 -50
- package/dist/public/node/output.js.map +1 -0
- package/dist/public/node/path.d.ts +1 -1
- package/dist/public/node/plugins/tunnel.d.ts +5 -5
- package/dist/public/node/plugins.d.ts +4 -4
- package/dist/public/node/result.d.ts +1 -1
- package/dist/public/node/ruby.d.ts +1 -1
- package/dist/public/node/ruby.js +7 -5
- package/dist/public/node/ruby.js.map +1 -1
- package/dist/public/node/session.d.ts +1 -1
- package/dist/public/node/session.js +9 -9
- package/dist/public/node/session.js.map +1 -1
- package/dist/public/node/system.d.ts +1 -1
- package/dist/public/node/system.js +2 -2
- package/dist/public/node/system.js.map +1 -1
- package/dist/public/node/tcp.js +4 -4
- package/dist/public/node/tcp.js.map +1 -1
- package/dist/public/node/testing/output.js +10 -9
- package/dist/public/node/testing/output.js.map +1 -1
- package/dist/public/node/ui.d.ts +11 -6
- package/dist/public/node/ui.js +5 -4
- package/dist/public/node/ui.js.map +1 -1
- package/dist/public/node/vscode.js +4 -4
- package/dist/public/node/vscode.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui.d.ts +6 -20
- package/dist/ui.js +8 -28
- package/dist/ui.js.map +1 -1
- package/package.json +6 -7
- package/dist/content-tokens.js.map +0 -1
- package/dist/network/api.d.ts +0 -2
- package/dist/network/api.js.map +0 -1
- package/dist/output.d.ts +0 -129
- package/dist/output.js.map +0 -1
- package/dist/private/common/ts/deep-required.js.map +0 -1
- package/dist/private/node/simple-definitions.d.ts +0 -4
- package/dist/private/node/simple-definitions.js +0 -2
- package/dist/private/node/simple-definitions.js.map +0 -1
|
@@ -16,8 +16,8 @@ import { Config, Interfaces } from '@oclif/core';
|
|
|
16
16
|
* @returns A dictionary of plug-in names to the response from the hook.
|
|
17
17
|
*/
|
|
18
18
|
export declare function fanoutHooks<TPluginMap extends HookReturnsPerPlugin, TEvent extends string & keyof TPluginMap>(config: Interfaces.Config, event: TEvent, options: TPluginMap[typeof event]['options'], timeout?: number): Promise<Partial<TPluginMap[typeof event]['pluginReturns']>>;
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
type AppSpecificMonorailFields = PickByPrefix<MonorailEventPublic, 'app_', 'project_type' | 'api_key' | 'partner_id'> & PickByPrefix<MonorailEventPublic, 'cmd_extensions_'> & PickByPrefix<MonorailEventPublic, 'cmd_scaffold_'>;
|
|
20
|
+
type AppSpecificSensitiveMonorailFields = PickByPrefix<MonorailEventSensitive, 'app_'>;
|
|
21
21
|
export interface HookReturnsPerPlugin extends HookReturnPerTunnelPlugin {
|
|
22
22
|
public_command_metadata: {
|
|
23
23
|
options: {
|
|
@@ -46,8 +46,8 @@ export interface HookReturnsPerPlugin extends HookReturnPerTunnelPlugin {
|
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
export
|
|
50
|
-
export
|
|
49
|
+
export type PluginReturnsForHook<TEvent extends keyof TPluginMap, TPluginName extends keyof TPluginMap[TEvent]['pluginReturns'], TPluginMap extends HookReturnsPerPlugin = HookReturnsPerPlugin> = TPluginMap[TEvent]['pluginReturns'][TPluginName];
|
|
50
|
+
export type FanoutHookFunction<TEvent extends keyof TPluginMap = string, TPluginName extends keyof TPluginMap[TEvent]['pluginReturns'] = string, TPluginMap extends HookReturnsPerPlugin = HookReturnsPerPlugin> = (this: Interfaces.Hook.Context, options: TPluginMap[TEvent]['options'] & {
|
|
51
51
|
config: Interfaces.Config;
|
|
52
52
|
}) => Promise<PluginReturnsForHook<TEvent, TPluginName, TPluginMap>>;
|
|
53
53
|
/**
|
package/dist/public/node/ruby.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as file from './fs.js';
|
|
|
5
5
|
import { joinPath, cwd } from './path.js';
|
|
6
6
|
import { AbortError, AbortSilentError } from './error.js';
|
|
7
7
|
import { pathConstants } from '../../private/node/constants.js';
|
|
8
|
-
import {
|
|
8
|
+
import { outputContent, outputToken } from '../../public/node/output.js';
|
|
9
9
|
import { isTruthy } from '../../private/node/environment/utilities.js';
|
|
10
10
|
import { Writable } from 'stream';
|
|
11
11
|
const RubyCLIVersion = '2.34.0';
|
|
@@ -144,11 +144,13 @@ async function validateRuby() {
|
|
|
144
144
|
version = coerceSemverVersion(stdout);
|
|
145
145
|
}
|
|
146
146
|
catch {
|
|
147
|
-
throw new AbortError('Ruby environment not found', `Make sure you have Ruby installed on your system. ${
|
|
147
|
+
throw new AbortError('Ruby environment not found', `Make sure you have Ruby installed on your system. ${outputContent `${outputToken.link('Documentation.', 'https://www.ruby-lang.org/en/documentation/installation/')}`
|
|
148
|
+
.value}`);
|
|
148
149
|
}
|
|
149
150
|
const isValid = version?.compare(MinRubyVersion);
|
|
150
151
|
if (isValid === -1 || isValid === undefined) {
|
|
151
|
-
throw new AbortError(`Ruby version ${
|
|
152
|
+
throw new AbortError(`Ruby version ${outputContent `${outputToken.yellow(version.raw)}`.value} is not supported`, `Make sure you have at least Ruby ${outputContent `${outputToken.yellow(MinRubyVersion)}`.value} installed on your system. ${outputContent `${outputToken.link('Documentation.', 'https://www.ruby-lang.org/en/documentation/installation/')}`
|
|
153
|
+
.value}`);
|
|
152
154
|
}
|
|
153
155
|
}
|
|
154
156
|
/**
|
|
@@ -161,11 +163,11 @@ async function validateBundler() {
|
|
|
161
163
|
version = coerceSemverVersion(stdout);
|
|
162
164
|
}
|
|
163
165
|
catch {
|
|
164
|
-
throw new AbortError('Bundler not found', `To install the latest version of Bundler, run ${
|
|
166
|
+
throw new AbortError('Bundler not found', `To install the latest version of Bundler, run ${outputContent `${outputToken.genericShellCommand(`${gemExecutable()} install bundler`)}`.value}`);
|
|
165
167
|
}
|
|
166
168
|
const isValid = version?.compare(MinBundlerVersion);
|
|
167
169
|
if (isValid === -1 || isValid === undefined) {
|
|
168
|
-
throw new AbortError(`Bundler version ${
|
|
170
|
+
throw new AbortError(`Bundler version ${outputContent `${outputToken.yellow(version.raw)}`.value} is not supported`, `To update to the latest version of Bundler, run ${outputContent `${outputToken.genericShellCommand(`${gemExecutable()} install bundler`)}`.value}`);
|
|
169
171
|
}
|
|
170
172
|
}
|
|
171
173
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ruby.js","sourceRoot":"","sources":["../../../src/public/node/ruby.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aAAa,EAAE,CAAA;IAClC,OAAO,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;AAC/D,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa;IACpB,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,OAAO,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;AACzD,CAAC","sourcesContent":["import {coerceSemverVersion} from './semver.js'\nimport {AbortSignal} from './abort.js'\nimport {platformAndArch} from './os.js'\nimport {captureOutput, exec} from './system.js'\nimport * as file from './fs.js'\nimport {joinPath, cwd} from './path.js'\nimport {AbortError, AbortSilentError} from './error.js'\nimport {pathConstants} from '../../private/node/constants.js'\nimport {AdminSession} from '../../public/node/session.js'\nimport {content, token} from '../../output.js'\nimport {isTruthy} from '../../private/node/environment/utilities.js'\nimport {Writable} from 'stream'\n\nconst RubyCLIVersion = '2.34.0'\nconst ThemeCheckVersion = '1.14.0'\nconst MinBundlerVersion = '2.3.8'\nconst MinRubyVersion = '2.7.5'\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}\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 await installCLIDependencies(options.stdout ?? process.stdout)\n const env: NodeJS.ProcessEnv = {\n ...process.env,\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 // 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(shopifyCLIDirectory(), 'Gemfile'),\n }\n\n try {\n await exec(bundleExecutable(), ['exec', 'shopify'].concat(args), {\n stdio: 'inherit',\n cwd: options.directory ?? cwd(),\n env,\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 */\nasync function installCLIDependencies(stdout: Writable) {\n const exists = await file.fileExists(shopifyCLIDirectory())\n\n if (!exists) stdout.write('Installing theme dependencies...')\n const usingLocalCLI2 = isTruthy(process.env.SHOPIFY_CLI_2_0_DIRECTORY)\n await validateRubyEnv()\n if (usingLocalCLI2) {\n await bundleInstallLocalShopifyCLI()\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 content`${token.link('Documentation.', 'https://www.ruby-lang.org/en/documentation/installation/')}`.value\n }`,\n )\n }\n\n const isValid = version?.compare(MinRubyVersion)\n if (isValid === -1 || isValid === undefined) {\n throw new AbortError(\n `Ruby version ${content`${token.yellow(version.raw)}`.value} is not supported`,\n `Make sure you have at least Ruby ${content`${token.yellow(MinRubyVersion)}`.value} installed on your system. ${\n content`${token.link('Documentation.', 'https://www.ruby-lang.org/en/documentation/installation/')}`.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 content`${token.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 ${content`${token.yellow(version.raw)}`.value} is not supported`,\n `To update to the latest version of Bundler, run ${\n content`${token.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(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 gemPath = joinPath(shopifyCLIDirectory(), 'Gemfile')\n const gemFileContent = [\"source 'https://rubygems.org'\", `gem 'shopify-cli', '${RubyCLIVersion}'`]\n const {platform} = platformAndArch()\n if (platform === 'windows') {\n // 'wdm' is required by 'listen', see https://github.com/Shopify/cli/issues/780\n gemFileContent.push(\"gem 'wdm', '>= 0.1.0'\")\n }\n await file.writeFile(gemPath, gemFileContent.join('\\n'))\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 */\nasync function bundleInstallLocalShopifyCLI(): Promise<void> {\n await exec(bundleExecutable(), ['install'], {cwd: shopifyCLIDirectory()})\n}\n\n/**\n * It runs bundle install for the CLI-managed copy of the Ruby CLI.\n */\nasync function bundleInstallShopifyCLI() {\n await exec(bundleExecutable(), ['config', 'set', '--local', 'path', shopifyCLIDirectory()], {\n cwd: shopifyCLIDirectory(),\n })\n await exec(bundleExecutable(), ['install'], {cwd: shopifyCLIDirectory()})\n}\n\n/**\n * It runs bundle install for the CLI-managed copy of theme-check.\n */\nasync function bundleInstallThemeCheck() {\n await exec(bundleExecutable(), ['config', 'set', '--local', 'path', themeCheckDirectory()], {\n cwd: themeCheckDirectory(),\n })\n await exec(bundleExecutable(), ['install'], {cwd: themeCheckDirectory()})\n}\n\n/**\n * It returns the directory where the Ruby CLI is located.\n *\n * @returns The absolute path to the directory.\n */\nfunction shopifyCLIDirectory(): string {\n return (\n process.env.SHOPIFY_CLI_2_0_DIRECTORY ??\n joinPath(pathConstants.directories.cache.vendor.path(), 'ruby-cli', RubyCLIVersion)\n )\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 process.env.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"]}
|
|
1
|
+
{"version":3,"file":"ruby.js","sourceRoot":"","sources":["../../../src/public/node/ruby.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,aAAa,CAAA;AAE/C,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,GAAG,EAAC,MAAM,WAAW,CAAA;AACvC,OAAO,EAAC,UAAU,EAAE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ACzD,CAAC","sourcesContent":["import {coerceSemverVersion} from './semver.js'\nimport {AbortSignal} from './abort.js'\nimport {platformAndArch} from './os.js'\nimport {captureOutput, exec} from './system.js'\nimport * as file from './fs.js'\nimport {joinPath, cwd} from './path.js'\nimport {AbortError, AbortSilentError} from './error.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/environment/utilities.js'\nimport {Writable} from 'stream'\n\nconst RubyCLIVersion = '2.34.0'\nconst ThemeCheckVersion = '1.14.0'\nconst MinBundlerVersion = '2.3.8'\nconst MinRubyVersion = '2.7.5'\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}\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 await installCLIDependencies(options.stdout ?? process.stdout)\n const env: NodeJS.ProcessEnv = {\n ...process.env,\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 // 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(shopifyCLIDirectory(), 'Gemfile'),\n }\n\n try {\n await exec(bundleExecutable(), ['exec', 'shopify'].concat(args), {\n stdio: 'inherit',\n cwd: options.directory ?? cwd(),\n env,\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 */\nasync function installCLIDependencies(stdout: Writable) {\n const exists = await file.fileExists(shopifyCLIDirectory())\n\n if (!exists) stdout.write('Installing theme dependencies...')\n const usingLocalCLI2 = isTruthy(process.env.SHOPIFY_CLI_2_0_DIRECTORY)\n await validateRubyEnv()\n if (usingLocalCLI2) {\n await bundleInstallLocalShopifyCLI()\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(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 gemPath = joinPath(shopifyCLIDirectory(), 'Gemfile')\n const gemFileContent = [\"source 'https://rubygems.org'\", `gem 'shopify-cli', '${RubyCLIVersion}'`]\n const {platform} = platformAndArch()\n if (platform === 'windows') {\n // 'wdm' is required by 'listen', see https://github.com/Shopify/cli/issues/780\n gemFileContent.push(\"gem 'wdm', '>= 0.1.0'\")\n }\n await file.writeFile(gemPath, gemFileContent.join('\\n'))\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 */\nasync function bundleInstallLocalShopifyCLI(): Promise<void> {\n await exec(bundleExecutable(), ['install'], {cwd: shopifyCLIDirectory()})\n}\n\n/**\n * It runs bundle install for the CLI-managed copy of the Ruby CLI.\n */\nasync function bundleInstallShopifyCLI() {\n await exec(bundleExecutable(), ['config', 'set', '--local', 'path', shopifyCLIDirectory()], {\n cwd: shopifyCLIDirectory(),\n })\n await exec(bundleExecutable(), ['install'], {cwd: shopifyCLIDirectory()})\n}\n\n/**\n * It runs bundle install for the CLI-managed copy of theme-check.\n */\nasync function bundleInstallThemeCheck() {\n await exec(bundleExecutable(), ['config', 'set', '--local', 'path', themeCheckDirectory()], {\n cwd: themeCheckDirectory(),\n })\n await exec(bundleExecutable(), ['install'], {cwd: themeCheckDirectory()})\n}\n\n/**\n * It returns the directory where the Ruby CLI is located.\n *\n * @returns The absolute path to the directory.\n */\nfunction shopifyCLIDirectory(): string {\n return (\n process.env.SHOPIFY_CLI_2_0_DIRECTORY ??\n joinPath(pathConstants.directories.cache.vendor.path(), 'ruby-cli', RubyCLIVersion)\n )\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 process.env.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"]}
|
|
@@ -2,7 +2,7 @@ import { normalizeStoreFqdn } from './environment/fqdn.js';
|
|
|
2
2
|
import { BugError } from './error.js';
|
|
3
3
|
import * as secureStore from '../../private/node/session/store.js';
|
|
4
4
|
import { exchangeCustomPartnerToken } from '../../private/node/session/exchange.js';
|
|
5
|
-
import {
|
|
5
|
+
import { outputContent, outputToken, outputDebug } from '../../public/node/output.js';
|
|
6
6
|
import { ensureAuthenticated } from '../../private/node/session.js';
|
|
7
7
|
import { environmentVariables } from '../../private/node/constants.js';
|
|
8
8
|
/**
|
|
@@ -15,8 +15,8 @@ import { environmentVariables } from '../../private/node/constants.js';
|
|
|
15
15
|
* @returns The access token for the Partners API.
|
|
16
16
|
*/
|
|
17
17
|
export async function ensureAuthenticatedPartners(scopes = [], env = process.env) {
|
|
18
|
-
|
|
19
|
-
${
|
|
18
|
+
outputDebug(outputContent `Ensuring that the user is authenticated with the Partners API with the following scopes:
|
|
19
|
+
${outputToken.json(scopes)}
|
|
20
20
|
`);
|
|
21
21
|
const envToken = env[environmentVariables.partnersToken];
|
|
22
22
|
if (envToken) {
|
|
@@ -38,8 +38,8 @@ ${token.json(scopes)}
|
|
|
38
38
|
export async function ensureAuthenticatedStorefront(scopes = [], password = undefined) {
|
|
39
39
|
if (password)
|
|
40
40
|
return password;
|
|
41
|
-
|
|
42
|
-
${
|
|
41
|
+
outputDebug(outputContent `Ensuring that the user is authenticated with the Storefront API with the following scopes:
|
|
42
|
+
${outputToken.json(scopes)}
|
|
43
43
|
`);
|
|
44
44
|
const tokens = await ensureAuthenticated({ storefrontRendererApi: { scopes } });
|
|
45
45
|
if (!tokens.storefront) {
|
|
@@ -56,8 +56,8 @@ ${token.json(scopes)}
|
|
|
56
56
|
* @returns The access token for the Admin API.
|
|
57
57
|
*/
|
|
58
58
|
export async function ensureAuthenticatedAdmin(store, scopes = [], forceRefresh = false) {
|
|
59
|
-
|
|
60
|
-
${
|
|
59
|
+
outputDebug(outputContent `Ensuring that the user is authenticated with the Admin API with the following scopes for the store ${outputToken.raw(store)}:
|
|
60
|
+
${outputToken.json(scopes)}
|
|
61
61
|
`);
|
|
62
62
|
const tokens = await ensureAuthenticated({ adminApi: { scopes, storeFqdn: store } }, process.env, forceRefresh);
|
|
63
63
|
if (!tokens.admin) {
|
|
@@ -77,8 +77,8 @@ ${token.json(scopes)}
|
|
|
77
77
|
* @returns The access token and store.
|
|
78
78
|
*/
|
|
79
79
|
export async function ensureAuthenticatedThemes(store, password, scopes = [], forceRefresh = false) {
|
|
80
|
-
|
|
81
|
-
${
|
|
80
|
+
outputDebug(outputContent `Ensuring that the user is authenticated with the Theme API with the following scopes:
|
|
81
|
+
${outputToken.json(scopes)}
|
|
82
82
|
`);
|
|
83
83
|
if (password)
|
|
84
84
|
return { token: password, storeFqdn: await normalizeStoreFqdn(store) };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/public/node/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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C,aAAa,CAAA;EACzB,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;CACzB,CAAC,CAAA;IACA,IAAI,QAAQ;QAAE,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC,KAAK,CAAC,EAAC,CAAA;IAClF,OAAO,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAA;AAC9D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,MAAM;IACpB,OAAO,WAAW,CAAC,MAAM,EAAE,CAAA;AAC7B,CAAC","sourcesContent":["import {normalizeStoreFqdn} from './environment/fqdn.js'\nimport {BugError} from './error.js'\nimport * as secureStore from '../../private/node/session/store.js'\nimport {exchangeCustomPartnerToken} from '../../private/node/session/exchange.js'\nimport {outputContent, outputToken, outputDebug} from '../../public/node/output.js'\nimport {ensureAuthenticated} from '../../private/node/session.js'\nimport {environmentVariables} from '../../private/node/constants.js'\n\n/**\n * Session Object to access the Admin API, includes the token and the store FQDN.\n */\nexport interface AdminSession {\n token: string\n storeFqdn: string\n}\n\n/**\n * Ensure that we have a valid session to access the Partners API.\n * If SHOPIFY_CLI_PARTNERS_TOKEN exists, that token will be used to obtain a valid Partners Token\n * If SHOPIFY_CLI_PARTNERS_TOKEN exists, scopes will be ignored.\n *\n * @param scopes - Optional array of extra scopes to authenticate with.\n * @param env - Optional environment variables to use.\n * @returns The access token for the Partners API.\n */\nexport async function ensureAuthenticatedPartners(scopes: string[] = [], env = process.env): Promise<string> {\n outputDebug(outputContent`Ensuring that the user is authenticated with the Partners API with the following scopes:\n${outputToken.json(scopes)}\n`)\n const envToken = env[environmentVariables.partnersToken]\n if (envToken) {\n return (await exchangeCustomPartnerToken(envToken)).accessToken\n }\n const tokens = await ensureAuthenticated({partnersApi: {scopes}})\n if (!tokens.partners) {\n throw new BugError('No partners token found after ensuring authenticated')\n }\n return tokens.partners\n}\n\n/**\n * Ensure that we have a valid session to access the Storefront API.\n *\n * @param scopes - Optional array of extra scopes to authenticate with.\n * @param password - Optional password to use.\n * @returns The access token for the Storefront API.\n */\nexport async function ensureAuthenticatedStorefront(\n scopes: string[] = [],\n password: string | undefined = undefined,\n): Promise<string> {\n if (password) return password\n\n outputDebug(outputContent`Ensuring that the user is authenticated with the Storefront API with the following scopes:\n${outputToken.json(scopes)}\n`)\n const tokens = await ensureAuthenticated({storefrontRendererApi: {scopes}})\n if (!tokens.storefront) {\n throw new BugError('No storefront token found after ensuring authenticated')\n }\n return tokens.storefront\n}\n\n/**\n * Ensure that we have a valid Admin session for the given store.\n *\n * @param store - Store fqdn to request auth for.\n * @param scopes - Optional array of extra scopes to authenticate with.\n * @param forceRefresh - Optional flag to force a refresh of the token.\n * @returns The access token for the Admin API.\n */\nexport async function ensureAuthenticatedAdmin(\n store: string,\n scopes: string[] = [],\n forceRefresh = false,\n): Promise<AdminSession> {\n outputDebug(outputContent`Ensuring that the user is authenticated with the Admin API with the following scopes for the store ${outputToken.raw(\n store,\n )}:\n${outputToken.json(scopes)}\n`)\n const tokens = await ensureAuthenticated({adminApi: {scopes, storeFqdn: store}}, process.env, forceRefresh)\n if (!tokens.admin) {\n throw new BugError('No admin token found after ensuring authenticated')\n }\n return tokens.admin\n}\n\n/**\n * Ensure that we have a valid session to access the Theme API.\n * If a password is provided, that token will be used against Theme Access API.\n * Otherwise, it will ensure that the user is authenticated with the Admin API.\n *\n * @param store - Store fqdn to request auth for.\n * @param password - Password generated from Theme Access app.\n * @param scopes - Optional array of extra scopes to authenticate with.\n * @param forceRefresh - Optional flag to force a refresh of the token.\n * @returns The access token and store.\n */\nexport async function ensureAuthenticatedThemes(\n store: string,\n password: string | undefined,\n scopes: string[] = [],\n forceRefresh = false,\n): Promise<AdminSession> {\n outputDebug(outputContent`Ensuring that the user is authenticated with the Theme API with the following scopes:\n${outputToken.json(scopes)}\n`)\n if (password) return {token: password, storeFqdn: await normalizeStoreFqdn(store)}\n return ensureAuthenticatedAdmin(store, scopes, forceRefresh)\n}\n\n/**\n * Logout from Shopify.\n *\n * @returns A promise that resolves when the logout is complete.\n */\nexport function logout(): Promise<void> {\n return secureStore.remove()\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbortError, ExternalError } from './error.js';
|
|
2
2
|
import { cwd } from './path.js';
|
|
3
|
-
import { shouldDisplayColors,
|
|
3
|
+
import { shouldDisplayColors, outputDebug } from '../../public/node/output.js';
|
|
4
4
|
import { execa } from 'execa';
|
|
5
5
|
import treeKill from 'tree-kill';
|
|
6
6
|
/**
|
|
@@ -89,7 +89,7 @@ function buildExec(command, args, options) {
|
|
|
89
89
|
// and all its sub-processes with Ctrl+C on Windows
|
|
90
90
|
windowsHide: false,
|
|
91
91
|
});
|
|
92
|
-
|
|
92
|
+
outputDebug(`
|
|
93
93
|
Running system process:
|
|
94
94
|
· Command: ${command} ${args.join(' ')}
|
|
95
95
|
· Working directory: ${options?.cwd ?? cwd()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../../src/public/node/system.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,YAAY,CAAA;AACpD,OAAO,EAAC,GAAG,EAAC,MAAM,WAAW,CAAA;AAC7B,OAAO,EAAC,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../../src/public/node/system.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,YAAY,CAAA;AACpD,OAAO,EAAC,GAAG,EAAC,MAAM,WAAW,CAAA;AAC7B,OAAO,EAAC,mBAAmB,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAA;AAC5E,OAAO,EAAC,KAAK,EAAoB,MAAM,OAAO,CAAA;AAC9C,OAAO,QAAQ,MAAM,WAAW,CAAA;AAchC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,GAAW;IAC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KAAK,UAAU,KAAK,CAAC,OAAe;IACzC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,UAAU,CAAC,OAAO,EAAE,IAAI,GAAG,OAAO,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {AbortSignal} from './abort.js'\nimport {AbortError, ExternalError} from './error.js'\nimport {cwd} from './path.js'\nimport {shouldDisplayColors, outputDebug} from '../../public/node/output.js'\nimport {execa, ExecaChildProcess} from 'execa'\nimport treeKill from 'tree-kill'\nimport type {Writable, Readable} from 'stream'\n\nexport interface ExecOptions {\n cwd?: string\n env?: {[key: string]: string | undefined}\n stdin?: Readable | 'inherit'\n stdout?: Writable | 'inherit'\n stderr?: Writable | 'inherit'\n stdio?: 'inherit'\n input?: string\n signal?: AbortSignal\n}\n\n/**\n * Opens a URL in the user's default browser.\n *\n * @param url - URL to open.\n */\nexport async function openURL(url: string): Promise<void> {\n const externalOpen = await import('open')\n await externalOpen.default(url)\n}\n\n/**\n * Runs a command asynchronously, aggregates the stdout data, and returns it.\n *\n * @param command - Command to be executed.\n * @param args - Arguments to pass to the command.\n * @param options - Optional settings for how to run the command.\n * @returns A promise that resolves with the aggregatted stdout of the command.\n */\nexport async function captureOutput(command: string, args: string[], options?: ExecOptions): Promise<string> {\n const result = await buildExec(command, args, options)\n return result.stdout\n}\n\n/**\n * Runs a command asynchronously.\n *\n * @param command - Command to be executed.\n * @param args - Arguments to pass to the command.\n * @param options - Optional settings for how to run the command.\n */\nexport async function exec(command: string, args: string[], options?: ExecOptions): Promise<void> {\n const commandProcess = buildExec(command, args, options)\n if (options?.stderr && options.stderr !== 'inherit') {\n commandProcess.stderr?.pipe(options.stderr)\n }\n if (options?.stdout && options.stdout !== 'inherit') {\n commandProcess.stdout?.pipe(options.stdout)\n }\n let aborted = false\n options?.signal?.addEventListener('abort', () => {\n const pid = commandProcess.pid\n if (pid) {\n aborted = true\n treeKill(pid, (err) => {\n if (err) throw new AbortError(`Failed to kill process ${pid}: ${err}`)\n })\n }\n })\n try {\n await commandProcess\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (processError: any) {\n // Windows will throw an error whenever the process is killed, no matter the reason.\n // The aborted flag tell use that we killed it, so we can ignore the error.\n if (aborted) return\n const abortError = new ExternalError(processError.message, command, args)\n abortError.stack = processError.stack\n throw abortError\n }\n}\n\n/**\n * Runs a command asynchronously.\n *\n * @param command - Command to be executed.\n * @param args - Arguments to pass to the command.\n * @param options - Optional settings for how to run the command.\n * @returns A promise for a result with stdout and stderr properties.\n */\nfunction buildExec(command: string, args: string[], options?: ExecOptions): ExecaChildProcess<string> {\n const env = options?.env ?? process.env\n if (shouldDisplayColors()) {\n env.FORCE_COLOR = '1'\n }\n const commandProcess = execa(command, args, {\n env,\n cwd: options?.cwd,\n input: options?.input,\n stdio: options?.stdio,\n stdin: options?.stdin,\n stdout: options?.stdout === 'inherit' ? 'inherit' : undefined,\n stderr: options?.stderr === 'inherit' ? 'inherit' : undefined,\n // Setting this to false makes it possible to kill the main process\n // and all its sub-processes with Ctrl+C on Windows\n windowsHide: false,\n })\n outputDebug(`\nRunning system process:\n · Command: ${command} ${args.join(' ')}\n · Working directory: ${options?.cwd ?? cwd()}\n`)\n return commandProcess\n}\n\n/**\n * Waits for a given number of seconds.\n *\n * @param seconds - Number of seconds to wait.\n */\nexport async function sleep(seconds: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, 1000 * seconds)\n })\n}\n"]}
|
package/dist/public/node/tcp.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { sleep } from './system.js';
|
|
2
2
|
import { AbortError } from './error.js';
|
|
3
|
-
import {
|
|
3
|
+
import { outputDebug, outputContent, outputToken } from '../../public/node/output.js';
|
|
4
4
|
import * as port from 'get-port-please';
|
|
5
5
|
/**
|
|
6
6
|
* Returns an available port in the current environment.
|
|
@@ -9,9 +9,9 @@ import * as port from 'get-port-please';
|
|
|
9
9
|
* @example
|
|
10
10
|
*/
|
|
11
11
|
export async function getAvailableTCPPort() {
|
|
12
|
-
|
|
12
|
+
outputDebug(outputContent `Getting a random port...`);
|
|
13
13
|
const randomPort = await retryOnError(() => port.getRandomPort());
|
|
14
|
-
|
|
14
|
+
outputDebug(outputContent `Random port obtained: ${outputToken.raw(`${randomPort}`)}`);
|
|
15
15
|
return randomPort;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
@@ -31,7 +31,7 @@ async function retryOnError(execute, maxTries = 5, waitTimeInSeconds = 1) {
|
|
|
31
31
|
}
|
|
32
32
|
catch (error) {
|
|
33
33
|
if (retryCount++ < maxTries) {
|
|
34
|
-
|
|
34
|
+
outputDebug(outputContent `Unknown problem getting a random port: ${error.message}`);
|
|
35
35
|
// eslint-disable-next-line no-await-in-loop
|
|
36
36
|
await sleep(waitTimeInSeconds);
|
|
37
37
|
}
|
|
@@ -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,
|
|
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,19 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { collectedLogs, clearCollectedLogs } from '../../../public/node/output.js';
|
|
2
2
|
/**
|
|
3
3
|
* Returns a set of functions to get the outputs ocurred during a test run.
|
|
4
4
|
*
|
|
5
5
|
* @returns An mock object with all the output functions.
|
|
6
6
|
*/ export function mockAndCaptureOutput() {
|
|
7
7
|
return {
|
|
8
|
-
output: () => (
|
|
9
|
-
info: () => (
|
|
10
|
-
debug: () => (
|
|
11
|
-
success: () => (
|
|
12
|
-
completed: () => (
|
|
13
|
-
warn: () => (
|
|
14
|
-
error: () => (
|
|
8
|
+
output: () => (collectedLogs.output ?? []).join('\n'),
|
|
9
|
+
info: () => (collectedLogs.info ?? []).join('\n'),
|
|
10
|
+
debug: () => (collectedLogs.debug ?? []).join('\n'),
|
|
11
|
+
success: () => (collectedLogs.success ?? []).join('\n'),
|
|
12
|
+
completed: () => (collectedLogs.completed ?? []).join('\n'),
|
|
13
|
+
warn: () => (collectedLogs.warn ?? []).join('\n'),
|
|
14
|
+
error: () => (collectedLogs.error ?? []).join('\n'),
|
|
15
15
|
clear: () => {
|
|
16
|
-
|
|
16
|
+
clearCollectedLogs();
|
|
17
|
+
// output.collectedLogs = {}
|
|
17
18
|
},
|
|
18
19
|
};
|
|
19
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../../../src/public/node/testing/output.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../../../src/public/node/testing/output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,kBAAkB,EAAC,MAAM,gCAAgC,CAAA;AAahF;;;;GAIG,CAAC,MAAM,UAAU,oBAAoB;IACtC,OAAO;QACL,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,aAAa,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACrD,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,aAAa,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACjD,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,aAAa,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACnD,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,aAAa,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACvD,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,aAAa,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC3D,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,aAAa,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACjD,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,aAAa,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACnD,KAAK,EAAE,GAAG,EAAE;YACV,kBAAkB,EAAE,CAAA;YACpB,4BAA4B;QAC9B,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import {collectedLogs, clearCollectedLogs} from '../../../public/node/output.js'\n\ninterface OutputMock {\n output: () => string\n info: () => string\n debug: () => string\n success: () => string\n completed: () => string\n warn: () => string\n error: () => string\n clear: () => void\n}\n\n/**\n * Returns a set of functions to get the outputs ocurred during a test run.\n *\n * @returns An mock object with all the output functions.\n */ export function mockAndCaptureOutput(): OutputMock {\n return {\n output: () => (collectedLogs.output ?? []).join('\\n'),\n info: () => (collectedLogs.info ?? []).join('\\n'),\n debug: () => (collectedLogs.debug ?? []).join('\\n'),\n success: () => (collectedLogs.success ?? []).join('\\n'),\n completed: () => (collectedLogs.completed ?? []).join('\\n'),\n warn: () => (collectedLogs.warn ?? []).join('\\n'),\n error: () => (collectedLogs.error ?? []).join('\\n'),\n clear: () => {\n clearCollectedLogs()\n // output.collectedLogs = {}\n },\n }\n}\n"]}
|
package/dist/public/node/ui.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { FatalError as Fatal } from './error.js';
|
|
2
|
-
import { OutputProcess } from '
|
|
3
|
-
import { AlertProps } from '../../private/node/ui/components/Alert.js';
|
|
2
|
+
import { OutputProcess } from './output.js';
|
|
3
|
+
import { AlertProps, CustomSection } from '../../private/node/ui/components/Alert.js';
|
|
4
4
|
import ScalarDict from '../../private/node/ui/components/Table/ScalarDict.js';
|
|
5
5
|
import { TableProps } from '../../private/node/ui/components/Table/Table.js';
|
|
6
6
|
import { Props as SelectPromptProps } from '../../private/node/ui/components/SelectPrompt.js';
|
|
7
7
|
import { Task } from '../../private/node/ui/components/Tasks.js';
|
|
8
8
|
import { Props as TextPromptProps } from '../../private/node/ui/components/TextPrompt.js';
|
|
9
|
-
import {
|
|
9
|
+
import { Props as SelectProps } from '../../private/node/ui/components/SelectInput.js';
|
|
10
10
|
import { Props as InfoTableProps } from '../../private/node/ui/components/Prompts/InfoTable.js';
|
|
11
|
+
import { SearchResults } from '../../private/node/ui/components/AutocompletePrompt.js';
|
|
12
|
+
import { TokenItem } from '../../private/node/ui/components/TokenizedText.js';
|
|
11
13
|
import { RenderOptions } from 'ink';
|
|
12
14
|
import { AbortController } from '@shopify/cli-kit/node/abort';
|
|
15
|
+
export { TokenItem };
|
|
13
16
|
interface RenderConcurrentOptions {
|
|
14
17
|
processes: OutputProcess[];
|
|
15
18
|
abortController?: AbortController;
|
|
@@ -20,7 +23,8 @@ interface RenderConcurrentOptions {
|
|
|
20
23
|
* Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.
|
|
21
24
|
*/
|
|
22
25
|
export declare function renderConcurrent({ processes, abortController, showTimestamps, renderOptions, }: RenderConcurrentOptions): Promise<void>;
|
|
23
|
-
export
|
|
26
|
+
export type AlertCustomSection = CustomSection;
|
|
27
|
+
export type RenderAlertOptions = Omit<AlertProps, 'type'>;
|
|
24
28
|
/**
|
|
25
29
|
* Renders an information banner to the console.
|
|
26
30
|
*
|
|
@@ -195,7 +199,8 @@ interface RenderAutocompletePromptProps<T> {
|
|
|
195
199
|
message: string;
|
|
196
200
|
choices: SelectProps<T>['items'];
|
|
197
201
|
infoTable?: InfoTableProps['table'];
|
|
198
|
-
search?: (term: string) => Promise<
|
|
202
|
+
search?: (term: string) => Promise<SearchResults<T>>;
|
|
203
|
+
hasMorePages?: boolean;
|
|
199
204
|
}
|
|
200
205
|
/**
|
|
201
206
|
* Renders an autocomplete prompt to the console.
|
|
@@ -223,6 +228,7 @@ export declare function renderAutocompletePrompt<T>(props: RenderAutocompletePro
|
|
|
223
228
|
* ```
|
|
224
229
|
*/
|
|
225
230
|
export declare function renderTable<T extends ScalarDict>(props: TableProps<T>): void;
|
|
231
|
+
export { Task };
|
|
226
232
|
/**
|
|
227
233
|
* Runs async tasks and displays their progress to the console.
|
|
228
234
|
*/
|
|
@@ -235,4 +241,3 @@ export declare function renderTasks<TContext>(tasks: Task<TContext>[]): Promise<
|
|
|
235
241
|
* ```
|
|
236
242
|
*/
|
|
237
243
|
export declare function renderTextPrompt(props: Omit<TextPromptProps, 'onSubmit'>): Promise<string>;
|
|
238
|
-
export {};
|
package/dist/public/node/ui.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { consoleError } from './output.js';
|
|
2
2
|
import ConcurrentOutput from '../../private/node/ui/components/ConcurrentOutput.js';
|
|
3
|
-
import { consoleError } from '../../output.js';
|
|
4
3
|
import { render, renderOnce } from '../../private/node/ui.js';
|
|
5
4
|
import { alert } from '../../private/node/ui/alert.js';
|
|
6
5
|
import { FatalError } from '../../private/node/ui/components/FatalError.js';
|
|
@@ -230,7 +229,9 @@ export function renderConfirmationPrompt({ message, infoTable, confirmationMessa
|
|
|
230
229
|
export function renderAutocompletePrompt(props) {
|
|
231
230
|
const newProps = {
|
|
232
231
|
search(term) {
|
|
233
|
-
return Promise.resolve(
|
|
232
|
+
return Promise.resolve({
|
|
233
|
+
data: props.choices.filter((item) => item.label.toLowerCase().includes(term.toLowerCase())),
|
|
234
|
+
});
|
|
234
235
|
},
|
|
235
236
|
...props,
|
|
236
237
|
};
|
|
@@ -259,7 +260,7 @@ export function renderTable(props) {
|
|
|
259
260
|
* Runs async tasks and displays their progress to the console.
|
|
260
261
|
*/
|
|
261
262
|
export async function renderTasks(tasks) {
|
|
262
|
-
return render(React.createElement(Tasks, { tasks: tasks
|
|
263
|
+
return render(React.createElement(Tasks, { tasks: tasks }));
|
|
263
264
|
}
|
|
264
265
|
/**
|
|
265
266
|
* Renders a text prompt to the console.
|