@shopify/cli-hydrogen 5.5.0 → 6.0.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 +2 -6
- package/dist/commands/hydrogen/{codegen-unstable.js → codegen.js} +2 -0
- package/dist/commands/hydrogen/deploy.js +1 -0
- package/dist/commands/hydrogen/deploy.test.js +1 -0
- package/dist/commands/hydrogen/dev.js +6 -8
- package/dist/commands/hydrogen/generate/route.js +5 -1
- package/dist/commands/hydrogen/generate/route.test.js +4 -2
- package/dist/commands/hydrogen/init.test.js +1 -4
- package/dist/commands/hydrogen/setup.js +1 -6
- package/dist/generator-templates/starter/CHANGELOG.md +143 -0
- package/dist/generator-templates/starter/app/components/Footer.tsx +19 -8
- package/dist/generator-templates/starter/app/components/Header.tsx +13 -5
- package/dist/generator-templates/starter/app/components/Layout.tsx +14 -4
- package/dist/generator-templates/starter/app/root.tsx +14 -27
- package/dist/generator-templates/starter/app/routes/$.tsx +2 -2
- package/dist/generator-templates/starter/app/routes/[robots.txt].tsx +2 -2
- package/dist/generator-templates/starter/app/routes/[sitemap.xml].tsx +5 -2
- package/dist/generator-templates/starter/app/routes/_index.tsx +4 -9
- package/dist/generator-templates/starter/app/routes/account.$.tsx +2 -2
- package/dist/generator-templates/starter/app/routes/account.addresses.tsx +6 -6
- package/dist/generator-templates/starter/app/routes/account.orders.$id.tsx +4 -4
- package/dist/generator-templates/starter/app/routes/account.orders._index.tsx +4 -4
- package/dist/generator-templates/starter/app/routes/account.profile.tsx +6 -6
- package/dist/generator-templates/starter/app/routes/account.tsx +2 -2
- package/dist/generator-templates/starter/app/routes/account_.activate.$id.$activationToken.tsx +6 -6
- package/dist/generator-templates/starter/app/routes/account_.login.tsx +6 -11
- package/dist/generator-templates/starter/app/routes/account_.logout.tsx +4 -4
- package/dist/generator-templates/starter/app/routes/account_.recover.tsx +4 -4
- package/dist/generator-templates/starter/app/routes/account_.register.tsx +4 -4
- package/dist/generator-templates/starter/app/routes/account_.reset.$id.$resetToken.tsx +4 -4
- package/dist/generator-templates/starter/app/routes/api.predictive-search.tsx +4 -4
- package/dist/generator-templates/starter/app/routes/blogs.$blogHandle.$articleHandle.tsx +5 -5
- package/dist/generator-templates/starter/app/routes/blogs.$blogHandle._index.tsx +5 -5
- package/dist/generator-templates/starter/app/routes/blogs._index.tsx +7 -4
- package/dist/generator-templates/starter/app/routes/cart.$lines.tsx +2 -2
- package/dist/generator-templates/starter/app/routes/cart.tsx +11 -8
- package/dist/generator-templates/starter/app/routes/collections.$handle.tsx +5 -5
- package/dist/generator-templates/starter/app/routes/collections._index.tsx +2 -2
- package/dist/generator-templates/starter/app/routes/discount.$code.tsx +2 -2
- package/dist/generator-templates/starter/app/routes/pages.$handle.tsx +5 -5
- package/dist/generator-templates/starter/app/routes/policies.$handle.tsx +5 -5
- package/dist/generator-templates/starter/app/routes/policies._index.tsx +2 -2
- package/dist/generator-templates/starter/app/routes/products.$handle.tsx +7 -7
- package/dist/generator-templates/starter/app/routes/search.tsx +5 -4
- package/dist/generator-templates/starter/app/styles/app.css +16 -16
- package/dist/generator-templates/starter/package.json +10 -10
- package/dist/generator-templates/starter/remix.config.js +0 -8
- package/dist/generator-templates/starter/storefrontapi.generated.d.ts +79 -55
- package/dist/lib/codegen.js +31 -22
- package/dist/lib/flags.js +8 -1
- package/dist/lib/onboarding/common.js +2 -14
- package/dist/lib/remix-version-check.js +2 -1
- package/dist/lib/remix-version-interop.js +1 -39
- package/dist/lib/remix-version-interop.test.js +8 -98
- package/dist/lib/setups/css/postcss.js +1 -6
- package/dist/lib/setups/css/tailwind.js +6 -12
- package/dist/lib/setups/routes/generate.js +13 -23
- package/dist/lib/setups/routes/generate.test.js +6 -20
- package/dist/lib/transpile/morph/typedefs.js +1 -1
- package/oclif.manifest.json +29 -16
- package/package.json +13 -9
|
@@ -48,9 +48,10 @@ aside header .close {
|
|
|
48
48
|
text-decoration: none;
|
|
49
49
|
transition: all 200ms;
|
|
50
50
|
width: 20px;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
aside header .close:hover {
|
|
54
|
+
opacity: 1;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
aside header h2 {
|
|
@@ -64,9 +65,10 @@ aside main {
|
|
|
64
65
|
|
|
65
66
|
aside p {
|
|
66
67
|
margin: 0 0 0.25rem;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
aside p:last-child {
|
|
71
|
+
margin: 0;
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
aside li {
|
|
@@ -110,16 +112,14 @@ aside li {
|
|
|
110
112
|
width: 100%;
|
|
111
113
|
}
|
|
112
114
|
|
|
113
|
-
.overlay {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
transform: translateX(calc(var(--aside-width) * -1));
|
|
122
|
-
}
|
|
115
|
+
.overlay:target {
|
|
116
|
+
opacity: 1;
|
|
117
|
+
pointer-events: auto;
|
|
118
|
+
visibility: visible;
|
|
119
|
+
}
|
|
120
|
+
/* reveal aside */
|
|
121
|
+
.overlay:target aside {
|
|
122
|
+
transform: translateX(calc(var(--aside-width) * -1));
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
/*
|
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
"name": "skeleton",
|
|
3
3
|
"private": true,
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "1.0.0",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "shopify hydrogen build",
|
|
8
|
-
"dev": "shopify hydrogen dev --codegen
|
|
8
|
+
"dev": "shopify hydrogen dev --codegen",
|
|
9
9
|
"preview": "npm run build && shopify hydrogen preview",
|
|
10
10
|
"lint": "eslint --no-error-on-unmatched-pattern --ext .js,.ts,.jsx,.tsx .",
|
|
11
11
|
"typecheck": "tsc --noEmit",
|
|
12
|
-
"codegen": "shopify hydrogen codegen
|
|
12
|
+
"codegen": "shopify hydrogen codegen"
|
|
13
13
|
},
|
|
14
14
|
"prettier": "@shopify/prettier-config",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@remix-run/react": "1.
|
|
17
|
-
"@shopify/cli": "3.
|
|
18
|
-
"@shopify/cli-hydrogen": "^
|
|
19
|
-
"@shopify/hydrogen": "^2023.
|
|
20
|
-
"@shopify/remix-oxygen": "^
|
|
16
|
+
"@remix-run/react": "2.1.0",
|
|
17
|
+
"@shopify/cli": "3.50.0",
|
|
18
|
+
"@shopify/cli-hydrogen": "^6.0.0",
|
|
19
|
+
"@shopify/hydrogen": "^2023.10.0",
|
|
20
|
+
"@shopify/remix-oxygen": "^2.0.0",
|
|
21
21
|
"graphql": "^16.6.0",
|
|
22
22
|
"graphql-tag": "^2.12.6",
|
|
23
23
|
"isbot": "^3.6.6",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"react-dom": "^18.2.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@remix-run/dev": "1.
|
|
29
|
-
"@remix-run/eslint-config": "1.
|
|
28
|
+
"@remix-run/dev": "2.1.0",
|
|
29
|
+
"@remix-run/eslint-config": "2.1.0",
|
|
30
30
|
"@shopify/oxygen-workers-types": "^3.17.3",
|
|
31
31
|
"@shopify/prettier-config": "^1.1.2",
|
|
32
32
|
"@total-typescript/ts-reset": "^0.4.2",
|
|
@@ -16,12 +16,4 @@ module.exports = {
|
|
|
16
16
|
serverModuleFormat: 'esm',
|
|
17
17
|
serverPlatform: 'neutral',
|
|
18
18
|
serverMinify: process.env.NODE_ENV === 'production',
|
|
19
|
-
future: {
|
|
20
|
-
v2_dev: true,
|
|
21
|
-
v2_meta: true,
|
|
22
|
-
v2_headers: true,
|
|
23
|
-
v2_errorBoundary: true,
|
|
24
|
-
v2_routeConvention: true,
|
|
25
|
-
v2_normalizeFormMethod: true,
|
|
26
|
-
},
|
|
27
19
|
};
|
|
@@ -55,7 +55,7 @@ export type ShopFragment = Pick<
|
|
|
55
55
|
|
|
56
56
|
export type HeaderQueryVariables = StorefrontAPI.Exact<{
|
|
57
57
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
58
|
-
headerMenuHandle: StorefrontAPI.Scalars['String'];
|
|
58
|
+
headerMenuHandle: StorefrontAPI.Scalars['String']['input'];
|
|
59
59
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
60
60
|
}>;
|
|
61
61
|
|
|
@@ -89,7 +89,7 @@ export type HeaderQuery = {
|
|
|
89
89
|
|
|
90
90
|
export type FooterQueryVariables = StorefrontAPI.Exact<{
|
|
91
91
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
92
|
-
footerMenuHandle: StorefrontAPI.Scalars['String'];
|
|
92
|
+
footerMenuHandle: StorefrontAPI.Scalars['String']['input'];
|
|
93
93
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
94
94
|
}>;
|
|
95
95
|
|
|
@@ -121,7 +121,7 @@ export type StoreRobotsQueryVariables = StorefrontAPI.Exact<{
|
|
|
121
121
|
export type StoreRobotsQuery = {shop: Pick<StorefrontAPI.Shop, 'id'>};
|
|
122
122
|
|
|
123
123
|
export type SitemapQueryVariables = StorefrontAPI.Exact<{
|
|
124
|
-
urlLimits?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']>;
|
|
124
|
+
urlLimits?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']['input']>;
|
|
125
125
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
126
126
|
}>;
|
|
127
127
|
|
|
@@ -223,8 +223,8 @@ export type RecommendedProductsQuery = {
|
|
|
223
223
|
|
|
224
224
|
export type CustomerAddressUpdateMutationVariables = StorefrontAPI.Exact<{
|
|
225
225
|
address: StorefrontAPI.MailingAddressInput;
|
|
226
|
-
customerAccessToken: StorefrontAPI.Scalars['String'];
|
|
227
|
-
id: StorefrontAPI.Scalars['ID'];
|
|
226
|
+
customerAccessToken: StorefrontAPI.Scalars['String']['input'];
|
|
227
|
+
id: StorefrontAPI.Scalars['ID']['input'];
|
|
228
228
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
229
229
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
230
230
|
}>;
|
|
@@ -241,8 +241,8 @@ export type CustomerAddressUpdateMutation = {
|
|
|
241
241
|
};
|
|
242
242
|
|
|
243
243
|
export type CustomerAddressDeleteMutationVariables = StorefrontAPI.Exact<{
|
|
244
|
-
customerAccessToken: StorefrontAPI.Scalars['String'];
|
|
245
|
-
id: StorefrontAPI.Scalars['ID'];
|
|
244
|
+
customerAccessToken: StorefrontAPI.Scalars['String']['input'];
|
|
245
|
+
id: StorefrontAPI.Scalars['ID']['input'];
|
|
246
246
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
247
247
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
248
248
|
}>;
|
|
@@ -262,8 +262,8 @@ export type CustomerAddressDeleteMutation = {
|
|
|
262
262
|
|
|
263
263
|
export type CustomerDefaultAddressUpdateMutationVariables =
|
|
264
264
|
StorefrontAPI.Exact<{
|
|
265
|
-
addressId: StorefrontAPI.Scalars['ID'];
|
|
266
|
-
customerAccessToken: StorefrontAPI.Scalars['String'];
|
|
265
|
+
addressId: StorefrontAPI.Scalars['ID']['input'];
|
|
266
|
+
customerAccessToken: StorefrontAPI.Scalars['String']['input'];
|
|
267
267
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
268
268
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
269
269
|
}>;
|
|
@@ -283,7 +283,7 @@ export type CustomerDefaultAddressUpdateMutation = {
|
|
|
283
283
|
|
|
284
284
|
export type CustomerAddressCreateMutationVariables = StorefrontAPI.Exact<{
|
|
285
285
|
address: StorefrontAPI.MailingAddressInput;
|
|
286
|
-
customerAccessToken: StorefrontAPI.Scalars['String'];
|
|
286
|
+
customerAccessToken: StorefrontAPI.Scalars['String']['input'];
|
|
287
287
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
288
288
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
289
289
|
}>;
|
|
@@ -474,7 +474,7 @@ export type OrderFragment = Pick<
|
|
|
474
474
|
export type OrderQueryVariables = StorefrontAPI.Exact<{
|
|
475
475
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
476
476
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
477
|
-
orderId: StorefrontAPI.Scalars['ID'];
|
|
477
|
+
orderId: StorefrontAPI.Scalars['ID']['input'];
|
|
478
478
|
}>;
|
|
479
479
|
|
|
480
480
|
export type OrderQuery = {
|
|
@@ -644,12 +644,16 @@ export type CustomerOrdersFragment = Pick<
|
|
|
644
644
|
|
|
645
645
|
export type CustomerOrdersQueryVariables = StorefrontAPI.Exact<{
|
|
646
646
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
647
|
-
customerAccessToken: StorefrontAPI.Scalars['String'];
|
|
648
|
-
endCursor?: StorefrontAPI.InputMaybe<
|
|
649
|
-
|
|
647
|
+
customerAccessToken: StorefrontAPI.Scalars['String']['input'];
|
|
648
|
+
endCursor?: StorefrontAPI.InputMaybe<
|
|
649
|
+
StorefrontAPI.Scalars['String']['input']
|
|
650
|
+
>;
|
|
651
|
+
first?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']['input']>;
|
|
650
652
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
651
|
-
last?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']>;
|
|
652
|
-
startCursor?: StorefrontAPI.InputMaybe<
|
|
653
|
+
last?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']['input']>;
|
|
654
|
+
startCursor?: StorefrontAPI.InputMaybe<
|
|
655
|
+
StorefrontAPI.Scalars['String']['input']
|
|
656
|
+
>;
|
|
653
657
|
}>;
|
|
654
658
|
|
|
655
659
|
export type CustomerOrdersQuery = {
|
|
@@ -697,7 +701,7 @@ export type CustomerOrdersQuery = {
|
|
|
697
701
|
};
|
|
698
702
|
|
|
699
703
|
export type CustomerUpdateMutationVariables = StorefrontAPI.Exact<{
|
|
700
|
-
customerAccessToken: StorefrontAPI.Scalars['String'];
|
|
704
|
+
customerAccessToken: StorefrontAPI.Scalars['String']['input'];
|
|
701
705
|
customer: StorefrontAPI.CustomerUpdateInput;
|
|
702
706
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
703
707
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
@@ -784,7 +788,7 @@ export type AddressFragment = Pick<
|
|
|
784
788
|
>;
|
|
785
789
|
|
|
786
790
|
export type CustomerQueryVariables = StorefrontAPI.Exact<{
|
|
787
|
-
customerAccessToken: StorefrontAPI.Scalars['String'];
|
|
791
|
+
customerAccessToken: StorefrontAPI.Scalars['String']['input'];
|
|
788
792
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
789
793
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
790
794
|
}>;
|
|
@@ -841,7 +845,7 @@ export type CustomerQuery = {
|
|
|
841
845
|
};
|
|
842
846
|
|
|
843
847
|
export type CustomerActivateMutationVariables = StorefrontAPI.Exact<{
|
|
844
|
-
id: StorefrontAPI.Scalars['ID'];
|
|
848
|
+
id: StorefrontAPI.Scalars['ID']['input'];
|
|
845
849
|
input: StorefrontAPI.CustomerActivateInput;
|
|
846
850
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
847
851
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
@@ -874,7 +878,7 @@ export type LoginMutation = {
|
|
|
874
878
|
};
|
|
875
879
|
|
|
876
880
|
export type CustomerRecoverMutationVariables = StorefrontAPI.Exact<{
|
|
877
|
-
email: StorefrontAPI.Scalars['String'];
|
|
881
|
+
email: StorefrontAPI.Scalars['String']['input'];
|
|
878
882
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
879
883
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
880
884
|
}>;
|
|
@@ -920,7 +924,7 @@ export type RegisterLoginMutation = {
|
|
|
920
924
|
};
|
|
921
925
|
|
|
922
926
|
export type CustomerResetMutationVariables = StorefrontAPI.Exact<{
|
|
923
|
-
id: StorefrontAPI.Scalars['ID'];
|
|
927
|
+
id: StorefrontAPI.Scalars['ID']['input'];
|
|
924
928
|
input: StorefrontAPI.CustomerResetInput;
|
|
925
929
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
926
930
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
@@ -986,9 +990,9 @@ export type PredictiveQueryFragment = {
|
|
|
986
990
|
export type PredictiveSearchQueryVariables = StorefrontAPI.Exact<{
|
|
987
991
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
988
992
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
989
|
-
limit: StorefrontAPI.Scalars['Int'];
|
|
993
|
+
limit: StorefrontAPI.Scalars['Int']['input'];
|
|
990
994
|
limitScope: StorefrontAPI.PredictiveSearchLimitScope;
|
|
991
|
-
searchTerm: StorefrontAPI.Scalars['String'];
|
|
995
|
+
searchTerm: StorefrontAPI.Scalars['String']['input'];
|
|
992
996
|
types?: StorefrontAPI.InputMaybe<
|
|
993
997
|
| Array<StorefrontAPI.PredictiveSearchType>
|
|
994
998
|
| StorefrontAPI.PredictiveSearchType
|
|
@@ -1053,8 +1057,8 @@ export type PredictiveSearchQuery = {
|
|
|
1053
1057
|
};
|
|
1054
1058
|
|
|
1055
1059
|
export type ArticleQueryVariables = StorefrontAPI.Exact<{
|
|
1056
|
-
articleHandle: StorefrontAPI.Scalars['String'];
|
|
1057
|
-
blogHandle: StorefrontAPI.Scalars['String'];
|
|
1060
|
+
articleHandle: StorefrontAPI.Scalars['String']['input'];
|
|
1061
|
+
blogHandle: StorefrontAPI.Scalars['String']['input'];
|
|
1058
1062
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
1059
1063
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
1060
1064
|
}>;
|
|
@@ -1080,11 +1084,15 @@ export type ArticleQuery = {
|
|
|
1080
1084
|
|
|
1081
1085
|
export type BlogQueryVariables = StorefrontAPI.Exact<{
|
|
1082
1086
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
1083
|
-
blogHandle: StorefrontAPI.Scalars['String'];
|
|
1084
|
-
first?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']>;
|
|
1085
|
-
last?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']>;
|
|
1086
|
-
startCursor?: StorefrontAPI.InputMaybe<
|
|
1087
|
-
|
|
1087
|
+
blogHandle: StorefrontAPI.Scalars['String']['input'];
|
|
1088
|
+
first?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']['input']>;
|
|
1089
|
+
last?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']['input']>;
|
|
1090
|
+
startCursor?: StorefrontAPI.InputMaybe<
|
|
1091
|
+
StorefrontAPI.Scalars['String']['input']
|
|
1092
|
+
>;
|
|
1093
|
+
endCursor?: StorefrontAPI.InputMaybe<
|
|
1094
|
+
StorefrontAPI.Scalars['String']['input']
|
|
1095
|
+
>;
|
|
1088
1096
|
}>;
|
|
1089
1097
|
|
|
1090
1098
|
export type BlogQuery = {
|
|
@@ -1133,11 +1141,15 @@ export type ArticleItemFragment = Pick<
|
|
|
1133
1141
|
|
|
1134
1142
|
export type BlogsQueryVariables = StorefrontAPI.Exact<{
|
|
1135
1143
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
1136
|
-
endCursor?: StorefrontAPI.InputMaybe<
|
|
1137
|
-
|
|
1144
|
+
endCursor?: StorefrontAPI.InputMaybe<
|
|
1145
|
+
StorefrontAPI.Scalars['String']['input']
|
|
1146
|
+
>;
|
|
1147
|
+
first?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']['input']>;
|
|
1138
1148
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
1139
|
-
last?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']>;
|
|
1140
|
-
startCursor?: StorefrontAPI.InputMaybe<
|
|
1149
|
+
last?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']['input']>;
|
|
1150
|
+
startCursor?: StorefrontAPI.InputMaybe<
|
|
1151
|
+
StorefrontAPI.Scalars['String']['input']
|
|
1152
|
+
>;
|
|
1141
1153
|
}>;
|
|
1142
1154
|
|
|
1143
1155
|
export type BlogsQuery = {
|
|
@@ -1182,13 +1194,17 @@ export type ProductItemFragment = Pick<
|
|
|
1182
1194
|
};
|
|
1183
1195
|
|
|
1184
1196
|
export type CollectionQueryVariables = StorefrontAPI.Exact<{
|
|
1185
|
-
handle: StorefrontAPI.Scalars['String'];
|
|
1197
|
+
handle: StorefrontAPI.Scalars['String']['input'];
|
|
1186
1198
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
1187
1199
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
1188
|
-
first?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']>;
|
|
1189
|
-
last?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']>;
|
|
1190
|
-
startCursor?: StorefrontAPI.InputMaybe<
|
|
1191
|
-
|
|
1200
|
+
first?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']['input']>;
|
|
1201
|
+
last?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']['input']>;
|
|
1202
|
+
startCursor?: StorefrontAPI.InputMaybe<
|
|
1203
|
+
StorefrontAPI.Scalars['String']['input']
|
|
1204
|
+
>;
|
|
1205
|
+
endCursor?: StorefrontAPI.InputMaybe<
|
|
1206
|
+
StorefrontAPI.Scalars['String']['input']
|
|
1207
|
+
>;
|
|
1192
1208
|
}>;
|
|
1193
1209
|
|
|
1194
1210
|
export type CollectionQuery = {
|
|
@@ -1245,11 +1261,15 @@ export type CollectionFragment = Pick<
|
|
|
1245
1261
|
|
|
1246
1262
|
export type StoreCollectionsQueryVariables = StorefrontAPI.Exact<{
|
|
1247
1263
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
1248
|
-
endCursor?: StorefrontAPI.InputMaybe<
|
|
1249
|
-
|
|
1264
|
+
endCursor?: StorefrontAPI.InputMaybe<
|
|
1265
|
+
StorefrontAPI.Scalars['String']['input']
|
|
1266
|
+
>;
|
|
1267
|
+
first?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']['input']>;
|
|
1250
1268
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
1251
|
-
last?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']>;
|
|
1252
|
-
startCursor?: StorefrontAPI.InputMaybe<
|
|
1269
|
+
last?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']['input']>;
|
|
1270
|
+
startCursor?: StorefrontAPI.InputMaybe<
|
|
1271
|
+
StorefrontAPI.Scalars['String']['input']
|
|
1272
|
+
>;
|
|
1253
1273
|
}>;
|
|
1254
1274
|
|
|
1255
1275
|
export type StoreCollectionsQuery = {
|
|
@@ -1274,7 +1294,7 @@ export type StoreCollectionsQuery = {
|
|
|
1274
1294
|
export type PageQueryVariables = StorefrontAPI.Exact<{
|
|
1275
1295
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
1276
1296
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
1277
|
-
handle: StorefrontAPI.Scalars['String'];
|
|
1297
|
+
handle: StorefrontAPI.Scalars['String']['input'];
|
|
1278
1298
|
}>;
|
|
1279
1299
|
|
|
1280
1300
|
export type PageQuery = {
|
|
@@ -1295,10 +1315,10 @@ export type PolicyFragment = Pick<
|
|
|
1295
1315
|
export type PolicyQueryVariables = StorefrontAPI.Exact<{
|
|
1296
1316
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
1297
1317
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
1298
|
-
privacyPolicy: StorefrontAPI.Scalars['Boolean'];
|
|
1299
|
-
refundPolicy: StorefrontAPI.Scalars['Boolean'];
|
|
1300
|
-
shippingPolicy: StorefrontAPI.Scalars['Boolean'];
|
|
1301
|
-
termsOfService: StorefrontAPI.Scalars['Boolean'];
|
|
1318
|
+
privacyPolicy: StorefrontAPI.Scalars['Boolean']['input'];
|
|
1319
|
+
refundPolicy: StorefrontAPI.Scalars['Boolean']['input'];
|
|
1320
|
+
shippingPolicy: StorefrontAPI.Scalars['Boolean']['input'];
|
|
1321
|
+
termsOfService: StorefrontAPI.Scalars['Boolean']['input'];
|
|
1302
1322
|
}>;
|
|
1303
1323
|
|
|
1304
1324
|
export type PolicyQuery = {
|
|
@@ -1429,7 +1449,7 @@ export type ProductFragment = Pick<
|
|
|
1429
1449
|
|
|
1430
1450
|
export type ProductQueryVariables = StorefrontAPI.Exact<{
|
|
1431
1451
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
1432
|
-
handle: StorefrontAPI.Scalars['String'];
|
|
1452
|
+
handle: StorefrontAPI.Scalars['String']['input'];
|
|
1433
1453
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
1434
1454
|
selectedOptions:
|
|
1435
1455
|
| Array<StorefrontAPI.SelectedOptionInput>
|
|
@@ -1530,7 +1550,7 @@ export type ProductVariantsFragment = {
|
|
|
1530
1550
|
export type ProductVariantsQueryVariables = StorefrontAPI.Exact<{
|
|
1531
1551
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
1532
1552
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
1533
|
-
handle: StorefrontAPI.Scalars['String'];
|
|
1553
|
+
handle: StorefrontAPI.Scalars['String']['input'];
|
|
1534
1554
|
}>;
|
|
1535
1555
|
|
|
1536
1556
|
export type ProductVariantsQuery = {
|
|
@@ -1599,12 +1619,16 @@ export type SearchArticleFragment = {__typename: 'Article'} & Pick<
|
|
|
1599
1619
|
|
|
1600
1620
|
export type SearchQueryVariables = StorefrontAPI.Exact<{
|
|
1601
1621
|
country?: StorefrontAPI.InputMaybe<StorefrontAPI.CountryCode>;
|
|
1602
|
-
endCursor?: StorefrontAPI.InputMaybe<
|
|
1603
|
-
|
|
1622
|
+
endCursor?: StorefrontAPI.InputMaybe<
|
|
1623
|
+
StorefrontAPI.Scalars['String']['input']
|
|
1624
|
+
>;
|
|
1625
|
+
first?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']['input']>;
|
|
1604
1626
|
language?: StorefrontAPI.InputMaybe<StorefrontAPI.LanguageCode>;
|
|
1605
|
-
last?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']>;
|
|
1606
|
-
query: StorefrontAPI.Scalars['String'];
|
|
1607
|
-
startCursor?: StorefrontAPI.InputMaybe<
|
|
1627
|
+
last?: StorefrontAPI.InputMaybe<StorefrontAPI.Scalars['Int']['input']>;
|
|
1628
|
+
query: StorefrontAPI.Scalars['String']['input'];
|
|
1629
|
+
startCursor?: StorefrontAPI.InputMaybe<
|
|
1630
|
+
StorefrontAPI.Scalars['String']['input']
|
|
1631
|
+
>;
|
|
1608
1632
|
}>;
|
|
1609
1633
|
|
|
1610
1634
|
export type SearchQuery = {
|
package/dist/lib/codegen.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
3
|
import { getCodeFormatOptions, formatCode } from './format-code.js';
|
|
4
4
|
import { renderWarning, renderFatalError } from '@shopify/cli-kit/node/ui';
|
|
5
5
|
import { relativePath, joinPath } from '@shopify/cli-kit/node/path';
|
|
6
6
|
import { AbortError } from '@shopify/cli-kit/node/error';
|
|
7
|
-
import { spawn } from 'node:child_process';
|
|
8
|
-
import { fileURLToPath } from 'node:url';
|
|
9
7
|
|
|
10
8
|
const nodePath = process.argv[1];
|
|
11
9
|
const modulePath = fileURLToPath(import.meta.url);
|
|
@@ -65,16 +63,20 @@ function spawnCodegenProcess({
|
|
|
65
63
|
return child;
|
|
66
64
|
}
|
|
67
65
|
async function codegen(options) {
|
|
68
|
-
await
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
await import('@shopify/hydrogen-codegen/patch').catch((error) => {
|
|
67
|
+
throw new AbortError(
|
|
68
|
+
`Failed to patch dependencies for codegen.
|
|
69
|
+
${error.stack}`,
|
|
70
|
+
"Please report this issue."
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
return generateTypes(options).catch((error) => {
|
|
72
74
|
const { message, details } = normalizeCodegenError(
|
|
73
75
|
error.message,
|
|
74
76
|
options.rootDirectory
|
|
75
77
|
);
|
|
76
78
|
throw new AbortError(message, details);
|
|
77
|
-
}
|
|
79
|
+
});
|
|
78
80
|
}
|
|
79
81
|
async function generateTypes({
|
|
80
82
|
watch,
|
|
@@ -82,30 +84,36 @@ async function generateTypes({
|
|
|
82
84
|
forceSfapiVersion,
|
|
83
85
|
...dirs
|
|
84
86
|
}) {
|
|
87
|
+
const { generate, loadCodegenConfig, CodegenContext } = await import('@graphql-codegen/cli');
|
|
85
88
|
const { config: codegenConfig } = (
|
|
86
89
|
// Load <root>/codegen.ts if available
|
|
87
90
|
await loadCodegenConfig({
|
|
88
91
|
configFilePath,
|
|
89
92
|
searchPlaces: [dirs.rootDirectory]
|
|
90
93
|
}) || // Fall back to default config
|
|
91
|
-
generateDefaultConfig(dirs, forceSfapiVersion)
|
|
94
|
+
await generateDefaultConfig(dirs, forceSfapiVersion)
|
|
92
95
|
);
|
|
93
96
|
await addHooksToHydrogenOptions(codegenConfig, dirs);
|
|
94
|
-
|
|
95
|
-
{
|
|
97
|
+
const codegenContext = new CodegenContext({
|
|
98
|
+
config: {
|
|
96
99
|
...codegenConfig,
|
|
97
|
-
cwd: dirs.rootDirectory,
|
|
98
100
|
watch,
|
|
99
101
|
// Note: do not use `silent` without `watch`, it will swallow errors and
|
|
100
102
|
// won't hide all logs. `errorsOnly` flag doesn't work either.
|
|
101
|
-
silent: !watch
|
|
103
|
+
silent: !watch,
|
|
104
|
+
// @ts-expect-error this is to avoid process.cwd() in tests
|
|
105
|
+
cwd: dirs.rootDirectory
|
|
102
106
|
},
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
// https://github.com/dotansimha/graphql-code-generator/issues/9490
|
|
108
|
+
filepath: "not-used-but-must-be-set"
|
|
109
|
+
});
|
|
110
|
+
codegenContext.cwd = dirs.rootDirectory;
|
|
111
|
+
await generate(codegenContext, true);
|
|
105
112
|
return Object.keys(codegenConfig.generates);
|
|
106
113
|
}
|
|
107
|
-
function generateDefaultConfig({ rootDirectory, appDirectory }, forceSfapiVersion) {
|
|
108
|
-
const
|
|
114
|
+
async function generateDefaultConfig({ rootDirectory, appDirectory }, forceSfapiVersion) {
|
|
115
|
+
const { schema, preset, pluckConfig } = await import('@shopify/hydrogen-codegen');
|
|
116
|
+
const defaultGlob = "*!(*.d).{ts,tsx,js,jsx}";
|
|
109
117
|
const appDirRelative = relativePath(rootDirectory, appDirectory);
|
|
110
118
|
return {
|
|
111
119
|
filepath: "virtual:codegen",
|
|
@@ -117,10 +125,10 @@ function generateDefaultConfig({ rootDirectory, appDirectory }, forceSfapiVersio
|
|
|
117
125
|
preset,
|
|
118
126
|
schema,
|
|
119
127
|
documents: [
|
|
120
|
-
|
|
121
|
-
// E.g. ./server.
|
|
122
|
-
joinPath(appDirRelative, "**",
|
|
123
|
-
// E.g. app/routes/_index.
|
|
128
|
+
defaultGlob,
|
|
129
|
+
// E.g. ./server.(t|j)s
|
|
130
|
+
joinPath(appDirRelative, "**", defaultGlob)
|
|
131
|
+
// E.g. app/routes/_index.(t|j)sx
|
|
124
132
|
],
|
|
125
133
|
...!!forceSfapiVersion && {
|
|
126
134
|
presetConfig: { importTypes: false },
|
|
@@ -143,6 +151,7 @@ function generateDefaultConfig({ rootDirectory, appDirectory }, forceSfapiVersio
|
|
|
143
151
|
};
|
|
144
152
|
}
|
|
145
153
|
async function addHooksToHydrogenOptions(codegenConfig, { rootDirectory }) {
|
|
154
|
+
const { schema } = await import('@shopify/hydrogen-codegen');
|
|
146
155
|
const [, options] = Object.entries(codegenConfig.generates).find(
|
|
147
156
|
([, value]) => (Array.isArray(value) ? value[0] : value)?.schema === schema
|
|
148
157
|
) || [];
|
package/dist/lib/flags.js
CHANGED
|
@@ -48,10 +48,17 @@ const commonFlags = {
|
|
|
48
48
|
default: true,
|
|
49
49
|
allowNo: true
|
|
50
50
|
}),
|
|
51
|
+
codegen: Flags.boolean({
|
|
52
|
+
description: "Generate types for the Storefront API queries found in your project.",
|
|
53
|
+
required: false,
|
|
54
|
+
default: false,
|
|
55
|
+
deprecateAliases: true,
|
|
56
|
+
aliases: ["codegen-unstable"]
|
|
57
|
+
}),
|
|
51
58
|
codegenConfigPath: Flags.string({
|
|
52
59
|
description: "Specify a path to a codegen configuration file. Defaults to `<root>/codegen.ts` if it exists.",
|
|
53
60
|
required: false,
|
|
54
|
-
dependsOn: ["codegen
|
|
61
|
+
dependsOn: ["codegen"]
|
|
55
62
|
}),
|
|
56
63
|
styling: Flags.string({
|
|
57
64
|
description: `Sets the styling strategy to use. One of ${STYLING_CHOICES.map(
|
|
@@ -58,12 +58,7 @@ async function handleRouteGeneration(controller, flagRoutes) {
|
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
rootDirectory: directory,
|
|
61
|
-
appDirectory: joinPath(directory, "app")
|
|
62
|
-
future: {
|
|
63
|
-
v2_errorBoundary: true,
|
|
64
|
-
v2_meta: true,
|
|
65
|
-
v2_routeConvention: true
|
|
66
|
-
}
|
|
61
|
+
appDirectory: joinPath(directory, "app")
|
|
67
62
|
}
|
|
68
63
|
);
|
|
69
64
|
return result.routeGroups;
|
|
@@ -74,14 +69,7 @@ async function handleRouteGeneration(controller, flagRoutes) {
|
|
|
74
69
|
function generateProjectEntries(options) {
|
|
75
70
|
return Promise.all(
|
|
76
71
|
["root", "entry.server", "entry.client"].map(
|
|
77
|
-
(filename) => generateProjectFile(filename,
|
|
78
|
-
v2Flags: {
|
|
79
|
-
isV2ErrorBoundary: true,
|
|
80
|
-
isV2Meta: true,
|
|
81
|
-
isV2RouteConvention: true
|
|
82
|
-
},
|
|
83
|
-
...options
|
|
84
|
-
})
|
|
72
|
+
(filename) => generateProjectFile(filename, options)
|
|
85
73
|
)
|
|
86
74
|
);
|
|
87
75
|
}
|
|
@@ -11,6 +11,7 @@ function getRequiredRemixVersion(require2 = createRequire(import.meta.url)) {
|
|
|
11
11
|
function checkRemixVersions() {
|
|
12
12
|
const require2 = createRequire(import.meta.url);
|
|
13
13
|
const requiredVersionInHydrogen = getRequiredRemixVersion(require2);
|
|
14
|
+
const satisfiesSemver = require2("semver/functions/satisfies.js");
|
|
14
15
|
const pkgs = [
|
|
15
16
|
"dev",
|
|
16
17
|
"react",
|
|
@@ -21,7 +22,7 @@ function checkRemixVersions() {
|
|
|
21
22
|
"eslint-config"
|
|
22
23
|
].map((name) => getRemixPackageVersion(require2, name));
|
|
23
24
|
const outOfSyncPkgs = pkgs.filter(
|
|
24
|
-
(pkg) => pkg.version && pkg.version
|
|
25
|
+
(pkg) => pkg.version && !satisfiesSemver(pkg.version, requiredVersionInHydrogen)
|
|
25
26
|
);
|
|
26
27
|
if (outOfSyncPkgs.length === 0)
|
|
27
28
|
return;
|
|
@@ -1,46 +1,8 @@
|
|
|
1
1
|
import { createRequire } from 'module';
|
|
2
|
-
import { getRemixConfig } from './remix-config.js';
|
|
3
2
|
|
|
4
|
-
function isRemixV2() {
|
|
5
|
-
try {
|
|
6
|
-
const require2 = createRequire(import.meta.url);
|
|
7
|
-
const version = require2("@remix-run/server-runtime/package.json")?.version ?? "";
|
|
8
|
-
return version.startsWith("2.");
|
|
9
|
-
} catch {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
async function getV2Flags(root, remixConfigFuture) {
|
|
14
|
-
const isV2 = isRemixV2();
|
|
15
|
-
const futureFlags = {
|
|
16
|
-
...!isV2 && (remixConfigFuture ?? (await getRemixConfig(root)).future)
|
|
17
|
-
};
|
|
18
|
-
return {
|
|
19
|
-
isV2Meta: isV2 || !!futureFlags.v2_meta,
|
|
20
|
-
isV2ErrorBoundary: isV2 || !!futureFlags.v2_errorBoundary,
|
|
21
|
-
isV2RouteConvention: isV2 ? !isV1RouteConventionInstalled() : !!futureFlags.v2_routeConvention
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
3
|
function convertRouteToV1(route) {
|
|
25
4
|
return route.replace(/(^|\.)_index$/, "$1index").replace(/\.(?!\w+\])/g, "/");
|
|
26
5
|
}
|
|
27
|
-
function convertTemplateToRemixVersion(template, { isV2Meta, isV2ErrorBoundary }) {
|
|
28
|
-
template = isV2Meta ? convertToMetaV2(template) : convertToMetaV1(template);
|
|
29
|
-
template = isV2ErrorBoundary ? convertToErrorBoundaryV2(template) : convertToErrorBoundaryV1(template);
|
|
30
|
-
return template;
|
|
31
|
-
}
|
|
32
|
-
function convertToMetaV2(template) {
|
|
33
|
-
return template.replace(/type MetaFunction\s*,?/, "").replace(/export (const|function) metaV1.+?\n};?\n/s, "").replace(/import \{\s*\} from '@shopify\/remix-oxygen';/, "");
|
|
34
|
-
}
|
|
35
|
-
function convertToMetaV1(template) {
|
|
36
|
-
return template.replace(/type V2_MetaFunction\s*,?/, "").replace(/export (const|function) meta[^V].+?\n};?\n/s, "").replace(/(const|function) metaV1/, "$1 meta").replace(/import \{\s*\} from '@remix-run\/react';/, "");
|
|
37
|
-
}
|
|
38
|
-
function convertToErrorBoundaryV2(template) {
|
|
39
|
-
return template.replace(/type ErrorBoundaryComponent\s*,?/s, "").replace(/useCatch\s*,?/s, "").replace(/export function CatchBoundary.+?\n}/s, "").replace(/export (const|function) ErrorBoundaryV1.+?\n};?/s, "").replace(/import \{\s*\} from '@shopify\/remix-oxygen';/, "").replace(/import \{\s*\} from '@remix-run\/react';/, "");
|
|
40
|
-
}
|
|
41
|
-
function convertToErrorBoundaryV1(template) {
|
|
42
|
-
return template.replace(/useRouteError\s*,?/s, "").replace(/isRouteErrorResponse\s*,?/s, "").replace(/export function ErrorBoundary[^V].+?\n}/s, "").replace(/(const|function) ErrorBoundaryV1/, "$1 ErrorBoundary").replace(/import \{\s*\} from '@remix-run\/react';/, "");
|
|
43
|
-
}
|
|
44
6
|
function isV1RouteConventionInstalled() {
|
|
45
7
|
try {
|
|
46
8
|
const require2 = createRequire(import.meta.url);
|
|
@@ -51,4 +13,4 @@ function isV1RouteConventionInstalled() {
|
|
|
51
13
|
}
|
|
52
14
|
}
|
|
53
15
|
|
|
54
|
-
export { convertRouteToV1,
|
|
16
|
+
export { convertRouteToV1, isV1RouteConventionInstalled };
|