@shopify/cli-hydrogen 11.1.1 → 11.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/dist/assets/hydrogen/starter/app/components/CartSummary.tsx +7 -30
  2. package/dist/assets/hydrogen/starter/app/graphql/customer-account/CustomerAddressMutations.ts +4 -7
  3. package/dist/assets/hydrogen/starter/app/graphql/customer-account/CustomerDetailsQuery.ts +1 -1
  4. package/dist/assets/hydrogen/starter/app/graphql/customer-account/CustomerOrderQuery.ts +1 -3
  5. package/dist/assets/hydrogen/starter/app/graphql/customer-account/CustomerOrdersQuery.ts +4 -6
  6. package/dist/assets/hydrogen/starter/app/graphql/customer-account/CustomerUpdateMutation.ts +2 -3
  7. package/dist/assets/hydrogen/starter/app/routes/account.addresses.tsx +3 -12
  8. package/dist/assets/hydrogen/starter/app/routes/account.orders.$id.tsx +1 -4
  9. package/dist/assets/hydrogen/starter/app/routes/account.orders._index.tsx +0 -1
  10. package/dist/assets/hydrogen/starter/app/routes/account.profile.tsx +0 -1
  11. package/dist/assets/hydrogen/starter/app/routes/account.tsx +0 -6
  12. package/dist/assets/hydrogen/starter/app/routes/cart.tsx +1 -1
  13. package/dist/assets/hydrogen/starter/customer-accountapi.generated.d.ts +13 -27
  14. package/dist/assets/hydrogen/starter/package.json +3 -3
  15. package/dist/assets/hydrogen/starter/tsconfig.json +3 -13
  16. package/dist/commands/hydrogen/deploy.js +2 -15
  17. package/dist/commands/hydrogen/init.d.ts +1 -1
  18. package/dist/lib/build.js +1 -4
  19. package/dist/lib/codegen.js +12 -3
  20. package/dist/lib/import-utils.js +1 -4
  21. package/dist/lib/onboarding/setup-template.mocks.js +6 -4
  22. package/dist/lib/template-diff.js +2 -3
  23. package/oclif.manifest.json +1 -8
  24. package/package.json +2 -2
@@ -1,8 +1,8 @@
1
1
  import type {CartApiQueryFragment} from 'storefrontapi.generated';
2
2
  import type {CartLayout} from '~/components/CartMain';
3
3
  import {CartForm, Money, type OptimisticCart} from '@shopify/hydrogen';
4
- import {useEffect, useRef} from 'react';
5
- import {FetcherWithComponents, useFetcher} from 'react-router';
4
+ import {useRef} from 'react';
5
+ import { FetcherWithComponents } from 'react-router';
6
6
 
