Fix merge

This commit is contained in:
Tobias Lins 2023-05-10 10:29:53 +02:00
commit 7f7f153c4c
6 changed files with 488 additions and 398 deletions

View File

@ -17,6 +17,10 @@ A Next.js 13 and App Router-ready ecommerce template, built with Shopify, featur
- Checkout and payments with Shopify
- Automatic light/dark mode based on system settings
## Alternate Providers
- [Saleor](https://github.com/saleor/nextjs-commerce) ([Demo](https://saleor-commerce.vercel.app/))
## Running locally
You will need to use the environment variables [defined in `.env.example`](.env.example) to run Next.js Commerce. It's recommended you use [Vercel Environment Variables](https://vercel.com/docs/concepts/projects/environment-variables) for this, but a `.env` file is all that is necessary.
@ -36,6 +40,8 @@ Your app should now be running on [localhost:3000](http://localhost:3000/).
## How to configure your Shopify store for Next.js Commerce
Next.js Commerce requires a [paid Shopify plan](https://www.shopify.com/pricing). It will not work with a Shopify Starter plan.
### Add Shopify domain to an environment variable
Create a `SHOPIFY_STORE_DOMAIN` environment variable and use your Shopify domain as the the value (ie. `SHOPIFY_STORE_SUBDOMAIN.myshopify.com`).

View File

@ -6,28 +6,35 @@ const baseUrl = process.env.NEXT_PUBLIC_VERCEL_URL
: 'http://localhost:3000';
export default async function sitemap(): Promise<Promise<Promise<MetadataRoute.Sitemap>>> {
const routesMap = ['', '/search'].map((route) => ({
const routesMap = [''].map((route) => ({
url: `${baseUrl}${route}`,
lastModified: new Date().toISOString()
}));
const collections = await getCollections();
const collectionsMap = collections.map((collection) => ({
url: `${baseUrl}${collection.path}`,
lastModified: collection.updatedAt
}));
const collectionsPromise = getCollections().then((collections) =>
collections.map((collection) => ({
url: `${baseUrl}${collection.path}`,
lastModified: collection.updatedAt
}))
);
const products = await getProducts({});
const productsMap = products.map((product) => ({
url: `${baseUrl}/product/${product.handle}`,
lastModified: product.updatedAt
}));
const productsPromise = getProducts({}).then((products) =>
products.map((product) => ({
url: `${baseUrl}/product/${product.handle}`,
lastModified: product.updatedAt
}))
);
const pages = await getPages();
const pagesMap = pages.map((page) => ({
url: `${baseUrl}/${page.handle}`,
lastModified: page.updatedAt
}));
const pagesPromise = getPages().then((pages) =>
pages.map((page) => ({
url: `${baseUrl}/${page.handle}`,
lastModified: page.updatedAt
}))
);
return [...routesMap, ...collectionsMap, ...productsMap, ...pagesMap];
const fetchedRoutes = (
await Promise.all([collectionsPromise, productsPromise, pagesPromise])
).flat();
return [...routesMap, ...fetchedRoutes];
}

View File

@ -1,4 +1,6 @@
export const createUrl = (pathname: string, params: URLSearchParams) => {
import { ReadonlyURLSearchParams } from 'next/navigation';
export const createUrl = (pathname: string, params: URLSearchParams | ReadonlyURLSearchParams) => {
const paramsString = params.toString();
const queryString = `${paramsString.length ? '?' : ''}${paramsString}`;

View File

@ -4,9 +4,6 @@ module.exports = {
// Disabling on production builds because we're running checks on PRs via GitHub Actions.
ignoreDuringBuilds: true
},
experimental: {
appDir: true
},
images: {
formats: ['image/avif', 'image/webp'],
remotePatterns: [

View File

@ -22,34 +22,34 @@
"*": "prettier --write --ignore-unknown"
},
"dependencies": {
"@headlessui/react": "^1.7.10",
"@headlessui/react": "^1.7.14",
"@vercel/analytics": "^1.0.0",
"@vercel/og": "^0.1.0",
"@vercel/og": "^0.5.4",
"clsx": "^1.2.1",
"framer-motion": "^8.4.0",
"framer-motion": "^10.12.8",
"is-empty-iterable": "^3.0.0",
"next": "13.3.1",
"next": "13.4.1",
"react": "18.2.0",
"react-cookie": "^4.1.1",
"react-dom": "18.2.0"
},
"devDependencies": {
"@playwright/test": "^1.31.2",
"@playwright/test": "^1.33.0",
"@tailwindcss/typography": "^0.5.9",
"@types/node": "18.13.0",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"@types/node": "20.1.0",
"@types/react": "18.2.6",
"@types/react-dom": "18.2.4",
"@vercel/git-hooks": "^1.0.0",
"autoprefixer": "^10.4.13",
"eslint": "^8.35.0",
"eslint-config-next": "^13.3.1",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-unicorn": "^45.0.2",
"lint-staged": "^13.1.1",
"postcss": "^8.4.21",
"prettier": "^2.8.4",
"prettier-plugin-tailwindcss": "^0.2.2",
"tailwindcss": "^3.2.6",
"typescript": "4.9.5"
"autoprefixer": "^10.4.14",
"eslint": "^8.40.0",
"eslint-config-next": "^13.4.1",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-unicorn": "^47.0.0",
"lint-staged": "^13.2.2",
"postcss": "^8.4.23",
"prettier": "^2.8.8",
"prettier-plugin-tailwindcss": "^0.2.8",
"tailwindcss": "^3.3.2",
"typescript": "5.0.4"
}
}

794
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff