4
0
forked from crowetic/commerce

Merge branch 'master' of github.com:vercel/commerce

This commit is contained in:
Belen Curcio 2021-01-09 12:51:17 -03:00
commit 4989c720e1
5 changed files with 25 additions and 32 deletions

View File

@ -9,7 +9,7 @@ Demo live at: [demo.vercel.store](https://demo.vercel.store/)
This project is currently <b>under development</b>. This project is currently <b>under development</b>.
## Goals and Features ## Features
- Performant by default - Performant by default
- SEO Ready - SEO Ready
@ -22,14 +22,24 @@ This project is currently <b>under development</b>.
- Dark Mode Support - Dark Mode Support
## Work in progress ## Work in progress
We're using Github Projects to keep track of issues in progress and todo's. Here is our [Board](https://github.com/vercel/commerce/projects/1) We're using Github Projects to keep track of issues in progress and todo's. Here is our [Board](https://github.com/vercel/commerce/projects/1)
## Integrations ## Integrations
Next.js Commerce integrates out-of-the-box with BigCommerce. We plan to support all major ecommerce backends. Next.js Commerce integrates out-of-the-box with BigCommerce. We plan to support all major ecommerce backends.
If you wish to work on a new cms/headless ecommerce provider, please check this repo https://github.com/vercel/commerce-framework and open a PR with your functions and utilities under the standard mentioned in the README.
## Goals
* **Next.js Commerce** should have a completely data **agnostic** UI
* **Aware of schema**: should ship with the right data schemas and types.
* All providers should return the right data types and schemas to blend correctly with Next.js Commerce.
* `@framework` will be the alias utilized in commerce and it will map to the ecommerce provider of preference- e.g BigCommerce, Shopify, Swell. All providers should expose the same standardized functions. _Note that the same applies for recipes using a CMS + an ecommerce provider._
There is a `framework` folder in the root folder that will contain multiple ecommerce providers.
Additionally, we need to ensure feature parity (not all providers have e.g. wishlist) we will also have to build a feature API to disable/enable features in the UI.
People actively working on this project: @okbel & @lfades.
## Troubleshoot ## Troubleshoot
@ -80,20 +90,9 @@ Our commitment to Open Source can be found [here](https://vercel.com/oss).
6. Add proper store values to `.env.local`. 6. Add proper store values to `.env.local`.
7. Run `yarn dev` to build and watch for code changes 7. Run `yarn dev` to build and watch for code changes
8. The development branch is `development` (this is the branch pull requests should be made against). 8. The development branch is `development` (this is the branch pull requests should be made against).
On a release, the relevant parts of the changes in the `staging` branch are rebased into `master`. On a release, `develop` branch is rebased into `master`.
## Goals
* **Next.js Commerce** should have a completely data **agnostic** UI
* **Aware of schema**: should ship with the right data schemas and types.
* All providers should return the right data types and schemas to blend correctly with Next.js Commerce.
* `@framework` will be the alias utilized in commerce and it will map to the ecommerce provider of preference- e.g BigCommerce, Shopify, Swell. All providers should expose the same standardized functions. _Note that the same applies for recipes using a CMS + an ecommerce provider._
There is a `framework` folder in the root folder that will contain multiple ecommerce providers.
Additionally, we need to ensure feature parity (not all providers have e.g. wishlist) we will also have to build a feature API to disable/enable features in the UI.
People actively working on this project: @okbel & @lfades.

View File

@ -1,6 +1,6 @@
// Fallback to CMS Data // Fallback to CMS Data
export const defatultPageProps = { export const defaultPageProps = {
header: { header: {
links: [ links: [
{ {

View File

@ -3,14 +3,14 @@ import type {
GetStaticPropsContext, GetStaticPropsContext,
InferGetStaticPropsType, InferGetStaticPropsType,
} from 'next' } from 'next'
import { Text } from '@components/ui'
import { Layout } from '@components/common'
import getSlug from '@lib/get-slug' import getSlug from '@lib/get-slug'
import { missingLocaleInPages } from '@lib/usage-warns' import { missingLocaleInPages } from '@lib/usage-warns'
import { Layout } from '@components/common'
import { Text } from '@components/ui'
import { getConfig } from '@framework/api' import { getConfig } from '@framework/api'
import getPage from '@framework/api/operations/get-page' import getPage from '@framework/api/operations/get-page'
import getAllPages from '@framework/api/operations/get-all-pages' import getAllPages from '@framework/api/operations/get-all-pages'
import { defatultPageProps } from '@lib/defaults' import { defaultPageProps } from '@lib/defaults'
export async function getStaticProps({ export async function getStaticProps({
preview, preview,
@ -34,7 +34,7 @@ export async function getStaticProps({
} }
return { return {
props: { ...defatultPageProps, pages, page }, props: { ...defaultPageProps, pages, page },
revalidate: 60 * 60, // Every hour revalidate: 60 * 60, // Every hour
} }
} }

View File

@ -1,10 +1,4 @@
import Document, { import Document, { Head, Html, Main, NextScript } from 'next/document'
DocumentContext,
Head,
Html,
Main,
NextScript,
} from 'next/document'
class MyDocument extends Document { class MyDocument extends Document {
render() { render() {

View File

@ -6,7 +6,7 @@ import { Layout } from '@components/common'
import { Heart } from '@components/icons' import { Heart } from '@components/icons'
import { Text, Container } from '@components/ui' import { Text, Container } from '@components/ui'
import { WishlistCard } from '@components/wishlist' import { WishlistCard } from '@components/wishlist'
import { defatultPageProps } from '@lib/defaults' import { defaultPageProps } from '@lib/defaults'
export async function getStaticProps({ export async function getStaticProps({
preview, preview,
@ -15,7 +15,7 @@ export async function getStaticProps({
const config = getConfig({ locale }) const config = getConfig({ locale })
const { pages } = await getAllPages({ config, preview }) const { pages } = await getAllPages({ config, preview })
return { return {
props: { ...defatultPageProps, pages }, props: { ...defaultPageProps, pages },
} }
} }