7
7
  type CartSummaryProps = {
8
8
  cart: OptimisticCart<CartApiQueryFragment | null>;
@@ -55,48 +55,28 @@ function CartDiscounts({
55
55
  ?.filter((discount) => discount.applicable)
56
56
  ?.map(({code}) => code) || [];
57
57
 
58
- const discountRemoveFetcher = useFetcher({key: 'discount-remove'});
59
- const discountAddFetcher = useFetcher({key: 'discount-add'});
60
- const discountCodeInput = useRef<HTMLInputElement>(null);
61
-
62
- // Clear the discount code input after the discount is added
63
- useEffect(() => {
64
- if (discountAddFetcher.data) {
65
- discountCodeInput.current!.value = '';
66
- }
67
- }, [discountAddFetcher.data]);
68
-
69
58
  return (
70
59
  <div>
71
60
  {/* Have existing discount, display it with a remove option */}
72
61
  <dl hidden={!codes.length}>
73
62
  <div>
74
63
  <dt>Discount(s)</dt>
75
- <UpdateDiscountForm fetcherKey="discount-remove">
64
+ <UpdateDiscountForm>
76
65
  <div className="cart-discount">
77
66
  <code>{codes?.join(', ')}</code>
78
67
  &nbsp;
79
- <button disabled={discountRemoveFetcher.state !== 'idle'}>
80
- Remove
81
- </button>
68
+ <button>Remove</button>
82
69
  </div>
83
70
  </UpdateDiscountForm>
84
71
  </div>
85
72
  </dl>
86
73
 
87
74
  {/* Show an input to apply a discount */}
88
- <UpdateDiscountForm discountCodes={codes} fetcherKey="discount-add">
75
+ <UpdateDiscountForm discountCodes={codes}>
89
76
  <div>
90
- <input
91
- type="text"
92
- name="discountCode"
93
- placeholder="Discount code"
94
- ref={discountCodeInput}
95
- />
77
+ <input type="text" name="discountCode" placeholder="Discount code" />
96
78
  &nbsp;
97
- <button type="submit" disabled={discountAddFetcher.state !== 'idle'}>
98
- Apply
99
- </button>
79
+ <button type="submit">Apply</button>
100
80
  </div>
101
81
  </UpdateDiscountForm>
102
82
  </div>
@@ -106,15 +86,12 @@ function CartDiscounts({
106
86
  function UpdateDiscountForm({
107
87
  discountCodes,
108
88
  children,
109
- fetcherKey,
110
89
  }: {
111
90
  discountCodes?: string[];
112
91
  children: React.ReactNode;
113
- fetcherKey?: string;
114
92
  }) {
115
93
  return (
116
94
  <CartForm
117
- fetcherKey={fetcherKey}
118
95
  route="/cart"
119
96
  action={CartForm.ACTIONS.DiscountCodesUpdate}
120
97
  inputs={{
@@ -4,8 +4,7 @@ export const UPDATE_ADDRESS_MUTATION = `#graphql
4
4
  $address: CustomerAddressInput!
5
5
  $addressId: ID!
6
6
  $defaultAddress: Boolean
7
- $language: LanguageCode
8
- ) @inContext(language: $language) {
7
+ ) {
9
8
  customerAddressUpdate(
10
9
  address: $address
11
10
  addressId: $addressId
@@ -26,9 +25,8 @@ export const UPDATE_ADDRESS_MUTATION = `#graphql
26
25
  // NOTE: https://shopify.dev/docs/api/customer/latest/mutations/customerAddressDelete
27
26
  export const DELETE_ADDRESS_MUTATION = `#graphql
28
27
  mutation customerAddressDelete(
29
- $addressId: ID!
30
- $language: LanguageCode
31
- ) @inContext(language: $language) {
28
+ $addressId: ID!,
29
+ ) {
32
30
  customerAddressDelete(addressId: $addressId) {
33
31
  deletedAddressId
34
32
  userErrors {
@@ -45,8 +43,7 @@ export const CREATE_ADDRESS_MUTATION = `#graphql
45
43
  mutation customerAddressCreate(
46
44
  $address: CustomerAddressInput!
47
45
  $defaultAddress: Boolean
48
- $language: LanguageCode
49
- ) @inContext(language: $language) {
46
+ ) {
50
47
  customerAddressCreate(
51
48
  address: $address
52
49
  defaultAddress: $defaultAddress
@@ -31,7 +31,7 @@ export const CUSTOMER_FRAGMENT = `#graphql
31
31
 
32
32
  // NOTE: https://shopify.dev/docs/api/customer/latest/queries/customer
33
33
  export const CUSTOMER_DETAILS_QUERY = `#graphql
34
- query CustomerDetails($language: LanguageCode) @inContext(language: $language) {
34
+ query CustomerDetails {
35
35
  customer {
36
36
  ...Customer
37
37
  }
@@ -46,7 +46,6 @@ export const CUSTOMER_ORDER_QUERY = `#graphql
46
46
  id
47
47
  name
48
48
  statusPageUrl
49
- fulfillmentStatus
50
49
  processedAt
51
50
  fulfillments(first: 1) {
52
51
  nodes {
@@ -78,8 +77,7 @@ export const CUSTOMER_ORDER_QUERY = `#graphql
78
77
  }
79
78
  }
80
79
  }
81
- query Order($orderId: ID!, $language: LanguageCode)
82
- @inContext(language: $language) {
80
+ query Order($orderId: ID!) {
83
81
  order(id: $orderId) {
84
82
  ... on Order {
85
83
  ...Order
@@ -1,4 +1,4 @@
1
- // NOTE: https://shopify.dev/docs/api/customer/latest/objects/Order
1
+ // https://shopify.dev/docs/api/customer/latest/objects/Order
2
2
  export const ORDER_ITEM_FRAGMENT = `#graphql
3
3
  fragment OrderItem on Order {
4
4
  totalPrice {
@@ -6,7 +6,6 @@ export const ORDER_ITEM_FRAGMENT = `#graphql
6
6
  currencyCode
7
7
  }
8
8
  financialStatus
9
- fulfillmentStatus
10
9
  fulfillments(first: 1) {
11
10
  nodes {
12
11
  status
@@ -18,7 +17,7 @@ export const ORDER_ITEM_FRAGMENT = `#graphql
18
17
  }
19
18
  ` as const;
20
19
 
21
- // NOTE: https://shopify.dev/docs/api/customer/latest/objects/Customer
20
+ // https://shopify.dev/docs/api/customer/latest/objects/Customer
22
21
  export const CUSTOMER_ORDERS_FRAGMENT = `#graphql
23
22
  fragment CustomerOrders on Customer {
24
23
  orders(
@@ -43,7 +42,7 @@ export const CUSTOMER_ORDERS_FRAGMENT = `#graphql
43
42
  ${ORDER_ITEM_FRAGMENT}
44
43
  ` as const;
45
44
 
46
- // NOTE: https://shopify.dev/docs/api/customer/latest/queries/customer
45
+ // https://shopify.dev/docs/api/customer/latest/queries/customer
47
46
  export const CUSTOMER_ORDERS_QUERY = `#graphql
48
47
  ${CUSTOMER_ORDERS_FRAGMENT}
49
48
  query CustomerOrders(
@@ -51,8 +50,7 @@ export const CUSTOMER_ORDERS_QUERY = `#graphql
51
50
  $first: Int
52
51
  $last: Int
53
52
  $startCursor: String
54
- $language: LanguageCode
55
- ) @inContext(language: $language) {
53
+ ) {
56
54
  customer {
57
55
  ...CustomerOrders
58
56
  }
@@ -1,9 +1,8 @@
1
- // NOTE: https://shopify.dev/docs/api/customer/latest/mutations/customerUpdate
2
1
  export const CUSTOMER_UPDATE_MUTATION = `#graphql
2
+ # https://shopify.dev/docs/api/customer/latest/mutations/customerUpdate
3
3
  mutation customerUpdate(
4
4
  $customer: CustomerUpdateInput!
5
- $language: LanguageCode
6
- ) @inContext(language: $language) {
5
+ ){
7
6
  customerUpdate(input: $customer) {
8
7
  customer {
9
8
  firstName
@@ -42,8 +42,7 @@ export async function loader({context}: LoaderFunctionArgs) {
42
42
  }
43
43
 
44
44
  export async function action({request, context}: ActionFunctionArgs) {
45
- const {customerAccount, storefront} = context;
46
- const {i18n} = storefront;
45
+ const {customerAccount} = context;
47
46
 
48
47
  try {
49
48
  const form = await request.formData();
@@ -97,11 +96,7 @@ export async function action({request, context}: ActionFunctionArgs) {
97
96
  const {data, errors} = await customerAccount.mutate(
98
97
  CREATE_ADDRESS_MUTATION,
99
98
  {
100
- variables: {
101
- address,
102
- defaultAddress,
103
- language: i18n.language,
104
- },
99
+ variables: {address, defaultAddress},
105
100
  },
106
101
  );
107
102
 
@@ -150,7 +145,6 @@ export async function action({request, context}: ActionFunctionArgs) {
150
145
  address,
151
146
  addressId: decodeURIComponent(addressId),
152
147
  defaultAddress,
153
- language: i18n.language,
154
148
  },
155
149
  },
156
150
  );
@@ -196,10 +190,7 @@ export async function action({request, context}: ActionFunctionArgs) {
196
190
  const {data, errors} = await customerAccount.mutate(
197
191
  DELETE_ADDRESS_MUTATION,
198
192
  {
199
- variables: {
200
- addressId: decodeURIComponent(addressId),
201
- language: i18n.language,
202
- },
193
+ variables: {addressId: decodeURIComponent(addressId)},
203
194
  },
204
195
  );
205
196
 
@@ -17,10 +17,7 @@ export async function loader({params, context}: LoaderFunctionArgs) {
17
17
  const {data, errors} = await context.customerAccount.query(
18
18
  CUSTOMER_ORDER_QUERY,
19
19
  {
20
- variables: {
21
- orderId,
22
- language: context.storefront.i18n.language,
23
- },
20
+ variables: {orderId},
24
21
  },
25
22
  );
26
23
 
@@ -26,7 +26,6 @@ export async function loader({request, context}: LoaderFunctionArgs) {
26
26
  {
27
27
  variables: {
28
28
  ...paginationVariables,
29
- language: context.storefront.i18n.language,
30
29
  },
31
30
  },
32
31
  );
@@ -50,7 +50,6 @@ export async function action({request, context}: ActionFunctionArgs) {
50
50
  {
51
51
  variables: {
52
52
  customer,
53
- language: context.storefront.i18n.language,
54
53
  },
55
54
  },
56
55
  );
@@ -1,4 +1,3 @@
1
-
2
1
  import {data as remixData, type LoaderFunctionArgs} from '@shopify/remix-oxygen';
3
2
  import { Form, NavLink, Outlet, useLoaderData } from 'react-router';
4
3
  import {CUSTOMER_DETAILS_QUERY} from '~/graphql/customer-account/CustomerDetailsQuery';
@@ -10,11 +9,6 @@ export function shouldRevalidate() {
10
9
  export async function loader({context}: LoaderFunctionArgs) {
11
10
  const {data, errors} = await context.customerAccount.query(
12
11
  CUSTOMER_DETAILS_QUERY,
13
- {
14
- variables: {
15
- language: context.storefront.i18n.language,
16
- },
17
- },
18
12
  );
19
13
 
20
14
  if (errors?.length || !data?.customer) {
@@ -1,4 +1,4 @@
1
- import {type MetaFunction, useLoaderData} from 'react-router';
1
+ import { type MetaFunction, useLoaderData } from 'react-router';
2
2
  import type {CartQueryDataReturn} from '@shopify/hydrogen';
3
3
  import {CartForm} from '@shopify/hydrogen';
4
4
  import {
@@ -9,7 +9,6 @@ export type CustomerAddressUpdateMutationVariables = CustomerAccountAPI.Exact<{
9
9
  defaultAddress?: CustomerAccountAPI.InputMaybe<
10
10
  CustomerAccountAPI.Scalars['Boolean']['input']
11
11
  >;
12
- language?: CustomerAccountAPI.InputMaybe<CustomerAccountAPI.LanguageCode>;
13
12
  }>;
14
13
 
15
14
  export type CustomerAddressUpdateMutation = {
@@ -28,7 +27,6 @@ export type CustomerAddressUpdateMutation = {
28
27
 
29
28
  export type CustomerAddressDeleteMutationVariables = CustomerAccountAPI.Exact<{
30
29
  addressId: CustomerAccountAPI.Scalars['ID']['input'];
31
- language?: CustomerAccountAPI.InputMaybe<CustomerAccountAPI.LanguageCode>;
32
30
  }>;
33
31
 
34
32
  export type CustomerAddressDeleteMutation = {
@@ -52,7 +50,6 @@ export type CustomerAddressCreateMutationVariables = CustomerAccountAPI.Exact<{
52
50
  defaultAddress?: CustomerAccountAPI.InputMaybe<
53
51
  CustomerAccountAPI.Scalars['Boolean']['input']
54
52
  >;
55
- language?: CustomerAccountAPI.InputMaybe<CustomerAccountAPI.LanguageCode>;
56
53
  }>;
57
54
 
58
55
  export type CustomerAddressCreateMutation = {
@@ -128,7 +125,7 @@ export type AddressFragment = Pick<
128
125
  >;
129
126
 
130
127
  export type CustomerDetailsQueryVariables = CustomerAccountAPI.Exact<{
131
- language?: CustomerAccountAPI.InputMaybe<CustomerAccountAPI.LanguageCode>;
128
+ [key: string]: never;
132
129
  }>;
133
130
 
134
131
  export type CustomerDetailsQuery = {
@@ -227,7 +224,7 @@ export type OrderLineItemFullFragment = Pick<
227
224
 
228
225
  export type OrderFragment = Pick<
229
226
  CustomerAccountAPI.Order,
230
- 'id' | 'name' | 'statusPageUrl' | 'fulfillmentStatus' | 'processedAt'
227
+ 'id' | 'name' | 'statusPageUrl' | 'processedAt'
231
228
  > & {
232
229
  fulfillments: {nodes: Array<Pick<CustomerAccountAPI.Fulfillment, 'status'>>};
233
230
  totalTax?: CustomerAccountAPI.Maybe<
@@ -299,14 +296,13 @@ export type OrderFragment = Pick<
299
296
 
300
297
  export type OrderQueryVariables = CustomerAccountAPI.Exact<{
301
298
  orderId: CustomerAccountAPI.Scalars['ID']['input'];
302
- language?: CustomerAccountAPI.InputMaybe<CustomerAccountAPI.LanguageCode>;
303
299
  }>;
304
300
 
305
301
  export type OrderQuery = {
306
302
  order?: CustomerAccountAPI.Maybe<
307
303
  Pick<
308
304
  CustomerAccountAPI.Order,
309
- 'id' | 'name' | 'statusPageUrl' | 'fulfillmentStatus' | 'processedAt'
305
+ 'id' | 'name' | 'statusPageUrl' | 'processedAt'
310
306
  > & {
311
307
  fulfillments: {
312
308
  nodes: Array<Pick<CustomerAccountAPI.Fulfillment, 'status'>>;
@@ -382,7 +378,7 @@ export type OrderQuery = {
382
378
 
383
379
  export type OrderItemFragment = Pick<
384
380
  CustomerAccountAPI.Order,
385
- 'financialStatus' | 'fulfillmentStatus' | 'id' | 'number' | 'processedAt'
381
+ 'financialStatus' | 'id' | 'number' | 'processedAt'
386
382
  > & {
387
383
  totalPrice: Pick<CustomerAccountAPI.MoneyV2, 'amount' | 'currencyCode'>;
388
384
  fulfillments: {nodes: Array<Pick<CustomerAccountAPI.Fulfillment, 'status'>>};
@@ -393,11 +389,7 @@ export type CustomerOrdersFragment = {
393
389
  nodes: Array<
394
390
  Pick<
395
391
  CustomerAccountAPI.Order,
396
- | 'financialStatus'
397
- | 'fulfillmentStatus'
398
- | 'id'
399
- | 'number'
400
- | 'processedAt'
392
+ 'financialStatus' | 'id' | 'number' | 'processedAt'
401
393
  > & {
402
394
  totalPrice: Pick<CustomerAccountAPI.MoneyV2, 'amount' | 'currencyCode'>;
403
395
  fulfillments: {
@@ -425,7 +417,6 @@ export type CustomerOrdersQueryVariables = CustomerAccountAPI.Exact<{
425
417
  startCursor?: CustomerAccountAPI.InputMaybe<
426
418
  CustomerAccountAPI.Scalars['String']['input']
427
419
  >;
428
- language?: CustomerAccountAPI.InputMaybe<CustomerAccountAPI.LanguageCode>;
429
420
  }>;
430
421
 
431
422
  export type CustomerOrdersQuery = {
@@ -434,11 +425,7 @@ export type CustomerOrdersQuery = {
434
425
  nodes: Array<
435
426
  Pick<
436
427
  CustomerAccountAPI.Order,
437
- | 'financialStatus'
438
- | 'fulfillmentStatus'
439
- | 'id'
440
- | 'number'
441
- | 'processedAt'
428
+ 'financialStatus' | 'id' | 'number' | 'processedAt'
442
429
  > & {
443
430
  totalPrice: Pick<
444
431
  CustomerAccountAPI.MoneyV2,
@@ -459,7 +446,6 @@ export type CustomerOrdersQuery = {
459
446
 
460
447
  export type CustomerUpdateMutationVariables = CustomerAccountAPI.Exact<{
461
448
  customer: CustomerAccountAPI.CustomerUpdateInput;
462
- language?: CustomerAccountAPI.InputMaybe<CustomerAccountAPI.LanguageCode>;
463
449
  }>;
464
450
 
465
451
  export type CustomerUpdateMutation = {
@@ -484,34 +470,34 @@ export type CustomerUpdateMutation = {
484
470
  };
485
471
 
486
472
  interface GeneratedQueryTypes {
487
- '#graphql\n query CustomerDetails($language: LanguageCode) @inContext(language: $language) {\n customer {\n ...Customer\n }\n }\n #graphql\n fragment Customer on Customer {\n id\n firstName\n lastName\n defaultAddress {\n ...Address\n }\n addresses(first: 6) {\n nodes {\n ...Address\n }\n }\n }\n fragment Address on CustomerAddress {\n id\n formatted\n firstName\n lastName\n company\n address1\n address2\n territoryCode\n zoneCode\n city\n zip\n phoneNumber\n }\n\n': {
473
+ '#graphql\n query CustomerDetails {\n customer {\n ...Customer\n }\n }\n #graphql\n fragment Customer on Customer {\n id\n firstName\n lastName\n defaultAddress {\n ...Address\n }\n addresses(first: 6) {\n nodes {\n ...Address\n }\n }\n }\n fragment Address on CustomerAddress {\n id\n formatted\n firstName\n lastName\n company\n address1\n address2\n territoryCode\n zoneCode\n city\n zip\n phoneNumber\n }\n\n': {
488
474
  return: CustomerDetailsQuery;
489
475
  variables: CustomerDetailsQueryVariables;
490
476
  };
491
- '#graphql\n fragment OrderMoney on MoneyV2 {\n amount\n currencyCode\n }\n fragment DiscountApplication on DiscountApplication {\n value {\n __typename\n ... on MoneyV2 {\n ...OrderMoney\n }\n ... on PricingPercentageValue {\n percentage\n }\n }\n }\n fragment OrderLineItemFull on LineItem {\n id\n title\n quantity\n price {\n ...OrderMoney\n }\n discountAllocations {\n allocatedAmount {\n ...OrderMoney\n }\n discountApplication {\n ...DiscountApplication\n }\n }\n totalDiscount {\n ...OrderMoney\n }\n image {\n altText\n height\n url\n id\n width\n }\n variantTitle\n }\n fragment Order on Order {\n id\n name\n statusPageUrl\n fulfillmentStatus\n processedAt\n fulfillments(first: 1) {\n nodes {\n status\n }\n }\n totalTax {\n ...OrderMoney\n }\n totalPrice {\n ...OrderMoney\n }\n subtotal {\n ...OrderMoney\n }\n shippingAddress {\n name\n formatted(withName: true)\n formattedArea\n }\n discountApplications(first: 100) {\n nodes {\n ...DiscountApplication\n }\n }\n lineItems(first: 100) {\n nodes {\n ...OrderLineItemFull\n }\n }\n }\n query Order($orderId: ID!, $language: LanguageCode)\n @inContext(language: $language) {\n order(id: $orderId) {\n ... on Order {\n ...Order\n }\n }\n }\n': {
477
+ '#graphql\n fragment OrderMoney on MoneyV2 {\n amount\n currencyCode\n }\n fragment DiscountApplication on DiscountApplication {\n value {\n __typename\n ... on MoneyV2 {\n ...OrderMoney\n }\n ... on PricingPercentageValue {\n percentage\n }\n }\n }\n fragment OrderLineItemFull on LineItem {\n id\n title\n quantity\n price {\n ...OrderMoney\n }\n discountAllocations {\n allocatedAmount {\n ...OrderMoney\n }\n discountApplication {\n ...DiscountApplication\n }\n }\n totalDiscount {\n ...OrderMoney\n }\n image {\n altText\n height\n url\n id\n width\n }\n variantTitle\n }\n fragment Order on Order {\n id\n name\n statusPageUrl\n processedAt\n fulfillments(first: 1) {\n nodes {\n status\n }\n }\n totalTax {\n ...OrderMoney\n }\n totalPrice {\n ...OrderMoney\n }\n subtotal {\n ...OrderMoney\n }\n shippingAddress {\n name\n formatted(withName: true)\n formattedArea\n }\n discountApplications(first: 100) {\n nodes {\n ...DiscountApplication\n }\n }\n lineItems(first: 100) {\n nodes {\n ...OrderLineItemFull\n }\n }\n }\n query Order($orderId: ID!) {\n order(id: $orderId) {\n ... on Order {\n ...Order\n }\n }\n }\n': {
492
478
  return: OrderQuery;
493
479
  variables: OrderQueryVariables;
494
480
  };
495
- '#graphql\n #graphql\n fragment CustomerOrders on Customer {\n orders(\n sortKey: PROCESSED_AT,\n reverse: true,\n first: $first,\n last: $last,\n before: $startCursor,\n after: $endCursor\n ) {\n nodes {\n ...OrderItem\n }\n pageInfo {\n hasPreviousPage\n hasNextPage\n endCursor\n startCursor\n }\n }\n }\n #graphql\n fragment OrderItem on Order {\n totalPrice {\n amount\n currencyCode\n }\n financialStatus\n fulfillmentStatus\n fulfillments(first: 1) {\n nodes {\n status\n }\n }\n id\n number\n processedAt\n }\n\n\n query CustomerOrders(\n $endCursor: String\n $first: Int\n $last: Int\n $startCursor: String\n $language: LanguageCode\n ) @inContext(language: $language) {\n customer {\n ...CustomerOrders\n }\n }\n': {
481
+ '#graphql\n #graphql\n fragment CustomerOrders on Customer {\n orders(\n sortKey: PROCESSED_AT,\n reverse: true,\n first: $first,\n last: $last,\n before: $startCursor,\n after: $endCursor\n ) {\n nodes {\n ...OrderItem\n }\n pageInfo {\n hasPreviousPage\n hasNextPage\n endCursor\n startCursor\n }\n }\n }\n #graphql\n fragment OrderItem on Order {\n totalPrice {\n amount\n currencyCode\n }\n financialStatus\n fulfillments(first: 1) {\n nodes {\n status\n }\n }\n id\n number\n processedAt\n }\n\n\n query CustomerOrders(\n $endCursor: String\n $first: Int\n $last: Int\n $startCursor: String\n ) {\n customer {\n ...CustomerOrders\n }\n }\n': {
496
482
  return: CustomerOrdersQuery;
497
483
  variables: CustomerOrdersQueryVariables;
498
484
  };
499
485
  }
500
486
 
501
487
  interface GeneratedMutationTypes {
502
- '#graphql\n mutation customerAddressUpdate(\n $address: CustomerAddressInput!\n $addressId: ID!\n $defaultAddress: Boolean\n $language: LanguageCode\n ) @inContext(language: $language) {\n customerAddressUpdate(\n address: $address\n addressId: $addressId\n defaultAddress: $defaultAddress\n ) {\n customerAddress {\n id\n }\n userErrors {\n code\n field\n message\n }\n }\n }\n': {
488
+ '#graphql\n mutation customerAddressUpdate(\n $address: CustomerAddressInput!\n $addressId: ID!\n $defaultAddress: Boolean\n ) {\n customerAddressUpdate(\n address: $address\n addressId: $addressId\n defaultAddress: $defaultAddress\n ) {\n customerAddress {\n id\n }\n userErrors {\n code\n field\n message\n }\n }\n }\n': {
503
489
  return: CustomerAddressUpdateMutation;
504
490
  variables: CustomerAddressUpdateMutationVariables;
505
491
  };
506
- '#graphql\n mutation customerAddressDelete(\n $addressId: ID!\n $language: LanguageCode\n ) @inContext(language: $language) {\n customerAddressDelete(addressId: $addressId) {\n deletedAddressId\n userErrors {\n code\n field\n message\n }\n }\n }\n': {
492
+ '#graphql\n mutation customerAddressDelete(\n $addressId: ID!,\n ) {\n customerAddressDelete(addressId: $addressId) {\n deletedAddressId\n userErrors {\n code\n field\n message\n }\n }\n }\n': {
507
493
  return: CustomerAddressDeleteMutation;
508
494
  variables: CustomerAddressDeleteMutationVariables;
509
495
  };
510
- '#graphql\n mutation customerAddressCreate(\n $address: CustomerAddressInput!\n $defaultAddress: Boolean\n $language: LanguageCode\n ) @inContext(language: $language) {\n customerAddressCreate(\n address: $address\n defaultAddress: $defaultAddress\n ) {\n customerAddress {\n id\n }\n userErrors {\n code\n field\n message\n }\n }\n }\n': {
496
+ '#graphql\n mutation customerAddressCreate(\n $address: CustomerAddressInput!\n $defaultAddress: Boolean\n ) {\n customerAddressCreate(\n address: $address\n defaultAddress: $defaultAddress\n ) {\n customerAddress {\n id\n }\n userErrors {\n code\n field\n message\n }\n }\n }\n': {
511
497
  return: CustomerAddressCreateMutation;
512
498
  variables: CustomerAddressCreateMutationVariables;
513
499
  };
514
- '#graphql\n mutation customerUpdate(\n $customer: CustomerUpdateInput!\n $language: LanguageCode\n ) @inContext(language: $language) {\n customerUpdate(input: $customer) {\n customer {\n firstName\n lastName\n emailAddress {\n emailAddress\n }\n phoneNumber {\n phoneNumber\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\n': {
500
+ '#graphql\n # https://shopify.dev/docs/api/customer/latest/mutations/customerUpdate\n mutation customerUpdate(\n $customer: CustomerUpdateInput!\n ){\n customerUpdate(input: $customer) {\n customer {\n firstName\n lastName\n emailAddress {\n emailAddress\n }\n phoneNumber {\n phoneNumber\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\n': {
515
501
  return: CustomerUpdateMutation;
516
502
  variables: CustomerUpdateMutationVariables;
517
503
  };
@@ -21,8 +21,8 @@
21
21
  "isbot": "^5.1.22",
22
22
  "react": "^18.2.0",
23
23
  "react-dom": "^18.2.0",
24
- "react-router": "^7.6.0",
25
- "react-router-dom": "^7.6.0"
24
+ "react-router": "7.6.0",
25
+ "react-router-dom": "7.6.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@eslint/compat": "^1.2.5",
@@ -60,4 +60,4 @@
60
60
  "engines": {
61
61
  "node": ">=18.0.0"
62
62
  }
63
- }
63
+ }
@@ -1,20 +1,10 @@
1
1
  {
2
2
  "include": [
3
- "env.d.ts",
4
- "app/**/*.ts",
5
- "app/**/*.tsx",
6
- "app/**/*.d.ts",
7
- "*.ts",
8
- "*.tsx",
9
- "*.d.ts",
3
+ "./**/*.d.ts",
4
+ "./**/*.ts",
5
+ "./**/*.tsx",
10
6
  ".react-router/types/**/*"
11
7
  ],
12
- "exclude": [
13
- "node_modules",
14
- "dist",
15
- "build",
16
- "packages/**/dist/**/*"
17
- ],
18
8
  "compilerOptions": {
19
9
  "lib": [
20
10
  "DOM",
@@ -7,7 +7,7 @@ import { AbortError } from '@shopify/cli-kit/node/error';
7
7
  import { writeFile } from '@shopify/cli-kit/node/fs';
8
8
  import { ensureIsClean, getLatestGitCommit, GitDirectoryNotCleanError } from '@shopify/cli-kit/node/git';
9
9
  import { resolvePath, relativePath } from '@shopify/cli-kit/node/path';
10
- import { renderWarning, renderSelectPrompt, renderConfirmationPrompt, renderInfo, renderSuccess, renderTasks } from '@shopify/cli-kit/node/ui';
10
+ import { renderWarning, renderSelectPrompt, renderConfirmationPrompt, renderSuccess, renderTasks } from '@shopify/cli-kit/node/ui';
11
11
  import { ciPlatform } from '@shopify/cli-kit/node/context/local';
12
12
  import { parseToken, createDeploy } from '@shopify/oxygen-cli/deploy';
13
13
  import { createRequire } from 'node:module';
@@ -109,11 +109,7 @@ class Deploy extends Command {
109
109
  env: "SHOPIFY_HYDROGEN_FLAG_METADATA_VERSION",
110
110
  hidden: true
111
111
  }),
112
- ...commonFlags.diff,
113
- "force-client-sourcemap": Flags.boolean({
114
- description: "Client sourcemapping is avoided by default because it makes backend code visible in the browser. Use this flag to force enabling it.",
115
- env: "SHOPIFY_HYDROGEN_FLAG_FORCE_CLIENT_SOURCEMAP"
116
- })
112
+ ...commonFlags.diff
117
113
  };
118
114
  async run() {
119
115
  const { flags } = await this.parse(Deploy);
@@ -164,7 +160,6 @@ async function runDeploy(options) {
164
160
  envBranch,
165
161
  environmentFile,
166
162
  force: forceOnUncommitedChanges,
167
- forceClientSourcemap = false,
168
163
  noVerify,
169
164
  lockfileCheck,
170
165
  jsonOutput,
@@ -439,13 +434,6 @@ Continue?`.value
439
434
  }
440
435
  };
441
436
  if (buildCommand) {
442
- if (forceClientSourcemap) {
443
- console.log("");
444
- renderInfo({
445
- headline: "The `--force-client-sourcemap` flag is not supported with a custom build command",
446
- body: "Client sourcemaps will not be generated."
447
- });
448
- }
449
437
  config.buildCommand = buildCommand;
450
438
  } else {
451
439
  hooks.buildFunction = async (assetPath) => {
@@ -460,7 +448,6 @@ Continue?`.value
460
448
  assetPath,
461
449
  lockfileCheck,
462
450
  sourcemap: true,
463
- forceClientSourcemap,
464
451
  useCodegen: false,
465
452
  entry: ssrEntry
466
453
  });
@@ -60,7 +60,7 @@ declare class Init extends Command {
60
60
  declare function runInit({ markets, ...options }?: InitOptions & {
61
61
  markets?: InitOptions['i18n'];
62
62
  }): Promise<{
63
- language?: "ts" | "js";
63
+ language?: "js" | "ts";
64
64
  packageManager: "npm" | "pnpm" | "yarn" | "bun" | "unknown";
65
65
  cssStrategy?: CssStrategy;
66
66
  cliCommand: CliCommand;
package/dist/lib/build.js CHANGED
@@ -55,9 +55,6 @@ function getSkeletonSourceDir() {
55
55
  }
56
56
  return joinPath(dirname(monorepoPackagesPath), "templates", "skeleton");
57
57
  }
58
- function getSkeletonNodeModules() {
59
- return joinPath(getSkeletonSourceDir(), "node_modules");
60
- }
61
58
  async function getRepoNodeModules() {
62
59
  const { stdout } = await execAsync("npm root");
63
60
  let nodeModulesPath = stdout.trim();
@@ -67,4 +64,4 @@ async function getRepoNodeModules() {
67
64
  return nodeModulesPath;
68
65
  }
69
66
 
70
- export { ASSETS_DIR_PREFIX, ASSETS_STARTER_DIR, ASSETS_STARTER_DIR_ROUTES, getAssetsDir, getPkgJsonPath, getRepoNodeModules, getSkeletonNodeModules, getSkeletonSourceDir, getStarterDir, getTemplateAppFile, hydrogenPackagesPath, isHydrogenMonorepo };
67
+ export { ASSETS_DIR_PREFIX, ASSETS_STARTER_DIR, ASSETS_STARTER_DIR_ROUTES, getAssetsDir, getPkgJsonPath, getRepoNodeModules, getSkeletonSourceDir, getStarterDir, getTemplateAppFile, hydrogenPackagesPath, isHydrogenMonorepo };
@@ -1,7 +1,7 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import { fileURLToPath } from 'node:url';
3
3
  import { getCodeFormatOptions, formatCode } from './format-code.js';
4
- import { renderWarning } from '@shopify/cli-kit/node/ui';
4
+ import { renderInfo, renderWarning } from '@shopify/cli-kit/node/ui';
5
5
  import { relativePath, resolvePath, joinPath, basename } from '@shopify/cli-kit/node/path';
6
6
  import { AbortError } from '@shopify/cli-kit/node/error';
7
7
  import { importLocal } from './import-utils.js';
@@ -71,7 +71,7 @@ function spawnCodegenProcess({
71
71
  if (/\.body\[\d\]/.test(message)) return;
72
72
  if (/console\.time(End)?\(\)/.test(message)) return;
73
73
  if (/─ (warning|info|success) ───/.test(message)) return;
74
- console.log("");
74
+ renderInfo({ body: "" });
75
75
  renderWarning({ headline: message, body: details });
76
76
  });
77
77
  child.on("close", (code) => {
@@ -97,6 +97,15 @@ async function codegen(options) {
97
97
  }
98
98
  async function executeReactRouterCodegen(options) {
99
99
  const { execSync, exec } = await import('child_process');
100
+ try {
101
+ execSync("npx react-router --version", {
102
+ cwd: options.rootDirectory,
103
+ stdio: "ignore"
104
+ });
105
+ } catch {
106
+ renderInfo({ body: "React Router not found, skipping typegen" });
107
+ return;
108
+ }
100
109
  if (options.watch) {
101
110
  exec("npx react-router typegen --watch", {
102
111
  cwd: options.rootDirectory
@@ -301,4 +310,4 @@ async function addHooksToHydrogenOptions(codegenConfig, { rootDirectory }) {
301
310
  }
302
311
  }
303
312
 
304
- export { codegen, generateDefaultConfig, spawnCodegenProcess };
313
+ export { codegen, executeReactRouterCodegen, generateDefaultConfig, spawnCodegenProcess };
@@ -10,10 +10,7 @@ async function importVite(root) {
10
10
  process.env.SHOPIFY_UNIT_TEST ? void 0 : { paths: [root] }
11
11
  );
12
12
  const vitePackageJson = await findUpAndReadPackageJson(vitePath);
13
- let viteNodeIndexFile = vitePackageJson.content.exports?.["."];
14
- if (typeof viteNodeIndexFile !== "string") {
15
- viteNodeIndexFile = viteNodeIndexFile?.import;
16
- }
13
+ let viteNodeIndexFile = vitePackageJson.content.exports?.["."].import;
17
14
  if (typeof viteNodeIndexFile !== "string") {
18
15
  viteNodeIndexFile = viteNodeIndexFile.default;
19
16
  }
@@ -2,7 +2,7 @@ import { rm, symlink } from 'node:fs/promises';
2
2
  import { vi } from 'vitest';
3
3
  import { writeFile } from '@shopify/cli-kit/node/fs';
4
4
  import { dirname, joinPath } from '@shopify/cli-kit/node/path';
5
- import { getSkeletonSourceDir, getSkeletonNodeModules } from '../build.js';
5
+ import { getSkeletonSourceDir, getRepoNodeModules } from '../build.js';
6
6
 
7
7
  const { renderTasksHook } = vi.hoisted(() => ({ renderTasksHook: vi.fn() }));
8
8
  vi.mock("../template-downloader.js", async () => ({
@@ -43,13 +43,15 @@ vi.mock(
43
43
  renderTasksHook.mockImplementationOnce(async () => {
44
44
  await writeFile(`${directory}/package-lock.json`, "{}");
45
45
  });
46
- const targetNodeModules = joinPath(directory, "node_modules");
47
- await rm(targetNodeModules, {
46
+ await rm(joinPath(directory, "node_modules"), {
48
47
  force: true,
49
48
  recursive: true
50
49
  }).catch(() => {
51
50
  });
52
- await symlink(await getSkeletonNodeModules(), targetNodeModules);
51
+ await symlink(
52
+ await getRepoNodeModules(),
53
+ joinPath(directory, "node_modules")
54
+ );
53
55
  })
54
56
  };
55
57
  }
@@ -45,8 +45,7 @@ ${colors.dim(
45
45
  "**/*.generated.d.ts",
46
46
  "**/package.json",
47
47
  "**/tsconfig.json",
48
- "**/.shopify",
49
- "**/.gitignore"
48
+ "**/.shopify"
50
49
  ]
51
50
  }).on("all", async (eventName, eventFilePath) => {
52
51
  const targetFile = joinPath(
@@ -172,7 +171,7 @@ async function applyTemplateDiff(targetDirectory, diffDirectory, templateDir) {
172
171
  force: true,
173
172
  recursive: true,
174
173
  filter: createFilter(
175
- /(^|\/|\\)(dist|node_modules|\.cache|\.turbo|package\.json|tsconfig\.json|\.gitignore)(\/|\\|$)/i
174
+ /(^|\/|\\)(dist|node_modules|\.cache|.turbo|package\.json|tsconfig\.json)(\/|\\|$)/i
176
175
  )
177
176
  });
178
177
  await mergePackageJson(diffDirectory, targetDirectory, {
@@ -503,13 +503,6 @@
503
503
  "required": false,
504
504
  "allowNo": false,
505
505
  "type": "boolean"
506
- },
507
- "force-client-sourcemap": {
508
- "description": "Client sourcemapping is avoided by default because it makes backend code visible in the browser. Use this flag to force enabling it.",
509
- "env": "SHOPIFY_HYDROGEN_FLAG_FORCE_CLIENT_SOURCEMAP",
510
- "name": "force-client-sourcemap",
511
- "allowNo": false,
512
- "type": "boolean"
513
506
  }
514
507
  },
515
508
  "hasDynamicHelp": false,
@@ -1735,5 +1728,5 @@
1735
1728
  ]
1736
1729
  }
1737
1730
  },
1738
- "version": "11.1.1"
1731
+ "version": "11.1.3"
1739
1732
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public",
5
5
  "@shopify:registry": "https://registry.npmjs.org"
6
6
  },
7
- "version": "11.1.1",
7
+ "version": "11.1.3",
8
8
  "license": "MIT",
9
9
  "type": "module",
10
10
  "repository": {
@@ -37,7 +37,7 @@
37
37
  "vitest": "^1.0.4"
38
38
  },
39
39
  "dependencies": {
40
- "@ast-grep/napi": "0.34.1",
40
+ "@ast-grep/napi": "0.11.0",
41
41
  "@oclif/core": "3.26.5",
42
42
  "@shopify/cli-kit": "^3.80.4",
43
43
  "@shopify/oxygen-cli": "4.6.18",