Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
Update react-loader and remove Sanity port
  • Loading branch information
thomasKn committed Dec 12, 2023
1 parent cec3209 commit 4de75d7
Show file tree
Hide file tree
Showing 8 changed files with 1,369 additions and 849 deletions.
2,159 changes: 1,345 additions & 814 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion templates/hydrogen-theme/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ PUBLIC_STOREFRONT_API_VERSION="2023-10"
# Sanity
SANITY_STUDIO_PROJECT_ID="r29ig4oy"
SANITY_STUDIO_DATASET="production"
SANITY_STUDIO_PORT="9999" # Sanity studio port (used by Sanity CLI)
SANITY_STUDIO_API_VERSION="2023-10-01" # Sanity API version
SANITY_STUDIO_PREVIEW_URL="https://headless-clone.vercel.app" # URL used by Sanity to preview content from the studio
SANITY_STUDIO_URL="http://localhost:9999" # URL used by the Hydrogen website to fetch live content from Sanity
Expand Down
12 changes: 3 additions & 9 deletions templates/hydrogen-theme/app/components/sanity/VisualEditing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,19 @@ import {enableOverlays} from '@sanity/overlays';
import {cx} from 'class-variance-authority';
import {useEffect, useRef} from 'react';

import {useEnvironmentVariables} from '~/hooks/useEnvironmentVariables';
import {useIsInIframe} from '~/hooks/useIsInIframe';
import {useSanityClient} from '~/hooks/useSanityClient';
import {useLiveMode} from '~/lib/sanity/sanity.loader';

