@shopify/cli-kit 3.7.1 → 3.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +61 -0
  3. package/dist/analytics.d.ts +9 -0
  4. package/dist/analytics.js +4 -10
  5. package/dist/analytics.js.map +1 -1
  6. package/dist/api/admin.js.map +1 -1
  7. package/dist/api/common.js.map +1 -1
  8. package/dist/api/graphql/get_urls.d.ts +10 -0
  9. package/dist/api/graphql/get_urls.js +10 -0
  10. package/dist/api/graphql/get_urls.js.map +1 -0
  11. package/dist/api/graphql/index.d.ts +19 -14
  12. package/dist/api/graphql/index.js +19 -14
  13. package/dist/api/graphql/index.js.map +1 -1
  14. package/dist/api/graphql/update_draft.js.map +1 -1
  15. package/dist/api/graphql/update_urls.d.ts +2 -2
  16. package/dist/api/graphql/update_urls.js +2 -2
  17. package/dist/api/graphql/update_urls.js.map +1 -1
  18. package/dist/array.d.ts +1 -1
  19. package/dist/content-tokens.d.ts +44 -0
  20. package/dist/content-tokens.js +103 -0
  21. package/dist/content-tokens.js.map +1 -0
  22. package/dist/error.d.ts +3 -3
  23. package/dist/error.js +9 -3
  24. package/dist/error.js.map +1 -1
  25. package/dist/file.d.ts +7 -0
  26. package/dist/file.js +9 -0
  27. package/dist/file.js.map +1 -1
  28. package/dist/git.js.map +1 -1
  29. package/dist/github.js.map +1 -1
  30. package/dist/metadata.d.ts +2 -2
  31. package/dist/node/base-command.js +1 -1
  32. package/dist/node/base-command.js.map +1 -1
  33. package/dist/node/checksum.js.map +1 -1
  34. package/dist/node/dot-env.d.ts +9 -0
  35. package/dist/node/dot-env.js +31 -0
  36. package/dist/node/dot-env.js.map +1 -1
  37. package/dist/node/error-handler.d.ts +7 -4
  38. package/dist/node/error-handler.js +48 -13
  39. package/dist/node/error-handler.js.map +1 -1
  40. package/dist/node/hooks/prerun.js.map +1 -1
  41. package/dist/node/node-package-manager.d.ts +9 -11
  42. package/dist/node/node-package-manager.js +21 -13
  43. package/dist/node/node-package-manager.js.map +1 -1
  44. package/dist/node/ruby.js +32 -18
  45. package/dist/node/ruby.js.map +1 -1
  46. package/dist/output.d.ts +22 -43
  47. package/dist/output.js +31 -91
  48. package/dist/output.js.map +1 -1
  49. package/dist/session/exchange.js.map +1 -1
  50. package/dist/session/post-auth.js +7 -1
  51. package/dist/session/post-auth.js.map +1 -1
  52. package/dist/session/validate.js.map +1 -1
  53. package/dist/session.js.map +1 -1
  54. package/dist/store.d.ts +4 -2
  55. package/dist/store.js +3 -4
  56. package/dist/store.js.map +1 -1
  57. package/dist/system.d.ts +2 -2
  58. package/dist/testing/output.js +6 -6
  59. package/dist/testing/output.js.map +1 -1
  60. package/dist/tsconfig.tsbuildinfo +1 -1
  61. package/dist/ui/executor.d.ts +8 -1
  62. package/dist/ui/executor.js +29 -1
  63. package/dist/ui/executor.js.map +1 -1
  64. package/dist/ui/inquirer/autocomplete.js +12 -2
  65. package/dist/ui/inquirer/autocomplete.js.map +1 -1
  66. package/dist/ui.d.ts +8 -3
  67. package/dist/ui.js +1 -1
  68. package/dist/ui.js.map +1 -1
  69. package/package.json +12 -11
