@shopify/cli-hydrogen 0.0.0-nightly-20230110194301

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 (86) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +63 -0
  3. package/dist/cli/commands/hydrogen/add/eslint.d.ts +11 -0
  4. package/dist/cli/commands/hydrogen/add/eslint.js +26 -0
  5. package/dist/cli/commands/hydrogen/add/eslint.js.map +1 -0
  6. package/dist/cli/commands/hydrogen/add/tailwind.d.ts +11 -0
  7. package/dist/cli/commands/hydrogen/add/tailwind.js +26 -0
  8. package/dist/cli/commands/hydrogen/add/tailwind.js.map +1 -0
  9. package/dist/cli/commands/hydrogen/build.d.ts +14 -0
  10. package/dist/cli/commands/hydrogen/build.js +49 -0
  11. package/dist/cli/commands/hydrogen/build.js.map +1 -0
  12. package/dist/cli/commands/hydrogen/deploy.d.ts +19 -0
  13. package/dist/cli/commands/hydrogen/deploy.js +58 -0
  14. package/dist/cli/commands/hydrogen/deploy.js.map +1 -0
  15. package/dist/cli/commands/hydrogen/dev.d.ts +13 -0
  16. package/dist/cli/commands/hydrogen/dev.js +31 -0
  17. package/dist/cli/commands/hydrogen/dev.js.map +1 -0
  18. package/dist/cli/commands/hydrogen/info.d.ts +12 -0
  19. package/dist/cli/commands/hydrogen/info.js +28 -0
  20. package/dist/cli/commands/hydrogen/info.js.map +1 -0
  21. package/dist/cli/commands/hydrogen/preview.d.ts +13 -0
  22. package/dist/cli/commands/hydrogen/preview.js +46 -0
  23. package/dist/cli/commands/hydrogen/preview.js.map +1 -0
  24. package/dist/cli/constants.d.ts +15 -0
  25. package/dist/cli/constants.js +16 -0
  26. package/dist/cli/constants.js.map +1 -0
  27. package/dist/cli/flags.d.ts +4 -0
  28. package/dist/cli/flags.js +16 -0
  29. package/dist/cli/flags.js.map +1 -0
  30. package/dist/cli/models/hydrogen.d.ts +22 -0
  31. package/dist/cli/models/hydrogen.js +82 -0
  32. package/dist/cli/models/hydrogen.js.map +1 -0
  33. package/dist/cli/prompts/git-init.d.ts +1 -0
  34. package/dist/cli/prompts/git-init.js +16 -0
  35. package/dist/cli/prompts/git-init.js.map +1 -0
  36. package/dist/cli/services/build/check-lockfile.d.ts +3 -0
  37. package/dist/cli/services/build/check-lockfile.js +80 -0
  38. package/dist/cli/services/build/check-lockfile.js.map +1 -0
  39. package/dist/cli/services/build.d.ts +14 -0
  40. package/dist/cli/services/build.js +44 -0
  41. package/dist/cli/services/build.js.map +1 -0
  42. package/dist/cli/services/deploy/config.d.ts +4 -0
  43. package/dist/cli/services/deploy/config.js +49 -0
  44. package/dist/cli/services/deploy/config.js.map +1 -0
  45. package/dist/cli/services/deploy/error.d.ts +4 -0
  46. package/dist/cli/services/deploy/error.js +11 -0
  47. package/dist/cli/services/deploy/error.js.map +1 -0
  48. package/dist/cli/services/deploy/graphql/create_deployment.d.ts +10 -0
  49. package/dist/cli/services/deploy/graphql/create_deployment.js +15 -0
  50. package/dist/cli/services/deploy/graphql/create_deployment.js.map +1 -0
  51. package/dist/cli/services/deploy/graphql/upload_deployment.d.ts +1 -0
  52. package/dist/cli/services/deploy/graphql/upload_deployment.js +16 -0
  53. package/dist/cli/services/deploy/graphql/upload_deployment.js.map +1 -0
  54. package/dist/cli/services/deploy/types.d.ts +37 -0
  55. package/dist/cli/services/deploy/types.js +2 -0
  56. package/dist/cli/services/deploy/types.js.map +1 -0
  57. package/dist/cli/services/deploy/upload.d.ts +5 -0
  58. package/dist/cli/services/deploy/upload.js +81 -0
  59. package/dist/cli/services/deploy/upload.js.map +1 -0
  60. package/dist/cli/services/deploy.d.ts +2 -0
  61. package/dist/cli/services/deploy.js +103 -0
  62. package/dist/cli/services/deploy.js.map +1 -0
  63. package/dist/cli/services/dev/check-version.d.ts +1 -0
  64. package/dist/cli/services/dev/check-version.js +30 -0
  65. package/dist/cli/services/dev/check-version.js.map +1 -0
  66. package/dist/cli/services/dev.d.ts +10 -0
  67. package/dist/cli/services/dev.js +37 -0
  68. package/dist/cli/services/dev.js.map +1 -0
  69. package/dist/cli/services/eslint.d.ts +8 -0
  70. package/dist/cli/services/eslint.js +74 -0
  71. package/dist/cli/services/eslint.js.map +1 -0
  72. package/dist/cli/services/info.d.ts +7 -0
  73. package/dist/cli/services/info.js +132 -0
  74. package/dist/cli/services/info.js.map +1 -0
  75. package/dist/cli/services/preview.d.ts +12 -0
  76. package/dist/cli/services/preview.js +63 -0
  77. package/dist/cli/services/preview.js.map +1 -0
  78. package/dist/cli/services/tailwind.d.ts +9 -0
  79. package/dist/cli/services/tailwind.js +103 -0
  80. package/dist/cli/services/tailwind.js.map +1 -0
  81. package/dist/cli/utilities/load-config.d.ts +5 -0
  82. package/dist/cli/utilities/load-config.js +6 -0
  83. package/dist/cli/utilities/load-config.js.map +1 -0
  84. package/dist/tsconfig.tsbuildinfo +1 -0
  85. package/oclif.manifest.json +1 -0
  86. package/package.json +78 -0
