@shopify/cli-hydrogen 4.1.2 → 4.2.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.
Files changed (35) hide show
  1. package/dist/commands/hydrogen/codegen-unstable.d.ts +14 -0
  2. package/dist/commands/hydrogen/codegen-unstable.js +64 -0
  3. package/dist/commands/hydrogen/dev.d.ts +4 -0
  4. package/dist/commands/hydrogen/dev.js +41 -7
  5. package/dist/commands/hydrogen/env/list.d.ts +19 -0
  6. package/dist/commands/hydrogen/env/list.js +96 -0
  7. package/dist/commands/hydrogen/env/list.test.d.ts +1 -0
  8. package/dist/commands/hydrogen/env/list.test.js +151 -0
  9. package/dist/commands/hydrogen/env/pull.d.ts +3 -1
  10. package/dist/commands/hydrogen/env/pull.js +20 -67
  11. package/dist/commands/hydrogen/env/pull.test.js +22 -115
  12. package/dist/lib/codegen.d.ts +25 -0
  13. package/dist/lib/codegen.js +128 -0
  14. package/dist/lib/colors.d.ts +3 -0
  15. package/dist/lib/colors.js +4 -1
  16. package/dist/lib/combined-environment-variables.d.ts +8 -0
  17. package/dist/lib/combined-environment-variables.js +74 -0
  18. package/dist/lib/combined-environment-variables.test.d.ts +1 -0
  19. package/dist/lib/combined-environment-variables.test.js +111 -0
  20. package/dist/lib/flags.d.ts +1 -0
  21. package/dist/lib/flags.js +6 -0
  22. package/dist/lib/graphql/admin/list-environments.d.ts +20 -0
  23. package/dist/lib/graphql/admin/list-environments.js +18 -0
  24. package/dist/lib/graphql/admin/pull-variables.d.ts +1 -1
  25. package/dist/lib/graphql/admin/pull-variables.js +2 -2
  26. package/dist/lib/mini-oxygen.d.ts +4 -1
  27. package/dist/lib/mini-oxygen.js +7 -3
  28. package/dist/lib/pull-environment-variables.d.ts +19 -0
  29. package/dist/lib/pull-environment-variables.js +67 -0
  30. package/dist/lib/pull-environment-variables.test.d.ts +1 -0
  31. package/dist/lib/pull-environment-variables.test.js +174 -0
  32. package/dist/lib/render-errors.d.ts +16 -0
  33. package/dist/lib/render-errors.js +37 -0
  34. package/oclif.manifest.json +1 -1
  35. package/package.json +6 -4