package/dist/store.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import Conf from 'conf';
2
2
  export interface CachedAppInfo {
3
3
  directory: string;
4
- appId: string;
4
+ appId?: string;
5
5
  title?: string;
6
6
  orgId?: string;
7
7
  storeFqdn?: string;
8
+ updateURLs?: boolean;
8
9
  }
9
10
  interface ConfSchema {
10
11
  appInfo: CachedAppInfo[];
@@ -17,10 +18,11 @@ export declare class CLIKitStore extends Conf<ConfSchema> {
17
18
  getAppInfo(directory: string): CachedAppInfo | undefined;
18
19
  setAppInfo(options: {
19
20
  directory: string;
20
- appId: string;
21
+ appId?: string;
21
22
  title?: string;
22
23
  storeFqdn?: string;
23
24
  orgId?: string;
25
+ updateURLs?: boolean;
24
26
  }): void;
25
27
  clearAppInfo(directory: string): void;
26
28
  getTheme(): string | undefined;
package/dist/store.js CHANGED
@@ -47,9 +47,7 @@ export class CLIKitStore extends Conf {
47
47
  return apps.find((app) => app.directory === directory);
48
48
  }
49
49
  setAppInfo(options) {
50
- debug(content `Storing app information for directory ${token.path(options.directory)}:
51
- ${token.json(options)}
52
- `);
50
+ debug(content `Storing app information for directory ${token.path(options.directory)}:${token.json(options)}`);
53
51
  const apps = this.get('appInfo') ?? [];
54
52
  const index = apps.findIndex((saved) => saved.directory === options.directory);
55
53
  if (index === -1) {
@@ -58,11 +56,12 @@ ${token.json(options)}
58
56
  else {
59
57
  const app = apps[index];
60
58
  apps[index] = {
61
- appId: options.appId,
62
59
  directory: options.directory,
60
+ appId: options.appId ?? app.appId,
63
61
  title: options.title ?? app.title,
64
62
  storeFqdn: options.storeFqdn ?? app.storeFqdn,
65
63
  orgId: options.orgId ?? app.orgId,
64
+ updateURLs: options.updateURLs ?? app.updateURLs,
66
65
  };
67
66
  }
68
67
  this.set('appInfo', apps);
package/dist/store.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AACjD,OAAO,SAAS,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAChC,OAAO,IAAc,MAAM,MAAM,CAAA;AAEjC,MAAM,UAAU,GAAG,EAAE,CAAA;AAgBrB,MAAM,MAAM,GAAG;IACb,OAAO,EAAE;QACP,IAAI,EAAE,OAAO;QACb,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;gBACD,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;KACF;CAC+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AE,KAAK,CAAC,CAAA;IAC/B,CAAC;IAED,UAAU;QACR,KAAK,CAAC,OAAO,CAAA,0BAA0B,CAAC,CAAA;QACxC,OAAO,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;IACjC,CAAC;IAED,UAAU,CAAC,KAAa;QACtB,KAAK,CAAC,OAAO,CAAA,0BAA0B,CAAC,CAAA;QACxC,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,KAAK,CAAC,CAAA;IACjC,CAAC;IAED,aAAa;QACX,KAAK,CAAC,OAAO,CAAA,2BAA2B,CAAC,CAAA;QACzC,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;IAC9B,CAAC;CACF","sourcesContent":["import {content, token, debug} from './output.js'\nimport constants from './constants.js'\nimport {Abort} from './error.js'\nimport Conf, {Schema} from 'conf'\n\nconst migrations = {}\n\nexport interface CachedAppInfo {\n directory: string\n appId: string\n title?: string\n orgId?: string\n storeFqdn?: string\n}\n\ninterface ConfSchema {\n appInfo: CachedAppInfo[]\n themeStore: string\n session: string\n}\n\nconst schema = {\n appInfo: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n appId: {\n type: 'string',\n },\n orgId: {\n type: 'string',\n },\n storeFqdn: {\n type: 'string',\n },\n },\n },\n },\n} as unknown as Schema<ConfSchema>\n\nlet _instance: CLIKitStore | undefined\n\nexport function cliKitStore() {\n if (!_instance) {\n throw new Abort(\"The CLIKitStore instance hasn't been initialized\")\n }\n return _instance\n}\n\nexport async function initializeCliKitStore() {\n if (!_instance) {\n // eslint-disable-next-line require-atomic-updates\n _instance = new CLIKitStore({\n schema,\n migrations,\n projectName: 'shopify-cli-kit',\n projectVersion: await constants.versions.cliKit(),\n })\n }\n}\n\nexport class CLIKitStore extends Conf<ConfSchema> {\n getAppInfo(directory: string): CachedAppInfo | undefined {\n debug(content`Reading cached app information for directory ${token.path(directory)}...`)\n const apps = this.get('appInfo') ?? []\n return apps.find((app: CachedAppInfo) => app.directory === directory)\n }\n\n setAppInfo(options: {directory: string; appId: string; title?: string; storeFqdn?: string; orgId?: string}): void {\n debug(content`Storing app information for directory ${token.path(options.directory)}:\n${token.json(options)}\n`)\n const apps = this.get('appInfo') ?? []\n const index = apps.findIndex((saved: CachedAppInfo) => saved.directory === options.directory)\n if (index === -1) {\n apps.push(options)\n } else {\n const app: CachedAppInfo = apps[index]\n apps[index] = {\n appId: options.appId,\n directory: options.directory,\n title: options.title ?? app.title,\n storeFqdn: options.storeFqdn ?? app.storeFqdn,\n orgId: options.orgId ?? app.orgId,\n }\n }\n this.set('appInfo', apps)\n }\n\n clearAppInfo(directory: string): void {\n debug(content`Clearning app information for directory ${token.path(directory)}...`)\n const apps = this.get('appInfo') ?? []\n const index = apps.findIndex((saved: CachedAppInfo) => saved.directory === directory)\n if (index !== -1) {\n apps.splice(index, 1)\n }\n this.set('appInfo', apps)\n }\n\n getTheme(): string | undefined {\n debug(content`Getting theme store...`)\n return this.get('themeStore')\n }\n\n setTheme(store: string): void {\n debug(content`Setting theme store...`)\n this.set('themeStore', store)\n }\n\n getSession(): string | undefined {\n debug(content`Getting session store...`)\n return this.get('sessionStore')\n }\n\n setSession(store: string): void {\n debug(content`Setting session store...`)\n this.set('sessionStore', store)\n }\n\n removeSession(): void {\n debug(content`Removing session store...`)\n this.set('sessionStore', '')\n }\n}\n"]}
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AACjD,OAAO,SAAS,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAChC,OAAO,IAAc,MAAM,MAAM,CAAA;AAEjC,MAAM,UAAU,GAAG,EAAE,CAAA;AAiBrB,MAAM,MAAM,GAAG;IACb,OAAO,EAAE;QACP,IAAI,EAAE,OAAO;QACb,KAAK,EAAE;YACL,IAAI,EAA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EAAE,IAAI,CAAC,CAAA;IAC3B,CAAC;IAED,QAAQ;QACN,KAAK,CAAC,OAAO,CAAA,wBAAwB,CAAC,CAAA;QACtC,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;IAC/B,CAAC;IAED,QAAQ,CAAC,KAAa;QACpB,KAAK,CAAC,OAAO,CAAA,wBAAwB,CAAC,CAAA;QACtC,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,CAAC,CAAA;IAC/B,CAAC;IAED,UAAU;QACR,KAAK,CAAC,OAAO,CAAA,0BAA0B,CAAC,CAAA;QACxC,OAAO,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;IACjC,CAAC;IAED,UAAU,CAAC,KAAa;QACtB,KAAK,CAAC,OAAO,CAAA,0BAA0B,CAAC,CAAA;QACxC,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,KAAK,CAAC,CAAA;IACjC,CAAC;IAED,aAAa;QACX,KAAK,CAAC,OAAO,CAAA,2BAA2B,CAAC,CAAA;QACzC,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;IAC9B,CAAC;CACF","sourcesContent":["import {content, token, debug} from './output.js'\nimport constants from './constants.js'\nimport {Abort} from './error.js'\nimport Conf, {Schema} from 'conf'\n\nconst migrations = {}\n\nexport interface CachedAppInfo {\n directory: string\n appId?: string\n title?: string\n orgId?: string\n storeFqdn?: string\n updateURLs?: boolean\n}\n\ninterface ConfSchema {\n appInfo: CachedAppInfo[]\n themeStore: string\n session: string\n}\n\nconst schema = {\n appInfo: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n appId: {\n type: 'string',\n },\n orgId: {\n type: 'string',\n },\n storeFqdn: {\n type: 'string',\n },\n },\n },\n },\n} as unknown as Schema<ConfSchema>\n\nlet _instance: CLIKitStore | undefined\n\nexport function cliKitStore() {\n if (!_instance) {\n throw new Abort(\"The CLIKitStore instance hasn't been initialized\")\n }\n return _instance\n}\n\nexport async function initializeCliKitStore() {\n if (!_instance) {\n // eslint-disable-next-line require-atomic-updates\n _instance = new CLIKitStore({\n schema,\n migrations,\n projectName: 'shopify-cli-kit',\n projectVersion: await constants.versions.cliKit(),\n })\n }\n}\n\nexport class CLIKitStore extends Conf<ConfSchema> {\n getAppInfo(directory: string): CachedAppInfo | undefined {\n debug(content`Reading cached app information for directory ${token.path(directory)}...`)\n const apps = this.get('appInfo') ?? []\n return apps.find((app: CachedAppInfo) => app.directory === directory)\n }\n\n setAppInfo(options: {\n directory: string\n appId?: string\n title?: string\n storeFqdn?: string\n orgId?: string\n updateURLs?: boolean\n }): void {\n debug(content`Storing app information for directory ${token.path(options.directory)}:${token.json(options)}`)\n const apps = this.get('appInfo') ?? []\n const index = apps.findIndex((saved: CachedAppInfo) => saved.directory === options.directory)\n if (index === -1) {\n apps.push(options)\n } else {\n const app: CachedAppInfo = apps[index]!\n apps[index] = {\n directory: options.directory,\n appId: options.appId ?? app.appId,\n title: options.title ?? app.title,\n storeFqdn: options.storeFqdn ?? app.storeFqdn,\n orgId: options.orgId ?? app.orgId,\n updateURLs: options.updateURLs ?? app.updateURLs,\n }\n }\n this.set('appInfo', apps)\n }\n\n clearAppInfo(directory: string): void {\n debug(content`Clearning app information for directory ${token.path(directory)}...`)\n const apps = this.get('appInfo') ?? []\n const index = apps.findIndex((saved: CachedAppInfo) => saved.directory === directory)\n if (index !== -1) {\n apps.splice(index, 1)\n }\n this.set('appInfo', apps)\n }\n\n getTheme(): string | undefined {\n debug(content`Getting theme store...`)\n return this.get('themeStore')\n }\n\n setTheme(store: string): void {\n debug(content`Setting theme store...`)\n this.set('themeStore', store)\n }\n\n getSession(): string | undefined {\n debug(content`Getting session store...`)\n return this.get('sessionStore')\n }\n\n setSession(store: string): void {\n debug(content`Setting session store...`)\n this.set('sessionStore', store)\n }\n\n removeSession(): void {\n debug(content`Removing session store...`)\n this.set('sessionStore', '')\n }\n}\n"]}
package/dist/system.d.ts CHANGED
@@ -23,8 +23,8 @@ export declare const open: (url: string) => Promise<void>;
23
23
  * @param args {string[]} Arguments to pass to the command.
24
24
  * @returns A promise that resolves with the aggregatted stdout of the command.
25
25
  */
26
- export declare const captureOutput: (command: string, args: string[], options?: ExecOptions) => Promise<string>;
27
- export declare const exec: (command: string, args: string[], options?: ExecOptions) => Promise<void>;
26
+ export declare const captureOutput: (command: string, args: string[], options?: ExecOptions | undefined) => Promise<string>;
27
+ export declare const exec: (command: string, args: string[], options?: ExecOptions | undefined) => Promise<void>;
28
28
  interface ConcurrentExecCommand {
29
29
  prefix: string;
30
30
  executable: string;
@@ -1,12 +1,12 @@
1
1
  import * as output from '../output.js';
2
2
  export function mockAndCaptureOutput() {
3
3
  return {
4
- output: () => output.collectedLogs.output.join('\n'),
5
- info: () => output.collectedLogs.info.join('\n'),
6
- debug: () => output.collectedLogs.debug.join('\n'),
7
- success: () => output.collectedLogs.success.join('\n'),
8
- completed: () => output.collectedLogs.completed.join('\n'),
9
- warn: () => output.collectedLogs.warn.join('\n'),
4
+ output: () => (output.collectedLogs.output ?? []).join('\n'),
5
+ info: () => (output.collectedLogs.info ?? []).join('\n'),
6
+ debug: () => (output.collectedLogs.debug ?? []).join('\n'),
7
+ success: () => (output.collectedLogs.success ?? []).join('\n'),
8
+ completed: () => (output.collectedLogs.completed ?? []).join('\n'),
9
+ warn: () => (output.collectedLogs.warn ?? []).join('\n'),
10
10
  clear: () => {
11
11
  output.clearCollectedLogs();
12
12
  },
@@ -1 +1 @@
1
- {"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/testing/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AAEtC,MAAM,UAAU,oBAAoB;IAClC,OAAO;QACL,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;QACpD,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAChD,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;QAClD,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;QACtD,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;QAC1D,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAChD,KAAK,EAAE,GAAG,EAAE;YACV,MAAM,CAAC,kBAAkB,EAAE,CAAA;QAC7B,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import * as output from '../output.js'\n\nexport function mockAndCaptureOutput() {\n return {\n output: () => output.collectedLogs.output.join('\\n'),\n info: () => output.collectedLogs.info.join('\\n'),\n debug: () => output.collectedLogs.debug.join('\\n'),\n success: () => output.collectedLogs.success.join('\\n'),\n completed: () => output.collectedLogs.completed.join('\\n'),\n warn: () => output.collectedLogs.warn.join('\\n'),\n clear: () => {\n output.clearCollectedLogs()\n },\n }\n}\n"]}
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/testing/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AAEtC,MAAM,UAAU,oBAAoB;IAClC,OAAO;QACL,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC5D,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACxD,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC1D,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC9D,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAClE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACxD,KAAK,EAAE,GAAG,EAAE;YACV,MAAM,CAAC,kBAAkB,EAAE,CAAA;QAC7B,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import * as output from '../output.js'\n\nexport function mockAndCaptureOutput() {\n return {\n output: () => (output.collectedLogs.output ?? []).join('\\n'),\n info: () => (output.collectedLogs.info ?? []).join('\\n'),\n debug: () => (output.collectedLogs.debug ?? []).join('\\n'),\n success: () => (output.collectedLogs.success ?? []).join('\\n'),\n completed: () => (output.collectedLogs.completed ?? []).join('\\n'),\n warn: () => (output.collectedLogs.warn ?? []).join('\\n'),\n clear: () => {\n output.clearCollectedLogs()\n },\n }\n}\n"]}