Skip to content

Commit

Permalink
Remove RSK as a direct dependency in the demo stores (#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
blittle authored Jan 30, 2023
1 parent d4382cc commit bb9ee26
Show file tree
Hide file tree
Showing 55 changed files with 156 additions and 107 deletions.
48 changes: 36 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 14 additions & 4 deletions packages/hydrogen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"types": "dist/production/index.d.ts",
"sideEffects": false,
"scripts": {
"build": "tsup --clean --config ../../tsup.config.ts",
"build": "tsup --clean --config ../../tsup.config.ts && npm run copy-hydrogen-react",
"copy-hydrogen-react": "cp ../../node_modules/@shopify/hydrogen-react/storefront.schema.json dist && cp ../../node_modules/@shopify/hydrogen-react/dist/types/storefront-api-types.d.ts dist",
"dev": "tsup --watch --config ../../tsup.config.ts",
"typecheck": "tsc --noEmit",
"test": "vitest"
Expand Down Expand Up @@ -39,18 +40,27 @@
"import": "./dist/build/index.js",
"default": "./dist/build/index.js"
},
"./storefront-api-types": "./dist/storefront-api-types.d.ts",
"./storefront.schema.json": "./dist/storefront.schema.json",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"storefront-api-types": [
"./dist/storefront-api-types.d.ts"
]
}
},
"files": [
"dist"
],
"peerDependencies": {
"@remix-run/react": "*",
"@remix-run/server-runtime": "1.11.0",
"@shopify/storefront-kit-react": "*"
"@remix-run/server-runtime": "1.11.0"
},
"dependencies": {
"recursive-readdir": "^2.2.3"
"recursive-readdir": "^2.2.3",
"@shopify/storefront-kit-react": "^2023.1.3"
},
"devDependencies": {
"@shopify/storefront-kit-react": "*",
Expand Down
38 changes: 38 additions & 0 deletions packages/hydrogen/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,41 @@ export {storefrontRedirect} from './routing/redirect';
export {graphiqlLoader} from './routing/graphiql';
export {Seo} from './seo/seo';
export type {SeoHandleFunction} from './seo/seo';

export {
AnalyticsEventName,
AnalyticsPageType,
ExternalVideo,
flattenConnection,
getClientBrowserParameters,
getShopifyCookies,
Image,
MediaFile,
ModelViewer,
Money,
parseMetafield,
sendShopifyAnalytics,
ShopifyAppSource,
ShopPayButton,
storefrontApiCustomScalars,
useShopifyCookies,
Video,
} from '@shopify/storefront-kit-react';

export type {
ClientBrowserParameters,
ParsedMetafields,
ShopifyAddToCart,
ShopifyAddToCartPayload,
ShopifyAnalytics,
ShopifyAnalyticsPayload,
ShopifyAnalyticsProduct,
ShopifyCookies,
ShopifyPageView,
ShopifyPageViewPayload,
StorefrontApiResponse,
StorefrontApiResponseError,
StorefrontApiResponseOk,
StorefrontApiResponseOkPartial,
StorefrontApiResponsePartial,
} from '@shopify/storefront-kit-react';
2 changes: 1 addition & 1 deletion rfc/cart.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export async function cartAdd({cartId, lines, storefront}) {
```jsx
import {useFetcher} from '@remix-run/react';
import {flattenConnection} from '@shopify/storefront-kit-react';
import {flattenConnection} from '@shopify/hydrogen-react';

export function ProductCard({product}) {
const firstVariant = flattenConnection(product?.variants)[0];
Expand Down
2 changes: 1 addition & 1 deletion rfc/fetching-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default {
To load data into your Hydrogen app, use a Remix `loader` and write a GraphQL query. Hydrogen provides a special `storefront` param to make queries against your Shopify storefront.

```ts
import type {ProductType} from '@shopify/storefront-kit-react/storefront-api-types';
import type {ProductType} from '@shopify/hydrogen/storefront-api-types';
import {json, useLoaderData, type LoaderArgs} from '@shopify/remix-oxygen';

export async function loader({params, context: {storefront}}: LoaderArgs) {
Expand Down
4 changes: 2 additions & 2 deletions rfc/guide-internationalization.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
import {
CountryCode,
LanguageCode,
} from '@shopify/storefront-kit-react/storefront-api-types';
} from '@shopify/hydrogen/storefront-api-types';

export type Locale = {
language: LanguageCode,
Expand Down Expand Up @@ -634,7 +634,7 @@ export function getLocaleFromRequest(request: Request): Locale {
import {
CountryCode,
LanguageCode,
} from '@shopify/storefront-kit-react/storefront-api-types';
} from '@shopify/hydrogen/storefront-api-types';
import {redirect, type AppLoadContext, type ActionFunction} from '@shopify/remix-oxygen';
import invariant from 'tiny-invariant';
import {updateCartBuyerIdentity} from '~/data';
Expand Down
Loading

0 comments on commit bb9ee26

Please sign in to comment.