@@ -0,0 +1,19 @@
1
+ import { EnvironmentVariable } from './graphql/admin/pull-variables.js';
2
+
3
+ interface Arguments {
4
+ envBranch?: string;
5
+ root: string;
6
+ /**
7
+ * Optional shop override that developers would have passed using the --shop
8
+ * flag.
9
+ */
10
+ flagShop?: string;
11
+ /**
12
+ * Does not prompt the user to fix any errors that are encountered (e.g. no
13
+ * linked storefront)
14
+ */
15
+ silent?: boolean;
16
+ }
17
+ declare function pullRemoteEnvironmentVariables({ envBranch, root, flagShop, silent, }: Arguments): Promise<EnvironmentVariable[]>;
18
+
19
+ export { pullRemoteEnvironmentVariables };
@@ -0,0 +1,67 @@
1
+ import { renderConfirmationPrompt } from '@shopify/cli-kit/node/ui';
2
+ import { outputContent, outputToken, outputInfo } from '@shopify/cli-kit/node/output';
3
+ import { linkStorefront } from '../commands/hydrogen/link.js';
4
+ import { adminRequest } from './graphql.js';
5
+ import { getHydrogenShop } from './shop.js';
6
+ import { getAdminSession } from './admin-session.js';
7
+ import { getConfig } from './shopify-config.js';
8
+ import { renderMissingLink, renderMissingStorefront } from './render-errors.js';
9
+ import { PullVariablesQuery } from './graphql/admin/pull-variables.js';
10
+
11
+ async function pullRemoteEnvironmentVariables({
12
+ envBranch,
13
+ root,
14
+ flagShop,
15
+ silent
16
+ }) {
17
+ const shop = await getHydrogenShop({ path: root, shop: flagShop });
18
+ const adminSession = await getAdminSession(shop);
19
+ let configStorefront = (await getConfig(root)).storefront;
20
+ if (!configStorefront?.id) {
21
+ if (!silent) {
22
+ renderMissingLink({ adminSession });
23
+ const runLink = await renderConfirmationPrompt({
24
+ message: outputContent`Run ${outputToken.genericShellCommand(
25
+ `npx shopify hydrogen link`
26
+ )}?`.value
27
+ });
28
+ if (!runLink) {
29
+ return [];
30
+ }
31
+ await linkStorefront({ path: root, shop: flagShop, silent });
32
+ }
33
+ }
34
+ configStorefront = (await getConfig(root)).storefront;
35
+ if (!configStorefront) {
36
+ return [];
37
+ }
38
+ if (!silent) {
39
+ outputInfo(
40
+ `Fetching environment variables from ${configStorefront.title}...`
41
+ );
42
+ }
43
+ const result = await adminRequest(
44
+ PullVariablesQuery,
45
+ adminSession,
46
+ {
47
+ id: configStorefront.id,
48
+ branch: envBranch
49
+ }
50
+ );
51
+ const storefront = result.hydrogenStorefront;
52
+ if (!storefront) {
53
+ if (!silent) {
54
+ renderMissingStorefront({ adminSession, storefront: configStorefront });
55
+ }
56
+ return [];
57
+ }
58
+ if (!storefront.environmentVariables.length) {
59
+ if (!silent) {
60
+ outputInfo(`No environment variables found.`);
61
+ }
62
+ return [];
63
+ }
64
+ return storefront.environmentVariables;
65
+ }
66
+
67
+ export { pullRemoteEnvironmentVariables };
@@ -0,0 +1,174 @@
1
+ import { vi, describe, beforeEach, afterEach, it, expect } from 'vitest';
2
+ import { mockAndCaptureOutput } from '@shopify/cli-kit/node/testing/output';
3
+ import { inTemporaryDirectory } from '@shopify/cli-kit/node/fs';
4
+ import { renderConfirmationPrompt } from '@shopify/cli-kit/node/ui';
5
+ import { PullVariablesQuery } from './graphql/admin/pull-variables.js';
6
+ import { getAdminSession } from './admin-session.js';
7
+ import { adminRequest } from './graphql.js';
8
+ import { getConfig } from './shopify-config.js';
9
+ import { renderMissingLink, renderMissingStorefront } from './render-errors.js';
10
+ import { linkStorefront } from '../commands/hydrogen/link.js';
11
+ import { pullRemoteEnvironmentVariables } from './pull-environment-variables.js';
12
+
13
+ vi.mock("@shopify/cli-kit/node/ui", async () => {
14
+ const original = await vi.importActual("@shopify/cli-kit/node/ui");
15
+ return {
16
+ ...original,
17
+ renderConfirmationPrompt: vi.fn()
18
+ };
19
+ });
20
+ vi.mock("../commands/hydrogen/link.js");
21
+ vi.mock("./admin-session.js");
22
+ vi.mock("./shopify-config.js");
23
+ vi.mock("./render-errors.js");
24
+ vi.mock("./graphql.js", async () => {
25
+ const original = await vi.importActual(
26
+ "./graphql.js"
27
+ );
28
+ return {
29
+ ...original,
30
+ adminRequest: vi.fn()
31
+ };
32
+ });
33
+ vi.mock("./shop.js", () => ({
34
+ getHydrogenShop: () => "my-shop"
35
+ }));
36
+ describe("pullRemoteEnvironmentVariables", () => {
37
+ const ENVIRONMENT_VARIABLES_RESPONSE = [
38
+ {
39
+ id: "gid://shopify/HydrogenStorefrontEnvironmentVariable/1",
40
+ key: "PUBLIC_API_TOKEN",
41
+ value: "abc123",
42
+ isSecret: false
43
+ }
44
+ ];
45
+ const ADMIN_SESSION = {
46
+ token: "abc123",
47
+ storeFqdn: "my-shop"
48
+ };
49
+ beforeEach(async () => {
50
+ vi.mocked(getAdminSession).mockResolvedValue(ADMIN_SESSION);
51
+ vi.mocked(getConfig).mockResolvedValue({
52
+ storefront: {
53
+ id: "gid://shopify/HydrogenStorefront/2",
54
+ title: "Existing Link"
55
+ }
56
+ });
57
+ vi.mocked(adminRequest).mockResolvedValue({
58
+ hydrogenStorefront: {
59
+ id: "gid://shopify/HydrogenStorefront/1",
60
+ environmentVariables: ENVIRONMENT_VARIABLES_RESPONSE
61
+ }
62
+ });
63
+ });
64
+ afterEach(() => {
65
+ vi.resetAllMocks();
66
+ mockAndCaptureOutput().clear();
67
+ });
68
+ it("makes a GraphQL call to fetch environment variables", async () => {
69
+ await inTemporaryDirectory(async (tmpDir) => {
70
+ await pullRemoteEnvironmentVariables({
71
+ root: tmpDir,
72
+ envBranch: "staging"
73
+ });
74
+ expect(adminRequest).toHaveBeenCalledWith(
75
+ PullVariablesQuery,
76
+ ADMIN_SESSION,
77
+ {
78
+ id: "gid://shopify/HydrogenStorefront/2",
79
+ branch: "staging"
80
+ }
81
+ );
82
+ });
83
+ });
84
+ it("returns environment variables", async () => {
85
+ await inTemporaryDirectory(async (tmpDir) => {
86
+ const environmentVariables = await pullRemoteEnvironmentVariables({
87
+ root: tmpDir
88
+ });
89
+ expect(environmentVariables).toBe(ENVIRONMENT_VARIABLES_RESPONSE);
90
+ });
91
+ });
92
+ describe("when environment variables are empty", () => {
93
+ beforeEach(() => {
94
+ vi.mocked(adminRequest).mockResolvedValue({
95
+ hydrogenStorefront: {
96
+ id: "gid://shopify/HydrogenStorefront/1",
97
+ environmentVariables: []
98
+ }
99
+ });
100
+ });
101
+ it("renders a message", async () => {
102
+ await inTemporaryDirectory(async (tmpDir) => {
103
+ const outputMock = mockAndCaptureOutput();
104
+ await pullRemoteEnvironmentVariables({ root: tmpDir });
105
+ expect(outputMock.info()).toMatch(/No environment variables found\./);
106
+ });
107
+ });
108
+ it("returns an empty array", async () => {
109
+ await inTemporaryDirectory(async (tmpDir) => {
110
+ const environmentVariables = await pullRemoteEnvironmentVariables({
111
+ root: tmpDir
112
+ });
113
+ expect(environmentVariables).toStrictEqual([]);
114
+ });
115
+ });
116
+ });
117
+ describe("when there is no linked storefront", () => {
118
+ beforeEach(() => {
119
+ vi.mocked(getConfig).mockResolvedValue({
120
+ storefront: void 0
121
+ });
122
+ });
123
+ it("calls renderMissingLink", async () => {
124
+ await inTemporaryDirectory(async (tmpDir) => {
125
+ await pullRemoteEnvironmentVariables({ root: tmpDir });
126
+ expect(renderMissingLink).toHaveBeenCalledOnce();
127
+ });
128
+ });
129
+ it("prompts the user to create a link", async () => {
130
+ vi.mocked(renderConfirmationPrompt).mockResolvedValue(true);
131
+ await inTemporaryDirectory(async (tmpDir) => {
132
+ await pullRemoteEnvironmentVariables({ root: tmpDir });
133
+ expect(renderConfirmationPrompt).toHaveBeenCalledWith({
134
+ message: expect.stringMatching(/Run .*npx shopify hydrogen link.*\?/)
135
+ });
136
+ expect(linkStorefront).toHaveBeenCalledWith({
137
+ path: tmpDir
138
+ });
139
+ });
140
+ });
141
+ describe("and the user does not create a new link", () => {
142
+ it("returns an empty array", async () => {
143
+ vi.mocked(renderConfirmationPrompt).mockResolvedValue(false);
144
+ await inTemporaryDirectory(async (tmpDir) => {
145
+ const environmentVariables = await pullRemoteEnvironmentVariables({
146
+ root: tmpDir
147
+ });
148
+ expect(environmentVariables).toStrictEqual([]);
149
+ });
150
+ });
151
+ });
152
+ });
153
+ describe("when there is no matching storefront in the shop", () => {
154
+ beforeEach(() => {
155
+ vi.mocked(adminRequest).mockResolvedValue({
156
+ hydrogenStorefront: null
157
+ });
158
+ });
159
+ it("calls renderMissingStorefront", async () => {
160
+ await inTemporaryDirectory(async (tmpDir) => {
161
+ await pullRemoteEnvironmentVariables({ root: tmpDir });
162
+ expect(renderMissingStorefront).toHaveBeenCalledOnce();
163
+ });
164
+ });
165
+ it("returns an empty array", async () => {
166
+ await inTemporaryDirectory(async (tmpDir) => {
167
+ const environmentVariables = await pullRemoteEnvironmentVariables({
168
+ root: tmpDir
169
+ });
170
+ expect(environmentVariables).toStrictEqual([]);
171
+ });
172
+ });
173
+ });
174
+ });
@@ -0,0 +1,16 @@
1
+ import { AdminSession } from '@shopify/cli-kit/node/session';
2
+
3
+ interface MissingStorefront {
4
+ adminSession: AdminSession;
5
+ storefront: {
6
+ id: string;
7
+ title: string;
8
+ };
9
+ }
10
+ declare function renderMissingStorefront({ adminSession, storefront, }: MissingStorefront): void;
11
+ interface MissingLink {
12
+ adminSession: AdminSession;
13
+ }
14
+ declare function renderMissingLink({ adminSession }: MissingLink): void;
15
+
16
+ export { renderMissingLink, renderMissingStorefront };
@@ -0,0 +1,37 @@
1
+ import { renderFatalError } from '@shopify/cli-kit/node/ui';
2
+ import { outputContent, outputToken } from '@shopify/cli-kit/node/output';
3
+ import { hydrogenStorefrontsUrl } from './admin-urls.js';
4
+ import { parseGid } from './graphql.js';
5
+
6
+ function renderMissingStorefront({
7
+ adminSession,
8
+ storefront
9
+ }) {
10
+ renderFatalError({
11
+ name: "NoStorefrontError",
12
+ type: 0,
13
+ message: outputContent`${outputToken.errorText(
14
+ "Couldn\u2019t find Hydrogen storefront."
15
+ )}`.value,
16
+ tryMessage: outputContent`Couldn’t find ${storefront.title} (ID: ${parseGid(
17
+ storefront.id
18
+ )}) on ${adminSession.storeFqdn}. Check that the storefront exists and run ${outputToken.genericShellCommand(
19
+ `npx shopify hydrogen link`
20
+ )} to link this project to it.\n\n${outputToken.link(
21
+ "Hydrogen Storefronts Admin",
22
+ hydrogenStorefrontsUrl(adminSession)
23
+ )}`.value
24
+ });
25
+ }
26
+ function renderMissingLink({ adminSession }) {
27
+ renderFatalError({
28
+ name: "NoLinkedStorefrontError",
29
+ type: 0,
30
+ message: `No linked Hydrogen storefront on ${adminSession.storeFqdn}`,
31
+ tryMessage: outputContent`To pull environment variables, link this project to a Hydrogen storefront. To select a storefront to link, run ${outputToken.genericShellCommand(
32
+ `npx shopify hydrogen link`
33
+ )}.`.value
34
+ });
35
+ }
36
+
37
+ export { renderMissingLink, renderMissingStorefront };
@@ -1 +1 @@
1
- {"version":"4.1.2","commands":{"hydrogen:build":{"id":"hydrogen:build","description":"Builds a Hydrogen storefront for production.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","aliases":[],"flags":{"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false},"sourcemap":{"name":"sourcemap","type":"boolean","description":"Generate sourcemaps for the build.","allowNo":false},"disable-route-warning":{"name":"disable-route-warning","type":"boolean","description":"Disable warning about missing standard routes.","allowNo":false},"base":{"name":"base","type":"option","hidden":true,"multiple":false},"entry":{"name":"entry","type":"option","hidden":true,"multiple":false},"target":{"name":"target","type":"option","hidden":true,"multiple":false}},"args":[]},"hydrogen:check":{"id":"hydrogen:check","description":"Returns diagnostic information about a Hydrogen storefront.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","aliases":[],"flags":{"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false}},"args":[{"name":"resource","description":"The resource to check. Currently only 'routes' is supported.","required":true,"options":["routes"]}]},"hydrogen:dev":{"id":"hydrogen:dev","description":"Runs Hydrogen storefront in an Oxygen worker for development.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","aliases":[],"flags":{"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false},"port":{"name":"port","type":"option","description":"Port to run the server on.","multiple":false,"default":3000},"disable-virtual-routes":{"name":"disable-virtual-routes","type":"boolean","description":"Disable rendering fallback routes when a route file doesn't exist","allowNo":false},"debug":{"name":"debug","type":"boolean","description":"Attaches a Node inspector","allowNo":false},"host":{"name":"host","type":"option","hidden":true,"multiple":false}},"args":[]},"hydrogen:g":{"id":"hydrogen:g","description":"Shortcut for `hydrogen generate`. See `hydrogen generate --help` for more information.","strict":false,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","hidden":true,"aliases":[],"flags":{},"args":[]},"hydrogen:init":{"id":"hydrogen:init","description":"Creates a new Hydrogen storefront.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"Overwrite the destination directory and files if they already exist.","allowNo":false},"path":{"name":"path","type":"option","description":"The path to the directory of the new Hydrogen storefront.","multiple":false},"language":{"name":"language","type":"option","description":"Sets the template language to use. One of `js` or `ts`.","multiple":false},"template":{"name":"template","type":"option","description":"Sets the template to use. One of `demo-store` or `hello-world`.","multiple":false},"install-deps":{"name":"install-deps","type":"boolean","description":"Auto install dependencies using the active package manager","allowNo":true}},"args":[]},"hydrogen:link":{"id":"hydrogen:link","description":"Link a local project to one of your shop's Hydrogen storefronts.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","hidden":true,"aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"Overwrite the destination directory and files if they already exist.","allowNo":false},"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false},"shop":{"name":"shop","type":"option","char":"s","description":"Shop URL. It can be the shop prefix (janes-apparel) or the full myshopify.com URL (janes-apparel.myshopify.com, https://janes-apparel.myshopify.com).","multiple":false},"storefront":{"name":"storefront","type":"option","char":"h","description":"The name of a Hydrogen Storefront (e.g. \"Jane's Apparel\")","multiple":false}},"args":[]},"hydrogen:list":{"id":"hydrogen:list","description":"Returns a list of Hydrogen storefronts available on a given shop.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","hidden":true,"aliases":[],"flags":{"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false},"shop":{"name":"shop","type":"option","char":"s","description":"Shop URL. It can be the shop prefix (janes-apparel) or the full myshopify.com URL (janes-apparel.myshopify.com, https://janes-apparel.myshopify.com).","multiple":false}},"args":[]},"hydrogen:preview":{"id":"hydrogen:preview","description":"Runs a Hydrogen storefront in an Oxygen worker for production.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","aliases":[],"flags":{"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false},"port":{"name":"port","type":"option","description":"Port to run the server on.","multiple":false,"default":3000}},"args":[]},"hydrogen:shortcut":{"id":"hydrogen:shortcut","description":"Creates a global `h2` shortcut for the Hydrogen CLI","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","aliases":[],"flags":{},"args":[]},"hydrogen:unlink":{"id":"hydrogen:unlink","description":"Unlink a local project from a Hydrogen storefront.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","hidden":true,"aliases":[],"flags":{"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false}},"args":[]},"hydrogen:env:pull":{"id":"hydrogen:env:pull","description":"Populate your .env with variables from your Hydrogen storefront.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","hidden":true,"aliases":[],"flags":{"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false},"shop":{"name":"shop","type":"option","char":"s","description":"Shop URL. It can be the shop prefix (janes-apparel) or the full myshopify.com URL (janes-apparel.myshopify.com, https://janes-apparel.myshopify.com).","multiple":false},"force":{"name":"force","type":"boolean","char":"f","description":"Overwrite the destination directory and files if they already exist.","allowNo":false}},"args":[]},"hydrogen:generate:route":{"id":"hydrogen:generate:route","description":"Generates a standard Shopify route.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","aliases":[],"flags":{"adapter":{"name":"adapter","type":"option","description":"Remix adapter used in the route. The default is `@shopify/remix-oxygen`.","multiple":false},"typescript":{"name":"typescript","type":"boolean","description":"Generate TypeScript files","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Overwrite the destination directory and files if they already exist.","allowNo":false},"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false}},"args":[{"name":"route","description":"The route to generate. One of home,page,cart,products,collections,policies,robots,sitemap,account,all.","required":true,"options":["home","page","cart","products","collections","policies","robots","sitemap","account","all"]}]},"hydrogen:generate:routes":{"id":"hydrogen:generate:routes","description":"Generates all supported standard shopify routes.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","aliases":[],"flags":{"adapter":{"name":"adapter","type":"option","description":"Remix adapter used in the route. The default is `@shopify/remix-oxygen`.","multiple":false},"typescript":{"name":"typescript","type":"boolean","description":"Generate TypeScript files","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Overwrite the destination directory and files if they already exist.","allowNo":false},"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false}},"args":[]}}}
1
+ {"version":"4.2.0","commands":{"hydrogen:build":{"id":"hydrogen:build","description":"Builds a Hydrogen storefront for production.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","aliases":[],"flags":{"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false},"sourcemap":{"name":"sourcemap","type":"boolean","description":"Generate sourcemaps for the build.","allowNo":false},"disable-route-warning":{"name":"disable-route-warning","type":"boolean","description":"Disable warning about missing standard routes.","allowNo":false},"base":{"name":"base","type":"option","hidden":true,"multiple":false},"entry":{"name":"entry","type":"option","hidden":true,"multiple":false},"target":{"name":"target","type":"option","hidden":true,"multiple":false}},"args":[]},"hydrogen:check":{"id":"hydrogen:check","description":"Returns diagnostic information about a Hydrogen storefront.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","aliases":[],"flags":{"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false}},"args":[{"name":"resource","description":"The resource to check. Currently only 'routes' is supported.","required":true,"options":["routes"]}]},"hydrogen:codegen-unstable":{"id":"hydrogen:codegen-unstable","description":"Generate types for the Storefront API queries found in your project.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","aliases":[],"flags":{"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false},"codegen-config-path":{"name":"codegen-config-path","type":"option","description":"Specify a path to a codegen configuration file. Defaults to `<root>/codegen.ts` if it exists.","required":false,"multiple":false},"watch":{"name":"watch","type":"boolean","description":"Watch the project for changes to update types on file save.","required":false,"allowNo":false}},"args":[]},"hydrogen:dev":{"id":"hydrogen:dev","description":"Runs Hydrogen storefront in an Oxygen worker for development.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","aliases":[],"flags":{"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false},"port":{"name":"port","type":"option","description":"Port to run the server on.","multiple":false,"default":3000},"codegen-unstable":{"name":"codegen-unstable","type":"boolean","description":"Generate types for the Storefront API queries found in your project. It updates the types on file save.","required":false,"allowNo":false},"codegen-config-path":{"name":"codegen-config-path","type":"option","description":"Specify a path to a codegen configuration file. Defaults to `<root>/codegen.ts` if it exists.","required":false,"multiple":false,"dependsOn":["codegen-unstable"]},"disable-virtual-routes":{"name":"disable-virtual-routes","type":"boolean","description":"Disable rendering fallback routes when a route file doesn't exist.","allowNo":false},"shop":{"name":"shop","type":"option","char":"s","description":"Shop URL. It can be the shop prefix (janes-apparel) or the full myshopify.com URL (janes-apparel.myshopify.com, https://janes-apparel.myshopify.com).","multiple":false},"debug":{"name":"debug","type":"boolean","description":"Attaches a Node inspector","allowNo":false},"host":{"name":"host","type":"option","hidden":true,"multiple":false},"env-branch":{"name":"env-branch","type":"option","char":"e","description":"Specify an environment's branch name when using remote environment variables.","hidden":true,"multiple":false}},"args":[]},"hydrogen:g":{"id":"hydrogen:g","description":"Shortcut for `hydrogen generate`. See `hydrogen generate --help` for more information.","strict":false,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","hidden":true,"aliases":[],"flags":{},"args":[]},"hydrogen:init":{"id":"hydrogen:init","description":"Creates a new Hydrogen storefront.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"Overwrite the destination directory and files if they already exist.","allowNo":false},"path":{"name":"path","type":"option","description":"The path to the directory of the new Hydrogen storefront.","multiple":false},"language":{"name":"language","type":"option","description":"Sets the template language to use. One of `js` or `ts`.","multiple":false},"template":{"name":"template","type":"option","description":"Sets the template to use. One of `demo-store` or `hello-world`.","multiple":false},"install-deps":{"name":"install-deps","type":"boolean","description":"Auto install dependencies using the active package manager","allowNo":true}},"args":[]},"hydrogen:link":{"id":"hydrogen:link","description":"Link a local project to one of your shop's Hydrogen storefronts.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","hidden":true,"aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"Overwrite the destination directory and files if they already exist.","allowNo":false},"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false},"shop":{"name":"shop","type":"option","char":"s","description":"Shop URL. It can be the shop prefix (janes-apparel) or the full myshopify.com URL (janes-apparel.myshopify.com, https://janes-apparel.myshopify.com).","multiple":false},"storefront":{"name":"storefront","type":"option","char":"h","description":"The name of a Hydrogen Storefront (e.g. \"Jane's Apparel\")","multiple":false}},"args":[]},"hydrogen:list":{"id":"hydrogen:list","description":"Returns a list of Hydrogen storefronts available on a given shop.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","hidden":true,"aliases":[],"flags":{"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false},"shop":{"name":"shop","type":"option","char":"s","description":"Shop URL. It can be the shop prefix (janes-apparel) or the full myshopify.com URL (janes-apparel.myshopify.com, https://janes-apparel.myshopify.com).","multiple":false}},"args":[]},"hydrogen:preview":{"id":"hydrogen:preview","description":"Runs a Hydrogen storefront in an Oxygen worker for production.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","aliases":[],"flags":{"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false},"port":{"name":"port","type":"option","description":"Port to run the server on.","multiple":false,"default":3000}},"args":[]},"hydrogen:shortcut":{"id":"hydrogen:shortcut","description":"Creates a global `h2` shortcut for the Hydrogen CLI","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","aliases":[],"flags":{},"args":[]},"hydrogen:unlink":{"id":"hydrogen:unlink","description":"Unlink a local project from a Hydrogen storefront.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","hidden":true,"aliases":[],"flags":{"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false}},"args":[]},"hydrogen:env:list":{"id":"hydrogen:env:list","description":"List the environments on your Hydrogen storefront.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","hidden":true,"aliases":[],"flags":{"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false},"shop":{"name":"shop","type":"option","char":"s","description":"Shop URL. It can be the shop prefix (janes-apparel) or the full myshopify.com URL (janes-apparel.myshopify.com, https://janes-apparel.myshopify.com).","multiple":false}},"args":[]},"hydrogen:env:pull":{"id":"hydrogen:env:pull","description":"Populate your .env with variables from your Hydrogen storefront.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","hidden":true,"aliases":[],"flags":{"env-branch":{"name":"env-branch","type":"option","char":"e","description":"Specify an environment's branch name when using remote environment variables.","hidden":true,"multiple":false},"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false},"shop":{"name":"shop","type":"option","char":"s","description":"Shop URL. It can be the shop prefix (janes-apparel) or the full myshopify.com URL (janes-apparel.myshopify.com, https://janes-apparel.myshopify.com).","multiple":false},"force":{"name":"force","type":"boolean","char":"f","description":"Overwrite the destination directory and files if they already exist.","allowNo":false}},"args":[]},"hydrogen:generate:route":{"id":"hydrogen:generate:route","description":"Generates a standard Shopify route.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","aliases":[],"flags":{"adapter":{"name":"adapter","type":"option","description":"Remix adapter used in the route. The default is `@shopify/remix-oxygen`.","multiple":false},"typescript":{"name":"typescript","type":"boolean","description":"Generate TypeScript files","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Overwrite the destination directory and files if they already exist.","allowNo":false},"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false}},"args":[{"name":"route","description":"The route to generate. One of home,page,cart,products,collections,policies,robots,sitemap,account,all.","required":true,"options":["home","page","cart","products","collections","policies","robots","sitemap","account","all"]}]},"hydrogen:generate:routes":{"id":"hydrogen:generate:routes","description":"Generates all supported standard shopify routes.","strict":true,"pluginName":"@shopify/cli-hydrogen","pluginAlias":"@shopify/cli-hydrogen","pluginType":"core","aliases":[],"flags":{"adapter":{"name":"adapter","type":"option","description":"Remix adapter used in the route. The default is `@shopify/remix-oxygen`.","multiple":false},"typescript":{"name":"typescript","type":"boolean","description":"Generate TypeScript files","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Overwrite the destination directory and files if they already exist.","allowNo":false},"path":{"name":"path","type":"option","description":"The path to the directory of the Hydrogen storefront. The default is the current directory.","multiple":false}},"args":[]}}}
package/package.json CHANGED
@@ -4,8 +4,8 @@
4
4
  "access": "public",
5
5
  "@shopify:registry": "https://registry.npmjs.org"
6
6
  },
7
- "version": "4.1.2",
8
- "license": "SEE LICENSE IN LICENSE.md",
7
+ "version": "4.2.0",
8
+ "license": "MIT",
9
9
  "type": "module",
10
10
  "scripts": {
11
11
  "build": "tsup --clean --config ./tsup.config.ts && oclif manifest",
@@ -27,14 +27,16 @@
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@remix-run/react": "^1.15.0",
30
- "@shopify/hydrogen-react": "^2023.4.1",
30
+ "@shopify/hydrogen-react": "^2023.4.2",
31
31
  "@shopify/remix-oxygen": "^1.0.6"
32
32
  },
33
33
  "dependencies": {
34
+ "@graphql-codegen/cli": "3.3.1",
34
35
  "@oclif/core": "2.1.4",
35
36
  "@remix-run/dev": "1.15.0",
36
37
  "@shopify/cli-kit": "3.45.0",
37
- "@shopify/mini-oxygen": "^1.5.0",
38
+ "@shopify/hydrogen-codegen": "^0.0.0",
39
+ "@shopify/mini-oxygen": "^1.6.0",
38
40
  "ansi-colors": "^4.1.3",
39
41
  "fast-glob": "^3.2.12",
40
42
  "fs-extra": "^10.1.0",