@shopify/cli-kit 3.34.0 → 3.36.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/content-tokens.js +1 -1
- package/dist/content-tokens.js.map +1 -1
- package/dist/error.js +2 -2
- package/dist/error.js.map +1 -1
- package/dist/git.js +2 -2
- package/dist/git.js.map +1 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -6
- package/dist/index.js.map +1 -1
- package/dist/metadata.d.ts +1 -1
- package/dist/metadata.js.map +1 -1
- package/dist/monorail.d.ts +1 -1
- package/dist/monorail.js +1 -1
- package/dist/monorail.js.map +1 -1
- package/dist/output.js +3 -7
- package/dist/output.js.map +1 -1
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js.map +1 -1
- package/dist/{typing → private/common/ts}/deep-required.d.ts +3 -3
- package/dist/{typing → private/common/ts}/deep-required.js +0 -0
- package/dist/private/common/ts/deep-required.js.map +1 -0
- package/dist/{typing → private/common/ts}/overloaded-parameters.d.ts +0 -0
- package/dist/{typing → private/common/ts}/overloaded-parameters.js +0 -0
- package/dist/private/common/ts/overloaded-parameters.js.map +1 -0
- package/dist/private/node/api/graphql.js +2 -3
- package/dist/private/node/api/graphql.js.map +1 -1
- package/dist/private/node/api/headers.d.ts +11 -2
- package/dist/private/node/api/headers.js +29 -3
- package/dist/private/node/api/headers.js.map +1 -1
- package/dist/private/node/api/rest.d.ts +5 -3
- package/dist/private/node/api/rest.js +8 -7
- package/dist/private/node/api/rest.js.map +1 -1
- package/dist/private/node/constants.d.ts +42 -0
- package/dist/private/node/constants.js +58 -0
- package/dist/private/node/constants.js.map +1 -0
- package/dist/private/node/environment/service.js +2 -2
- package/dist/private/node/environment/service.js.map +1 -1
- package/dist/private/node/session/device-authorization.js +1 -1
- package/dist/private/node/session/device-authorization.js.map +1 -1
- package/dist/private/node/session/exchange.js +1 -1
- package/dist/private/node/session/exchange.js.map +1 -1
- package/dist/private/node/session/identity-token-validation.js +1 -1
- package/dist/private/node/session/identity-token-validation.js.map +1 -1
- package/dist/private/node/session/post-auth.js +10 -10
- package/dist/private/node/session/post-auth.js.map +1 -1
- package/dist/private/node/session/store.js +6 -6
- package/dist/private/node/session/store.js.map +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.js +2 -2
- package/dist/private/node/session.js.map +1 -1
- package/dist/{typing → private/node}/simple-definitions.d.ts +0 -0
- package/dist/{typing → private/node}/simple-definitions.js +0 -0
- package/dist/private/node/simple-definitions.js.map +1 -0
- package/dist/private/node/ui/alert.d.ts +1 -1
- package/dist/private/node/ui/alert.js +2 -2
- package/dist/private/node/ui/alert.js.map +1 -1
- package/dist/private/node/ui/components/Alert.d.ts +5 -0
- package/dist/private/node/ui/components/Alert.js +9 -6
- package/dist/private/node/ui/components/Alert.js.map +1 -1
- package/dist/private/node/ui/components/Alert.test.js +30 -4
- package/dist/private/node/ui/components/Alert.test.js.map +1 -1
- package/dist/private/node/ui/components/AutocompletePrompt.d.ts +12 -0
- package/dist/private/node/ui/components/AutocompletePrompt.js +111 -0
- package/dist/private/node/ui/components/AutocompletePrompt.js.map +1 -0
- package/dist/private/node/ui/components/AutocompletePrompt.test.d.ts +1 -0
- package/dist/private/node/ui/components/AutocompletePrompt.test.js +473 -0
- package/dist/private/node/ui/components/AutocompletePrompt.test.js.map +1 -0
- package/dist/private/node/ui/components/Banner.d.ts +0 -1
- package/dist/private/node/ui/components/Banner.js +4 -4
- package/dist/private/node/ui/components/Banner.js.map +1 -1
- package/dist/private/node/ui/components/Banner.test.js +10 -5
- package/dist/private/node/ui/components/Banner.test.js.map +1 -1
- package/dist/private/node/ui/components/FatalError.js +1 -1
- package/dist/private/node/ui/components/FatalError.js.map +1 -1
- package/dist/private/node/ui/components/FatalError.test.js +4 -8
- package/dist/private/node/ui/components/FatalError.test.js.map +1 -1
- package/dist/private/node/ui/components/{Table.d.ts → Prompts/InfoTable.d.ts} +2 -2
- package/dist/private/node/ui/components/{Table.js → Prompts/InfoTable.js} +6 -6
- package/dist/private/node/ui/components/Prompts/InfoTable.js.map +1 -0
- package/dist/private/node/ui/components/SelectInput.d.ts +9 -2
- package/dist/private/node/ui/components/SelectInput.js +96 -52
- package/dist/private/node/ui/components/SelectInput.js.map +1 -1
- package/dist/private/node/ui/components/SelectInput.test.js +140 -54
- package/dist/private/node/ui/components/SelectInput.test.js.map +1 -1
- package/dist/private/node/ui/components/SelectPrompt.d.ts +6 -4
- package/dist/private/node/ui/components/SelectPrompt.js +18 -11
- package/dist/private/node/ui/components/SelectPrompt.js.map +1 -1
- package/dist/private/node/ui/components/SelectPrompt.test.js +113 -23
- package/dist/private/node/ui/components/SelectPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/Table/Column.d.ts +5 -0
- package/dist/private/node/ui/components/Table/Column.js +2 -0
- package/dist/private/node/ui/components/Table/Column.js.map +1 -0
- package/dist/private/node/ui/components/Table/Row.d.ts +12 -0
- package/dist/private/node/ui/components/Table/Row.js +24 -0
- package/dist/private/node/ui/components/Table/Row.js.map +1 -0
- package/dist/private/node/ui/components/Table/ScalarDict.d.ts +5 -0
- package/dist/private/node/ui/components/Table/ScalarDict.js +2 -0
- package/dist/private/node/ui/components/Table/ScalarDict.js.map +1 -0
- package/dist/private/node/ui/components/Table/Table.d.ts +12 -0
- package/dist/private/node/ui/components/Table/Table.js +30 -0
- package/dist/private/node/ui/components/Table/Table.js.map +1 -0
- package/dist/private/node/ui/components/Table/Table.test.d.ts +1 -0
- package/dist/private/node/ui/components/Table/Table.test.js +41 -0
- package/dist/private/node/ui/components/Table/Table.test.js.map +1 -0
- package/dist/private/node/ui/components/Tasks.d.ts +6 -5
- package/dist/private/node/ui/components/Tasks.js +32 -11
- package/dist/private/node/ui/components/Tasks.js.map +1 -1
- package/dist/private/node/ui/components/Tasks.test.js +55 -9
- package/dist/private/node/ui/components/Tasks.test.js.map +1 -1
- package/dist/private/node/ui/components/TextInput.d.ts +4 -1
- package/dist/private/node/ui/components/TextInput.js +22 -13
- package/dist/private/node/ui/components/TextInput.js.map +1 -1
- package/dist/private/node/ui/components/TextInput.test.js +47 -40
- package/dist/private/node/ui/components/TextInput.test.js.map +1 -1
- package/dist/private/node/ui/components/TextPrompt.d.ts +3 -1
- package/dist/private/node/ui/components/TextPrompt.js +28 -15
- package/dist/private/node/ui/components/TextPrompt.js.map +1 -1
- package/dist/private/node/ui/components/TextPrompt.test.js +71 -15
- package/dist/private/node/ui/components/TextPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/TokenizedText.d.ts +3 -0
- package/dist/private/node/ui/components/TokenizedText.js +33 -1
- package/dist/private/node/ui/components/TokenizedText.js.map +1 -1
- package/dist/private/node/ui/utilities.d.ts +2 -0
- package/dist/private/node/ui/utilities.js +6 -0
- package/dist/private/node/ui/utilities.js.map +1 -0
- package/dist/public/common/string.d.ts +11 -0
- package/dist/public/common/string.js +21 -0
- package/dist/public/common/string.js.map +1 -1
- package/dist/{typing → public/common/ts}/pick-by-prefix.d.ts +4 -3
- package/dist/{typing → public/common/ts}/pick-by-prefix.js +0 -0
- package/dist/public/common/ts/pick-by-prefix.js.map +1 -0
- package/dist/public/common/version.d.ts +1 -0
- package/dist/public/common/version.js +2 -0
- package/dist/public/common/version.js.map +1 -0
- package/dist/public/node/analytics.js +2 -2
- package/dist/public/node/analytics.js.map +1 -1
- package/dist/public/node/api/admin.d.ts +4 -1
- package/dist/public/node/api/admin.js +5 -4
- package/dist/public/node/api/admin.js.map +1 -1
- package/dist/public/node/api/http.d.ts +0 -0
- package/dist/public/node/api/http.js +2 -0
- package/dist/public/node/api/http.js.map +1 -0
- package/dist/public/node/api/oxygen.js +1 -1
- package/dist/public/node/api/oxygen.js.map +1 -1
- package/dist/public/node/archiver.js +2 -1
- package/dist/public/node/archiver.js.map +1 -1
- package/dist/public/node/cli.js +6 -6
- package/dist/public/node/cli.js.map +1 -1
- package/dist/public/node/dot-env.js +2 -2
- package/dist/public/node/dot-env.js.map +1 -1
- package/dist/public/node/environment/local.js +17 -17
- package/dist/public/node/environment/local.js.map +1 -1
- package/dist/public/node/environment/spin.js +6 -6
- package/dist/public/node/environment/spin.js.map +1 -1
- package/dist/public/node/error-handler.js +13 -10
- package/dist/public/node/error-handler.js.map +1 -1
- package/dist/public/node/framework.js +2 -2
- package/dist/public/node/framework.js.map +1 -1
- package/dist/public/node/fs.d.ts +241 -4
- package/dist/public/node/fs.js +366 -2
- package/dist/public/node/fs.js.map +1 -1
- package/dist/public/node/git.d.ts +90 -0
- package/dist/public/node/git.js +174 -0
- package/dist/public/node/git.js.map +1 -0
- package/dist/public/node/github.js +1 -1
- package/dist/public/node/github.js.map +1 -1
- package/dist/{http/fetch.d.ts → public/node/http.d.ts} +18 -7
- package/dist/{http/fetch.js → public/node/http.js} +21 -8
- package/dist/public/node/http.js.map +1 -0
- package/dist/public/node/liquid.js +9 -9
- package/dist/public/node/liquid.js.map +1 -1
- package/dist/public/node/node-package-manager.d.ts +20 -9
- package/dist/public/node/node-package-manager.js +19 -25
- package/dist/public/node/node-package-manager.js.map +1 -1
- package/dist/public/node/path.d.ts +22 -0
- package/dist/{path.js → public/node/path.js} +8 -20
- package/dist/public/node/path.js.map +1 -0
- package/dist/public/node/presets.js +5 -5
- package/dist/public/node/presets.js.map +1 -1
- package/dist/public/node/ruby.js +29 -33
- package/dist/public/node/ruby.js.map +1 -1
- package/dist/public/node/session.js +2 -2
- package/dist/public/node/session.js.map +1 -1
- package/dist/public/node/ui.d.ts +63 -9
- package/dist/public/node/ui.js +83 -8
- package/dist/public/node/ui.js.map +1 -1
- package/dist/public/node/vscode.js +8 -8
- package/dist/public/node/vscode.js.map +1 -1
- package/dist/secure-store.js +4 -4
- package/dist/secure-store.js.map +1 -1
- package/dist/store.d.ts +10 -10
- package/dist/store.js +21 -22
- package/dist/store.js.map +1 -1
- package/dist/testing/store.js +3 -3
- package/dist/testing/store.js.map +1 -1
- package/dist/testing/ui.d.ts +4 -1
- package/dist/testing/ui.js +24 -1
- package/dist/testing/ui.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/executor.d.ts +2 -14
- package/dist/ui/executor.js +38 -72
- package/dist/ui/executor.js.map +1 -1
- package/dist/ui.js +9 -26
- package/dist/ui.js.map +1 -1
- package/package.json +4 -6
- package/dist/constants.d.ts +0 -48
- package/dist/constants.js +0 -67
- package/dist/constants.js.map +0 -1
- package/dist/file.d.ts +0 -98
- package/dist/file.js +0 -216
- package/dist/file.js.map +0 -1
- package/dist/http/fetch.js.map +0 -1
- package/dist/http/formdata.d.ts +0 -3
- package/dist/http/formdata.js +0 -6
- package/dist/http/formdata.js.map +0 -1
- package/dist/http.d.ts +0 -26
- package/dist/http.js +0 -31
- package/dist/http.js.map +0 -1
- package/dist/npm.d.ts +0 -27
- package/dist/npm.js +0 -20
- package/dist/npm.js.map +0 -1
- package/dist/path.d.ts +0 -25
- package/dist/path.js.map +0 -1
- package/dist/private/node/ui/components/Table.js.map +0 -1
- package/dist/typing/deep-required.js.map +0 -1
- package/dist/typing/overloaded-parameters.js.map +0 -1
- package/dist/typing/pick-by-prefix.js.map +0 -1
- package/dist/typing/simple-definitions.js.map +0 -1
- package/dist/ui/inquirer/autocomplete.d.ts +0 -11
- package/dist/ui/inquirer/autocomplete.js +0 -110
- package/dist/ui/inquirer/autocomplete.js.map +0 -1
- package/dist/ui/inquirer/input.d.ts +0 -16
- package/dist/ui/inquirer/input.js +0 -45
- package/dist/ui/inquirer/input.js.map +0 -1
- package/dist/ui/inquirer/password.d.ts +0 -7
- package/dist/ui/inquirer/password.js +0 -8
- package/dist/ui/inquirer/password.js.map +0 -1
- package/dist/ui/inquirer/select.d.ts +0 -14
- package/dist/ui/inquirer/select.js +0 -26
- package/dist/ui/inquirer/select.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { normalizeStoreFqdn } from './environment/fqdn.js';
|
|
2
2
|
import * as secureStore from '../../private/node/session/store.js';
|
|
3
3
|
import { exchangeCustomPartnerToken } from '../../private/node/session/exchange.js';
|
|
4
|
-
import constants from '../../constants.js';
|
|
5
4
|
import { content, token, debug } from '../../output.js';
|
|
6
5
|
import { Bug } from '../../error.js';
|
|
7
6
|
import { ensureAuthenticated } from '../../private/node/session.js';
|
|
7
|
+
import { environmentVariables } from '../../private/node/constants.js';
|
|
8
8
|
/**
|
|
9
9
|
* Ensure that we have a valid session to access the Partners API.
|
|
10
10
|
* If SHOPIFY_CLI_PARTNERS_TOKEN exists, that token will be used to obtain a valid Partners Token
|
|
@@ -18,7 +18,7 @@ export async function ensureAuthenticatedPartners(scopes = [], env = process.env
|
|
|
18
18
|
debug(content `Ensuring that the user is authenticated with the Partners API with the following scopes:
|
|
19
19
|
${token.json(scopes)}
|
|
20
20
|
`);
|
|
21
|
-
const envToken = env[
|
|
21
|
+
const envToken = env[environmentVariables.partnersToken];
|
|
22
22
|
if (envToken) {
|
|
23
23
|
return (await exchangeCustomPartnerToken(envToken)).accessToken;
|
|
24
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/public/node/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,WAAW,MAAM,qCAAqC,CAAA;
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/public/node/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,WAAW,MAAM,qCAAqC,CAAA;AAClE,OAAO,EAAC,0BAA0B,EAAC,MAAM,wCAAwC,CAAA;AACjF,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAC,GAAG,EAAC,MAAM,gBAAgB,CAAA;AAClC,OAAO,EAAC,mBAAmB,EAAC,MAAM,+BAA+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b,SAAmB,EAAE,EACrB,YAAY,GAAG,KAAK;IAEpB,KAAK,CAAC,OAAO,CAAA,sGAAsG,KAAK,CAAC,GAAG,CAC1H,KAAK,CACN;EACD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;CACnB,CAAC,CAAA;IACA,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,EAAC,QAAQ,EAAE,EAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAC,EAAC,EAAE,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;IAC3G,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;QACjB,MAAM,IAAI,GAAG,CAAC,mDAAmD,CAAC,CAAA;KACnE;IACD,OAAO,MAAM,CAAC,KAAK,CAAA;AACrB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,KAAa,EACb,QAA4B,EAC5B,SAAmB,EAAE,EACrB,YAAY,GAAG,KAAK;IAEpB,KAAK,CAAC,OAAO,CAAA;EACb,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;CACnB,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 * as secureStore from '../../private/node/session/store.js'\nimport {exchangeCustomPartnerToken} from '../../private/node/session/exchange.js'\nimport {content, token, debug} from '../../output.js'\nimport {Bug} from '../../error.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 debug(content`Ensuring that the user is authenticated with the Partners API with the following scopes:\n${token.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 Bug('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 debug(content`Ensuring that the user is authenticated with the Storefront API with the following scopes:\n${token.json(scopes)}\n`)\n const tokens = await ensureAuthenticated({storefrontRendererApi: {scopes}})\n if (!tokens.storefront) {\n throw new Bug('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 debug(content`Ensuring that the user is authenticated with the Admin API with the following scopes for the store ${token.raw(\n store,\n )}:\n${token.json(scopes)}\n`)\n const tokens = await ensureAuthenticated({adminApi: {scopes, storeFqdn: store}}, process.env, forceRefresh)\n if (!tokens.admin) {\n throw new Bug('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 debug(content`Ensuring that the user is authenticated with the Theme API with the following scopes:\n${token.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"]}
|
package/dist/public/node/ui.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { OutputProcess } from '../../output.js';
|
|
2
2
|
import { Fatal } from '../../error.js';
|
|
3
3
|
import { AlertProps } from '../../private/node/ui/components/Alert.js';
|
|
4
|
+
import ScalarDict from '../../private/node/ui/components/Table/ScalarDict.js';
|
|
5
|
+
import { TableProps } from '../../private/node/ui/components/Table/Table.js';
|
|
4
6
|
import { Props as SelectPromptProps } from '../../private/node/ui/components/SelectPrompt.js';
|
|
5
7
|
import { Task } from '../../private/node/ui/components/Tasks.js';
|
|
6
8
|
import { Props as TextPromptProps } from '../../private/node/ui/components/TextPrompt.js';
|
|
9
|
+
import { Item as SelectItem, Props as SelectProps } from '../../private/node/ui/components/SelectInput.js';
|
|
10
|
+
import { Props as InfoTableProps } from '../../private/node/ui/components/Prompts/InfoTable.js';
|
|
7
11
|
import { RenderOptions } from 'ink';
|
|
8
12
|
import { AbortController } from '@shopify/cli-kit/node/abort';
|
|
9
13
|
interface RenderConcurrentOptions {
|
|
@@ -16,7 +20,7 @@ interface RenderConcurrentOptions {
|
|
|
16
20
|
* Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.
|
|
17
21
|
*/
|
|
18
22
|
export declare function renderConcurrent({ processes, abortController, showTimestamps, renderOptions, }: RenderConcurrentOptions): Promise<void>;
|
|
19
|
-
declare type RenderAlertOptions = Omit<AlertProps, 'type'>;
|
|
23
|
+
export declare type RenderAlertOptions = Omit<AlertProps, 'type'>;
|
|
20
24
|
/**
|
|
21
25
|
* Renders an information banner to the console.
|
|
22
26
|
*
|
|
@@ -145,40 +149,90 @@ export declare function renderFatalError(error: Fatal): void;
|
|
|
145
149
|
/**
|
|
146
150
|
* Renders a select prompt to the console.
|
|
147
151
|
*
|
|
152
|
+
* ```
|
|
148
153
|
* ? Associate your project with the org Castile Ventures?
|
|
149
154
|
*
|
|
150
155
|
* Add: • new-ext
|
|
151
156
|
*
|
|
152
157
|
* Remove: • integrated-demand-ext
|
|
153
158
|
* • order-discount
|
|
154
|
-
|
|
159
|
+
*
|
|
155
160
|
* \> (f) first
|
|
156
161
|
* (s) second
|
|
157
162
|
* (3) third
|
|
158
163
|
* (4) fourth
|
|
159
164
|
* (5) seventh
|
|
160
165
|
* (6) tenth
|
|
161
|
-
|
|
166
|
+
*
|
|
162
167
|
* Automations
|
|
163
168
|
* (7) fifth
|
|
164
169
|
* (8) sixth
|
|
165
|
-
|
|
170
|
+
*
|
|
166
171
|
* Merchant Admin
|
|
167
172
|
* (9) eighth
|
|
168
173
|
* (10) ninth
|
|
169
|
-
|
|
170
|
-
*
|
|
174
|
+
*
|
|
175
|
+
* Press ↑↓ arrows to select, enter to confirm
|
|
176
|
+
* ```
|
|
171
177
|
*/
|
|
172
178
|
export declare function renderSelectPrompt<T>(props: Omit<SelectPromptProps<T>, 'onSubmit'>): Promise<T>;
|
|
179
|
+
interface RenderConfirmationPromptOptions extends Pick<SelectPromptProps<boolean>, 'message' | 'infoTable'> {
|
|
180
|
+
confirmationMessage?: string;
|
|
181
|
+
cancellationMessage?: string;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Renders a confirmation prompt to the console.
|
|
185
|
+
*
|
|
186
|
+
* ? Do you want to continue?
|
|
187
|
+
*
|
|
188
|
+
* \> (y) Yes, confirm
|
|
189
|
+
* (n) No, canccel
|
|
190
|
+
*
|
|
191
|
+
* Press ↑↓ arrows to select, enter to confirm
|
|
192
|
+
*/
|
|
193
|
+
export declare function renderConfirmationPrompt({ message, infoTable, confirmationMessage, cancellationMessage, }: RenderConfirmationPromptOptions): Promise<boolean>;
|
|
194
|
+
interface RenderAutocompletePromptProps<T> {
|
|
195
|
+
message: string;
|
|
196
|
+
choices: SelectProps<T>['items'];
|
|
197
|
+
infoTable?: InfoTableProps['table'];
|
|
198
|
+
search?: (term: string) => Promise<SelectItem<T>[]>;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Renders an autocomplete prompt to the console.
|
|
202
|
+
* ```
|
|
203
|
+
* ? Select a template Type to search...
|
|
204
|
+
|
|
205
|
+
* \> first
|
|
206
|
+
* second
|
|
207
|
+
* third
|
|
208
|
+
|
|
209
|
+
* Press ↑↓ arrows to select, enter to confirm
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
export declare function renderAutocompletePrompt<T>(props: RenderAutocompletePromptProps<T>): Promise<T>;
|
|
213
|
+
/**
|
|
214
|
+
* Renders a table to the console.
|
|
215
|
+
*
|
|
216
|
+
* ```
|
|
217
|
+
* name role Identifier
|
|
218
|
+
* ──────────────────────── ───────────── ──────────
|
|
219
|
+
* Dawn [live] #1361
|
|
220
|
+
* Studio #1363
|
|
221
|
+
* Debut [unpublished] #1374
|
|
222
|
+
* Development (1a23b4-MBP) [development] #1368
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
export declare function renderTable<T extends ScalarDict>(props: TableProps<T>): void;
|
|
173
226
|
/**
|
|
174
227
|
* Runs async tasks and displays their progress to the console.
|
|
175
228
|
*/
|
|
176
|
-
export declare function renderTasks(tasks: Task[]): Promise<void>;
|
|
229
|
+
export declare function renderTasks<TContext>(tasks: Task<TContext>[]): Promise<void>;
|
|
177
230
|
/**
|
|
178
231
|
* Renders a text prompt to the console.
|
|
179
|
-
*
|
|
232
|
+
* ```
|
|
180
233
|
* ? What is your name?
|
|
181
234
|
* \> John
|
|
235
|
+
* ```
|
|
182
236
|
*/
|
|
183
|
-
export declare function renderTextPrompt(props: Omit<TextPromptProps, 'onSubmit'>): Promise<
|
|
237
|
+
export declare function renderTextPrompt(props: Omit<TextPromptProps, 'onSubmit'>): Promise<string>;
|
|
184
238
|
export {};
|
package/dist/public/node/ui.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { isUnitTest } from './environment/local.js';
|
|
1
2
|
import ConcurrentOutput from '../../private/node/ui/components/ConcurrentOutput.js';
|
|
2
3
|
import { consoleError } from '../../output.js';
|
|
3
4
|
import { render, renderOnce } from '../../private/node/ui.js';
|
|
4
5
|
import { alert } from '../../private/node/ui/alert.js';
|
|
5
6
|
import { FatalError } from '../../private/node/ui/components/FatalError.js';
|
|
7
|
+
import Table from '../../private/node/ui/components/Table/Table.js';
|
|
6
8
|
import { SelectPrompt } from '../../private/node/ui/components/SelectPrompt.js';
|
|
7
9
|
import { Tasks } from '../../private/node/ui/components/Tasks.js';
|
|
8
10
|
import { TextPrompt } from '../../private/node/ui/components/TextPrompt.js';
|
|
11
|
+
import { AutocompletePrompt } from '../../private/node/ui/components/AutocompletePrompt.js';
|
|
9
12
|
import React from 'react';
|
|
10
13
|
import { AbortController } from '@shopify/cli-kit/node/abort';
|
|
11
14
|
/**
|
|
@@ -150,29 +153,31 @@ export function renderFatalError(error) {
|
|
|
150
153
|
/**
|
|
151
154
|
* Renders a select prompt to the console.
|
|
152
155
|
*
|
|
156
|
+
* ```
|
|
153
157
|
* ? Associate your project with the org Castile Ventures?
|
|
154
158
|
*
|
|
155
159
|
* Add: • new-ext
|
|
156
160
|
*
|
|
157
161
|
* Remove: • integrated-demand-ext
|
|
158
162
|
* • order-discount
|
|
159
|
-
|
|
163
|
+
*
|
|
160
164
|
* \> (f) first
|
|
161
165
|
* (s) second
|
|
162
166
|
* (3) third
|
|
163
167
|
* (4) fourth
|
|
164
168
|
* (5) seventh
|
|
165
169
|
* (6) tenth
|
|
166
|
-
|
|
170
|
+
*
|
|
167
171
|
* Automations
|
|
168
172
|
* (7) fifth
|
|
169
173
|
* (8) sixth
|
|
170
|
-
|
|
174
|
+
*
|
|
171
175
|
* Merchant Admin
|
|
172
176
|
* (9) eighth
|
|
173
177
|
* (10) ninth
|
|
174
|
-
|
|
175
|
-
*
|
|
178
|
+
*
|
|
179
|
+
* Press ↑↓ arrows to select, enter to confirm
|
|
180
|
+
* ```
|
|
176
181
|
*/
|
|
177
182
|
export function renderSelectPrompt(props) {
|
|
178
183
|
return new Promise((resolve, reject) => {
|
|
@@ -181,17 +186,87 @@ export function renderSelectPrompt(props) {
|
|
|
181
186
|
}).catch(reject);
|
|
182
187
|
});
|
|
183
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Renders a confirmation prompt to the console.
|
|
191
|
+
*
|
|
192
|
+
* ? Do you want to continue?
|
|
193
|
+
*
|
|
194
|
+
* \> (y) Yes, confirm
|
|
195
|
+
* (n) No, canccel
|
|
196
|
+
*
|
|
197
|
+
* Press ↑↓ arrows to select, enter to confirm
|
|
198
|
+
*/
|
|
199
|
+
export function renderConfirmationPrompt({ message, infoTable, confirmationMessage = 'Yes, confirm', cancellationMessage = 'No, cancel', }) {
|
|
200
|
+
const choices = [
|
|
201
|
+
{
|
|
202
|
+
label: confirmationMessage,
|
|
203
|
+
value: true,
|
|
204
|
+
key: 'y',
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
label: cancellationMessage,
|
|
208
|
+
value: false,
|
|
209
|
+
key: 'n',
|
|
210
|
+
},
|
|
211
|
+
];
|
|
212
|
+
return renderSelectPrompt({
|
|
213
|
+
choices,
|
|
214
|
+
message,
|
|
215
|
+
infoTable,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Renders an autocomplete prompt to the console.
|
|
220
|
+
* ```
|
|
221
|
+
* ? Select a template Type to search...
|
|
222
|
+
|
|
223
|
+
* \> first
|
|
224
|
+
* second
|
|
225
|
+
* third
|
|
226
|
+
|
|
227
|
+
* Press ↑↓ arrows to select, enter to confirm
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
export function renderAutocompletePrompt(props) {
|
|
231
|
+
const newProps = {
|
|
232
|
+
search(term) {
|
|
233
|
+
return Promise.resolve(props.choices.filter((item) => item.label.toLowerCase().includes(term.toLowerCase())));
|
|
234
|
+
},
|
|
235
|
+
...props,
|
|
236
|
+
};
|
|
237
|
+
return new Promise((resolve, reject) => {
|
|
238
|
+
render(React.createElement(AutocompletePrompt, { ...newProps, onSubmit: (value) => resolve(value) }), {
|
|
239
|
+
exitOnCtrlC: false,
|
|
240
|
+
}).catch(reject);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Renders a table to the console.
|
|
245
|
+
*
|
|
246
|
+
* ```
|
|
247
|
+
* name role Identifier
|
|
248
|
+
* ──────────────────────── ───────────── ──────────
|
|
249
|
+
* Dawn [live] #1361
|
|
250
|
+
* Studio #1363
|
|
251
|
+
* Debut [unpublished] #1374
|
|
252
|
+
* Development (1a23b4-MBP) [development] #1368
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
export function renderTable(props) {
|
|
256
|
+
return renderOnce(React.createElement(Table, { ...props }));
|
|
257
|
+
}
|
|
184
258
|
/**
|
|
185
259
|
* Runs async tasks and displays their progress to the console.
|
|
186
260
|
*/
|
|
187
|
-
export function renderTasks(tasks) {
|
|
188
|
-
return render(React.createElement(Tasks, { tasks: tasks }));
|
|
261
|
+
export async function renderTasks(tasks) {
|
|
262
|
+
return render(React.createElement(Tasks, { tasks: tasks, silent: isUnitTest() }));
|
|
189
263
|
}
|
|
190
264
|
/**
|
|
191
265
|
* Renders a text prompt to the console.
|
|
192
|
-
*
|
|
266
|
+
* ```
|
|
193
267
|
* ? What is your name?
|
|
194
268
|
* \> John
|
|
269
|
+
* ```
|
|
195
270
|
*/
|
|
196
271
|
export function renderTextPrompt(props) {
|
|
197
272
|
return new Promise((resolve, reject) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/public/node/ui.tsx"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,sDAAsD,CAAA;AACnF,OAAO,EAAC,YAAY,EAAgB,MAAM,iBAAiB,CAAA;AAC3D,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,0BAA0B,CAAA;AAE3D,OAAO,EAAC,KAAK,EAAC,MAAM,gCAAgC,CAAA;AAEpD,OAAO,EAAC,UAAU,EAAC,MAAM,gDAAgD,CAAA;AACzE,OAAO,EAAC,YAAY,EAA6B,MAAM,kDAAkD,CAAA;AACzG,OAAO,EAAC,KAAK,EAAO,MAAM,2CAA2C,CAAA;AACrE,OAAO,EAAC,UAAU,EAA2B,MAAM,gDAAgD,CAAA;AACnG,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAS3D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EACrC,SAAS,EACT,eAAe,EACf,cAAc,GAAG,IAAI,EACrB,aAAa,GAAG,EAAE,GACM;IACxB,OAAO,MAAM,CACX,oBAAC,gBAAgB,IACf,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,eAAe,IAAI,IAAI,eAAe,EAAE,EACzD,cAAc,EAAE,cAAc,GAC9B,EACF,aAAa,CACd,CAAA;AACH,CAAC;AAID;;;;;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C,CAAA;AACxC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAwC;IACvE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,CAAC,oBAAC,UAAU,OAAK,KAAK,EAAE,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAI,EAAE;YAC7E,WAAW,EAAE,KAAK;SACnB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import ConcurrentOutput from '../../private/node/ui/components/ConcurrentOutput.js'\nimport {consoleError, OutputProcess} from '../../output.js'\nimport {render, renderOnce} from '../../private/node/ui.js'\nimport {Fatal} from '../../error.js'\nimport {alert} from '../../private/node/ui/alert.js'\nimport {AlertProps} from '../../private/node/ui/components/Alert.js'\nimport {FatalError} from '../../private/node/ui/components/FatalError.js'\nimport {SelectPrompt, Props as SelectPromptProps} from '../../private/node/ui/components/SelectPrompt.js'\nimport {Tasks, Task} from '../../private/node/ui/components/Tasks.js'\nimport {TextPrompt, Props as TextPromptProps} from '../../private/node/ui/components/TextPrompt.js'\nimport React from 'react'\nimport {RenderOptions} from 'ink'\nimport {AbortController} from '@shopify/cli-kit/node/abort'\n\ninterface RenderConcurrentOptions {\n processes: OutputProcess[]\n abortController?: AbortController\n showTimestamps?: boolean\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.\n */\nexport async function renderConcurrent({\n processes,\n abortController,\n showTimestamps = true,\n renderOptions = {},\n}: RenderConcurrentOptions) {\n return render(\n <ConcurrentOutput\n processes={processes}\n abortController={abortController ?? new AbortController()}\n showTimestamps={showTimestamps}\n />,\n renderOptions,\n )\n}\n\ntype RenderAlertOptions = Omit<AlertProps, 'type'>\n\n/**\n * Renders an information banner to the console.\n *\n * Basic:\n *\n * ```\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ Body │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n *\n * Complete:\n * ```\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * │ Body │\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 dev docs: │\n * │ https://shopify.dev │\n * │ │\n * │ Link: https://shopify.com │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderInfo(options: RenderAlertOptions) {\n return alert({...options, type: 'info'})\n}\n\n/**\n * Renders a success banner to the console.\n *\n * Basic:\n *\n * ```\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n *\n * Complete:\n * ```\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * │ Body │\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 dev docs: │\n * │ https://shopify.dev │\n * │ │\n * │ Link: https://shopify.com │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderSuccess(options: RenderAlertOptions) {\n return alert({...options, type: 'success'})\n}\n\n/**\n * Renders a warning banner to the console.\n *\n * Basic:\n *\n * ```\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n *\n * Complete:\n * ```\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * │ Body │\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 dev docs: │\n * │ https://shopify.dev │\n * │ │\n * │ Link: https://shopify.com │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderWarning(options: RenderAlertOptions) {\n return alert({...options, type: 'warning'})\n}\n\n/**\n * Renders a Fatal error to the console inside a banner.\n *\n * ```\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Couldn't connect to the Shopify Partner Dashboard. │\n * │ │\n * │ Check your internet connection and try again. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderFatalError(error: Fatal) {\n return renderOnce(<FatalError error={error} />, 'error', consoleError)\n}\n\n/**\n * Renders a select prompt to the console.\n *\n * ? Associate your project with the org Castile Ventures?\n *\n * Add: • new-ext\n *\n * Remove: • integrated-demand-ext\n * • order-discount\n\n * \\> (f) first\n * (s) second\n * (3) third\n * (4) fourth\n * (5) seventh\n * (6) tenth\n\n * Automations\n * (7) fifth\n * (8) sixth\n\n * Merchant Admin\n * (9) eighth\n * (10) ninth\n\n * navigate with arrows, enter to select\n */\nexport function renderSelectPrompt<T>(props: Omit<SelectPromptProps<T>, 'onSubmit'>): Promise<T> {\n return new Promise((resolve, reject) => {\n render(<SelectPrompt {...props} onSubmit={(value: T) => resolve(value)} />, {\n exitOnCtrlC: false,\n }).catch(reject)\n })\n}\n\n/**\n * Runs async tasks and displays their progress to the console.\n */\nexport function renderTasks(tasks: Task[]) {\n return render(<Tasks tasks={tasks} />)\n}\n\n/**\n * Renders a text prompt to the console.\n *\n * ? What is your name?\n * \\> John\n */\nexport function renderTextPrompt(props: Omit<TextPromptProps, 'onSubmit'>) {\n return new Promise((resolve, reject) => {\n render(<TextPrompt {...props} onSubmit={(value: string) => resolve(value)} />, {\n exitOnCtrlC: false,\n }).catch(reject)\n })\n}\n"]}
|
|
1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C,oBAAC,UAAU,OAAK,KAAK,EAAE,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAI,EAAE;YAC7E,WAAW,EAAE,KAAK;SACnB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {isUnitTest} from './environment/local.js'\nimport ConcurrentOutput from '../../private/node/ui/components/ConcurrentOutput.js'\nimport {consoleError, OutputProcess} from '../../output.js'\nimport {render, renderOnce} from '../../private/node/ui.js'\nimport {Fatal} from '../../error.js'\nimport {alert} from '../../private/node/ui/alert.js'\nimport {AlertProps} from '../../private/node/ui/components/Alert.js'\nimport {FatalError} from '../../private/node/ui/components/FatalError.js'\nimport ScalarDict from '../../private/node/ui/components/Table/ScalarDict.js'\nimport Table, {TableProps} from '../../private/node/ui/components/Table/Table.js'\nimport {SelectPrompt, Props as SelectPromptProps} from '../../private/node/ui/components/SelectPrompt.js'\nimport {Tasks, Task} from '../../private/node/ui/components/Tasks.js'\nimport {TextPrompt, Props as TextPromptProps} from '../../private/node/ui/components/TextPrompt.js'\nimport {Item as SelectItem, Props as SelectProps} from '../../private/node/ui/components/SelectInput.js'\nimport {Props as InfoTableProps} from '../../private/node/ui/components/Prompts/InfoTable.js'\nimport {AutocompletePrompt} from '../../private/node/ui/components/AutocompletePrompt.js'\nimport React from 'react'\nimport {RenderOptions} from 'ink'\nimport {AbortController} from '@shopify/cli-kit/node/abort'\n\ninterface RenderConcurrentOptions {\n processes: OutputProcess[]\n abortController?: AbortController\n showTimestamps?: boolean\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.\n */\nexport async function renderConcurrent({\n processes,\n abortController,\n showTimestamps = true,\n renderOptions = {},\n}: RenderConcurrentOptions) {\n return render(\n <ConcurrentOutput\n processes={processes}\n abortController={abortController ?? new AbortController()}\n showTimestamps={showTimestamps}\n />,\n renderOptions,\n )\n}\n\nexport type RenderAlertOptions = Omit<AlertProps, 'type'>\n\n/**\n * Renders an information banner to the console.\n *\n * Basic:\n *\n * ```\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ Body │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n *\n * Complete:\n * ```\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * │ Body │\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 dev docs: │\n * │ https://shopify.dev │\n * │ │\n * │ Link: https://shopify.com │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderInfo(options: RenderAlertOptions) {\n return alert({...options, type: 'info'})\n}\n\n/**\n * Renders a success banner to the console.\n *\n * Basic:\n *\n * ```\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n *\n * Complete:\n * ```\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * │ Body │\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 dev docs: │\n * │ https://shopify.dev │\n * │ │\n * │ Link: https://shopify.com │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderSuccess(options: RenderAlertOptions) {\n return alert({...options, type: 'success'})\n}\n\n/**\n * Renders a warning banner to the console.\n *\n * Basic:\n *\n * ```\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n *\n * Complete:\n * ```\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * │ Body │\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 dev docs: │\n * │ https://shopify.dev │\n * │ │\n * │ Link: https://shopify.com │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderWarning(options: RenderAlertOptions) {\n return alert({...options, type: 'warning'})\n}\n\n/**\n * Renders a Fatal error to the console inside a banner.\n *\n * ```\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Couldn't connect to the Shopify Partner Dashboard. │\n * │ │\n * │ Check your internet connection and try again. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderFatalError(error: Fatal) {\n return renderOnce(<FatalError error={error} />, 'error', consoleError)\n}\n\n/**\n * Renders a select prompt to the console.\n *\n * ```\n * ? Associate your project with the org Castile Ventures?\n *\n * Add: • new-ext\n *\n * Remove: • integrated-demand-ext\n * • order-discount\n *\n * \\> (f) first\n * (s) second\n * (3) third\n * (4) fourth\n * (5) seventh\n * (6) tenth\n *\n * Automations\n * (7) fifth\n * (8) sixth\n *\n * Merchant Admin\n * (9) eighth\n * (10) ninth\n *\n * Press ↑↓ arrows to select, enter to confirm\n * ```\n */\nexport function renderSelectPrompt<T>(props: Omit<SelectPromptProps<T>, 'onSubmit'>): Promise<T> {\n return new Promise((resolve, reject) => {\n render(<SelectPrompt {...props} onSubmit={(value: T) => resolve(value)} />, {\n exitOnCtrlC: false,\n }).catch(reject)\n })\n}\n\ninterface RenderConfirmationPromptOptions extends Pick<SelectPromptProps<boolean>, 'message' | 'infoTable'> {\n confirmationMessage?: string\n cancellationMessage?: string\n}\n\n/**\n * Renders a confirmation prompt to the console.\n *\n * ? Do you want to continue?\n *\n * \\> (y) Yes, confirm\n * (n) No, canccel\n *\n * Press ↑↓ arrows to select, enter to confirm\n */\nexport function renderConfirmationPrompt({\n message,\n infoTable,\n confirmationMessage = 'Yes, confirm',\n cancellationMessage = 'No, cancel',\n}: RenderConfirmationPromptOptions): Promise<boolean> {\n const choices = [\n {\n label: confirmationMessage,\n value: true,\n key: 'y',\n },\n {\n label: cancellationMessage,\n value: false,\n key: 'n',\n },\n ]\n\n return renderSelectPrompt({\n choices,\n message,\n infoTable,\n })\n}\n\ninterface RenderAutocompletePromptProps<T> {\n message: string\n choices: SelectProps<T>['items']\n infoTable?: InfoTableProps['table']\n search?: (term: string) => Promise<SelectItem<T>[]>\n}\n\n/**\n * Renders an autocomplete prompt to the console.\n * ```\n * ? Select a template Type to search...\n\n * \\> first\n * second\n * third\n\n * Press ↑↓ arrows to select, enter to confirm\n * ```\n */\nexport function renderAutocompletePrompt<T>(props: RenderAutocompletePromptProps<T>): Promise<T> {\n const newProps = {\n search(term: string) {\n return Promise.resolve(props.choices.filter((item) => item.label.toLowerCase().includes(term.toLowerCase())))\n },\n ...props,\n }\n\n return new Promise((resolve, reject) => {\n render(<AutocompletePrompt {...newProps} onSubmit={(value: T) => resolve(value)} />, {\n exitOnCtrlC: false,\n }).catch(reject)\n })\n}\n\n/**\n * Renders a table to the console.\n *\n * ```\n * name role Identifier\n * ──────────────────────── ───────────── ──────────\n * Dawn [live] #1361\n * Studio #1363\n * Debut [unpublished] #1374\n * Development (1a23b4-MBP) [development] #1368\n * ```\n */\nexport function renderTable<T extends ScalarDict>(props: TableProps<T>) {\n return renderOnce(<Table {...props} />)\n}\n\n/**\n * Runs async tasks and displays their progress to the console.\n */\nexport async function renderTasks<TContext>(tasks: Task<TContext>[]) {\n return render(<Tasks tasks={tasks} silent={isUnitTest()} />)\n}\n\n/**\n * Renders a text prompt to the console.\n * ```\n * ? What is your name?\n * \\> John\n * ```\n */\nexport function renderTextPrompt(props: Omit<TextPromptProps, 'onSubmit'>): Promise<string> {\n return new Promise((resolve, reject) => {\n render(<TextPrompt {...props} onSubmit={(value: string) => resolve(value)} />, {\n exitOnCtrlC: false,\n }).catch(reject)\n })\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { fileExists, writeFile, readFile, findPathUp } from './fs.js';
|
|
2
|
+
import { joinPath } from './path.js';
|
|
3
3
|
import { content, token, debug } from '../../output.js';
|
|
4
4
|
/**
|
|
5
5
|
* Check if user editor is VS Code.
|
|
@@ -9,11 +9,11 @@ import { content, token, debug } from '../../output.js';
|
|
|
9
9
|
*/
|
|
10
10
|
export async function isVSCode(root = process.cwd()) {
|
|
11
11
|
debug(content `Checking if the directory ${token.path(root)} or any of its parents has a .vscode directory... `);
|
|
12
|
-
const config = await
|
|
12
|
+
const config = await findPathUp(joinPath(root, '.vscode'), { type: 'directory' });
|
|
13
13
|
if (!config) {
|
|
14
14
|
return false;
|
|
15
15
|
}
|
|
16
|
-
return
|
|
16
|
+
return fileExists(config);
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Add VSCode extension recommendations.
|
|
@@ -25,18 +25,18 @@ export async function addRecommendedExtensions(directory, recommendations) {
|
|
|
25
25
|
debug(content `Adding VSCode recommended extensions at ${token.path(directory)}:
|
|
26
26
|
${token.json(recommendations)}
|
|
27
27
|
`);
|
|
28
|
-
const extensionsPath =
|
|
28
|
+
const extensionsPath = joinPath(directory, '.vscode/extensions.json');
|
|
29
29
|
if (await isVSCode(directory)) {
|
|
30
30
|
let originalExtensionsJson = { recommendations: [] };
|
|
31
|
-
if (await
|
|
32
|
-
const originalExtensionsFile = await
|
|
31
|
+
if (await fileExists(extensionsPath)) {
|
|
32
|
+
const originalExtensionsFile = await readFile(extensionsPath);
|
|
33
33
|
originalExtensionsJson = JSON.parse(originalExtensionsFile);
|
|
34
34
|
}
|
|
35
35
|
const newExtensionsJson = {
|
|
36
36
|
...originalExtensionsJson,
|
|
37
37
|
recommendations: [...originalExtensionsJson.recommendations, ...recommendations],
|
|
38
38
|
};
|
|
39
|
-
await
|
|
39
|
+
await writeFile(extensionsPath, JSON.stringify(newExtensionsJson, null, 2));
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
//# sourceMappingURL=vscode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vscode.js","sourceRoot":"","sources":["../../../src/public/node/vscode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"vscode.js","sourceRoot":"","sources":["../../../src/public/node/vscode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,SAAS,CAAA;AACnE,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAA;AAClC,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,iBAAiB,CAAA;AAErD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE;IACjD,KAAK,CAAC,OAAO,CAAA,6BAA6B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAA;IAC/G,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,EAAC,IAAI,EAAE,WAAW,EAAC,CAAC,CAAA;IAE/E,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,KAAK,CAAA;KACb;IAED,OAAO,UAAU,CAAC,MAAM,CAAC,CAAA;AAC3B,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,SAAiB,EAAE,eAAyB;IACzF,KAAK,CAAC,OAAO,CAAA,2CAA2C,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;EAC7E,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;GAC1B,CAAC,CAAA;IACF,MAAM,cAAc,GAAG,QAAQ,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAA;IAErE,IAAI,MAAM,QAAQ,CAAC,SAAS,CAAC,EAAE;QAC7B,IAAI,sBAAsB,GAAG,EAAC,eAAe,EAAE,EAAE,EAAC,CAAA;QAClD,IAAI,MAAM,UAAU,CAAC,cAAc,CAAC,EAAE;YACpC,MAAM,sBAAsB,GAAG,MAAM,QAAQ,CAAC,cAAc,CAAC,CAAA;YAC7D,sBAAsB,GAAG,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAA;SAC5D;QACD,MAAM,iBAAiB,GAAG;YACxB,GAAG,sBAAsB;YACzB,eAAe,EAAE,CAAC,GAAG,sBAAsB,CAAC,eAAe,EAAE,GAAG,eAAe,CAAC;SACjF,CAAA;QACD,MAAM,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;KAC5E;AACH,CAAC","sourcesContent":["import {fileExists, writeFile, readFile, findPathUp} from './fs.js'\nimport {joinPath} from './path.js'\nimport {content, token, debug} from '../../output.js'\n\n/**\n * Check if user editor is VS Code.\n *\n * @param root - Root directory to start searching for .vscode directory.\n * @returns True if user editor is VS Code.\n */\nexport async function isVSCode(root = process.cwd()): Promise<boolean> {\n debug(content`Checking if the directory ${token.path(root)} or any of its parents has a .vscode directory... `)\n const config = await findPathUp(joinPath(root, '.vscode'), {type: 'directory'})\n\n if (!config) {\n return false\n }\n\n return fileExists(config)\n}\n\n/**\n * Add VSCode extension recommendations.\n *\n * @param directory - Directory that contains the .vscode folder.\n * @param recommendations - List of VSCode extensions to recommend.\n */\nexport async function addRecommendedExtensions(directory: string, recommendations: string[]): Promise<void> {\n debug(content`Adding VSCode recommended extensions at ${token.path(directory)}:\n${token.json(recommendations)}\n `)\n const extensionsPath = joinPath(directory, '.vscode/extensions.json')\n\n if (await isVSCode(directory)) {\n let originalExtensionsJson = {recommendations: []}\n if (await fileExists(extensionsPath)) {\n const originalExtensionsFile = await readFile(extensionsPath)\n originalExtensionsJson = JSON.parse(originalExtensionsFile)\n }\n const newExtensionsJson = {\n ...originalExtensionsJson,\n recommendations: [...originalExtensionsJson.recommendations, ...recommendations],\n }\n await writeFile(extensionsPath, JSON.stringify(newExtensionsJson, null, 2))\n }\n}\n"]}
|
package/dist/secure-store.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import constants from './constants.js';
|
|
2
1
|
import { content as outputContent, debug } from './output.js';
|
|
3
2
|
import { Abort } from './error.js';
|
|
3
|
+
import { keychainConstants } from './private/node/constants.js';
|
|
4
4
|
/**
|
|
5
5
|
* Fetches secured content from the system's keychain.
|
|
6
6
|
* @param identifier - Identifier to identify the content.
|
|
@@ -10,7 +10,7 @@ export async function fetch(identifier) {
|
|
|
10
10
|
debug(outputContent `Reading ${identifier} from the secure store...`);
|
|
11
11
|
try {
|
|
12
12
|
const keytar = await import('keytar');
|
|
13
|
-
const content = await keytar.getPassword(
|
|
13
|
+
const content = await keytar.getPassword(keychainConstants.service, identifier);
|
|
14
14
|
return content;
|
|
15
15
|
}
|
|
16
16
|
catch (error) {
|
|
@@ -27,7 +27,7 @@ export async function store(identifier, content) {
|
|
|
27
27
|
debug(outputContent `Updating ${identifier} in the secure store with new content...`);
|
|
28
28
|
try {
|
|
29
29
|
const keytar = await import('keytar');
|
|
30
|
-
await keytar.default.setPassword(
|
|
30
|
+
await keytar.default.setPassword(keychainConstants.service, identifier, content);
|
|
31
31
|
}
|
|
32
32
|
catch (error) {
|
|
33
33
|
throw createAbort(error, 'Unable to update the secure store');
|
|
@@ -42,7 +42,7 @@ export async function remove(identifier) {
|
|
|
42
42
|
debug(outputContent `Removing ${identifier} from the secure store...`);
|
|
43
43
|
try {
|
|
44
44
|
const keytar = await import('keytar');
|
|
45
|
-
const result = await keytar.default.deletePassword(
|
|
45
|
+
const result = await keytar.default.deletePassword(keychainConstants.service, identifier);
|
|
46
46
|
return result;
|
|
47
47
|
}
|
|
48
48
|
catch (error) {
|
package/dist/secure-store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secure-store.js","sourceRoot":"","sources":["../src/secure-store.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"secure-store.js","sourceRoot":"","sources":["../src/secure-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,aAAa,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAC3D,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAChC,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAA;AAE7D;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,UAAkB;IAC5C,KAAK,CAAC,aAAa,CAAA,WAAW,UAAU,2BAA2B,CAAC,CAAA;IACpE,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAA;QACrC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,iBAAiB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QAC/E,OAAO,OAAO,CAAA;KACf;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,WAAW,CAAC,KAAK,EAAE,sCAAsC,CAAC,CAAA;KACjE;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,UAAkB,EAAE,OAAe;IAC7D,KAAK,CAAC,aAAa,CAAA,YAAY,UAAU,0CAA0C,CAAC,CAAA;IACpF,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAA;QACrC,MAAM,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,iBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;KACjF;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,WAAW,CAAC,KAAK,EAAE,mCAAmC,CAAC,CAAA;KAC9D;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,UAAkB;IAC7C,KAAK,CAAC,aAAa,CAAA,YAAY,UAAU,2BAA2B,CAAC,CAAA;IACrE,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAA;QACrC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QACzF,OAAO,MAAM,CAAA;KACd;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,WAAW,CAAC,KAAK,EAAE,wCAAwC,CAAC,CAAA;KACnE;AACH,CAAC;AAED,SAAS,WAAW,CAAC,KAAc,EAAE,OAAe;IAClD,IAAI,UAAU,GAAG,OAAO,CAAA;IACxB,IAAI,KAAK,GAAuB,EAAE,CAAA;IAClC,IAAI,KAAK,YAAY,KAAK,EAAE;QAC1B,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QACjD,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;KACpB;IACD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,UAAU,CAAC,CAAA;IACnC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAA;IACnB,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["import {content as outputContent, debug} from './output.js'\nimport {Abort} from './error.js'\nimport {keychainConstants} from './private/node/constants.js'\n\n/**\n * Fetches secured content from the system's keychain.\n * @param identifier - Identifier to identify the content.\n * @returns A promise that resolves with the content or null if it doesn't exist.\n */\nexport async function fetch(identifier: string): Promise<string | null> {\n debug(outputContent`Reading ${identifier} from the secure store...`)\n try {\n const keytar = await import('keytar')\n const content = await keytar.getPassword(keychainConstants.service, identifier)\n return content\n } catch (error) {\n throw createAbort(error, 'Unable to read from the secure store')\n }\n}\n\n/**\n * Securely stores the content under the given key.\n * @param identifier - Identifier to identify the content.\n * @param content - The content to be stored.\n * @returns A promise that resolves when the storing completes.\n */\nexport async function store(identifier: string, content: string): Promise<void> {\n debug(outputContent`Updating ${identifier} in the secure store with new content...`)\n try {\n const keytar = await import('keytar')\n await keytar.default.setPassword(keychainConstants.service, identifier, content)\n } catch (error) {\n throw createAbort(error, 'Unable to update the secure store')\n }\n}\n\n/**\n * Removes the content with the given identifier.\n * @param identifier - Identifier to identify the content.\n * @returns A promise that resolves with true if the content was deleted.\n */\nexport async function remove(identifier: string): Promise<boolean> {\n debug(outputContent`Removing ${identifier} from the secure store...`)\n try {\n const keytar = await import('keytar')\n const result = await keytar.default.deletePassword(keychainConstants.service, identifier)\n return result\n } catch (error) {\n throw createAbort(error, 'Unable to remove from the secure store')\n }\n}\n\nfunction createAbort(error: unknown, message: string) {\n let newMessage = message\n let stack: string | undefined = ''\n if (error instanceof Error) {\n newMessage = message.concat(`: ${error.message}`)\n stack = error.stack\n }\n const abort = new Abort(newMessage)\n abort.stack = stack\n return abort\n}\n"]}
|
package/dist/store.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ interface ConfSchema {
|
|
|
13
13
|
themeStore: string;
|
|
14
14
|
session: string;
|
|
15
15
|
}
|
|
16
|
-
export declare function cliKitStore():
|
|
17
|
-
export declare function getAppInfo(directory: string):
|
|
16
|
+
export declare function cliKitStore(): CLIKitStore;
|
|
17
|
+
export declare function getAppInfo(directory: string): CachedAppInfo | undefined;
|
|
18
18
|
export declare function setAppInfo(options: {
|
|
19
19
|
directory: string;
|
|
20
20
|
appId?: string;
|
|
@@ -23,14 +23,14 @@ export declare function setAppInfo(options: {
|
|
|
23
23
|
orgId?: string;
|
|
24
24
|
updateURLs?: boolean;
|
|
25
25
|
tunnelPlugin?: string;
|
|
26
|
-
}):
|
|
27
|
-
export declare function clearAppInfo(directory: string):
|
|
28
|
-
export declare function getThemeStore():
|
|
29
|
-
export declare function setThemeStore(themeStore: string):
|
|
30
|
-
export declare function getSession():
|
|
31
|
-
export declare function setSession(session: string):
|
|
32
|
-
export declare function removeSession():
|
|
33
|
-
export declare function clearAllAppInfo():
|
|
26
|
+
}): void;
|
|
27
|
+
export declare function clearAppInfo(directory: string): void;
|
|
28
|
+
export declare function getThemeStore(): string | undefined;
|
|
29
|
+
export declare function setThemeStore(themeStore: string): void;
|
|
30
|
+
export declare function getSession(): string | undefined;
|
|
31
|
+
export declare function setSession(session: string): void;
|
|
32
|
+
export declare function removeSession(): void;
|
|
33
|
+
export declare function clearAllAppInfo(): void;
|
|
34
34
|
export declare class CLIKitStore extends Conf<ConfSchema> {
|
|
35
35
|
getAppInfo(directory: string): CachedAppInfo | undefined;
|
|
36
36
|
setAppInfo(options: {
|
package/dist/store.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { content, token, debug } from './output.js';
|
|
2
|
-
import
|
|
2
|
+
import { CLI_KIT_VERSION } from './public/common/version.js';
|
|
3
3
|
import Conf from 'conf';
|
|
4
4
|
const migrations = {};
|
|
5
5
|
const schema = {
|
|
@@ -22,52 +22,51 @@ const schema = {
|
|
|
22
22
|
},
|
|
23
23
|
};
|
|
24
24
|
let _instance;
|
|
25
|
-
export
|
|
25
|
+
export function cliKitStore() {
|
|
26
26
|
if (!_instance) {
|
|
27
|
-
// eslint-disable-next-line require-atomic-updates
|
|
28
27
|
_instance = new CLIKitStore({
|
|
29
28
|
schema,
|
|
30
29
|
migrations,
|
|
31
30
|
projectName: 'shopify-cli-kit',
|
|
32
|
-
projectVersion:
|
|
31
|
+
projectVersion: CLI_KIT_VERSION,
|
|
33
32
|
});
|
|
34
33
|
}
|
|
35
34
|
return _instance;
|
|
36
35
|
}
|
|
37
|
-
export
|
|
38
|
-
const store =
|
|
36
|
+
export function getAppInfo(directory) {
|
|
37
|
+
const store = cliKitStore();
|
|
39
38
|
return store.getAppInfo(directory);
|
|
40
39
|
}
|
|
41
|
-
export
|
|
42
|
-
const store =
|
|
40
|
+
export function setAppInfo(options) {
|
|
41
|
+
const store = cliKitStore();
|
|
43
42
|
store.setAppInfo(options);
|
|
44
43
|
}
|
|
45
|
-
export
|
|
46
|
-
const store =
|
|
44
|
+
export function clearAppInfo(directory) {
|
|
45
|
+
const store = cliKitStore();
|
|
47
46
|
store.clearAppInfo(directory);
|
|
48
47
|
}
|
|
49
|
-
export
|
|
50
|
-
const store =
|
|
48
|
+
export function getThemeStore() {
|
|
49
|
+
const store = cliKitStore();
|
|
51
50
|
return store.getThemeStore();
|
|
52
51
|
}
|
|
53
|
-
export
|
|
54
|
-
const store =
|
|
52
|
+
export function setThemeStore(themeStore) {
|
|
53
|
+
const store = cliKitStore();
|
|
55
54
|
store.setThemeStore(themeStore);
|
|
56
55
|
}
|
|
57
|
-
export
|
|
58
|
-
const store =
|
|
56
|
+
export function getSession() {
|
|
57
|
+
const store = cliKitStore();
|
|
59
58
|
return store.getSession();
|
|
60
59
|
}
|
|
61
|
-
export
|
|
62
|
-
const store =
|
|
60
|
+
export function setSession(session) {
|
|
61
|
+
const store = cliKitStore();
|
|
63
62
|
store.setSession(session);
|
|
64
63
|
}
|
|
65
|
-
export
|
|
66
|
-
const store =
|
|
64
|
+
export function removeSession() {
|
|
65
|
+
const store = cliKitStore();
|
|
67
66
|
store.removeSession();
|
|
68
67
|
}
|
|
69
|
-
export
|
|
70
|
-
const store =
|
|
68
|
+
export function clearAllAppInfo() {
|
|
69
|
+
const store = cliKitStore();
|
|
71
70
|
store.clearAllAppInfo();
|
|
72
71
|
}
|
|
73
72
|
export class CLIKitStore extends Conf {
|