export function VisualEditing() {
const env = useEnvironmentVariables();
const isInIframe = useIsInIframe();
const navigateRemix = useNavigate();
const location = useLocation();
const navigateComposerRef = useRef<HistoryAdapterNavigate>();
const sanityStudioUrl = env?.SANITY_STUDIO_URL!;
const client = useSanityClient();

useEffect(() => {
if (!sanityStudioUrl) return;

const disable = enableOverlays({
allowStudioOrigin: sanityStudioUrl,
history: {
subscribe: (navigate) => {
navigateComposerRef.current = navigate;
Expand All @@ -43,7 +37,7 @@ export function VisualEditing() {
});

return () => disable();
}, [navigateRemix, sanityStudioUrl]);
}, [navigateRemix]);

useEffect(() => {
if (navigateComposerRef.current) {
Expand All @@ -54,8 +48,8 @@ export function VisualEditing() {
}
}, [location.hash, location.pathname, location.search]);

// Enable live queries from the specified studio origin URL
useLiveMode({allowStudioOrigin: sanityStudioUrl, client});
// Enable live queries
useLiveMode({client});

return !isInIframe ? <ExitBanner /> : null;
}
Expand Down
10 changes: 5 additions & 5 deletions templates/hydrogen-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-navigation-menu": "^1.1.4",
"@remix-run/react": "2.3.1",
"@sanity/client": "^6.9.3",
"@sanity/client": "^6.10.0",
"@sanity/image-url": "^1.0.2",
"@sanity/overlays": "^2.1.5",
"@sanity/react-loader": "^1.4.0",
"@sanity/overlays": "^2.2.0",
"@sanity/react-loader": "^1.6.0",
"@shopify/cli": "3.51.2",
"@shopify/cli-hydrogen": "^6.1.0",
"@shopify/hydrogen": "^2023.10.3",
Expand Down Expand Up @@ -55,7 +55,7 @@
"@tailwindcss/typography": "^0.5.10",
"@total-typescript/ts-reset": "^0.5.1",
"@types/eslint": "^8.44.8",
"@types/react": "^18.2.42",
"@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17",
"eslint": "^8.55.0",
"eslint-plugin-hydrogen": "^0.12.3",
Expand All @@ -64,7 +64,7 @@
"postcss": "^8.4.32",
"postcss-import": "^15.1.0",
"postcss-preset-env": "^9.3.0",
"prettier": "^3.1.0",
"prettier": "^3.1.1",
"prettier-plugin-tailwindcss": "0.5.9",
"tailwindcss": "^3.3.6",
"type-fest": "^4.8.3",
Expand Down
11 changes: 6 additions & 5 deletions templates/hydrogen-theme/studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@
"@sanity/code-input": "^4.1.1",
"@sanity/color-input": "^3.1.0",
"@sanity/document-internationalization": "^2.0.2",
"@sanity/icons": "^2.7.0",
"@sanity/icons": "^2.8.0",
"@sanity/language-filter": "^3.2.1",
"@sanity/presentation": "^1.2.0",
"@sanity/ui": "^1.9.3",
"@sanity/util": "^3.21.1",
"@sanity/uuid": "^3.0.2",
"@sanity/vision": "^3.21.1",
"@shopify/polaris": "^12.2.0",
"@shopify/polaris-icons": "^7.10.0",
"@shopify/polaris": "^12.3.0",
"@shopify/polaris-icons": "^7.11.0",
"groq": "^3.21.1",
"lodash": "^4.17.21",
"lodash.get": "^4.4.2",
Expand All @@ -48,11 +49,11 @@
"@sanity/eslint-config-studio": "^3.0.1",
"@types/lodash": "^4.14.202",
"@types/lodash.get": "^4.4.9",
"@types/react": "^18.2.42",
"@types/react": "^18.2.43",
"@types/styled-components": "^5.1.34",
"eslint": "^8.55.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.1.0",
"prettier": "^3.1.1",
"typescript": "^5.3.3"
}
}
3 changes: 1 addition & 2 deletions templates/hydrogen-theme/studio/project.details.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
export const projectDetails = {
projectId: process.env.SANITY_STUDIO_PROJECT_ID!,
dataset: process.env.SANITY_STUDIO_DATASET || 'production',
port: process.env.SANITY_STUDIO_PORT || 9999,
apiVersion: process.env.SANITY_STUDIO_API_VERSION || '2023-10-01',
previewUrl: process.env.SANITY_STUDIO_PREVIEW_URL,
previewSecret: process.env.SANITY_STUDIO_PREVIEW_SECRET,
shopifyShopHandle: process.env.SANITY_STUDIO_SHOPIFY_SHOP_HANDLE,
}
};
20 changes: 8 additions & 12 deletions templates/hydrogen-theme/studio/sanity.cli.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
import {defineCliConfig, getStudioEnvironmentVariables} from 'sanity/cli'
import {defineCliConfig, getStudioEnvironmentVariables} from 'sanity/cli';

const envDir = '../'
const envDir = '../';
// Load environment variables from the root of the project so Sanity CLI can use them
getStudioEnvironmentVariables({
envFile: {
mode: 'development',
envDir,
},
})
});

const projectId = process.env.SANITY_STUDIO_PROJECT_ID!
const dataset = process.env.SANITY_STUDIO_DATASET!
const port = parseInt(process.env.SANITY_STUDIO_PORT!)
const projectId = process.env.SANITY_STUDIO_PROJECT_ID!;
const dataset = process.env.SANITY_STUDIO_DATASET!;

export default defineCliConfig({
api: {
projectId,
dataset,
},
server: {
port,
},
vite: (config) => {
// Tell vite to load environment variables from the root of the project so they're available in the browser
// Only variables prefixed with SANITY_STUDIO_ will be available
config.envDir = envDir
config.envDir = envDir;

return config
return config;
},
})
});
2 changes: 1 addition & 1 deletion templates/hydrogen-theme/studio/sanity.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {fontPicker} from '@headless.build/sanity-font-picker';
import {colorPicker} from '@headless.build/sanity-color-picker';
import {rangeSlider} from '@headless.build/sanity-plugin-range-slider';
import {codeInput} from '@sanity/code-input';
import {presentationTool} from 'sanity/presentation';
import {presentationTool} from '@sanity/presentation';
import {languageFilter} from '@sanity/language-filter';

import {schemaTypes} from './schemas';
Expand Down

0 comments on commit 4de75d7

Please sign in to comment.