@shopify/cli-hydrogen 5.0.2 → 5.1.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/build.js +16 -2
- package/dist/commands/hydrogen/codegen-unstable.js +13 -24
- package/dist/commands/hydrogen/dev.js +45 -39
- 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/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 +270 -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 +185 -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-version-interop.js +5 -5
- package/dist/lib/remix-version-interop.test.js +11 -1
- 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 +16 -16
- 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/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/package.json
CHANGED
|
@@ -4,43 +4,46 @@
|
|
|
4
4
|
"access": "public",
|
|
5
5
|
"@shopify:registry": "https://registry.npmjs.org"
|
|
6
6
|
},
|
|
7
|
-
"version": "5.0
|
|
7
|
+
"version": "5.1.0",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"scripts": {
|
|
11
|
-
"build": "tsup --
|
|
11
|
+
"build": "tsup --config ./tsup.config.ts && node scripts/build-check.mjs",
|
|
12
12
|
"dev": "tsup --watch --config ./tsup.config.ts",
|
|
13
13
|
"typecheck": "tsc --noEmit",
|
|
14
14
|
"generate:manifest": "oclif manifest",
|
|
15
|
-
"test": "cross-env SHOPIFY_UNIT_TEST=1 vitest run",
|
|
16
|
-
"test:watch": "cross-env SHOPIFY_UNIT_TEST=1 vitest"
|
|
15
|
+
"test": "cross-env SHOPIFY_UNIT_TEST=1 vitest run --test-timeout=15000",
|
|
16
|
+
"test:watch": "cross-env SHOPIFY_UNIT_TEST=1 vitest --test-timeout=15000"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/diff": "^5.0.2",
|
|
20
|
-
"@types/fs-extra": "^
|
|
20
|
+
"@types/fs-extra": "^11.0.1",
|
|
21
21
|
"@types/gunzip-maybe": "^1.4.0",
|
|
22
22
|
"@types/prettier": "^2.7.2",
|
|
23
23
|
"@types/recursive-readdir": "^2.2.1",
|
|
24
24
|
"@types/tar-fs": "^2.0.1",
|
|
25
|
-
"oclif": "
|
|
25
|
+
"oclif": "3.9.1",
|
|
26
26
|
"tempy": "^3.0.0",
|
|
27
|
-
"
|
|
27
|
+
"type-fest": "^3.6.0",
|
|
28
|
+
"vitest": "^0.33.0"
|
|
28
29
|
},
|
|
29
30
|
"peerDependencies": {
|
|
30
31
|
"@remix-run/react": "^1.17.1",
|
|
31
|
-
"@shopify/hydrogen-react": "^2023.
|
|
32
|
+
"@shopify/hydrogen-react": "^2023.7.0",
|
|
32
33
|
"@shopify/remix-oxygen": "^1.1.1"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
36
|
+
"@ast-grep/napi": "^0.5.3",
|
|
35
37
|
"@graphql-codegen/cli": "3.3.1",
|
|
36
|
-
"@oclif/core": "2.
|
|
38
|
+
"@oclif/core": "2.8.5",
|
|
37
39
|
"@remix-run/dev": "1.17.1",
|
|
38
|
-
"@shopify/cli-kit": "3.
|
|
40
|
+
"@shopify/cli-kit": "3.47.5",
|
|
39
41
|
"@shopify/hydrogen-codegen": "^0.0.2",
|
|
40
|
-
"@shopify/mini-oxygen": "^1.
|
|
42
|
+
"@shopify/mini-oxygen": "^1.7.0",
|
|
43
|
+
"ansi-escapes": "^6.2.0",
|
|
41
44
|
"diff": "^5.1.0",
|
|
42
45
|
"fast-glob": "^3.2.12",
|
|
43
|
-
"fs-extra": "^
|
|
46
|
+
"fs-extra": "^11.1.0",
|
|
44
47
|
"gunzip-maybe": "^1.4.2",
|
|
45
48
|
"prettier": "^2.8.4",
|
|
46
49
|
"recursive-readdir": "^2.2.3",
|
|
@@ -50,10 +53,7 @@
|
|
|
50
53
|
"bin": "dist/create-app.js",
|
|
51
54
|
"exports": {
|
|
52
55
|
"./package.json": "./package.json",
|
|
53
|
-
"./commands/hydrogen/init":
|
|
54
|
-
"types": "./dist/commands/hydrogen/init.d.ts",
|
|
55
|
-
"default": "./dist/commands/hydrogen/init.js"
|
|
56
|
-
}
|
|
56
|
+
"./commands/hydrogen/init": "./dist/commands/hydrogen/init.js"
|
|
57
57
|
},
|
|
58
58
|
"files": [
|
|
59
59
|
"dist",
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
|
|
2
|
-
import Command from '@shopify/cli-kit/node/base-command';
|
|
3
|
-
|
|
4
|
-
declare class Build extends Command {
|
|
5
|
-
static description: string;
|
|
6
|
-
static flags: {
|
|
7
|
-
path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
8
|
-
sourcemap: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
|
|
9
|
-
'disable-route-warning': _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
|
|
10
|
-
base: _oclif_core_lib_interfaces_parser_js.OptionFlag<unknown, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
11
|
-
entry: _oclif_core_lib_interfaces_parser_js.OptionFlag<unknown, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
12
|
-
target: _oclif_core_lib_interfaces_parser_js.OptionFlag<unknown, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
13
|
-
};
|
|
14
|
-
run(): Promise<void>;
|
|
15
|
-
}
|
|
16
|
-
declare function runBuild({ path: appPath, sourcemap, disableRouteWarning, }: {
|
|
17
|
-
path?: string;
|
|
18
|
-
sourcemap?: boolean;
|
|
19
|
-
disableRouteWarning?: boolean;
|
|
20
|
-
}): Promise<void>;
|
|
21
|
-
declare function copyPublicFiles(publicPath: string, buildPathClient: string): Promise<void>;
|
|
22
|
-
|
|
23
|
-
export { copyPublicFiles, Build as default, runBuild };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
|
|
2
|
-
import Command from '@shopify/cli-kit/node/base-command';
|
|
3
|
-
|
|
4
|
-
declare class GenerateRoute extends Command {
|
|
5
|
-
static description: string;
|
|
6
|
-
static flags: {
|
|
7
|
-
path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
8
|
-
};
|
|
9
|
-
static args: {
|
|
10
|
-
resource: _oclif_core_lib_interfaces_parser_js.Arg<string, Record<string, unknown>>;
|
|
11
|
-
};
|
|
12
|
-
run(): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { GenerateRoute as default };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
|
|
2
|
-
import Command from '@shopify/cli-kit/node/base-command';
|
|
3
|
-
|
|
4
|
-
declare class Codegen extends Command {
|
|
5
|
-
static description: string;
|
|
6
|
-
static flags: {
|
|
7
|
-
path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
8
|
-
"codegen-config-path": _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
9
|
-
"force-sfapi-version": _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
10
|
-
watch: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
|
|
11
|
-
};
|
|
12
|
-
run(): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { Codegen as default };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
|
|
2
|
-
import Command from '@shopify/cli-kit/node/base-command';
|
|
3
|
-
|
|
4
|
-
declare class Dev extends Command {
|
|
5
|
-
static description: string;
|
|
6
|
-
static flags: {
|
|
7
|
-
path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
8
|
-
port: _oclif_core_lib_interfaces_parser_js.OptionFlag<number, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
9
|
-
"codegen-unstable": _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
|
|
10
|
-
"codegen-config-path": _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
11
|
-
sourcemap: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
|
|
12
|
-
'disable-virtual-routes': _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
|
|
13
|
-
shop: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
14
|
-
debug: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
|
|
15
|
-
host: _oclif_core_lib_interfaces_parser_js.OptionFlag<unknown, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
16
|
-
"env-branch": _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
17
|
-
};
|
|
18
|
-
run(): Promise<void>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { Dev as default };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
|
|
2
|
-
import Command from '@shopify/cli-kit/node/base-command';
|
|
3
|
-
|
|
4
|
-
declare class EnvList extends Command {
|
|
5
|
-
static description: string;
|
|
6
|
-
static flags: {
|
|
7
|
-
path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
8
|
-
shop: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
9
|
-
};
|
|
10
|
-
run(): Promise<void>;
|
|
11
|
-
}
|
|
12
|
-
interface Flags {
|
|
13
|
-
path?: string;
|
|
14
|
-
shop?: string;
|
|
15
|
-
}
|
|
16
|
-
declare function listEnvironments({ path, shop: flagShop }: Flags): Promise<void>;
|
|
17
|
-
|
|
18
|
-
export { EnvList as default, listEnvironments };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
|
|
2
|
-
import Command from '@shopify/cli-kit/node/base-command';
|
|
3
|
-
|
|
4
|
-
declare class EnvPull extends Command {
|
|
5
|
-
static description: string;
|
|
6
|
-
static flags: {
|
|
7
|
-
"env-branch": _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
8
|
-
path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
9
|
-
shop: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
10
|
-
force: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
|
|
11
|
-
};
|
|
12
|
-
run(): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
interface Flags {
|
|
15
|
-
envBranch?: string;
|
|
16
|
-
force?: boolean;
|
|
17
|
-
path?: string;
|
|
18
|
-
shop?: string;
|
|
19
|
-
}
|
|
20
|
-
declare function pullVariables({ envBranch, force, path, shop: flagShop, }: Flags): Promise<void>;
|
|
21
|
-
|
|
22
|
-
export { EnvPull as default, pullVariables };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import Command from '@shopify/cli-kit/node/base-command';
|
|
2
|
-
|
|
3
|
-
declare class GenerateRouteShortcut extends Command {
|
|
4
|
-
static description: string;
|
|
5
|
-
static strict: boolean;
|
|
6
|
-
static hidden: boolean;
|
|
7
|
-
run(): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { GenerateRouteShortcut as default };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
|
|
2
|
-
import Command from '@shopify/cli-kit/node/base-command';
|
|
3
|
-
import { RemixV2Flags } from '../../../lib/remix-version-interop.js';
|
|
4
|
-
|
|
5
|
-
declare const GENERATOR_TEMPLATES_DIR = "generator-templates";
|
|
6
|
-
interface Result {
|
|
7
|
-
operation: 'generated' | 'skipped' | 'overwritten';
|
|
8
|
-
}
|
|
9
|
-
declare class GenerateRoute extends Command {
|
|
10
|
-
static description: string;
|
|
11
|
-
static flags: {
|
|
12
|
-
adapter: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
13
|
-
typescript: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
|
|
14
|
-
force: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
|
|
15
|
-
path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
16
|
-
};
|
|
17
|
-
static hidden: true;
|
|
18
|
-
static args: {
|
|
19
|
-
route: _oclif_core_lib_interfaces_parser_js.Arg<string, Record<string, unknown>>;
|
|
20
|
-
};
|
|
21
|
-
run(): Promise<void>;
|
|
22
|
-
}
|
|
23
|
-
declare function runGenerate(routeFrom: string, routeTo: string, { directory, typescript, force, adapter, templatesRoot, v2Flags, }: {
|
|
24
|
-
directory: string;
|
|
25
|
-
typescript?: boolean;
|
|
26
|
-
force?: boolean;
|
|
27
|
-
adapter?: string;
|
|
28
|
-
templatesRoot?: string;
|
|
29
|
-
v2Flags?: RemixV2Flags;
|
|
30
|
-
}): Promise<Result>;
|
|
31
|
-
|
|
32
|
-
export { GENERATOR_TEMPLATES_DIR, GenerateRoute as default, runGenerate };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
|
|
2
|
-
import Command from '@shopify/cli-kit/node/base-command';
|
|
3
|
-
|
|
4
|
-
declare class GenerateRoutes extends Command {
|
|
5
|
-
static description: string;
|
|
6
|
-
static hidden: true;
|
|
7
|
-
static flags: {
|
|
8
|
-
adapter: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
9
|
-
typescript: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
|
|
10
|
-
force: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
|
|
11
|
-
path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
12
|
-
};
|
|
13
|
-
run(): Promise<void>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { GenerateRoutes as default };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
|
|
2
|
-
import Command from '@shopify/cli-kit/node/base-command';
|
|
3
|
-
|
|
4
|
-
declare class Init extends Command {
|
|
5
|
-
static description: string;
|
|
6
|
-
static flags: {
|
|
7
|
-
force: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
|
|
8
|
-
path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
9
|
-
language: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
10
|
-
template: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
11
|
-
'install-deps': _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
|
|
12
|
-
};
|
|
13
|
-
run(): Promise<void>;
|
|
14
|
-
}
|
|
15
|
-
declare function runInit(options?: {
|
|
16
|
-
path?: string;
|
|
17
|
-
template?: string;
|
|
18
|
-
language?: string;
|
|
19
|
-
token?: string;
|
|
20
|
-
force?: boolean;
|
|
21
|
-
installDeps?: boolean;
|
|
22
|
-
}): Promise<void>;
|
|
23
|
-
|
|
24
|
-
export { Init as default, runInit };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
|
|
2
|
-
import Command from '@shopify/cli-kit/node/base-command';
|
|
3
|
-
|
|
4
|
-
declare class Link extends Command {
|
|
5
|
-
static description: string;
|
|
6
|
-
static flags: {
|
|
7
|
-
force: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
|
|
8
|
-
path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
9
|
-
shop: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
10
|
-
storefront: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
11
|
-
};
|
|
12
|
-
run(): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
interface LinkStorefrontArguments {
|
|
15
|
-
force?: boolean;
|
|
16
|
-
path?: string;
|
|
17
|
-
shop?: string;
|
|
18
|
-
storefront?: string;
|
|
19
|
-
silent?: boolean;
|
|
20
|
-
}
|
|
21
|
-
declare function linkStorefront({ force, path, shop: flagShop, storefront: flagStorefront, silent, }: LinkStorefrontArguments): Promise<void>;
|
|
22
|
-
|
|
23
|
-
export { LinkStorefrontArguments, Link as default, linkStorefront };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
|
|
2
|
-
import Command from '@shopify/cli-kit/node/base-command';
|
|
3
|
-
import { Deployment } from '../../lib/graphql/admin/list-storefronts.js';
|
|
4
|
-
import '@shopify/cli-kit/node/session';
|
|
5
|
-
|
|
6
|
-
declare class List extends Command {
|
|
7
|
-
static description: string;
|
|
8
|
-
static flags: {
|
|
9
|
-
path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
10
|
-
shop: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
11
|
-
};
|
|
12
|
-
run(): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
interface Flags {
|
|
15
|
-
path?: string;
|
|
16
|
-
shop?: string;
|
|
17
|
-
}
|
|
18
|
-
declare function listStorefronts({ path, shop: flagShop }: Flags): Promise<void>;
|
|
19
|
-
declare function formatDeployment(deployment: Deployment): string;
|
|
20
|
-
|
|
21
|
-
export { List as default, formatDeployment, listStorefronts };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
|
|
2
|
-
import Command from '@shopify/cli-kit/node/base-command';
|
|
3
|
-
|
|
4
|
-
declare class Preview extends Command {
|
|
5
|
-
static description: string;
|
|
6
|
-
static flags: {
|
|
7
|
-
path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
8
|
-
port: _oclif_core_lib_interfaces_parser_js.OptionFlag<number, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
9
|
-
};
|
|
10
|
-
run(): Promise<void>;
|
|
11
|
-
}
|
|
12
|
-
declare function runPreview({ port, path: appPath, }: {
|
|
13
|
-
port?: number;
|
|
14
|
-
path?: string;
|
|
15
|
-
}): Promise<void>;
|
|
16
|
-
|
|
17
|
-
export { Preview as default, runPreview };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import Command from '@shopify/cli-kit/node/base-command';
|
|
2
|
-
|
|
3
|
-
declare class Shortcut extends Command {
|
|
4
|
-
static description: string;
|
|
5
|
-
run(): Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
declare function runCreateShortcut(): Promise<void>;
|
|
8
|
-
|
|
9
|
-
export { Shortcut as default, runCreateShortcut };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
|
|
2
|
-
import Command from '@shopify/cli-kit/node/base-command';
|
|
3
|
-
|
|
4
|
-
declare class Unlink extends Command {
|
|
5
|
-
static description: string;
|
|
6
|
-
static flags: {
|
|
7
|
-
path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined, _oclif_core_lib_interfaces_parser_js.CustomOptions>;
|
|
8
|
-
};
|
|
9
|
-
run(): Promise<void>;
|
|
10
|
-
}
|
|
11
|
-
interface LinkFlags {
|
|
12
|
-
path?: string;
|
|
13
|
-
}
|
|
14
|
-
declare function unlinkStorefront({ path }: LinkFlags): Promise<void>;
|
|
15
|
-
|
|
16
|
-
export { LinkFlags, Unlink as default, unlinkStorefront };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/dist/create-app.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import {flattenConnection} from '@shopify/hydrogen';
|
|
2
|
-
import type {LoaderArgs, ErrorBoundaryComponent} from '@shopify/remix-oxygen';
|
|
3
|
-
import {useCatch, useRouteError, isRouteErrorResponse} from '@remix-run/react';
|
|
4
|
-
import {
|
|
5
|
-
CollectionConnection,
|
|
6
|
-
PageConnection,
|
|
7
|
-
ProductConnection,
|
|
8
|
-
} from '@shopify/hydrogen/storefront-api-types';
|
|
9
|
-
|
|
10
|
-
const MAX_URLS = 250; // the google limit is 50K, however, SF API only allow querying for 250 resources each time
|
|
11
|
-
|
|
12
|
-
interface SitemapQueryData {
|
|
13
|
-
products: ProductConnection;
|
|
14
|
-
collections: CollectionConnection;
|
|
15
|
-
pages: PageConnection;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface ProductEntry {
|
|
19
|
-
url: string;
|
|
20
|
-
lastMod: string;
|
|
21
|
-
changeFreq: string;
|
|
22
|
-
image?: {
|
|
23
|
-
url: string;
|
|
24
|
-
title?: string;
|
|
25
|
-
caption?: string;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export async function loader({request, context: {storefront}}: LoaderArgs) {
|
|
30
|
-
const data = await storefront.query<SitemapQueryData>(SITEMAP_QUERY, {
|
|
31
|
-
variables: {
|
|
32
|
-
urlLimits: MAX_URLS,
|
|
33
|
-
language: storefront.i18n.language,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
if (!data) {
|
|
38
|
-
throw new Response('No data found', {status: 404});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return new Response(
|
|
42
|
-
shopSitemap({data, baseUrl: new URL(request.url).origin}),
|
|
43
|
-
{
|
|
44
|
-
headers: {
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
46
|
-
'content-type': 'application/xml',
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
48
|
-
'cache-control': `max-age=${60 * 60 * 24}`,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export const ErrorBoundaryV1: ErrorBoundaryComponent = ({error}) => {
|
|
55
|
-
console.error(error);
|
|
56
|
-
|
|
57
|
-
return <div>There was an error.</div>;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export function CatchBoundary() {
|
|
61
|
-
const caught = useCatch();
|
|
62
|
-
console.error(caught);
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<div>
|
|
66
|
-
There was an error. Status: {caught.status}. Message:{' '}
|
|
67
|
-
{caught.data?.message}
|
|
68
|
-
</div>
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function ErrorBoundary() {
|
|
73
|
-
const error = useRouteError();
|
|
74
|
-
|
|
75
|
-
if (isRouteErrorResponse(error)) {
|
|
76
|
-
console.error(error.status, error.statusText, error.data);
|
|
77
|
-
return <div>Route Error</div>;
|
|
78
|
-
} else {
|
|
79
|
-
console.error((error as Error).message);
|
|
80
|
-
return <div>Thrown Error</div>;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function xmlEncode(string: string) {
|
|
85
|
-
return string.replace(/[&<>'"]/g, (char) => `&#${char.charCodeAt(0)};`);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function shopSitemap({
|
|
89
|
-
data,
|
|
90
|
-
baseUrl,
|
|
91
|
-
}: {
|
|
92
|
-
data: SitemapQueryData;
|
|
93
|
-
baseUrl: string;
|
|
94
|
-
}) {
|
|
95
|
-
const productsData = flattenConnection(data.products)
|
|
96
|
-
.filter((product) => product.onlineStoreUrl)
|
|
97
|
-
.map((product) => {
|
|
98
|
-
const url = `${baseUrl}/products/${xmlEncode(product.handle)}`;
|
|
99
|
-
|
|
100
|
-
const finalObject: ProductEntry = {
|
|
101
|
-
url,
|
|
102
|
-
lastMod: product.updatedAt,
|
|
103
|
-
changeFreq: 'daily',
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
if (product.featuredImage?.url) {
|
|
107
|
-
finalObject.image = {
|
|
108
|
-
url: xmlEncode(product.featuredImage.url),
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
if (product.title) {
|
|
112
|
-
finalObject.image.title = xmlEncode(product.title);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (product.featuredImage.altText) {
|
|
116
|
-
finalObject.image.caption = xmlEncode(product.featuredImage.altText);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return finalObject;
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
const collectionsData = flattenConnection(data.collections)
|
|
124
|
-
.filter((collection) => collection.onlineStoreUrl)
|
|
125
|
-
.map((collection) => {
|
|
126
|
-
const url = `${baseUrl}/collections/${collection.handle}`;
|
|
127
|
-
|
|
128
|
-
return {
|
|
129
|
-
url,
|
|
130
|
-
lastMod: collection.updatedAt,
|
|
131
|
-
changeFreq: 'daily',
|
|
132
|
-
};
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
const pagesData = flattenConnection(data.pages)
|
|
136
|
-
.filter((page) => page.onlineStoreUrl)
|
|
137
|
-
.map((page) => {
|
|
138
|
-
const url = `${baseUrl}/pages/${page.handle}`;
|
|
139
|
-
|
|
140
|
-
return {
|
|
141
|
-
url,
|
|
142
|
-
lastMod: page.updatedAt,
|
|
143
|
-
changeFreq: 'weekly',
|
|
144
|
-
};
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
const urlsDatas = [...productsData, ...collectionsData, ...pagesData];
|
|
148
|
-
|
|
149
|
-
return `
|
|
150
|
-
<urlset
|
|
151
|
-
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
|
152
|
-
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
|
|
153
|
-
>
|
|
154
|
-
${urlsDatas.map((url) => renderUrlTag(url)).join('')}
|
|
155
|
-
</urlset>`;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function renderUrlTag({
|
|
159
|
-
url,
|
|
160
|
-
lastMod,
|
|
161
|
-
changeFreq,
|
|
162
|
-
image,
|
|
163
|
-
}: {
|
|
164
|
-
url: string;
|
|
165
|
-
lastMod?: string;
|
|
166
|
-
changeFreq?: string;
|
|
167
|
-
image?: {
|
|
168
|
-
url: string;
|
|
169
|
-
title?: string;
|
|
170
|
-
caption?: string;
|
|
171
|
-
};
|
|
172
|
-
}) {
|
|
173
|
-
return `
|
|
174
|
-
<url>
|
|
175
|
-
<loc>${url}</loc>
|
|
176
|
-
<lastmod>${lastMod}</lastmod>
|
|
177
|
-
<changefreq>${changeFreq}</changefreq>
|
|
178
|
-
${
|
|
179
|
-
image
|
|
180
|
-
? `
|
|
181
|
-
<image:image>
|
|
182
|
-
<image:loc>${image.url}</image:loc>
|
|
183
|
-
<image:title>${image.title ?? ''}</image:title>
|
|
184
|
-
<image:caption>${image.caption ?? ''}</image:caption>
|
|
185
|
-
</image:image>`
|
|
186
|
-
: ''
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
</url>
|
|
190
|
-
`;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const SITEMAP_QUERY = `#graphql
|
|
194
|
-
query sitemaps($urlLimits: Int, $language: LanguageCode)
|
|
195
|
-
@inContext(language: $language) {
|
|
196
|
-
products(
|
|
197
|
-
first: $urlLimits
|
|
198
|
-
query: "published_status:'online_store:visible'"
|
|
199
|
-
) {
|
|
200
|
-
edges {
|
|
201
|
-
node {
|
|
202
|
-
updatedAt
|
|
203
|
-
handle
|
|
204
|
-
onlineStoreUrl
|
|
205
|
-
title
|
|
206
|
-
featuredImage {
|
|
207
|
-
url
|
|
208
|
-
altText
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
collections(
|
|
214
|
-
first: $urlLimits
|
|
215
|
-
query: "published_status:'online_store:visible'"
|
|
216
|
-
) {
|
|
217
|
-
edges {
|
|
218
|
-
node {
|
|
219
|
-
updatedAt
|
|
220
|
-
handle
|
|
221
|
-
onlineStoreUrl
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
pages(first: $urlLimits, query: "published_status:'published'") {
|
|
226
|
-
edges {
|
|
227
|
-
node {
|
|
228
|
-
updatedAt
|
|
229
|
-
handle
|
|
230
|
-
onlineStoreUrl
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
`;
|