@shopify/cli-hydrogen 4.1.1 → 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.
- package/dist/commands/hydrogen/codegen-unstable.d.ts +14 -0
- package/dist/commands/hydrogen/codegen-unstable.js +64 -0
- package/dist/commands/hydrogen/dev.d.ts +5 -0
- package/dist/commands/hydrogen/dev.js +48 -6
- package/dist/commands/hydrogen/env/list.d.ts +19 -0
- package/dist/commands/hydrogen/env/list.js +96 -0
- package/dist/commands/hydrogen/env/list.test.d.ts +1 -0
- package/dist/commands/hydrogen/env/list.test.js +151 -0
- package/dist/commands/hydrogen/env/pull.d.ts +23 -0
- package/dist/commands/hydrogen/env/pull.js +68 -0
- package/dist/commands/hydrogen/env/pull.test.d.ts +1 -0
- package/dist/commands/hydrogen/env/pull.test.js +112 -0
- package/dist/commands/hydrogen/init.js +3 -1
- package/dist/commands/hydrogen/link.d.ts +24 -0
- package/dist/commands/hydrogen/link.js +102 -0
- package/dist/commands/hydrogen/link.test.d.ts +1 -0
- package/dist/commands/hydrogen/link.test.js +137 -0
- package/dist/commands/hydrogen/list.d.ts +21 -0
- package/dist/commands/hydrogen/list.js +83 -0
- package/dist/commands/hydrogen/list.test.d.ts +1 -0
- package/dist/commands/hydrogen/list.test.js +116 -0
- package/dist/commands/hydrogen/unlink.d.ts +17 -0
- package/dist/commands/hydrogen/unlink.js +29 -0
- package/dist/commands/hydrogen/unlink.test.d.ts +1 -0
- package/dist/commands/hydrogen/unlink.test.js +36 -0
- package/dist/generator-templates/routes/[robots.txt].tsx +111 -19
- package/dist/generator-templates/routes/collections/index.tsx +102 -0
- package/dist/lib/admin-session.d.ts +5 -0
- package/dist/lib/admin-session.js +16 -0
- package/dist/lib/admin-session.test.d.ts +1 -0
- package/dist/lib/admin-session.test.js +27 -0
- package/dist/lib/admin-urls.d.ts +8 -0
- package/dist/lib/admin-urls.js +18 -0
- package/dist/lib/codegen.d.ts +25 -0
- package/dist/lib/codegen.js +128 -0
- package/dist/lib/colors.d.ts +3 -0
- package/dist/lib/colors.js +4 -1
- package/dist/lib/combined-environment-variables.d.ts +8 -0
- package/dist/lib/combined-environment-variables.js +74 -0
- package/dist/lib/combined-environment-variables.test.d.ts +1 -0
- package/dist/lib/combined-environment-variables.test.js +111 -0
- package/dist/lib/flags.d.ts +2 -0
- package/dist/lib/flags.js +13 -0
- package/dist/lib/graphql/admin/link-storefront.d.ts +11 -0
- package/dist/lib/graphql/admin/link-storefront.js +11 -0
- package/dist/lib/graphql/admin/list-environments.d.ts +20 -0
- package/dist/lib/graphql/admin/list-environments.js +18 -0
- package/dist/lib/graphql/admin/list-storefronts.d.ts +17 -0
- package/dist/lib/graphql/admin/list-storefronts.js +16 -0
- package/dist/lib/graphql/admin/pull-variables.d.ts +16 -0
- package/dist/lib/graphql/admin/pull-variables.js +15 -0
- package/dist/lib/graphql.d.ts +21 -0
- package/dist/lib/graphql.js +18 -0
- package/dist/lib/graphql.test.d.ts +1 -0
- package/dist/lib/graphql.test.js +15 -0
- package/dist/lib/mini-oxygen.d.ts +4 -1
- package/dist/lib/mini-oxygen.js +7 -3
- package/dist/lib/missing-storefronts.d.ts +5 -0
- package/dist/lib/missing-storefronts.js +18 -0
- package/dist/lib/pull-environment-variables.d.ts +19 -0
- package/dist/lib/pull-environment-variables.js +67 -0
- package/dist/lib/pull-environment-variables.test.d.ts +1 -0
- package/dist/lib/pull-environment-variables.test.js +174 -0
- package/dist/lib/render-errors.d.ts +16 -0
- package/dist/lib/render-errors.js +37 -0
- package/dist/lib/shop.d.ts +7 -0
- package/dist/lib/shop.js +32 -0
- package/dist/lib/shop.test.d.ts +1 -0
- package/dist/lib/shop.test.js +78 -0
- package/dist/lib/shopify-config.d.ts +35 -0
- package/dist/lib/shopify-config.js +86 -0
- package/dist/lib/shopify-config.test.d.ts +1 -0
- package/dist/lib/shopify-config.test.js +209 -0
- package/oclif.manifest.json +1 -1
- package/package.json +7 -5
|
@@ -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 };
|
package/dist/lib/shop.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { renderTextPrompt } from '@shopify/cli-kit/node/ui';
|
|
2
|
+
import { AbortError } from '@shopify/cli-kit/node/error';
|
|
3
|
+
import { outputContent, outputToken } from '@shopify/cli-kit/node/output';
|
|
4
|
+
import { getConfig, setShop } from './shopify-config.js';
|
|
5
|
+
|
|
6
|
+
async function getHydrogenShop(flags) {
|
|
7
|
+
const { shop: flagShop, path: flagPath } = flags;
|
|
8
|
+
const targetPath = flagPath ?? process.cwd();
|
|
9
|
+
const { shop: configShop } = await getConfig(targetPath);
|
|
10
|
+
let promptShop;
|
|
11
|
+
if (!flagShop && !configShop) {
|
|
12
|
+
promptShop = await renderTextPrompt({
|
|
13
|
+
message: "Specify which Shop you would like to use (e.g. janes-goods.myshopify.com)",
|
|
14
|
+
allowEmpty: false
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
const shop = flagShop || configShop || promptShop;
|
|
18
|
+
if (!shop) {
|
|
19
|
+
throw new AbortError(
|
|
20
|
+
"A shop is required",
|
|
21
|
+
`Specify the shop passing ${outputContent`${outputToken.genericShellCommand(
|
|
22
|
+
`--shop={your_shop_url}}`
|
|
23
|
+
)}`.value} or set the ${outputContent`${outputToken.genericShellCommand("SHOPIFY_SHOP")}`.value} environment variable.`
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
if (!configShop || flagShop && flagShop != configShop) {
|
|
27
|
+
await setShop(targetPath, shop);
|
|
28
|
+
}
|
|
29
|
+
return shop;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { getHydrogenShop };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { vi, describe, beforeEach, afterEach, it, expect } from 'vitest';
|
|
2
|
+
import { inTemporaryDirectory } from '@shopify/cli-kit/node/fs';
|
|
3
|
+
import { AbortError } from '@shopify/cli-kit/node/error';
|
|
4
|
+
import { mockAndCaptureOutput } from '@shopify/cli-kit/node/testing/output';
|
|
5
|
+
import { renderTextPrompt } from '@shopify/cli-kit/node/ui';
|
|
6
|
+
import { getHydrogenShop } from './shop.js';
|
|
7
|
+
import { getConfig, setShop } from './shopify-config.js';
|
|
8
|
+
|
|
9
|
+
vi.mock("@shopify/cli-kit/node/ui");
|
|
10
|
+
vi.mock("./shopify-config.js");
|
|
11
|
+
describe("getHydrogenShop()", () => {
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
vi.mocked(getConfig).mockResolvedValue({});
|
|
14
|
+
});
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
mockAndCaptureOutput().clear();
|
|
17
|
+
vi.clearAllMocks();
|
|
18
|
+
});
|
|
19
|
+
describe("when a shop is passed via flag", () => {
|
|
20
|
+
it("returns the shop", async () => {
|
|
21
|
+
await inTemporaryDirectory(async (tmpDir) => {
|
|
22
|
+
const shop = await getHydrogenShop({ shop: "my-shop", path: tmpDir });
|
|
23
|
+
expect(shop).toBe("my-shop");
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
describe("when a shop is not provided via flag", () => {
|
|
28
|
+
describe("and there is no existing SHOP_NAME file", () => {
|
|
29
|
+
it("prompts the user to enter a new name", async () => {
|
|
30
|
+
await inTemporaryDirectory(async (tmpDir) => {
|
|
31
|
+
vi.mocked(renderTextPrompt).mockResolvedValue("my-prompted-shop");
|
|
32
|
+
const shop = await getHydrogenShop({ path: tmpDir });
|
|
33
|
+
expect(renderTextPrompt).toHaveBeenCalledWith({
|
|
34
|
+
message: "Specify which Shop you would like to use (e.g. janes-goods.myshopify.com)",
|
|
35
|
+
allowEmpty: false
|
|
36
|
+
});
|
|
37
|
+
expect(shop).toBe("my-prompted-shop");
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
describe("and the user does not enter a value", () => {
|
|
41
|
+
it("throws an error", async () => {
|
|
42
|
+
await inTemporaryDirectory(async (tmpDir) => {
|
|
43
|
+
vi.mocked(renderTextPrompt).mockResolvedValue("");
|
|
44
|
+
await expect(getHydrogenShop({ path: tmpDir })).rejects.toThrow(
|
|
45
|
+
AbortError
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
describe("and there is an existing shop from the config file", () => {
|
|
52
|
+
it("returns the shop", async () => {
|
|
53
|
+
vi.mocked(getConfig).mockResolvedValue({ shop: "previous-shop" });
|
|
54
|
+
await inTemporaryDirectory(async (tmpDir) => {
|
|
55
|
+
const shop = await getHydrogenShop({ path: tmpDir });
|
|
56
|
+
expect(shop).toBe("previous-shop");
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
describe("when the SHOP_NAME file does not exist", () => {
|
|
62
|
+
it("gets created", async () => {
|
|
63
|
+
await inTemporaryDirectory(async (tmpDir) => {
|
|
64
|
+
await getHydrogenShop({ shop: "new-shop", path: tmpDir });
|
|
65
|
+
expect(setShop).toHaveBeenCalledWith(tmpDir, "new-shop");
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
describe("when the shop is different from the value in SHOP_NAME", () => {
|
|
70
|
+
it("overwrites SHOP_NAME with the new value", async () => {
|
|
71
|
+
vi.mocked(getConfig).mockResolvedValue({ shop: "previous-shop" });
|
|
72
|
+
await inTemporaryDirectory(async (tmpDir) => {
|
|
73
|
+
await getHydrogenShop({ shop: "new-shop", path: tmpDir });
|
|
74
|
+
expect(setShop).toHaveBeenCalledWith(tmpDir, "new-shop");
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
declare const SHOPIFY_DIR = ".shopify";
|
|
2
|
+
declare const SHOPIFY_DIR_PROJECT = "project.json";
|
|
3
|
+
interface Storefront {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
}
|
|
7
|
+
interface ShopifyConfig {
|
|
8
|
+
shop?: string;
|
|
9
|
+
storefront?: Storefront;
|
|
10
|
+
}
|
|
11
|
+
declare function getConfig(root: string): Promise<ShopifyConfig>;
|
|
12
|
+
declare function setShop(root: string, shop: string): Promise<ShopifyConfig>;
|
|
13
|
+
/**
|
|
14
|
+
* Adds storefront information to the config
|
|
15
|
+
*
|
|
16
|
+
* @param root the target directory
|
|
17
|
+
* @returns the updated config
|
|
18
|
+
*/
|
|
19
|
+
declare function setStorefront(root: string, storefront: Storefront): Promise<ShopifyConfig>;
|
|
20
|
+
/**
|
|
21
|
+
* Removes storefront information from the config
|
|
22
|
+
*
|
|
23
|
+
* @param root the target directory
|
|
24
|
+
* @returns the updated config
|
|
25
|
+
*/
|
|
26
|
+
declare function unsetStorefront(root: string): Promise<ShopifyConfig>;
|
|
27
|
+
/**
|
|
28
|
+
* Conditionally adds .shopify to the directory's .gitignore file
|
|
29
|
+
* @param root
|
|
30
|
+
* @returns A boolean; true if the .gitignore was updated, false if there was
|
|
31
|
+
* an error or the .gitignore didn't need updating
|
|
32
|
+
*/
|
|
33
|
+
declare function ensureShopifyGitIgnore(root: string): Promise<boolean>;
|
|
34
|
+
|
|
35
|
+
export { SHOPIFY_DIR, SHOPIFY_DIR_PROJECT, ShopifyConfig, ensureShopifyGitIgnore, getConfig, setShop, setStorefront, unsetStorefront };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { resolvePath, dirname } from '@shopify/cli-kit/node/path';
|
|
2
|
+
import { fileExists, readFile, mkdir, writeFile } from '@shopify/cli-kit/node/fs';
|
|
3
|
+
import { AbortError } from '@shopify/cli-kit/node/error';
|
|
4
|
+
import { outputInfo } from '@shopify/cli-kit/node/output';
|
|
5
|
+
|
|
6
|
+
const SHOPIFY_DIR = ".shopify";
|
|
7
|
+
const SHOPIFY_DIR_PROJECT = "project.json";
|
|
8
|
+
async function getConfig(root) {
|
|
9
|
+
const filePath = resolvePath(root, SHOPIFY_DIR, SHOPIFY_DIR_PROJECT);
|
|
10
|
+
if (!await fileExists(filePath)) {
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
13
|
+
return JSON.parse(await readFile(filePath));
|
|
14
|
+
}
|
|
15
|
+
async function setShop(root, shop) {
|
|
16
|
+
const filePath = resolvePath(root, SHOPIFY_DIR, SHOPIFY_DIR_PROJECT);
|
|
17
|
+
if (!await fileExists(filePath)) {
|
|
18
|
+
await mkdir(dirname(filePath));
|
|
19
|
+
const newConfig = {
|
|
20
|
+
shop
|
|
21
|
+
};
|
|
22
|
+
await writeFile(filePath, JSON.stringify(newConfig));
|
|
23
|
+
await ensureShopifyGitIgnore(root);
|
|
24
|
+
return newConfig;
|
|
25
|
+
}
|
|
26
|
+
const existingConfig = JSON.parse(await readFile(filePath));
|
|
27
|
+
const config = {
|
|
28
|
+
...existingConfig,
|
|
29
|
+
shop
|
|
30
|
+
};
|
|
31
|
+
await writeFile(filePath, JSON.stringify(config));
|
|
32
|
+
await ensureShopifyGitIgnore(root);
|
|
33
|
+
return config;
|
|
34
|
+
}
|
|
35
|
+
async function setStorefront(root, storefront) {
|
|
36
|
+
try {
|
|
37
|
+
const filePath = resolvePath(root, SHOPIFY_DIR, SHOPIFY_DIR_PROJECT);
|
|
38
|
+
const existingConfig = JSON.parse(await readFile(filePath));
|
|
39
|
+
const config = {
|
|
40
|
+
...existingConfig,
|
|
41
|
+
storefront
|
|
42
|
+
};
|
|
43
|
+
await writeFile(filePath, JSON.stringify(config));
|
|
44
|
+
await ensureShopifyGitIgnore(root);
|
|
45
|
+
return config;
|
|
46
|
+
} catch {
|
|
47
|
+
throw new AbortError("Project configuration could not be found.");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async function unsetStorefront(root) {
|
|
51
|
+
try {
|
|
52
|
+
const filePath = resolvePath(root, SHOPIFY_DIR, SHOPIFY_DIR_PROJECT);
|
|
53
|
+
const existingConfig = JSON.parse(await readFile(filePath));
|
|
54
|
+
const config = {
|
|
55
|
+
...existingConfig,
|
|
56
|
+
storefront: void 0
|
|
57
|
+
};
|
|
58
|
+
await writeFile(filePath, JSON.stringify(config));
|
|
59
|
+
await ensureShopifyGitIgnore(root);
|
|
60
|
+
return config;
|
|
61
|
+
} catch {
|
|
62
|
+
throw new AbortError("Project configuration could not be found.");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function ensureShopifyGitIgnore(root) {
|
|
66
|
+
try {
|
|
67
|
+
const gitIgnoreFilePath = resolvePath(root, ".gitignore");
|
|
68
|
+
let gitIgnoreContents = await fileExists(gitIgnoreFilePath) ? await readFile(gitIgnoreFilePath) : "";
|
|
69
|
+
if (gitIgnoreContents.includes(".shopify")) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
if (gitIgnoreContents.length > 0) {
|
|
73
|
+
gitIgnoreContents += `
|
|
74
|
+
`;
|
|
75
|
+
}
|
|
76
|
+
gitIgnoreContents += `${SHOPIFY_DIR}\r
|
|
77
|
+
`;
|
|
78
|
+
outputInfo("Adding .shopify to .gitignore...");
|
|
79
|
+
await writeFile(gitIgnoreFilePath, gitIgnoreContents);
|
|
80
|
+
return true;
|
|
81
|
+
} catch {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { SHOPIFY_DIR, SHOPIFY_DIR_PROJECT, ensureShopifyGitIgnore, getConfig, setShop, setStorefront, unsetStorefront };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { inTemporaryDirectory, mkdir, writeFile, fileExists, readFile } from '@shopify/cli-kit/node/fs';
|
|
3
|
+
import { joinPath, dirname } from '@shopify/cli-kit/node/path';
|
|
4
|
+
import { getConfig, SHOPIFY_DIR, SHOPIFY_DIR_PROJECT, setShop, setStorefront, unsetStorefront, ensureShopifyGitIgnore } from './shopify-config.js';
|
|
5
|
+
|
|
6
|
+
describe("getConfig()", () => {
|
|
7
|
+
describe("when no config exists", () => {
|
|
8
|
+
it("returns an empty object", async () => {
|
|
9
|
+
await inTemporaryDirectory(async (tmpDir) => {
|
|
10
|
+
const config = await getConfig(tmpDir);
|
|
11
|
+
expect(config).toStrictEqual({});
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
describe("when a config exists", () => {
|
|
16
|
+
it("returns the config", async () => {
|
|
17
|
+
await inTemporaryDirectory(async (tmpDir) => {
|
|
18
|
+
const existingConfig = {
|
|
19
|
+
shop: "my-shop"
|
|
20
|
+
};
|
|
21
|
+
const filePath = joinPath(tmpDir, SHOPIFY_DIR, SHOPIFY_DIR_PROJECT);
|
|
22
|
+
await mkdir(dirname(filePath));
|
|
23
|
+
await writeFile(filePath, JSON.stringify(existingConfig));
|
|
24
|
+
const config = await getConfig(tmpDir);
|
|
25
|
+
expect(config).toStrictEqual(existingConfig);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
describe("setShop()", () => {
|
|
31
|
+
describe("when no config exists", () => {
|
|
32
|
+
it("creates a new config file", async () => {
|
|
33
|
+
await inTemporaryDirectory(async (tmpDir) => {
|
|
34
|
+
const filePath = joinPath(tmpDir, SHOPIFY_DIR, SHOPIFY_DIR_PROJECT);
|
|
35
|
+
expect(await fileExists(filePath)).toBeFalsy();
|
|
36
|
+
await setShop(tmpDir, "new-shop");
|
|
37
|
+
expect(await fileExists(filePath)).toBeTruthy();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
it("returns the new config", async () => {
|
|
41
|
+
await inTemporaryDirectory(async (tmpDir) => {
|
|
42
|
+
const config = await setShop(tmpDir, "new-shop");
|
|
43
|
+
expect(config).toStrictEqual({
|
|
44
|
+
shop: "new-shop"
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
describe("when a config exists", () => {
|
|
50
|
+
it("updates the config file", async () => {
|
|
51
|
+
await inTemporaryDirectory(async (tmpDir) => {
|
|
52
|
+
const existingConfig = {
|
|
53
|
+
shop: "previous-shop",
|
|
54
|
+
storefront: {
|
|
55
|
+
id: "gid://shopify/HydrogenStorefront/1",
|
|
56
|
+
title: "Hydrogen"
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const filePath = joinPath(tmpDir, SHOPIFY_DIR, SHOPIFY_DIR_PROJECT);
|
|
60
|
+
await mkdir(dirname(filePath));
|
|
61
|
+
await writeFile(filePath, JSON.stringify(existingConfig));
|
|
62
|
+
expect(JSON.parse(await readFile(filePath))).toStrictEqual(
|
|
63
|
+
existingConfig
|
|
64
|
+
);
|
|
65
|
+
await setShop(tmpDir, "new-shop");
|
|
66
|
+
expect(JSON.parse(await readFile(filePath))).toStrictEqual({
|
|
67
|
+
...existingConfig,
|
|
68
|
+
shop: "new-shop"
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
it("returns the new config", async () => {
|
|
73
|
+
await inTemporaryDirectory(async (tmpDir) => {
|
|
74
|
+
const existingConfig = {
|
|
75
|
+
shop: "previous-shop",
|
|
76
|
+
storefront: {
|
|
77
|
+
id: "gid://shopify/HydrogenStorefront/1",
|
|
78
|
+
title: "Hydrogen"
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const filePath = joinPath(tmpDir, SHOPIFY_DIR, SHOPIFY_DIR_PROJECT);
|
|
82
|
+
await mkdir(dirname(filePath));
|
|
83
|
+
await writeFile(filePath, JSON.stringify(existingConfig));
|
|
84
|
+
const config = await setShop(tmpDir, "new-shop");
|
|
85
|
+
expect(config).toStrictEqual({
|
|
86
|
+
...existingConfig,
|
|
87
|
+
shop: "new-shop"
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
describe("setStorefront()", () => {
|
|
94
|
+
it("updates the config file", async () => {
|
|
95
|
+
await inTemporaryDirectory(async (tmpDir) => {
|
|
96
|
+
const existingConfig = {
|
|
97
|
+
shop: "previous-shop",
|
|
98
|
+
storefront: {
|
|
99
|
+
id: "gid://shopify/HydrogenStorefront/1",
|
|
100
|
+
title: "Hydrogen"
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const filePath = joinPath(tmpDir, SHOPIFY_DIR, SHOPIFY_DIR_PROJECT);
|
|
104
|
+
await mkdir(dirname(filePath));
|
|
105
|
+
await writeFile(filePath, JSON.stringify(existingConfig));
|
|
106
|
+
expect(JSON.parse(await readFile(filePath))).toStrictEqual(
|
|
107
|
+
existingConfig
|
|
108
|
+
);
|
|
109
|
+
const newStorefront = {
|
|
110
|
+
id: "gid://shopify/HydrogenStorefront/2",
|
|
111
|
+
title: "Remix"
|
|
112
|
+
};
|
|
113
|
+
await setStorefront(tmpDir, newStorefront);
|
|
114
|
+
expect(JSON.parse(await readFile(filePath))).toStrictEqual({
|
|
115
|
+
...existingConfig,
|
|
116
|
+
storefront: newStorefront
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
it("returns the new config", async () => {
|
|
121
|
+
await inTemporaryDirectory(async (tmpDir) => {
|
|
122
|
+
const existingConfig = {
|
|
123
|
+
shop: "previous-shop",
|
|
124
|
+
storefront: {
|
|
125
|
+
id: "gid://shopify/HydrogenStorefront/1",
|
|
126
|
+
title: "Hydrogen"
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const filePath = joinPath(tmpDir, SHOPIFY_DIR, SHOPIFY_DIR_PROJECT);
|
|
130
|
+
await mkdir(dirname(filePath));
|
|
131
|
+
await writeFile(filePath, JSON.stringify(existingConfig));
|
|
132
|
+
const newStorefront = {
|
|
133
|
+
id: "gid://shopify/HydrogenStorefront/2",
|
|
134
|
+
title: "Remix"
|
|
135
|
+
};
|
|
136
|
+
const config = await setStorefront(tmpDir, newStorefront);
|
|
137
|
+
expect(config).toStrictEqual({
|
|
138
|
+
...existingConfig,
|
|
139
|
+
storefront: newStorefront
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
describe("unsetStorefront()", () => {
|
|
145
|
+
it("removes the storefront configuration and returns the config", async () => {
|
|
146
|
+
await inTemporaryDirectory(async (tmpDir) => {
|
|
147
|
+
const existingConfig = {
|
|
148
|
+
shop: "previous-shop",
|
|
149
|
+
storefront: {
|
|
150
|
+
id: "gid://shopify/HydrogenStorefront/1",
|
|
151
|
+
title: "Hydrogen"
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const filePath = joinPath(tmpDir, SHOPIFY_DIR, SHOPIFY_DIR_PROJECT);
|
|
155
|
+
await mkdir(dirname(filePath));
|
|
156
|
+
await writeFile(filePath, JSON.stringify(existingConfig));
|
|
157
|
+
expect(JSON.parse(await readFile(filePath))).toStrictEqual(
|
|
158
|
+
existingConfig
|
|
159
|
+
);
|
|
160
|
+
const config = await unsetStorefront(tmpDir);
|
|
161
|
+
expect(config).toStrictEqual({
|
|
162
|
+
shop: "previous-shop",
|
|
163
|
+
storefront: void 0
|
|
164
|
+
});
|
|
165
|
+
expect(JSON.parse(await readFile(filePath))).toStrictEqual({
|
|
166
|
+
shop: "previous-shop"
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
describe("ensureShopifyGitIgnore()", () => {
|
|
172
|
+
describe("when a .gitignore file already exists", () => {
|
|
173
|
+
it("updates the .gitignore file and returns true", async () => {
|
|
174
|
+
await inTemporaryDirectory(async (tmpDir) => {
|
|
175
|
+
const existingFileContents = "node_modules\r\n";
|
|
176
|
+
const filePath = joinPath(tmpDir, ".gitignore");
|
|
177
|
+
await writeFile(filePath, JSON.stringify(existingFileContents));
|
|
178
|
+
expect(await readFile(filePath)).not.toContain(".shopify");
|
|
179
|
+
const result = await ensureShopifyGitIgnore(tmpDir);
|
|
180
|
+
expect(await readFile(filePath)).toContain(".shopify");
|
|
181
|
+
expect(result).toBeTruthy();
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
describe("and the file is already ignoring .shopify", () => {
|
|
185
|
+
it("does not update the file and returns false", async () => {
|
|
186
|
+
await inTemporaryDirectory(async (tmpDir) => {
|
|
187
|
+
const existingFileContents = "node_modules\n.shopify\r\n";
|
|
188
|
+
const filePath = joinPath(tmpDir, ".gitignore");
|
|
189
|
+
await writeFile(filePath, JSON.stringify(existingFileContents));
|
|
190
|
+
const originalFile = await readFile(filePath);
|
|
191
|
+
const result = await ensureShopifyGitIgnore(tmpDir);
|
|
192
|
+
expect(await readFile(filePath)).toStrictEqual(originalFile);
|
|
193
|
+
expect(result).toBeFalsy();
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
describe("when a .gitignore does not exist", () => {
|
|
199
|
+
it("creates the .gitignore file and returns true", async () => {
|
|
200
|
+
await inTemporaryDirectory(async (tmpDir) => {
|
|
201
|
+
const filePath = joinPath(tmpDir, ".gitignore");
|
|
202
|
+
expect(await fileExists(filePath)).toBeFalsy();
|
|
203
|
+
const result = await ensureShopifyGitIgnore(tmpDir);
|
|
204
|
+
expect(await readFile(filePath)).toContain(".shopify");
|
|
205
|
+
expect(result).toBeTruthy();
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
});
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"4.1.1","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},"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: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: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.
|
|
8
|
-
"license": "
|
|
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.
|
|
31
|
-
"@shopify/remix-oxygen": "^1.0.
|
|
30
|
+
"@shopify/hydrogen-react": "^2023.4.2",
|
|
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/
|
|
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",
|