@shopify/cli-hydrogen 5.0.2 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/hydrogen/build.js +21 -6
- package/dist/commands/hydrogen/check.js +2 -2
- package/dist/commands/hydrogen/codegen-unstable.js +14 -25
- package/dist/commands/hydrogen/dev.js +55 -43
- package/dist/commands/hydrogen/env/list.js +25 -24
- package/dist/commands/hydrogen/env/list.test.js +46 -43
- package/dist/commands/hydrogen/env/pull.js +53 -25
- package/dist/commands/hydrogen/env/pull.test.js +123 -42
- package/dist/commands/hydrogen/generate/route.js +31 -132
- package/dist/commands/hydrogen/generate/route.test.js +34 -126
- package/dist/commands/hydrogen/init.js +46 -127
- package/dist/commands/hydrogen/init.test.js +352 -100
- package/dist/commands/hydrogen/link.js +70 -69
- package/dist/commands/hydrogen/link.test.js +72 -107
- package/dist/commands/hydrogen/list.js +22 -12
- package/dist/commands/hydrogen/list.test.js +51 -48
- package/dist/commands/hydrogen/login.js +31 -0
- package/dist/commands/hydrogen/logout.js +21 -0
- package/dist/commands/hydrogen/preview.js +1 -1
- package/dist/commands/hydrogen/setup/css.js +79 -0
- package/dist/commands/hydrogen/setup/markets.js +53 -0
- package/dist/commands/hydrogen/setup.js +133 -0
- package/dist/commands/hydrogen/shortcut.js +2 -45
- package/dist/commands/hydrogen/shortcut.test.js +10 -37
- package/dist/generator-templates/assets/css-modules/package.json +6 -0
- package/dist/generator-templates/assets/postcss/package.json +10 -0
- package/dist/generator-templates/assets/postcss/postcss.config.js +8 -0
- package/dist/generator-templates/assets/tailwind/package.json +13 -0
- package/dist/generator-templates/assets/tailwind/postcss.config.js +10 -0
- package/dist/generator-templates/assets/tailwind/tailwind.config.js +8 -0
- package/dist/generator-templates/assets/tailwind/tailwind.css +3 -0
- package/dist/generator-templates/assets/vanilla-extract/package.json +9 -0
- package/dist/generator-templates/starter/.eslintignore +5 -0
- package/dist/generator-templates/starter/.eslintrc.js +18 -0
- package/dist/generator-templates/starter/.graphqlrc.yml +1 -0
- package/dist/generator-templates/starter/README.md +40 -0
- package/dist/generator-templates/starter/app/components/Aside.tsx +47 -0
- package/dist/generator-templates/starter/app/components/Cart.tsx +340 -0
- package/dist/generator-templates/starter/app/components/Footer.tsx +99 -0
- package/dist/generator-templates/starter/app/components/Header.tsx +178 -0
- package/dist/generator-templates/starter/app/components/Layout.tsx +95 -0
- package/dist/generator-templates/starter/app/components/Search.tsx +480 -0
- package/dist/generator-templates/starter/app/entry.client.tsx +12 -0
- package/dist/generator-templates/starter/app/entry.server.tsx +33 -0
- package/dist/generator-templates/starter/app/root.tsx +264 -0
- package/dist/generator-templates/starter/app/routes/$.tsx +7 -0
- package/dist/generator-templates/{routes → starter/app/routes}/[robots.txt].tsx +47 -69
- package/dist/generator-templates/starter/app/routes/[sitemap.xml].tsx +174 -0
- package/dist/generator-templates/starter/app/routes/_index.tsx +145 -0
- package/dist/generator-templates/starter/app/routes/account.$.tsx +9 -0
- package/dist/generator-templates/starter/app/routes/account.addresses.tsx +563 -0
- package/dist/generator-templates/starter/app/routes/account.orders.$id.tsx +309 -0
- package/dist/generator-templates/starter/app/routes/account.orders._index.tsx +196 -0
- package/dist/generator-templates/starter/app/routes/account.profile.tsx +289 -0
- package/dist/generator-templates/starter/app/routes/account.tsx +203 -0
- package/dist/generator-templates/starter/app/routes/account_.activate.$id.$activationToken.tsx +157 -0
- package/dist/generator-templates/starter/app/routes/account_.login.tsx +143 -0
- package/dist/generator-templates/starter/app/routes/account_.logout.tsx +33 -0
- package/dist/generator-templates/starter/app/routes/account_.recover.tsx +124 -0
- package/dist/generator-templates/starter/app/routes/account_.register.tsx +207 -0
- package/dist/generator-templates/starter/app/routes/account_.reset.$id.$resetToken.tsx +136 -0
- package/dist/generator-templates/starter/app/routes/api.predictive-search.tsx +342 -0
- package/dist/generator-templates/starter/app/routes/blogs.$blogHandle.$articleHandle.tsx +88 -0
- package/dist/generator-templates/starter/app/routes/blogs.$blogHandle._index.tsx +162 -0
- package/dist/generator-templates/starter/app/routes/blogs._index.tsx +94 -0
- package/dist/generator-templates/starter/app/routes/cart.tsx +104 -0
- package/dist/generator-templates/starter/app/routes/collections.$handle.tsx +184 -0
- package/dist/generator-templates/starter/app/routes/collections._index.tsx +120 -0
- package/dist/generator-templates/starter/app/routes/pages.$handle.tsx +57 -0
- package/dist/generator-templates/starter/app/routes/policies.$handle.tsx +94 -0
- package/dist/generator-templates/starter/app/routes/policies._index.tsx +63 -0
- package/dist/generator-templates/starter/app/routes/products.$handle.tsx +418 -0
- package/dist/generator-templates/starter/app/routes/search.tsx +168 -0
- package/dist/generator-templates/starter/app/styles/app.css +473 -0
- package/dist/generator-templates/starter/app/styles/reset.css +129 -0
- package/dist/generator-templates/starter/app/utils.ts +46 -0
- package/dist/generator-templates/starter/package.json +43 -0
- package/dist/generator-templates/starter/public/favicon.svg +28 -0
- package/dist/generator-templates/starter/remix.config.js +26 -0
- package/dist/generator-templates/starter/remix.env.d.ts +39 -0
- package/dist/generator-templates/starter/server.ts +253 -0
- package/dist/generator-templates/starter/storefrontapi.generated.d.ts +1906 -0
- package/dist/generator-templates/starter/tsconfig.json +22 -0
- package/dist/lib/auth.js +123 -0
- package/dist/lib/auth.test.js +157 -0
- package/dist/lib/build.js +51 -0
- package/dist/lib/check-version.js +3 -3
- package/dist/lib/check-version.test.js +24 -0
- package/dist/lib/codegen.js +26 -17
- package/dist/lib/environment-variables.js +68 -0
- package/dist/lib/environment-variables.test.js +147 -0
- package/dist/lib/file.js +41 -0
- package/dist/lib/file.test.js +69 -0
- package/dist/lib/flags.js +39 -2
- package/dist/lib/format-code.js +26 -0
- package/dist/lib/gid.js +12 -0
- package/dist/lib/{graphql.test.js → gid.test.js} +1 -1
- package/dist/lib/graphql/admin/client.js +27 -0
- package/dist/lib/graphql/admin/client.test.js +51 -0
- package/dist/lib/graphql/admin/create-storefront.js +13 -15
- package/dist/lib/graphql/admin/create-storefront.test.js +64 -0
- package/dist/lib/graphql/admin/fetch-job.js +6 -15
- package/dist/lib/graphql/admin/link-storefront.js +7 -11
- package/dist/lib/graphql/admin/link-storefront.test.js +38 -0
- package/dist/lib/graphql/admin/list-environments.js +2 -2
- package/dist/lib/graphql/admin/list-environments.test.js +44 -0
- package/dist/lib/graphql/admin/list-storefronts.js +7 -11
- package/dist/lib/graphql/admin/list-storefronts.test.js +44 -0
- package/dist/lib/graphql/admin/pull-variables.js +3 -3
- package/dist/lib/graphql/admin/pull-variables.test.js +37 -0
- package/dist/lib/graphql/business-platform/user-account.js +83 -0
- package/dist/lib/graphql/business-platform/user-account.test.js +80 -0
- package/dist/lib/log.js +216 -9
- package/dist/lib/log.test.js +92 -0
- package/dist/lib/mini-oxygen.js +19 -9
- package/dist/lib/missing-routes.js +0 -2
- package/dist/lib/onboarding/common.js +456 -0
- package/dist/lib/onboarding/index.js +2 -0
- package/dist/lib/onboarding/local.js +229 -0
- package/dist/lib/onboarding/remote.js +89 -0
- package/dist/lib/remix-config.js +135 -0
- package/dist/lib/remix-version-check.js +51 -0
- package/dist/lib/remix-version-check.test.js +38 -0
- package/dist/lib/remix-version-interop.js +6 -6
- package/dist/lib/remix-version-interop.test.js +12 -2
- package/dist/lib/render-errors.js +13 -11
- package/dist/lib/setups/css/assets.js +89 -0
- package/dist/lib/setups/css/css-modules.js +22 -0
- package/dist/lib/setups/css/index.js +44 -0
- package/dist/lib/setups/css/postcss.js +34 -0
- package/dist/lib/setups/css/replacers.js +137 -0
- package/dist/lib/setups/css/tailwind.js +54 -0
- package/dist/lib/setups/css/vanilla-extract.js +22 -0
- package/dist/lib/setups/i18n/domains.test.js +25 -0
- package/dist/lib/setups/i18n/index.js +46 -0
- package/dist/lib/setups/i18n/replacers.js +227 -0
- package/dist/lib/setups/i18n/subdomains.test.js +25 -0
- package/dist/lib/setups/i18n/subfolders.test.js +25 -0
- package/dist/lib/setups/i18n/templates/domains.js +14 -0
- package/dist/lib/setups/i18n/templates/domains.ts +25 -0
- package/dist/lib/setups/i18n/templates/subdomains.js +14 -0
- package/dist/lib/setups/i18n/templates/subdomains.ts +24 -0
- package/dist/lib/setups/i18n/templates/subfolders.js +14 -0
- package/dist/lib/setups/i18n/templates/subfolders.ts +28 -0
- package/dist/lib/setups/routes/generate.js +244 -0
- package/dist/lib/setups/routes/generate.test.js +313 -0
- package/dist/lib/shell.js +52 -5
- package/dist/lib/shell.test.js +42 -16
- package/dist/lib/shopify-config.js +23 -18
- package/dist/lib/shopify-config.test.js +63 -73
- package/dist/lib/template-downloader.js +9 -7
- package/dist/lib/transpile-ts.js +9 -29
- package/dist/virtual-routes/routes/index.jsx +40 -19
- package/oclif.manifest.json +710 -1
- package/package.json +20 -21
- package/dist/commands/hydrogen/build.d.ts +0 -23
- package/dist/commands/hydrogen/check.d.ts +0 -15
- package/dist/commands/hydrogen/codegen-unstable.d.ts +0 -15
- package/dist/commands/hydrogen/dev.d.ts +0 -21
- package/dist/commands/hydrogen/env/list.d.ts +0 -18
- package/dist/commands/hydrogen/env/pull.d.ts +0 -22
- package/dist/commands/hydrogen/g.d.ts +0 -10
- package/dist/commands/hydrogen/generate/route.d.ts +0 -32
- package/dist/commands/hydrogen/generate/route.test.d.ts +0 -1
- package/dist/commands/hydrogen/generate/routes.d.ts +0 -16
- package/dist/commands/hydrogen/init.d.ts +0 -24
- package/dist/commands/hydrogen/init.test.d.ts +0 -1
- package/dist/commands/hydrogen/link.d.ts +0 -23
- package/dist/commands/hydrogen/link.test.d.ts +0 -1
- package/dist/commands/hydrogen/list.d.ts +0 -21
- package/dist/commands/hydrogen/list.test.d.ts +0 -1
- package/dist/commands/hydrogen/preview.d.ts +0 -17
- package/dist/commands/hydrogen/shortcut.d.ts +0 -9
- package/dist/commands/hydrogen/shortcut.test.d.ts +0 -1
- package/dist/commands/hydrogen/unlink.d.ts +0 -16
- package/dist/commands/hydrogen/unlink.test.d.ts +0 -1
- package/dist/create-app.d.ts +0 -1
- package/dist/generator-templates/routes/[sitemap.xml].tsx +0 -235
- package/dist/generator-templates/routes/account/login.tsx +0 -103
- package/dist/generator-templates/routes/account/register.tsx +0 -103
- package/dist/generator-templates/routes/cart.tsx +0 -81
- package/dist/generator-templates/routes/collections/$collectionHandle.tsx +0 -104
- package/dist/generator-templates/routes/collections/index.tsx +0 -102
- package/dist/generator-templates/routes/graphiql.tsx +0 -10
- package/dist/generator-templates/routes/index.tsx +0 -40
- package/dist/generator-templates/routes/pages/$pageHandle.tsx +0 -112
- package/dist/generator-templates/routes/policies/$policyHandle.tsx +0 -140
- package/dist/generator-templates/routes/policies/index.tsx +0 -117
- package/dist/generator-templates/routes/products/$productHandle.tsx +0 -92
- package/dist/hooks/init.d.ts +0 -5
- package/dist/lib/admin-session.d.ts +0 -6
- package/dist/lib/admin-session.js +0 -16
- package/dist/lib/admin-session.test.d.ts +0 -1
- package/dist/lib/admin-session.test.js +0 -27
- package/dist/lib/admin-urls.d.ts +0 -8
- package/dist/lib/check-lockfile.d.ts +0 -3
- package/dist/lib/check-lockfile.test.d.ts +0 -1
- package/dist/lib/check-version.d.ts +0 -16
- package/dist/lib/check-version.test.d.ts +0 -1
- package/dist/lib/codegen.d.ts +0 -26
- package/dist/lib/combined-environment-variables.d.ts +0 -8
- package/dist/lib/combined-environment-variables.js +0 -57
- package/dist/lib/combined-environment-variables.test.d.ts +0 -1
- package/dist/lib/combined-environment-variables.test.js +0 -111
- package/dist/lib/config.d.ts +0 -20
- package/dist/lib/config.js +0 -141
- package/dist/lib/flags.d.ts +0 -27
- package/dist/lib/flags.test.d.ts +0 -1
- package/dist/lib/graphql/admin/create-storefront.d.ts +0 -17
- package/dist/lib/graphql/admin/fetch-job.d.ts +0 -23
- package/dist/lib/graphql/admin/link-storefront.d.ts +0 -14
- package/dist/lib/graphql/admin/list-environments.d.ts +0 -21
- package/dist/lib/graphql/admin/list-storefronts.d.ts +0 -25
- package/dist/lib/graphql/admin/pull-variables.d.ts +0 -21
- package/dist/lib/graphql.d.ts +0 -21
- package/dist/lib/graphql.js +0 -18
- package/dist/lib/graphql.test.d.ts +0 -1
- package/dist/lib/log.d.ts +0 -6
- package/dist/lib/mini-oxygen.d.ts +0 -22
- package/dist/lib/missing-routes.d.ts +0 -8
- package/dist/lib/missing-routes.test.d.ts +0 -1
- package/dist/lib/missing-storefronts.d.ts +0 -5
- package/dist/lib/missing-storefronts.js +0 -18
- package/dist/lib/process.d.ts +0 -6
- package/dist/lib/pull-environment-variables.d.ts +0 -20
- package/dist/lib/pull-environment-variables.js +0 -57
- package/dist/lib/pull-environment-variables.test.d.ts +0 -1
- package/dist/lib/pull-environment-variables.test.js +0 -174
- package/dist/lib/remix-version-interop.d.ts +0 -11
- package/dist/lib/remix-version-interop.test.d.ts +0 -1
- package/dist/lib/render-errors.d.ts +0 -16
- package/dist/lib/shell.d.ts +0 -11
- package/dist/lib/shell.test.d.ts +0 -1
- package/dist/lib/shop.d.ts +0 -7
- package/dist/lib/shop.js +0 -32
- package/dist/lib/shop.test.d.ts +0 -1
- package/dist/lib/shop.test.js +0 -78
- package/dist/lib/shopify-config.d.ts +0 -35
- package/dist/lib/shopify-config.test.d.ts +0 -1
- package/dist/lib/string.d.ts +0 -3
- package/dist/lib/string.test.d.ts +0 -1
- package/dist/lib/template-downloader.d.ts +0 -6
- package/dist/lib/transpile-ts.d.ts +0 -16
- package/dist/lib/user-errors.d.ts +0 -9
- package/dist/lib/user-errors.js +0 -11
- package/dist/lib/virtual-routes.d.ts +0 -7
- package/dist/lib/virtual-routes.test.d.ts +0 -1
- /package/dist/{commands/hydrogen/env/list.test.d.ts → lib/setups/css/common.js} +0 -0
- /package/dist/{commands/hydrogen/env/pull.test.d.ts → lib/setups/i18n/mock-i18n-types.js} +0 -0
package/dist/lib/config.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { renderFatalError } from '@shopify/cli-kit/node/ui';
|
|
2
|
-
import { outputWarn } from '@shopify/cli-kit/node/output';
|
|
3
|
-
import { fileExists } from '@shopify/cli-kit/node/fs';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
import path from 'path';
|
|
6
|
-
import fs from 'fs/promises';
|
|
7
|
-
|
|
8
|
-
const BUILD_DIR = "dist";
|
|
9
|
-
const CLIENT_SUBDIR = "client";
|
|
10
|
-
const WORKER_SUBDIR = "worker";
|
|
11
|
-
const oxygenServerMainFields = ["browser", "module", "main"];
|
|
12
|
-
function getProjectPaths(appPath, entry) {
|
|
13
|
-
const root = appPath ?? process.cwd();
|
|
14
|
-
const publicPath = path.join(root, "public");
|
|
15
|
-
const buildPath = path.join(root, BUILD_DIR);
|
|
16
|
-
const buildPathClient = path.join(buildPath, CLIENT_SUBDIR);
|
|
17
|
-
const buildPathWorkerFile = path.join(buildPath, WORKER_SUBDIR, "index.js");
|
|
18
|
-
return {
|
|
19
|
-
root,
|
|
20
|
-
buildPath,
|
|
21
|
-
buildPathClient,
|
|
22
|
-
buildPathWorkerFile,
|
|
23
|
-
publicPath
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
async function getRemixConfig(root, skipOxygenChecks = false, mode = process.env.NODE_ENV) {
|
|
27
|
-
const { readConfig } = await import('@remix-run/dev/dist/config.js');
|
|
28
|
-
const config = await readConfig(root, mode);
|
|
29
|
-
if (!skipOxygenChecks) {
|
|
30
|
-
if (!config.serverEntryPoint) {
|
|
31
|
-
throwConfigError(
|
|
32
|
-
"Could not find a server entry point.",
|
|
33
|
-
"Please add a server option to your remix.config.js pointing to an Oxygen worker entry file."
|
|
34
|
-
);
|
|
35
|
-
} else {
|
|
36
|
-
assertEntryFileExists(config.rootDirectory, config.serverEntryPoint);
|
|
37
|
-
}
|
|
38
|
-
if (config.serverPlatform !== "neutral") {
|
|
39
|
-
throwConfigError(
|
|
40
|
-
'The serverPlatform in remix.config.js must be "neutral".'
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
if (config.serverModuleFormat !== "esm") {
|
|
44
|
-
throwConfigError(
|
|
45
|
-
'The serverModuleFormat in remix.config.js must be "esm".'
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
if (config.serverDependenciesToBundle !== "all") {
|
|
49
|
-
throwConfigError(
|
|
50
|
-
'The serverDependenciesToBundle in remix.config.js must be "all".'
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
if (!config.serverConditions?.includes("worker")) {
|
|
54
|
-
throwConfigError(
|
|
55
|
-
'The serverConditions in remix.config.js must include "worker".'
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
if (process.env.NODE_ENV === "development" && !config.serverConditions?.includes("development")) {
|
|
59
|
-
outputWarn(
|
|
60
|
-
"Add `process.env.NODE_ENV` value to serverConditions in remix.config.js to enable debugging features in development."
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
if (!config.serverMainFields || !oxygenServerMainFields.every(
|
|
64
|
-
(v, i) => config.serverMainFields?.[i] === v
|
|
65
|
-
)) {
|
|
66
|
-
throwConfigError(
|
|
67
|
-
`The serverMainFields in remix.config.js must be ${JSON.stringify(
|
|
68
|
-
oxygenServerMainFields
|
|
69
|
-
)}.`
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
const cdnUrl = process.env.HYDROGEN_ASSET_BASE_URL;
|
|
73
|
-
if (cdnUrl && !config.publicPath.startsWith(cdnUrl)) {
|
|
74
|
-
throwConfigError(
|
|
75
|
-
"The publicPath in remix.config.js must be prepended with the value of `process.env.HYDROGEN_ASSET_BASE_URL`."
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
const expectedServerBuildPath = path.join(
|
|
79
|
-
BUILD_DIR,
|
|
80
|
-
WORKER_SUBDIR,
|
|
81
|
-
"index.js"
|
|
82
|
-
);
|
|
83
|
-
if (config.serverBuildPath !== path.resolve(root, expectedServerBuildPath)) {
|
|
84
|
-
throwConfigError(
|
|
85
|
-
`The serverBuildPath in remix.config.js must be "${expectedServerBuildPath}".`
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
const expectedAssetsBuildDirectory = path.join(BUILD_DIR, CLIENT_SUBDIR);
|
|
89
|
-
if (!config.assetsBuildDirectory.startsWith(
|
|
90
|
-
path.resolve(root, expectedAssetsBuildDirectory)
|
|
91
|
-
)) {
|
|
92
|
-
throwConfigError(
|
|
93
|
-
`The assetsBuildDirectory in remix.config.js must be in "${expectedAssetsBuildDirectory}".`
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
if (process.env.LOCAL_DEV) {
|
|
98
|
-
const packagesPath = fileURLToPath(new URL("../../..", import.meta.url));
|
|
99
|
-
config.watchPaths ??= [];
|
|
100
|
-
config.watchPaths.push(
|
|
101
|
-
...(await fs.readdir(packagesPath)).map(
|
|
102
|
-
(pkg) => pkg === "hydrogen-react" ? path.resolve(packagesPath, pkg, "dist", "browser-dev", "index.mjs") : path.resolve(packagesPath, pkg, "dist", "development", "index.js")
|
|
103
|
-
)
|
|
104
|
-
);
|
|
105
|
-
config.watchPaths.push(
|
|
106
|
-
path.join(packagesPath, "cli", "dist", "virtual-routes", "**", "*")
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
return config;
|
|
110
|
-
}
|
|
111
|
-
function throwConfigError(message, tryMessage = null) {
|
|
112
|
-
renderFatalError({
|
|
113
|
-
name: "ConfigError",
|
|
114
|
-
type: 0,
|
|
115
|
-
message,
|
|
116
|
-
tryMessage
|
|
117
|
-
});
|
|
118
|
-
process.exit(1);
|
|
119
|
-
}
|
|
120
|
-
async function assertEntryFileExists(root, fileRelative) {
|
|
121
|
-
const fileAbsolute = path.resolve(root, fileRelative);
|
|
122
|
-
const exists = await fileExists(fileAbsolute);
|
|
123
|
-
if (!exists) {
|
|
124
|
-
if (!path.extname(fileAbsolute)) {
|
|
125
|
-
const { readdir } = await import('fs/promises');
|
|
126
|
-
const files = await readdir(path.dirname(fileAbsolute));
|
|
127
|
-
const exists2 = files.some((file) => {
|
|
128
|
-
const { name, ext } = path.parse(file);
|
|
129
|
-
return name === path.basename(fileAbsolute) && /^\.[jt]s$/.test(ext);
|
|
130
|
-
});
|
|
131
|
-
if (exists2)
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
throwConfigError(
|
|
135
|
-
`Entry file "${fileRelative}" not found.`,
|
|
136
|
-
"Please ensure the file exists and that the path is correctly added to the `server` property in remix.config.js."
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export { assertEntryFileExists, getProjectPaths, getRemixConfig };
|
package/dist/lib/flags.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
|
|
2
|
-
|
|
3
|
-
declare const commonFlags: {
|
|
4
|
-
path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
5
|
-
port: _oclif_core_lib_interfaces_parser_js.OptionFlag<number, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
6
|
-
force: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
|
|
7
|
-
shop: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
8
|
-
"env-branch": _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
9
|
-
sourcemap: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
|
|
10
|
-
};
|
|
11
|
-
declare function flagsToCamelObject(obj: Record<string, any>): any;
|
|
12
|
-
/**
|
|
13
|
-
* Parse process arguments into an object for use in the cli as flags.
|
|
14
|
-
* This is used when starting the init command from create-hydrogen without Oclif.
|
|
15
|
-
* @example
|
|
16
|
-
* input: `node ./bin --force --no-install-deps --language js`
|
|
17
|
-
* output: { force: true, installDeps: false, language: 'js' }
|
|
18
|
-
*/
|
|
19
|
-
declare function parseProcessFlags(processArgv: string[], flagMap?: Record<string, string>): any;
|
|
20
|
-
/**
|
|
21
|
-
* Create a deprecated flag to prevent the CLI from crashing when a deprecated flag is used.
|
|
22
|
-
* Displays an info message when the flag is used.
|
|
23
|
-
* @param name The name of the flag.
|
|
24
|
-
*/
|
|
25
|
-
declare function deprecated(name: string): _oclif_core_lib_interfaces_parser_js.FlagDefinition<unknown, Record<string, unknown>>;
|
|
26
|
-
|
|
27
|
-
export { commonFlags, deprecated, flagsToCamelObject, parseProcessFlags };
|
package/dist/lib/flags.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AdminSession } from '@shopify/cli-kit/node/session';
|
|
2
|
-
import { UserError } from '../../user-errors.js';
|
|
3
|
-
|
|
4
|
-
declare const CreateStorefrontMutation = "#graphql\n mutation CreateStorefront($title: String!) {\n hydrogenStorefrontCreate(title: $title) {\n hydrogenStorefront {\n id\n title\n productionUrl\n }\n userErrors {\n code\n field\n message\n }\n jobId\n }\n }\n";
|
|
5
|
-
interface HydrogenStorefront {
|
|
6
|
-
id: string;
|
|
7
|
-
title: string;
|
|
8
|
-
productionUrl: string;
|
|
9
|
-
}
|
|
10
|
-
declare function createStorefront(shop: string, title: string): Promise<{
|
|
11
|
-
adminSession: AdminSession;
|
|
12
|
-
storefront: HydrogenStorefront | undefined;
|
|
13
|
-
userErrors: UserError[];
|
|
14
|
-
jobId: string | undefined;
|
|
15
|
-
}>;
|
|
16
|
-
|
|
17
|
-
export { CreateStorefrontMutation, createStorefront };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { AdminSession } from '@shopify/cli-kit/node/session';
|
|
2
|
-
|
|
3
|
-
declare const FetchJobQuery = "#graphql\n query FetchJob($id: ID!) {\n hydrogenStorefrontJob(id: $id) {\n id\n done\n errors {\n code\n message\n }\n }\n }\n";
|
|
4
|
-
interface JobError {
|
|
5
|
-
code: string;
|
|
6
|
-
message: string | undefined;
|
|
7
|
-
}
|
|
8
|
-
interface JobSchema {
|
|
9
|
-
hydrogenStorefrontJob: {
|
|
10
|
-
id: string;
|
|
11
|
-
done: boolean;
|
|
12
|
-
errors: JobError[];
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
declare function fetchJob(shop: string, jobId: string): Promise<{
|
|
16
|
-
adminSession: AdminSession;
|
|
17
|
-
id: string;
|
|
18
|
-
done: boolean;
|
|
19
|
-
errors: JobError[];
|
|
20
|
-
}>;
|
|
21
|
-
declare function waitForJob(shop: string, jobId: string): Promise<void>;
|
|
22
|
-
|
|
23
|
-
export { FetchJobQuery, JobSchema, fetchJob, waitForJob };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { AdminSession } from '@shopify/cli-kit/node/session';
|
|
2
|
-
|
|
3
|
-
declare const LinkStorefrontQuery = "#graphql\n query LinkStorefront {\n hydrogenStorefronts {\n id\n title\n productionUrl\n }\n }\n";
|
|
4
|
-
declare function getStorefronts(shop: string): Promise<{
|
|
5
|
-
adminSession: AdminSession;
|
|
6
|
-
storefronts: {
|
|
7
|
-
parsedId: string;
|
|
8
|
-
id: string;
|
|
9
|
-
title: string;
|
|
10
|
-
productionUrl: string;
|
|
11
|
-
}[];
|
|
12
|
-
}>;
|
|
13
|
-
|
|
14
|
-
export { LinkStorefrontQuery, getStorefronts };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { AdminSession } from '@shopify/cli-kit/node/session';
|
|
2
|
-
|
|
3
|
-
type EnvironmentType = 'PREVIEW' | 'PRODUCTION' | 'CUSTOM';
|
|
4
|
-
interface Environment {
|
|
5
|
-
branch: string | null;
|
|
6
|
-
createdAt: string;
|
|
7
|
-
id: string;
|
|
8
|
-
name: string;
|
|
9
|
-
type: EnvironmentType;
|
|
10
|
-
url: string | null;
|
|
11
|
-
}
|
|
12
|
-
interface HydrogenStorefront {
|
|
13
|
-
id: string;
|
|
14
|
-
environments: Environment[];
|
|
15
|
-
productionUrl: string;
|
|
16
|
-
}
|
|
17
|
-
declare function getStorefrontEnvironments(adminSession: AdminSession, storefrontId: string): Promise<{
|
|
18
|
-
storefront: HydrogenStorefront | null;
|
|
19
|
-
}>;
|
|
20
|
-
|
|
21
|
-
export { Environment, getStorefrontEnvironments };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { AdminSession } from '@shopify/cli-kit/node/session';
|
|
2
|
-
|
|
3
|
-
interface Deployment {
|
|
4
|
-
id: string;
|
|
5
|
-
createdAt: string;
|
|
6
|
-
commitMessage: string | null;
|
|
7
|
-
}
|
|
8
|
-
interface HydrogenStorefront {
|
|
9
|
-
id: string;
|
|
10
|
-
title: string;
|
|
11
|
-
productionUrl?: string;
|
|
12
|
-
currentProductionDeployment: Deployment | null;
|
|
13
|
-
}
|
|
14
|
-
declare function getStorefrontsWithDeployment(shop: string): Promise<{
|
|
15
|
-
adminSession: AdminSession;
|
|
16
|
-
storefronts: {
|
|
17
|
-
parsedId: string;
|
|
18
|
-
id: string;
|
|
19
|
-
title: string;
|
|
20
|
-
productionUrl?: string | undefined;
|
|
21
|
-
currentProductionDeployment: Deployment | null;
|
|
22
|
-
}[];
|
|
23
|
-
}>;
|
|
24
|
-
|
|
25
|
-
export { Deployment, HydrogenStorefront, getStorefrontsWithDeployment };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { AdminSession } from '@shopify/cli-kit/node/session';
|
|
2
|
-
|
|
3
|
-
declare const PullVariablesQuery = "#graphql\n query PullVariables($id: ID!, $branch: String) {\n hydrogenStorefront(id: $id) {\n id\n environmentVariables(branchName: $branch) {\n id\n isSecret\n key\n value\n }\n }\n }\n";
|
|
4
|
-
interface EnvironmentVariable {
|
|
5
|
-
id: string;
|
|
6
|
-
isSecret: boolean;
|
|
7
|
-
key: string;
|
|
8
|
-
value: string;
|
|
9
|
-
}
|
|
10
|
-
interface HydrogenStorefront {
|
|
11
|
-
id: string;
|
|
12
|
-
environmentVariables: EnvironmentVariable[];
|
|
13
|
-
}
|
|
14
|
-
interface PullVariablesSchema {
|
|
15
|
-
hydrogenStorefront: HydrogenStorefront | null;
|
|
16
|
-
}
|
|
17
|
-
declare function getStorefrontEnvVariables(adminSession: AdminSession, storefrontId: string, envBranch?: string): Promise<{
|
|
18
|
-
storefront: HydrogenStorefront | null;
|
|
19
|
-
}>;
|
|
20
|
-
|
|
21
|
-
export { EnvironmentVariable, PullVariablesQuery, PullVariablesSchema, getStorefrontEnvVariables };
|
package/dist/lib/graphql.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { GraphQLVariables } from '@shopify/cli-kit/node/api/graphql';
|
|
2
|
-
import { AdminSession } from '@shopify/cli-kit/node/session';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This is a temporary workaround until cli-kit includes a way to specify
|
|
6
|
-
* API versions for the Admin API because we need to target the unstable
|
|
7
|
-
* branch for this early access phase.
|
|
8
|
-
*
|
|
9
|
-
* @param query - GraphQL query to execute.
|
|
10
|
-
* @param session - Shopify admin session including token and Store FQDN.
|
|
11
|
-
* @param variables - GraphQL variables to pass to the query.
|
|
12
|
-
* @returns The response of the query of generic type <T>.
|
|
13
|
-
*/
|
|
14
|
-
declare function adminRequest<T>(query: string, session: AdminSession, variables?: GraphQLVariables): Promise<T>;
|
|
15
|
-
/**
|
|
16
|
-
* @param gid a Global ID to parse (e.g. 'gid://shopify/HydrogenStorefront/1')
|
|
17
|
-
* @returns the ID of the record (e.g. '1')
|
|
18
|
-
*/
|
|
19
|
-
declare function parseGid(gid: string): string;
|
|
20
|
-
|
|
21
|
-
export { adminRequest, parseGid };
|
package/dist/lib/graphql.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { graphqlRequest } from '@shopify/cli-kit/node/api/graphql';
|
|
2
|
-
import { AbortError } from '@shopify/cli-kit/node/error';
|
|
3
|
-
|
|
4
|
-
async function adminRequest(query, session, variables) {
|
|
5
|
-
const api = "Admin";
|
|
6
|
-
const url = `https://${session.storeFqdn}/admin/api/unstable/graphql.json`;
|
|
7
|
-
return graphqlRequest({ query, api, url, token: session.token, variables });
|
|
8
|
-
}
|
|
9
|
-
const GID_REGEXP = /gid:\/\/shopify\/\w*\/(\d+)/;
|
|
10
|
-
function parseGid(gid) {
|
|
11
|
-
const matches = GID_REGEXP.exec(gid);
|
|
12
|
-
if (matches && matches[1] !== void 0) {
|
|
13
|
-
return matches[1];
|
|
14
|
-
}
|
|
15
|
-
throw new AbortError(`Invalid Global ID: ${gid}`);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { adminRequest, parseGid };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/dist/lib/log.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
type MiniOxygenOptions = {
|
|
2
|
-
root: string;
|
|
3
|
-
port?: number;
|
|
4
|
-
watch?: boolean;
|
|
5
|
-
buildPathClient: string;
|
|
6
|
-
buildPathWorkerFile: string;
|
|
7
|
-
environmentVariables?: {
|
|
8
|
-
[key: string]: string;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
declare function startMiniOxygen({ root, port, watch, buildPathWorkerFile, buildPathClient, environmentVariables, }: MiniOxygenOptions): Promise<{
|
|
12
|
-
listeningAt: string;
|
|
13
|
-
port: number;
|
|
14
|
-
showBanner(options?: {
|
|
15
|
-
mode?: string;
|
|
16
|
-
headlinePrefix?: string;
|
|
17
|
-
extraLines?: string[];
|
|
18
|
-
}): void;
|
|
19
|
-
}>;
|
|
20
|
-
declare function logResponse(request: Request, response: Response): void;
|
|
21
|
-
|
|
22
|
-
export { logResponse, startMiniOxygen };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { RemixConfig } from '@remix-run/dev/dist/config.js';
|
|
2
|
-
|
|
3
|
-
declare function findMissingRoutes(config: {
|
|
4
|
-
routes: RemixConfig['routes'];
|
|
5
|
-
}, requiredRoutes?: string[]): string[];
|
|
6
|
-
declare function logMissingRoutes(routes: string[]): void;
|
|
7
|
-
|
|
8
|
-
export { findMissingRoutes, logMissingRoutes };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { renderInfo } from '@shopify/cli-kit/node/ui';
|
|
2
|
-
import { newHydrogenStorefrontUrl } from './admin-urls.js';
|
|
3
|
-
|
|
4
|
-
function logMissingStorefronts(adminSession) {
|
|
5
|
-
renderInfo({
|
|
6
|
-
headline: "Hydrogen storefronts",
|
|
7
|
-
body: "There are no Hydrogen storefronts on your Shop.",
|
|
8
|
-
nextSteps: [
|
|
9
|
-
`Ensure you have specified the correct shop (you specified: ${adminSession.storeFqdn})`,
|
|
10
|
-
`Ensure you have the Hydrogen sales channel installed https://apps.shopify.com/hydrogen`,
|
|
11
|
-
`Create a new Hydrogen storefront: ${newHydrogenStorefrontUrl(
|
|
12
|
-
adminSession
|
|
13
|
-
)}`
|
|
14
|
-
]
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { logMissingStorefronts };
|
package/dist/lib/process.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { EnvironmentVariable } from './graphql/admin/pull-variables.js';
|
|
2
|
-
import '@shopify/cli-kit/node/session';
|
|
3
|
-
|
|
4
|
-
interface Arguments {
|
|
5
|
-
envBranch?: string;
|
|
6
|
-
root: string;
|
|
7
|
-
/**
|
|
8
|
-
* Optional shop override that developers would have passed using the --shop
|
|
9
|
-
* flag.
|
|
10
|
-
*/
|
|
11
|
-
flagShop?: string;
|
|
12
|
-
/**
|
|
13
|
-
* Does not prompt the user to fix any errors that are encountered (e.g. no
|
|
14
|
-
* linked storefront)
|
|
15
|
-
*/
|
|
16
|
-
silent?: boolean;
|
|
17
|
-
}
|
|
18
|
-
declare function pullRemoteEnvironmentVariables({ envBranch, root, flagShop, silent, }: Arguments): Promise<EnvironmentVariable[]>;
|
|
19
|
-
|
|
20
|
-
export { pullRemoteEnvironmentVariables };
|
|
@@ -1,57 +0,0 @@
|
|
|
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 { getHydrogenShop } from './shop.js';
|
|
5
|
-
import { getAdminSession } from './admin-session.js';
|
|
6
|
-
import { getConfig } from './shopify-config.js';
|
|
7
|
-
import { renderMissingLink, renderMissingStorefront } from './render-errors.js';
|
|
8
|
-
import { getStorefrontEnvVariables } from './graphql/admin/pull-variables.js';
|
|
9
|
-
|
|
10
|
-
async function pullRemoteEnvironmentVariables({
|
|
11
|
-
envBranch,
|
|
12
|
-
root,
|
|
13
|
-
flagShop,
|
|
14
|
-
silent
|
|
15
|
-
}) {
|
|
16
|
-
const shop = await getHydrogenShop({ path: root, shop: flagShop });
|
|
17
|
-
const adminSession = await getAdminSession(shop);
|
|
18
|
-
let configStorefront = (await getConfig(root)).storefront;
|
|
19
|
-
if (!configStorefront?.id) {
|
|
20
|
-
if (!silent) {
|
|
21
|
-
renderMissingLink({ adminSession });
|
|
22
|
-
const runLink = await renderConfirmationPrompt({
|
|
23
|
-
message: outputContent`Run ${outputToken.genericShellCommand(
|
|
24
|
-
`npx shopify hydrogen link`
|
|
25
|
-
)}?`.value
|
|
26
|
-
});
|
|
27
|
-
if (!runLink) {
|
|
28
|
-
return [];
|
|
29
|
-
}
|
|
30
|
-
await linkStorefront({ path: root, shop: flagShop, silent });
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
configStorefront = (await getConfig(root)).storefront;
|
|
34
|
-
if (!configStorefront) {
|
|
35
|
-
return [];
|
|
36
|
-
}
|
|
37
|
-
const { storefront } = await getStorefrontEnvVariables(
|
|
38
|
-
adminSession,
|
|
39
|
-
configStorefront.id,
|
|
40
|
-
envBranch
|
|
41
|
-
);
|
|
42
|
-
if (!storefront) {
|
|
43
|
-
if (!silent) {
|
|
44
|
-
renderMissingStorefront({ adminSession, storefront: configStorefront });
|
|
45
|
-
}
|
|
46
|
-
return [];
|
|
47
|
-
}
|
|
48
|
-
if (!storefront.environmentVariables.length) {
|
|
49
|
-
if (!silent) {
|
|
50
|
-
outputInfo(`No environment variables found.`);
|
|
51
|
-
}
|
|
52
|
-
return [];
|
|
53
|
-
}
|
|
54
|
-
return storefront.environmentVariables;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export { pullRemoteEnvironmentVariables };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|