@@ -0,0 +1,82 @@
1
+ import { loadConfig } from '../utilities/load-config.js';
2
+ import { path, error as kitError, file } from '@shopify/cli-kit';
3
+ import { getDependencies, getPackageName, pnpmLockfile, yarnLockfile, } from '@shopify/cli-kit/node/node-package-manager';
4
+ class AppErrors {
5
+ constructor() {
6
+ this.errors = {};
7
+ }
8
+ addError(path, message) {
9
+ this.errors[path] = message;
10
+ }
11
+ getError(path) {
12
+ return this.errors[path];
13
+ }
14
+ isEmpty() {
15
+ return Object.keys(this.errors).length === 0;
16
+ }
17
+ toJSON() {
18
+ return Object.values(this.errors);
19
+ }
20
+ }
21
+ class HydrogenAppLoader {
22
+ constructor({ directory }) {
23
+ this.errors = new AppErrors();
24
+ this.directory = directory;
25
+ }
26
+ async loaded() {
27
+ if (!(await file.exists(this.directory))) {
28
+ throw new kitError.Abort(`Couldn't find directory ${this.directory}`);
29
+ }
30
+ const { configuration } = await this.loadConfig();
31
+ const yarnLockPath = path.join(this.directory, yarnLockfile);
32
+ const yarnLockExists = await file.exists(yarnLockPath);
33
+ const pnpmLockPath = path.join(this.directory, pnpmLockfile);
34
+ const pnpmLockExists = await file.exists(pnpmLockPath);
35
+ const packageJSONPath = path.join(this.directory, 'package.json');
36
+ const name = await getPackageName(packageJSONPath);
37
+ const nodeDependencies = await getDependencies(packageJSONPath);
38
+ const tsConfigExists = await file.exists(path.join(this.directory, 'tsconfig.json'));
39
+ const language = tsConfigExists && nodeDependencies.typescript ? 'TypeScript' : 'JavaScript';
40
+ let packageManager;
41
+ if (yarnLockExists) {
42
+ packageManager = 'yarn';
43
+ }
44
+ else if (pnpmLockExists) {
45
+ packageManager = 'pnpm';
46
+ }
47
+ else {
48
+ packageManager = 'npm';
49
+ }
50
+ const app = {
51
+ name: name ?? path.basename(this.directory),
52
+ directory: this.directory,
53
+ configuration,
54
+ packageManager,
55
+ nodeDependencies,
56
+ language,
57
+ };
58
+ if (!this.errors.isEmpty())
59
+ app.errors = this.errors;
60
+ return app;
61
+ }
62
+ async loadConfig() {
63
+ const abortError = new kitError.Abort(`Couldn't find hydrogen configuration file`);
64
+ try {
65
+ const config = await loadConfig({ root: this.directory });
66
+ if (!config) {
67
+ throw abortError;
68
+ }
69
+ return config;
70
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
+ }
72
+ catch (error) {
73
+ abortError.stack = error.stack;
74
+ throw abortError;
75
+ }
76
+ }
77
+ }
78
+ export async function load(directory) {
79
+ const loader = new HydrogenAppLoader({ directory });
80
+ return loader.loaded();
81
+ }
82
+ //# sourceMappingURL=hydrogen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydrogen.js","sourceRoot":"","sources":["../../../src/cli/models/hydrogen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAC,IAAI,EAAE,KAAK,IAAI,QAAQ,EAAE,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAC9D,OAAO,EACL,eAAe,EACf,cAAc,EAEd,YAAY,EACZ,YAAY,GACb,MAAM,4CAA4C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BACX,MAAM,UAAU,CAAA;aACjB;YAED,OAAO,MAAM,CAAA;YACb,8DAA8D;SAC/D;QAAC,OAAO,KAAU,EAAE;YACnB,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;YAC9B,MAAM,UAAU,CAAA;SACjB;IACH,CAAC;CACF;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,SAAiB;IAC1C,MAAM,MAAM,GAAG,IAAI,iBAAiB,CAAC,EAAC,SAAS,EAAC,CAAC,CAAA;IAEjD,OAAO,MAAM,CAAC,MAAM,EAAE,CAAA;AACxB,CAAC","sourcesContent":["import {loadConfig} from '../utilities/load-config.js'\nimport {path, error as kitError, file} from '@shopify/cli-kit'\nimport {\n getDependencies,\n getPackageName,\n PackageManager,\n pnpmLockfile,\n yarnLockfile,\n} from '@shopify/cli-kit/node/node-package-manager'\n\n/* eslint-disable @typescript-eslint/ban-ts-comment */\n// @ts-ignore\nimport type {HydrogenConfig} from '@shopify/hydrogen/config'\n/* eslint-enable @typescript-eslint/ban-ts-comment */\n\nexport interface HydrogenApp {\n name: string\n directory: string\n packageManager: PackageManager\n configuration: HydrogenConfig\n nodeDependencies: {[key: string]: string}\n language: 'JavaScript' | 'TypeScript'\n errors?: AppErrors\n}\n\ninterface AppLoaderConstructorArgs {\n directory: string\n}\n\nclass AppErrors {\n private errors: {\n [key: string]: string\n } = {}\n\n addError(path: string, message: string): void {\n this.errors[path] = message\n }\n\n getError(path: string) {\n return this.errors[path]\n }\n\n isEmpty() {\n return Object.keys(this.errors).length === 0\n }\n\n toJSON(): string[] {\n return Object.values(this.errors)\n }\n}\n\nclass HydrogenAppLoader {\n private directory: string\n private errors: AppErrors = new AppErrors()\n\n constructor({directory}: AppLoaderConstructorArgs) {\n this.directory = directory\n }\n\n async loaded() {\n if (!(await file.exists(this.directory))) {\n throw new kitError.Abort(`Couldn't find directory ${this.directory}`)\n }\n\n const {configuration} = await this.loadConfig()\n\n const yarnLockPath = path.join(this.directory, yarnLockfile)\n const yarnLockExists = await file.exists(yarnLockPath)\n const pnpmLockPath = path.join(this.directory, pnpmLockfile)\n const pnpmLockExists = await file.exists(pnpmLockPath)\n const packageJSONPath = path.join(this.directory, 'package.json')\n const name = await getPackageName(packageJSONPath)\n const nodeDependencies = await getDependencies(packageJSONPath)\n const tsConfigExists = await file.exists(path.join(this.directory, 'tsconfig.json'))\n const language = tsConfigExists && nodeDependencies.typescript ? 'TypeScript' : 'JavaScript'\n\n let packageManager: PackageManager\n if (yarnLockExists) {\n packageManager = 'yarn'\n } else if (pnpmLockExists) {\n packageManager = 'pnpm'\n } else {\n packageManager = 'npm'\n }\n\n const app: HydrogenApp = {\n name: name ?? path.basename(this.directory),\n directory: this.directory,\n configuration,\n packageManager,\n nodeDependencies,\n language,\n }\n\n if (!this.errors.isEmpty()) app.errors = this.errors\n\n return app\n }\n\n async loadConfig() {\n const abortError = new kitError.Abort(`Couldn't find hydrogen configuration file`)\n\n try {\n const config = await loadConfig({root: this.directory})\n\n if (!config) {\n throw abortError\n }\n\n return config\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n abortError.stack = error.stack\n throw abortError\n }\n }\n}\n\nexport async function load(directory: string): Promise<HydrogenApp> {\n const loader = new HydrogenAppLoader({directory})\n\n return loader.loaded()\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare const gitInit: () => Promise<boolean>;
@@ -0,0 +1,16 @@
1
+ import { ui } from '@shopify/cli-kit';
2
+ export const gitInit = async () => {
3
+ const question = {
4
+ type: 'select',
5
+ name: 'initialize',
6
+ message: "Git version control hasn't been initialized for this directory. Do you want to do that now?",
7
+ choices: [
8
+ { name: 'Yes', value: 'yes' },
9
+ { name: 'No', value: 'no' },
10
+ ],
11
+ default: 'yes',
12
+ };
13
+ const promptResults = await ui.prompt([question]);
14
+ return promptResults.initialize === 'yes';
15
+ };
16
+ //# sourceMappingURL=git-init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-init.js","sourceRoot":"","sources":["../../../src/cli/prompts/git-init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,EAAC,MAAM,kBAAkB,CAAA;AAEnC,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,IAAsB,EAAE;IAClD,MAAM,QAAQ,GAAgB;QAC5B,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,6FAA6F;QACtG,OAAO,EAAE;YACP,EAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAC;YAC3B,EAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAC;SAC1B;QACD,OAAO,EAAE,KAAK;KACf,CAAA;IAED,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEjD,OAAO,aAAa,CAAC,UAAU,KAAK,KAAK,CAAA;AAC3C,CAAC,CAAA","sourcesContent":["import {ui} from '@shopify/cli-kit'\n\nexport const gitInit = async (): Promise<boolean> => {\n const question: ui.Question = {\n type: 'select',\n name: 'initialize',\n message: \"Git version control hasn't been initialized for this directory. Do you want to do that now?\",\n choices: [\n {name: 'Yes', value: 'yes'},\n {name: 'No', value: 'no'},\n ],\n default: 'yes',\n }\n\n const promptResults = await ui.prompt([question])\n\n return promptResults.initialize === 'yes'\n}\n"]}
@@ -0,0 +1,3 @@
1
+ declare type LockFileStatus = 'missing' | 'multiple' | 'ignored' | 'ok';
2
+ export declare function checkLockfileStatus(directory: string): Promise<LockFileStatus>;
3
+ export {};
@@ -0,0 +1,80 @@
1
+ import { file, git, path } from '@shopify/cli-kit';
2
+ import { renderWarning } from '@shopify/cli-kit/node/ui';
3
+ import { lockfiles } from '@shopify/cli-kit/node/node-package-manager';
4
+ function missingLockfileWarning() {
5
+ renderWarning({
6
+ headline: 'No lockfile found',
7
+ body: `If you don’t commit a lockfile, then your app might install the wrong ` +
8
+ `package versions when deploying. To avoid versioning issues, generate a ` +
9
+ `new lockfile and commit it to your repository.`,
10
+ nextSteps: [
11
+ [
12
+ 'Generate a lockfile. Run',
13
+ {
14
+ command: 'npm|yarn|pnpm install',
15
+ },
16
+ ],
17
+ 'Commit the new file to your repository',
18
+ ],
19
+ });
20
+ }
21
+ function multipleLockfilesWarning(lockfiles) {
22
+ const packageManagers = {
23
+ 'yarn.lock': 'yarn',
24
+ 'package-lock.json': 'npm',
25
+ 'pnpm-lock.yaml': 'pnpm',
26
+ };
27
+ const lockfileList = lockfiles.map((lockfile) => {
28
+ return `${lockfile} (created by ${packageManagers[lockfile]})`;
29
+ });
30
+ renderWarning({
31
+ headline: 'Multiple lockfiles found',
32
+ body: [
33
+ `Your project contains more than one lockfile. This can cause version ` +
34
+ `conflicts when installing and deploying your app. The following ` +
35
+ `lockfiles were detected:\n`,
36
+ { list: { items: lockfileList } },
37
+ ],
38
+ nextSteps: ['Delete any unneeded lockfiles', 'Commit the change to your repository'],
39
+ });
40
+ }
41
+ function lockfileIgnoredWarning(lockfile) {
42
+ renderWarning({
43
+ headline: 'Lockfile ignored by Git',
44
+ body: `Your project’s lockfile isn’t being tracked by Git. If you don’t commit ` +
45
+ `a lockfile, then your app might install the wrong package versions when ` +
46
+ `deploying.`,
47
+ nextSteps: [
48
+ `In your project’s .gitignore file, delete any references to ${lockfile}`,
49
+ 'Commit the change to your repository',
50
+ ],
51
+ });
52
+ }
53
+ export async function checkLockfileStatus(directory) {
54
+ const availableLockfiles = await lockfiles.reduce(async (acc, lockFileName) => {
55
+ const lockfilePath = path.resolve(directory, lockFileName);
56
+ if (await file.exists(lockfilePath)) {
57
+ return (await acc).concat(lockFileName);
58
+ }
59
+ else {
60
+ return acc;
61
+ }
62
+ }, Promise.resolve([]));
63
+ if (!availableLockfiles.length) {
64
+ missingLockfileWarning();
65
+ return 'missing';
66
+ }
67
+ if (availableLockfiles.length > 1) {
68
+ multipleLockfilesWarning(availableLockfiles);
69
+ return 'multiple';
70
+ }
71
+ const repo = git.factory(directory);
72
+ const lockfile = availableLockfiles[0];
73
+ const ignoredLockfile = await repo.checkIgnore([lockfile]);
74
+ if (ignoredLockfile.length) {
75
+ lockfileIgnoredWarning(lockfile);
76
+ return 'ignored';
77
+ }
78
+ return 'ok';
79
+ }
80
+ //# sourceMappingURL=check-lockfile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-lockfile.js","sourceRoot":"","sources":["../../../../src/cli/services/build/check-lockfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAC,SAAS,EAAC,MAAM,4CAA4C,CAAA;AAGpE,SAAS,sBAAsB;IAC7B,aAAa,CAAC;QACZ,QAAQ,EAAE,mBAAmB;QAC7B,IAAI,EACF,wEAAwE;YACxE,0EAA0E;YAC1E,gDAAgD;QAClD,SAAS,EAAE;YACT;gBACE,0BAA0B;gBAC1B;oBACE,OAAO,EAAE,uBAAuB;iBACjC;aACF;YACD,wCAAwC;SACzC;KACF,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,wBAAwB,CAAC,SAAqB;IACrD,MAAM,eAAe,GAAG;QACtB,WAAW,EAAE,MAAM;QACnB,mBAAmB,EAAE,KAAK;QAC1B,gBAAgB,EAAE,MAAM;KACzB,CAAA;IAED,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC9C,OAAO,GAAG,QAAQ,gBAAgB,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAA;IAChE,CAAC,CAAC,CAAA;IAEF,aAAa,CAAC;QACZ,QAAQ,EAAE,0BAA0B;QACpC,IAAI,EAAE;YACJ,uEAAuE;gBACrE,kEAAkE;gBAClE,4BAA4B;YAC9B,EAAC,IAAI,EAAE,EAAC,KAAK,EAAE,YAAY,EAAC,EAAC;SAC9B;QACD,SAAS,E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;QAC1B,sBAAsB,CAAC,QAAQ,CAAC,CAAA;QAChC,OAAO,SAAS,CAAA;KACjB;IAED,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import {file, git, path} from '@shopify/cli-kit'\nimport {renderWarning} from '@shopify/cli-kit/node/ui'\nimport {lockfiles} from '@shopify/cli-kit/node/node-package-manager'\nimport type {Lockfile} from '@shopify/cli-kit/node/node-package-manager'\n\nfunction missingLockfileWarning() {\n renderWarning({\n headline: 'No lockfile found',\n body:\n `If you don’t commit a lockfile, then your app might install the wrong ` +\n `package versions when deploying. To avoid versioning issues, generate a ` +\n `new lockfile and commit it to your repository.`,\n nextSteps: [\n [\n 'Generate a lockfile. Run',\n {\n command: 'npm|yarn|pnpm install',\n },\n ],\n 'Commit the new file to your repository',\n ],\n })\n}\n\nfunction multipleLockfilesWarning(lockfiles: Lockfile[]) {\n const packageManagers = {\n 'yarn.lock': 'yarn',\n 'package-lock.json': 'npm',\n 'pnpm-lock.yaml': 'pnpm',\n }\n\n const lockfileList = lockfiles.map((lockfile) => {\n return `${lockfile} (created by ${packageManagers[lockfile]})`\n })\n\n renderWarning({\n headline: 'Multiple lockfiles found',\n body: [\n `Your project contains more than one lockfile. This can cause version ` +\n `conflicts when installing and deploying your app. The following ` +\n `lockfiles were detected:\\n`,\n {list: {items: lockfileList}},\n ],\n nextSteps: ['Delete any unneeded lockfiles', 'Commit the change to your repository'],\n })\n}\n\nfunction lockfileIgnoredWarning(lockfile: string) {\n renderWarning({\n headline: 'Lockfile ignored by Git',\n body:\n `Your project’s lockfile isn’t being tracked by Git. If you don’t commit ` +\n `a lockfile, then your app might install the wrong package versions when ` +\n `deploying.`,\n nextSteps: [\n `In your project’s .gitignore file, delete any references to ${lockfile}`,\n 'Commit the change to your repository',\n ],\n })\n}\n\ntype LockFileStatus = 'missing' | 'multiple' | 'ignored' | 'ok'\n\nexport async function checkLockfileStatus(directory: string): Promise<LockFileStatus> {\n const availableLockfiles = await lockfiles.reduce(async (acc, lockFileName) => {\n const lockfilePath = path.resolve(directory, lockFileName)\n if (await file.exists(lockfilePath)) {\n return (await acc).concat(lockFileName)\n } else {\n return acc\n }\n }, Promise.resolve([] as Lockfile[]))\n\n if (!availableLockfiles.length) {\n missingLockfileWarning()\n return 'missing'\n }\n\n if (availableLockfiles.length > 1) {\n multipleLockfilesWarning(availableLockfiles)\n return 'multiple'\n }\n\n const repo = git.factory(directory)\n const lockfile = availableLockfiles[0]!\n const ignoredLockfile = await repo.checkIgnore([lockfile])\n\n if (ignoredLockfile.length) {\n lockfileIgnoredWarning(lockfile)\n return 'ignored'\n }\n\n return 'ok'\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { ui } from '@shopify/cli-kit';
2
+ declare type Target = 'node' | 'client' | 'worker';
3
+ interface DevOptions {
4
+ directory: string;
5
+ targets: {
6
+ [key in Target]: boolean | string;
7
+ };
8
+ base?: string;
9
+ assetBaseURL?: string;
10
+ verbose?: boolean;
11
+ }
12
+ export declare function buildTaskList({ directory, targets, base, assetBaseURL, verbose }: DevOptions): ui.ListrTask[];
13
+ export declare function build(options: DevOptions): Promise<void>;
14
+ export {};
@@ -0,0 +1,44 @@
1
+ import { checkLockfileStatus } from './build/check-lockfile.js';
2
+ import { build as viteBuild } from 'vite';
3
+ import { ui, environment, error as kitError } from '@shopify/cli-kit';
4
+ export function buildTaskList({ directory, targets, base, assetBaseURL, verbose }) {
5
+ const commonConfig = { base, root: directory };
6
+ return Object.entries(targets)
7
+ .filter(([_, value]) => value)
8
+ .map(([key, value]) => ({
9
+ title: `Building ${key} code`,
10
+ task: async (_, task) => {
11
+ if (key === 'worker') {
12
+ process.env.WORKER = 'true';
13
+ }
14
+ if (assetBaseURL) {
15
+ process.env.HYDROGEN_ASSET_BASE_URL = assetBaseURL;
16
+ }
17
+ try {
18
+ await viteBuild({
19
+ ...commonConfig,
20
+ build: {
21
+ outDir: `dist/${key}`,
22
+ ssr: typeof value === 'string' ? value : undefined,
23
+ manifest: key === 'client',
24
+ },
25
+ logLevel: verbose ? 'info' : 'silent',
26
+ });
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
+ }
29
+ catch (error) {
30
+ const abortError = new kitError.Abort(error.message);
31
+ abortError.stack = error.stack;
32
+ throw abortError;
33
+ }
34
+ task.title = `Built ${key} code`;
35
+ },
36
+ }));
37
+ }
38
+ export async function build(options) {
39
+ await checkLockfileStatus(options.directory);
40
+ const tasks = await buildTaskList(options);
41
+ const list = ui.newListr(tasks, { rendererSilent: environment.local.isUnitTest() });
42
+ await list.run();
43
+ }
44
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/cli/services/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAC,KAAK,IAAI,SAAS,EAAC,MAAM,MAAM,CAAA;AACvC,OAAO,EAAC,EAAE,EAAE,WAAW,EAAE,KAAK,IAAI,QAAQ,EAAC,MAAM,kBAAkB,CAAA;AAYnE,MAAM,UAAU,aAAa,CAAC,EAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAa;IACzF,MAAM,YAAY,GAAG,EAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAC,CAAA;IAE5C,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;SAC3B,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC;SAC7B,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;QACtB,KAAK,EAAE,YAAY,GAAG,OAAO;QAC7B,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE;YACtB,IAAI,GAAG,KAAK,QAAQ,EAAE;gBACpB,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAA;aAC5B;YACD,IAAI,YAAY,EAAE;gBAChB,OAAO,CAAC,GAAG,CAAC,uBAAuB,GAAG,YAAY,CAAA;aACnD;YAED,IAAI;gBACF,MAAM,SAAS,CAAC;oBACd,GAAG,YAAY;oBACf,KAAK,EAAE;wBACL,MAAM,EAAE,QAAQ,GAAG,EAAE;wBACrB,GAAG,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;wBAClD,QAAQ,EAAE,GAAG,KAAK,QAAQ;qBAC3B;oBACD,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ;iBACtC,CAAC,CAAA;gBACF,8DAA8D;aAC/D;YAAC,OAAO,KAAU,EAAE;gBACnB,MAAM,UAAU,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;gBACpD,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;gBAC9B,MAAM,UAAU,CAAA;aACjB;YAED,IAAI,CAAC,KAAK,GAAG,SAAS,GAAG,OAAO,CAAA;QAClC,CAAC;KACF,CAAC,CAAC,CAAA;AACP,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,OAAmB;IAC7C,MAAM,mBAAmB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAE5C,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,CAAA;IAE1C,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAC,cAAc,EAAE,WAAW,CAAC,KAAK,CAAC,UAAU,EAAE,EAAC,CAAC,CAAA;IAEjF,MAAM,IAAI,CAAC,GAAG,EAAE,CAAA;AAClB,CAAC","sourcesContent":["import {checkLockfileStatus} from './build/check-lockfile.js'\nimport {build as viteBuild} from 'vite'\nimport {ui, environment, error as kitError} from '@shopify/cli-kit'\n\ntype Target = 'node' | 'client' | 'worker'\n\ninterface DevOptions {\n directory: string\n targets: {[key in Target]: boolean | string}\n base?: string\n assetBaseURL?: string\n verbose?: boolean\n}\n\nexport function buildTaskList({directory, targets, base, assetBaseURL, verbose}: DevOptions): ui.ListrTask[] {\n const commonConfig = {base, root: directory}\n\n return Object.entries(targets)\n .filter(([_, value]) => value)\n .map(([key, value]) => ({\n title: `Building ${key} code`,\n task: async (_, task) => {\n if (key === 'worker') {\n process.env.WORKER = 'true'\n }\n if (assetBaseURL) {\n process.env.HYDROGEN_ASSET_BASE_URL = assetBaseURL\n }\n\n try {\n await viteBuild({\n ...commonConfig,\n build: {\n outDir: `dist/${key}`,\n ssr: typeof value === 'string' ? value : undefined,\n manifest: key === 'client',\n },\n logLevel: verbose ? 'info' : 'silent',\n })\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n const abortError = new kitError.Abort(error.message)\n abortError.stack = error.stack\n throw abortError\n }\n\n task.title = `Built ${key} code`\n },\n }))\n}\n\nexport async function build(options: DevOptions) {\n await checkLockfileStatus(options.directory)\n\n const tasks = await buildTaskList(options)\n\n const list = ui.newListr(tasks, {rendererSilent: environment.local.isUnitTest()})\n\n await list.run()\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import { DeployConfig, ReqDeployConfig } from './types.js';
2
+ export declare const validateProject: (config: DeployConfig) => Promise<void>;
3
+ export declare const initializeGit: (config: DeployConfig) => Promise<void>;
4
+ export declare const fillDeployConfig: (config: DeployConfig) => Promise<ReqDeployConfig>;
@@ -0,0 +1,49 @@
1
+ import { gitInit } from '../../prompts/git-init.js';
2
+ import { git, error, path } from '@shopify/cli-kit';
3
+ const MINIMAL_GIT_IGNORE = {
4
+ system: ['.DS_Store'],
5
+ logs: ['logs', '*.log', 'npm-debug.log*', 'yarn-debug.log*', 'yarn-error.log*'],
6
+ testing: ['/coverage', '*.lcov'],
7
+ dependencies: ['/node_modules', '.npm', '.yarn-integrity', '/.pnp', '.pnp.js'],
8
+ typescript: ['*.tsbuildinfo'],
9
+ environment: ['.env', '.env.test', '.env.local'],
10
+ production: ['/dist'],
11
+ };
12
+ export const validateProject = async (config) => {
13
+ await git.ensurePresentOrAbort();
14
+ try {
15
+ await git.ensureInsideGitDirectory(config.path);
16
+ }
17
+ catch (err) {
18
+ if (err?.message !== git.OutsideGitDirectoryError(config.path).message)
19
+ throw error;
20
+ await initializeGit(config);
21
+ }
22
+ };
23
+ export const initializeGit = async (config) => {
24
+ if (!config.assumeYes) {
25
+ const shouldGitInit = await gitInit();
26
+ if (!shouldGitInit)
27
+ throw new error.AbortSilent();
28
+ }
29
+ await git.initializeRepository(config.path);
30
+ git.createGitIgnore(config.path, MINIMAL_GIT_IGNORE);
31
+ await git.addAll(config.path);
32
+ await git.commit('Initial commit generated by Hydrogen', { directory: config.path });
33
+ };
34
+ export const fillDeployConfig = async (config) => {
35
+ const [latestCommit, commitRef] = await Promise.all([
36
+ git.getLatestCommit(config.path),
37
+ git.getHeadSymbolicRef(config.path),
38
+ ]);
39
+ return {
40
+ ...config,
41
+ pathToBuild: config.pathToBuild ? path.resolve(config.pathToBuild) : '',
42
+ commitMessage: config.commitMessage ?? latestCommit.message,
43
+ commitAuthor: config.commitAuthor ?? latestCommit.author_name,
44
+ commitSha: latestCommit.hash,
45
+ timestamp: latestCommit.date,
46
+ commitRef,
47
+ };
48
+ };
49
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/cli/services/deploy/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,2BAA2B,CAAA;AACjD,OAAO,EAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAEjD,MAAM,kBAAkB,GAA0B;IAChD,MAAM,EAAE,CAAC,WAAW,CAAC;IACrB,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,CAA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AAC,CAAC,CAAA;AACpF,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,MAAoB,EAA4B,EAAE;IACvF,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAClD,GAAG,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC;QAChC,GAAG,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC;KACpC,CAAC,CAAA;IAEF,OAAO;QACL,GAAG,MAAM;QACT,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE;QACvE,aAAa,EAAE,MAAM,CAAC,aAAa,IAAI,YAAY,CAAC,OAAO;QAC3D,YAAY,EAAE,MAAM,CAAC,YAAY,IAAI,YAAY,CAAC,WAAW;QAC7D,SAAS,EAAE,YAAY,CAAC,IAAI;QAC5B,SAAS,EAAE,YAAY,CAAC,IAAI;QAC5B,SAAS;KACV,CAAA;AACH,CAAC,CAAA","sourcesContent":["import {DeployConfig, ReqDeployConfig} from './types.js'\nimport {gitInit} from '../../prompts/git-init.js'\nimport {git, error, path} from '@shopify/cli-kit'\n\nconst MINIMAL_GIT_IGNORE: git.GitIgnoreTemplate = {\n system: ['.DS_Store'],\n logs: ['logs', '*.log', 'npm-debug.log*', 'yarn-debug.log*', 'yarn-error.log*'],\n testing: ['/coverage', '*.lcov'],\n dependencies: ['/node_modules', '.npm', '.yarn-integrity', '/.pnp', '.pnp.js'],\n typescript: ['*.tsbuildinfo'],\n environment: ['.env', '.env.test', '.env.local'],\n production: ['/dist'],\n}\n\nexport const validateProject = async (config: DeployConfig) => {\n await git.ensurePresentOrAbort()\n try {\n await git.ensureInsideGitDirectory(config.path)\n } catch (err: unknown) {\n if ((err as error.Abort)?.message !== git.OutsideGitDirectoryError(config.path).message) throw error\n await initializeGit(config)\n }\n}\n\nexport const initializeGit = async (config: DeployConfig) => {\n if (!config.assumeYes) {\n const shouldGitInit = await gitInit()\n if (!shouldGitInit) throw new error.AbortSilent()\n }\n\n await git.initializeRepository(config.path)\n git.createGitIgnore(config.path, MINIMAL_GIT_IGNORE)\n await git.addAll(config.path)\n await git.commit('Initial commit generated by Hydrogen', {directory: config.path})\n}\n\nexport const fillDeployConfig = async (config: DeployConfig): Promise<ReqDeployConfig> => {\n const [latestCommit, commitRef] = await Promise.all([\n git.getLatestCommit(config.path),\n git.getHeadSymbolicRef(config.path),\n ])\n\n return {\n ...config,\n pathToBuild: config.pathToBuild ? path.resolve(config.pathToBuild) : '',\n commitMessage: config.commitMessage ?? latestCommit.message,\n commitAuthor: config.commitAuthor ?? latestCommit.author_name,\n commitSha: latestCommit.hash,\n timestamp: latestCommit.date,\n commitRef,\n }\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import { error } from '@shopify/cli-kit';
2
+ export declare const WebPageNotAvailable: () => error.Abort;
3
+ export declare const TooManyRequestsError: () => Error;
4
+ export declare const UnrecoverableError: (message: string) => Error;
@@ -0,0 +1,11 @@
1
+ import { error } from '@shopify/cli-kit';
2
+ export const WebPageNotAvailable = () => {
3
+ return new error.Abort('Web page not available.');
4
+ };
5
+ export const TooManyRequestsError = () => {
6
+ return new Error("You've made too many requests. Please try again later.");
7
+ };
8
+ export const UnrecoverableError = (message) => {
9
+ return new Error(`Unrecoverable: ${message}`);
10
+ };
11
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../../../src/cli/services/deploy/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,kBAAkB,CAAA;AAEtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAA;AACnD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,OAAO,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;AAC5E,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAAE,EAAE;IACpD,OAAO,IAAI,KAAK,CAAC,kBAAkB,OAAO,EAAE,CAAC,CAAA;AAC/C,CAAC,CAAA","sourcesContent":["import {error} from '@shopify/cli-kit'\n\nexport const WebPageNotAvailable = () => {\n return new error.Abort('Web page not available.')\n}\n\nexport const TooManyRequestsError = () => {\n return new Error(\"You've made too many requests. Please try again later.\")\n}\n\nexport const UnrecoverableError = (message: string) => {\n return new Error(`Unrecoverable: ${message}`)\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import { OxygenError } from '../types.js';
2
+ export declare const CreateDeploymentQuery: string;
3
+ export interface CreateDeploymentQuerySchema {
4
+ createDeployment: CreateDeploymentResponse;
5
+ }
6
+ export interface CreateDeploymentResponse {
7
+ deploymentID: string;
8
+ assetBaseURL: string;
9
+ error: OxygenError;
10
+ }
@@ -0,0 +1,15 @@
1
+ import { gql } from 'graphql-request';
2
+ export const CreateDeploymentQuery = gql `
3
+ mutation createDeployment($input: CreateDeploymentInput!) {
4
+ createDeployment(input: $input) {
5
+ deploymentID
6
+ assetBaseURL
7
+ error {
8
+ code
9
+ unrecoverable
10
+ debugInfo
11
+ }
12
+ }
13
+ }
14
+ `;
15
+ //# sourceMappingURL=create_deployment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_deployment.js","sourceRoot":"","sources":["../../../../../src/cli/services/deploy/graphql/create_deployment.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,iBAAiB,CAAA;AAEnC,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAA;;;;;;;;;;;;CAYvC,CAAA","sourcesContent":["import {OxygenError} from '../types.js'\nimport {gql} from 'graphql-request'\n\nexport const CreateDeploymentQuery = gql`\n mutation createDeployment($input: CreateDeploymentInput!) {\n createDeployment(input: $input) {\n deploymentID\n assetBaseURL\n error {\n code\n unrecoverable\n debugInfo\n }\n }\n }\n`\n\nexport interface CreateDeploymentQuerySchema {\n createDeployment: CreateDeploymentResponse\n}\n\nexport interface CreateDeploymentResponse {\n deploymentID: string\n assetBaseURL: string\n error: OxygenError\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare const UploadDeploymentQuery: string;
@@ -0,0 +1,16 @@
1
+ import { gql } from 'graphql-request';
2
+ export const UploadDeploymentQuery = gql `
3
+ mutation uploadDeployment($file: Upload!, $deploymentID: ID!) {
4
+ uploadDeployment(file: $file, deploymentID: $deploymentID) {
5
+ deployment {
6
+ previewURL
7
+ }
8
+ error {
9
+ code
10
+ unrecoverable
11
+ debugInfo
12
+ }
13
+ }
14
+ }
15
+ `;
16
+ //# sourceMappingURL=upload_deployment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload_deployment.js","sourceRoot":"","sources":["../../../../../src/cli/services/deploy/graphql/upload_deployment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,iBAAiB,CAAA;AAEnC,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAA;;;;;;;;;;;;;CAavC,CAAA","sourcesContent":["import {gql} from 'graphql-request'\n\nexport const UploadDeploymentQuery = gql`\n mutation uploadDeployment($file: Upload!, $deploymentID: ID!) {\n uploadDeployment(file: $file, deploymentID: $deploymentID) {\n deployment {\n previewURL\n }\n error {\n code\n unrecoverable\n debugInfo\n }\n }\n }\n`\n"]}
@@ -0,0 +1,37 @@
1
+ export interface DeployConfig {
2
+ deploymentToken: string;
3
+ oxygenAddress: string;
4
+ healthCheck: boolean;
5
+ assumeYes: boolean;
6
+ path: string;
7
+ pathToBuild?: string;
8
+ commitMessage?: string;
9
+ commitAuthor?: string;
10
+ commitSha?: string;
11
+ commitRef?: string;
12
+ timestamp?: string;
13
+ }
14
+ export declare type ReqDeployConfig = Required<DeployConfig>;
15
+ export interface OxygenError {
16
+ code: string;
17
+ unrecoverable: boolean;
18
+ debugInfo: string;
19
+ }
20
+ export interface UploadDeploymentResponse {
21
+ data: {
22
+ uploadDeployment: {
23
+ deployment: {
24
+ previewURL: string;
25
+ };
26
+ error: OxygenError;
27
+ };
28
+ };
29
+ }
30
+ export interface GraphQLError {
31
+ message: string;
32
+ extensions?: Map<string, unknown>;
33
+ locations: {
34
+ line: number;
35
+ column: number;
36
+ };
37
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/cli/services/deploy/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface DeployConfig {\n deploymentToken: string\n oxygenAddress: string\n healthCheck: boolean\n assumeYes: boolean\n path: string\n pathToBuild?: string\n commitMessage?: string\n commitAuthor?: string\n commitSha?: string\n commitRef?: string\n timestamp?: string\n}\nexport type ReqDeployConfig = Required<DeployConfig>\n\nexport interface OxygenError {\n code: string\n unrecoverable: boolean\n debugInfo: string\n}\n\nexport interface UploadDeploymentResponse {\n data: {\n uploadDeployment: {\n deployment: {\n previewURL: string\n }\n error: OxygenError\n }\n }\n}\n\nexport interface GraphQLError {\n message: string\n extensions?: Map<string, unknown>\n locations: {\n line: number\n column: number\n }\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { ReqDeployConfig } from './types.js';
2
+ import { CreateDeploymentResponse } from './graphql/create_deployment.js';
3
+ export declare const createDeployment: (config: ReqDeployConfig) => Promise<CreateDeploymentResponse>;
4
+ export declare const uploadDeployment: (config: ReqDeployConfig, deploymentID: string) => Promise<string>;
5
+ export declare const healthCheck: (pingUrl: string) => Promise<void>;
@@ -0,0 +1,81 @@
1
+ import { CreateDeploymentQuery, } from './graphql/create_deployment.js';
2
+ import { UnrecoverableError, WebPageNotAvailable, TooManyRequestsError } from './error.js';
3
+ import { UploadDeploymentQuery } from './graphql/upload_deployment.js';
4
+ import { api, http, file } from '@shopify/cli-kit';
5
+ import { zip } from '@shopify/cli-kit/node/archiver';
6
+ import { ClientError } from 'graphql-request';
7
+ export const createDeployment = async (config) => {
8
+ const variables = {
9
+ input: {
10
+ branch: config.commitRef,
11
+ commitHash: config.commitSha,
12
+ commitAuthor: config.commitAuthor,
13
+ commitMessage: config.commitMessage,
14
+ commitTimestamp: config.timestamp,
15
+ },
16
+ };
17
+ try {
18
+ const response = await api.oxygen.request(config.oxygenAddress, CreateDeploymentQuery, config.deploymentToken, variables);
19
+ if (response.createDeployment?.error) {
20
+ if (response.createDeployment.error.unrecoverable) {
21
+ throw UnrecoverableError(response.createDeployment.error.debugInfo);
22
+ }
23
+ throw new Error(`Failed to create deployment. ${response.createDeployment.error.debugInfo}`);
24
+ }
25
+ return response.createDeployment;
26
+ }
27
+ catch (error) {
28
+ if (error instanceof ClientError) {
29
+ if (error.response.status === 429) {
30
+ throw TooManyRequestsError();
31
+ }
32
+ }
33
+ throw error;
34
+ }
35
+ };
36
+ export const uploadDeployment = async (config, deploymentID) => {
37
+ let deploymentData;
38
+ await file.inTemporaryDirectory(async (tmpDir) => {
39
+ const distPath = config.pathToBuild ? config.pathToBuild : `${config.path}/dist`;
40
+ const distZipPath = `${tmpDir}/dist.zip`;
41
+ await zip(distPath, distZipPath);
42
+ const formData = http.formData();
43
+ formData.append('operations', buildOperationsString(deploymentID));
44
+ formData.append('map', JSON.stringify({ '0': ['variables.file'] }));
45
+ formData.append('0', file.createReadStream(distZipPath), { filename: distZipPath });
46
+ const response = await api.oxygen.uploadDeploymentFile(config.oxygenAddress, config.deploymentToken, formData);
47
+ if (!response.ok) {
48
+ if (response.status === 429) {
49
+ throw TooManyRequestsError();
50
+ }
51
+ if (response.status !== 200 && response.status !== 202) {
52
+ throw new Error(`Failed to upload deployment. ${await response.json()}`);
53
+ }
54
+ }
55
+ deploymentData = (await response.json());
56
+ });
57
+ if (!deploymentData) {
58
+ throw new Error('Failed to upload deployment.');
59
+ }
60
+ const deploymentError = deploymentData.data?.uploadDeployment?.error;
61
+ if (deploymentError) {
62
+ if (deploymentError.unrecoverable) {
63
+ throw UnrecoverableError(deploymentError.debugInfo);
64
+ }
65
+ throw new Error(`Failed to upload deployment: ${deploymentError.debugInfo}`);
66
+ }
67
+ return deploymentData.data.uploadDeployment.deployment.previewURL;
68
+ };
69
+ export const healthCheck = async (pingUrl) => {
70
+ const url = `${pingUrl}/__health`;
71
+ const result = await http.fetch(url, { method: 'GET' });
72
+ if (result.status !== 200)
73
+ throw WebPageNotAvailable();
74
+ };
75
+ const buildOperationsString = (deploymentID) => {
76
+ return JSON.stringify({
77
+ query: UploadDeploymentQuery,
78
+ variables: { deploymentID, file: null },
79
+ });
80
+ };
81
+ //# sourceMappingURL=upload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../../src/cli/services/deploy/upload.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,qBAAqB,GACtB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAC,kBAAkB,EAAE,mBAAmB,EAAE,oBAAoB,EAAC,MAAM,YAAY,CAAA;AACxF,OAAO,EAAC,qBAAqB,EAAC,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAC,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAC,GAAG,EAAC,MAAM,gCAAgC,CAAA;AAClD,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAA;AAE3C,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,MAAuB,EAAqC,EAAE;IACnG,MAAM,SAAS,GAAG;QAChB,KAAK,EAAE;YACL,MAAM,EAAE,MAAM,CAAC,SAAS;YACxB,UAAU,EAAE,MAAM,CAAC,SAAS;YAC5B,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,eAAe,EAAE,MAAM,CAAC,SAAS;SA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;KAC7E;IAED,OAAO,cAAc,CAAC,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,UAAU,CAAA;AACnE,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,OAAe,EAAE,EAAE;IACnD,MAAM,GAAG,GAAG,GAAG,OAAO,WAAW,CAAA;IACjC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC,CAAA;IACrD,IAAI,MAAM,CAAC,MAAM,KAAK,GAAG;QAAE,MAAM,mBAAmB,EAAE,CAAA;AACxD,CAAC,CAAA;AAED,MAAM,qBAAqB,GAAG,CAAC,YAAoB,EAAU,EAAE;IAC7D,OAAO,IAAI,CAAC,SAAS,CAAC;QACpB,KAAK,EAAE,qBAAqB;QAC5B,SAAS,EAAE,EAAC,YAAY,EAAE,IAAI,EAAE,IAAI,EAAC;KACtC,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import {ReqDeployConfig, UploadDeploymentResponse} from './types.js'\nimport {\n CreateDeploymentResponse,\n CreateDeploymentQuerySchema,\n CreateDeploymentQuery,\n} from './graphql/create_deployment.js'\nimport {UnrecoverableError, WebPageNotAvailable, TooManyRequestsError} from './error.js'\nimport {UploadDeploymentQuery} from './graphql/upload_deployment.js'\nimport {api, http, file} from '@shopify/cli-kit'\nimport {zip} from '@shopify/cli-kit/node/archiver'\nimport {ClientError} from 'graphql-request'\n\nexport const createDeployment = async (config: ReqDeployConfig): Promise<CreateDeploymentResponse> => {\n const variables = {\n input: {\n branch: config.commitRef,\n commitHash: config.commitSha,\n commitAuthor: config.commitAuthor,\n commitMessage: config.commitMessage,\n commitTimestamp: config.timestamp,\n },\n }\n\n try {\n const response: CreateDeploymentQuerySchema = await api.oxygen.request(\n config.oxygenAddress,\n CreateDeploymentQuery,\n config.deploymentToken,\n variables,\n )\n\n if (response.createDeployment?.error) {\n if (response.createDeployment.error.unrecoverable) {\n throw UnrecoverableError(response.createDeployment.error.debugInfo)\n }\n\n throw new Error(`Failed to create deployment. ${response.createDeployment.error.debugInfo}`)\n }\n\n return response.createDeployment\n } catch (error) {\n if (error instanceof ClientError) {\n if (error.response.status === 429) {\n throw TooManyRequestsError()\n }\n }\n\n throw error\n }\n}\n\nexport const uploadDeployment = async (config: ReqDeployConfig, deploymentID: string): Promise<string> => {\n let deploymentData: UploadDeploymentResponse | undefined\n\n await file.inTemporaryDirectory(async (tmpDir) => {\n const distPath = config.pathToBuild ? config.pathToBuild : `${config.path}/dist`\n const distZipPath = `${tmpDir}/dist.zip`\n await zip(distPath, distZipPath)\n\n const formData = http.formData()\n formData.append('operations', buildOperationsString(deploymentID))\n formData.append('map', JSON.stringify({'0': ['variables.file']}))\n formData.append('0', file.createReadStream(distZipPath), {filename: distZipPath})\n\n const response = await api.oxygen.uploadDeploymentFile(config.oxygenAddress, config.deploymentToken, formData)\n if (!response.ok) {\n if (response.status === 429) {\n throw TooManyRequestsError()\n }\n if (response.status !== 200 && response.status !== 202) {\n throw new Error(`Failed to upload deployment. ${await response.json()}`)\n }\n }\n\n deploymentData = (await response.json()) as UploadDeploymentResponse\n })\n\n if (!deploymentData) {\n throw new Error('Failed to upload deployment.')\n }\n const deploymentError = deploymentData.data?.uploadDeployment?.error\n if (deploymentError) {\n if (deploymentError.unrecoverable) {\n throw UnrecoverableError(deploymentError.debugInfo)\n }\n\n throw new Error(`Failed to upload deployment: ${deploymentError.debugInfo}`)\n }\n\n return deploymentData.data.uploadDeployment.deployment.previewURL\n}\n\nexport const healthCheck = async (pingUrl: string) => {\n const url = `${pingUrl}/__health`\n const result = await http.fetch(url, {method: 'GET'})\n if (result.status !== 200) throw WebPageNotAvailable()\n}\n\nconst buildOperationsString = (deploymentID: string): string => {\n return JSON.stringify({\n query: UploadDeploymentQuery,\n variables: {deploymentID, file: null},\n })\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import { DeployConfig } from './deploy/types.js';
2
+ export declare function deployToOxygen(_config: DeployConfig): Promise<any>;