Monorepo with Turborepo (#651)

* Moved everything

* Figuring out how to make imports work

* Updated exports

* Added missing exports

* Added @vercel/commerce-local to `site`

* Updated commerce config

* Updated exports and commerce config

* Updated commerce hoc

* Fixed exports in local

* Added publish config

* Updated imports in site

* It's actually working

* Don't use debugger in dev for better speeds

* Improved DX when editing packages

* Set up eslint with husky

* Updated prettier config

* Added prettier setup to every package

* Moved bigcommerce

* Moved Bigcommerce to src and package updates

* Updated setup of bigcommerce

* Moved definitions script

* Moved commercejs

* Move to src

* Fixed types in commercejs

* Moved kibocommerce

* Moved kibocommerce to src

* Added package/tsconfig to kibocommerce

* Fixed imports and other things

* Moved ordercloud

* Moved ordercloud to src

* Fixed imports

* Added missing prettier files

* Moved Saleor

* Moved Saleor to src

* Fixed imports

* Replaced all imports to @commerce

* Added prettierignore/rc to all providers

* Moved shopify to src

* Build shopify in packages

* Moved Spree

* Moved spree to src

* Updated spree

* Moved swell

* Moved swell to src

* Fixed type imports in swell

* Moved Vendure to packages

* Moved vendure to src

* Fixed imports in vendure

* Added codegen to saleor

* Updated codegen setup for shopify

* Added codegen to vendure

* Added codegen to kibocommerce

* Added all packages to site's deps

* Updated codegen setup in bigcommerce

* Minor fixes

* Updated providers' names in site

* Updated packages based on Bel's changes

* Updated turbo to latest

* Fixed ts complains

* Set npm engine in root

* New lockfile install

* remove engines

* Regen lockfile

* Switched from npm to yarn

* Updated typesVersions in all packages

* Moved dep

* Updated SWR to the just released 1.2.0

* Removed "isolatedModules" from packages

* Updated list of providers and default

* Updated swell declaration

* Removed next import from kibocommerce

* Added COMMERCE_PROVIDER log

* Added another log

* Updated turbo config

* Updated docs

* Removed test logs

Co-authored-by: Jared Palmer <jared@jaredpalmer.com>
This commit is contained in:
Luis Alvarez D 2022-02-01 14:14:05 -05:00 committed by GitHub
parent d0ef346189
commit 0afe686fe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1326 changed files with 9109 additions and 19494 deletions

14
.gitignore vendored
View File

@ -2,18 +2,19 @@
# dependencies
node_modules
/.pnp
.pnp
.pnp.js
# testing
/coverage
coverage
# next.js
.next/
out/
.next
out
# production
/build
build
dist
# misc
.DS_Store
@ -34,3 +35,6 @@ yarn-error.log*
# vercel
.vercel
# Turborepo
.turbo

View File

@ -1,3 +1,4 @@
# Every package defines its prettier config
node_modules
.next
public
packages
site

View File

@ -2,13 +2,5 @@
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"useTabs": false,
"overrides": [
{
"files": ["framework/saleor/**/*"],
"options": {
"printWidth": 120
}
}
]
"useTabs": false
}

View File

@ -1,3 +1,8 @@
{
"recommendations": ["esbenp.prettier-vscode", "csstools.postcss", "bradlc.vscode-tailwindcss"]
"recommendations": [
"esbenp.prettier-vscode",
"csstools.postcss",
"bradlc.vscode-tailwindcss",
"ms-vscode.vscode-typescript-next"
]
}

View File

@ -35,11 +35,10 @@ Next.js Commerce integrates out-of-the-box with BigCommerce, Shopify, Swell, Sal
## Considerations
- `framework/commerce` contains all types, helpers and functions to be used as base to build a new **provider**.
- **Providers** live under `framework`'s root folder and they will extend Next.js Commerce types and functionality (`framework/commerce`).
- `packages/commerce` contains all types, helpers and functions to be used as base to build a new **provider**.
- **Providers** live under `packages`'s root folder and they will extend Next.js Commerce types and functionality (`packages/commerce`).
- We have a **Features API** to ensure feature parity between the UI and the Provider. The UI should update accordingly and no extra code should be bundled. All extra configuration for features will live under `features` in `commerce.config.json` and if needed it can also be accessed programatically.
- Each **provider** should add its corresponding `next.config.js` and `commerce.config.json` adding specific data related to the provider. For example in case of BigCommerce, the images CDN and additional API routes.
- **Providers don't depend on anything that's specific to the application they're used in**. They only depend on `framework/commerce`, on their own framework folder and on some dependencies included in `package.json`
## Configuration
@ -55,18 +54,9 @@ NEXT_PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxx
NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN=xxxxxxx.myshopify.com
```
And check that the `tsconfig.json` resolves to the chosen provider:
```
"@framework": ["framework/shopify"],
"@framework/*": ["framework/shopify/*"]
```
That's it!
### Features
Every provider defines the features that it supports under `framework/{provider}/commerce.config.json`
Every provider defines the features that it supports under `packages/{provider}/src/commerce.config.json`
#### Features Available
@ -98,9 +88,7 @@ For example: Turning `cart` off will disable Cart capabilities.
### How to create a new provider
🔔 New providers are on hold [until we have a new API for commerce](https://github.com/vercel/commerce/pull/252) 🔔
Follow our docs for [Adding a new Commerce Provider](framework/commerce/new-provider.md).
Follow our docs for [Adding a new Commerce Provider](packages/commerce/new-provider.md).
If you succeeded building a provider, submit a PR with a valid demo and we'll review it asap.
@ -119,7 +107,7 @@ Our commitment to Open Source can be found [here](https://vercel.com/oss).
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)
People actively working on this project: @okbel & @lfades.
People actively working on this project: @okbel, @lfades, @dominiksipowicz, @gbibeaul.
## Troubleshoot

View File

@ -1,2 +0,0 @@
export * from '@commerce/product/use-price'
export { default } from '@commerce/product/use-price'

View File

@ -1 +0,0 @@
export * from '@commerce/types/checkout'

View File

@ -1 +0,0 @@
export * from '@commerce/types/common'

View File

@ -1,5 +0,0 @@
import * as Core from '@commerce/types/customer'
export * from '@commerce/types/customer'
export type CustomerSchema = Core.CustomerSchema

View File

@ -1,8 +0,0 @@
import * as Core from '@commerce/types/login'
import type { LoginMutationVariables } from '../schema'
export * from '@commerce/types/login'
export type LoginOperation = Core.LoginOperation & {
variables: LoginMutationVariables
}

View File

@ -1 +0,0 @@
export * from '@commerce/types/logout'

View File

@ -1 +0,0 @@
export * from '@commerce/types/product'

View File

@ -1 +0,0 @@
export * from '@commerce/types/signup'

View File

@ -1,92 +0,0 @@
/**
* This file is expected to be used in next.config.js only
*/
const path = require('path')
const fs = require('fs')
const merge = require('deepmerge')
const prettier = require('prettier')
const PROVIDERS = [
'local',
'bigcommerce',
'saleor',
'shopify',
'swell',
'vendure',
'ordercloud',
'kibocommerce',
'spree',
'commercejs',
]
function getProviderName() {
return (
process.env.COMMERCE_PROVIDER ||
(process.env.BIGCOMMERCE_STOREFRONT_API_URL
? 'bigcommerce'
: process.env.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN
? 'shopify'
: process.env.NEXT_PUBLIC_SWELL_STORE_ID
? 'swell'
: 'local')
)
}
function withCommerceConfig(nextConfig = {}) {
const commerce = nextConfig.commerce || {}
const name = commerce.provider || getProviderName()
if (!name) {
throw new Error(
`The commerce provider is missing, please add a valid provider name or its environment variables`
)
}
if (!PROVIDERS.includes(name)) {
throw new Error(
`The commerce provider "${name}" can't be found, please use one of "${PROVIDERS.join(
', '
)}"`
)
}
const commerceNextConfig = require(path.join('../', name, 'next.config'))
const config = merge(nextConfig, commerceNextConfig)
config.env = config.env || {}
Object.entries(config.commerce.features).forEach(([k, v]) => {
if (v) config.env[`COMMERCE_${k.toUpperCase()}_ENABLED`] = true
})
// Update paths in `tsconfig.json` to point to the selected provider
if (config.commerce.updateTSConfig !== false) {
const tsconfigPath = path.join(process.cwd(), 'tsconfig.json')
const tsconfig = require(tsconfigPath)
tsconfig.compilerOptions.paths['@framework'] = [`framework/${name}`]
tsconfig.compilerOptions.paths['@framework/*'] = [`framework/${name}/*`]
// When running for production it may be useful to exclude the other providers
// from TS checking
if (process.env.VERCEL) {
const exclude = tsconfig.exclude.filter(
(item) => !item.startsWith('framework/')
)
tsconfig.exclude = PROVIDERS.reduce((exclude, current) => {
if (current !== name) exclude.push(`framework/${current}`)
return exclude
}, exclude)
}
fs.writeFileSync(
tsconfigPath,
prettier.format(JSON.stringify(tsconfig), { parser: 'json' })
)
}
return config
}
module.exports = { withCommerceConfig, getProviderName }

View File

@ -1,2 +0,0 @@
export * from '@commerce/product/use-price'
export { default } from '@commerce/product/use-price'

View File

@ -1 +0,0 @@
export * from '@commerce/types/common'

View File

@ -1 +0,0 @@
export * from '@commerce/types/customer'

View File

@ -1 +0,0 @@
export * from '@commerce/types/logout'

View File

@ -1 +0,0 @@
export * from '@commerce/types/page'

View File

@ -1 +0,0 @@
export * from '@commerce/types/signup'

View File

@ -1 +0,0 @@
export * from '@commerce/types/wishlist'

View File

@ -1,14 +0,0 @@
import { SWRHook } from '@commerce/utils/types'
import useCheckout, { UseCheckout } from '@commerce/checkout/use-checkout'
export default useCheckout as UseCheckout<typeof handler>
export const handler: SWRHook<any> = {
fetchOptions: {
query: '',
},
async fetcher({ input, options, fetch }) {},
useHook:
({ useData }) =>
async (input) => ({}),
}

View File

@ -1,15 +0,0 @@
import useAddItem, { UseAddItem } from '@commerce/customer/address/use-add-item'
import { MutationHook } from '@commerce/utils/types'
export default useAddItem as UseAddItem<typeof handler>
export const handler: MutationHook<any> = {
fetchOptions: {
query: '',
},
async fetcher({ input, options, fetch }) {},
useHook:
({ fetch }) =>
() =>
async () => ({}),
}

View File

@ -1,15 +0,0 @@
import useAddItem, { UseAddItem } from '@commerce/customer/card/use-add-item'
import { MutationHook } from '@commerce/utils/types'
export default useAddItem as UseAddItem<typeof handler>
export const handler: MutationHook<any> = {
fetchOptions: {
query: '',
},
async fetcher({ input, options, fetch }) {},
useHook:
({ fetch }) =>
() =>
async () => ({}),
}

View File

@ -1,2 +0,0 @@
export * from '@commerce/product/use-price'
export { default } from '@commerce/product/use-price'

View File

@ -1,8 +0,0 @@
import * as Core from '@commerce/types/login'
import type { CustomerUserAuthInfoInput } from '../schema'
export * from '@commerce/types/login'
export type LoginOperation = Core.LoginOperation & {
variables: CustomerUserAuthInfoInput
}

View File

@ -1 +0,0 @@
export * from '@commerce/types/logout'

View File

@ -1 +0,0 @@
export * from '@commerce/types/signup'

View File

@ -1,2 +0,0 @@
export * from '@commerce/product/use-price'
export { default } from '@commerce/product/use-price'

View File

@ -1,2 +0,0 @@
export * from '@commerce/product/use-price'
export { default } from '@commerce/product/use-price'

View File

@ -1,15 +0,0 @@
import useAddItem, { UseAddItem } from '@commerce/customer/address/use-add-item'
import { MutationHook } from '@commerce/utils/types'
export default useAddItem as UseAddItem<typeof handler>
export const handler: MutationHook<any> = {
fetchOptions: {
query: '',
},
async fetcher({ input, options, fetch }) {},
useHook:
({ fetch }) =>
() =>
async () => ({}),
}

View File

@ -1,15 +0,0 @@
import useAddItem, { UseAddItem } from '@commerce/customer/card/use-add-item'
import { MutationHook } from '@commerce/utils/types'
export default useAddItem as UseAddItem<typeof handler>
export const handler: MutationHook<any> = {
fetchOptions: {
query: '',
},
async fetcher({ input, options, fetch }) {},
useHook:
({ fetch }) =>
() =>
async () => ({}),
}

View File

@ -1,2 +0,0 @@
export * from '@commerce/product/use-price'
export { default } from '@commerce/product/use-price'

View File

@ -1,15 +0,0 @@
import useAddItem, { UseAddItem } from '@commerce/customer/address/use-add-item'
import { MutationHook } from '@commerce/utils/types'
export default useAddItem as UseAddItem<typeof handler>
export const handler: MutationHook<any> = {
fetchOptions: {
query: '',
},
async fetcher({ input, options, fetch }) {},
useHook:
({ fetch }) =>
() =>
async () => ({}),
}

View File

@ -1,15 +0,0 @@
import useAddItem, { UseAddItem } from '@commerce/customer/card/use-add-item'
import { MutationHook } from '@commerce/utils/types'
export default useAddItem as UseAddItem<typeof handler>
export const handler: MutationHook<any> = {
fetchOptions: {
query: '',
},
async fetcher({ input, options, fetch }) {},
useHook:
({ fetch }) =>
() =>
async () => ({}),
}

View File

@ -1,2 +0,0 @@
export * from '@commerce/product/use-price'
export { default } from '@commerce/product/use-price'

View File

@ -1 +0,0 @@
export * from '@commerce/types/checkout'

View File

@ -1 +0,0 @@
export * from '@commerce/types/common'

View File

@ -1,5 +0,0 @@
import * as Core from '@commerce/types/customer'
export * from '@commerce/types/customer'
export type CustomerSchema = Core.CustomerSchema

View File

@ -1,8 +0,0 @@
import * as Core from '@commerce/types/login'
import type { CustomerAccessTokenCreateInput } from '../schema'
export * from '@commerce/types/login'
export type LoginOperation = Core.LoginOperation & {
variables: CustomerAccessTokenCreateInput
}

View File

@ -1 +0,0 @@
export * from '@commerce/types/logout'

View File

@ -1 +0,0 @@
export * from '@commerce/types/product'

View File

@ -1 +0,0 @@
export * from '@commerce/types/signup'

View File

@ -1 +0,0 @@
export * from '@commerce/types/site'

View File

@ -1 +0,0 @@
export * from '@commerce/types/wishlist'

View File

@ -1,2 +0,0 @@
export * from '@commerce/product/use-price'
export { default } from '@commerce/product/use-price'

View File

@ -1,14 +0,0 @@
import { SWRHook } from '@commerce/utils/types'
import useCheckout, { UseCheckout } from '@commerce/checkout/use-checkout'
export default useCheckout as UseCheckout<typeof handler>
export const handler: SWRHook<any> = {
fetchOptions: {
query: '',
},
async fetcher({ input, options, fetch }) {},
useHook:
({ useData }) =>
async (input) => ({}),
}

View File

@ -1,15 +0,0 @@
import useAddItem, { UseAddItem } from '@commerce/customer/address/use-add-item'
import { MutationHook } from '@commerce/utils/types'
export default useAddItem as UseAddItem<typeof handler>
export const handler: MutationHook<any> = {
fetchOptions: {
query: '',
},
async fetcher({ input, options, fetch }) {},
useHook:
({ fetch }) =>
() =>
async () => ({}),
}

View File

@ -1,15 +0,0 @@
import useAddItem, { UseAddItem } from '@commerce/customer/card/use-add-item'
import { MutationHook } from '@commerce/utils/types'
export default useAddItem as UseAddItem<typeof handler>
export const handler: MutationHook<any> = {
fetchOptions: {
query: '',
},
async fetcher({ input, options, fetch }) {},
useHook:
({ fetch }) =>
() =>
async () => ({}),
}

View File

@ -1,2 +0,0 @@
export * from '@commerce/product/use-price'
export { default } from '@commerce/product/use-price'

View File

@ -1 +0,0 @@
export * from '@commerce/types/cart'

View File

@ -1 +0,0 @@
export * from '@commerce/types/checkout'

View File

@ -1 +0,0 @@
export * from '@commerce/types/common'

View File

@ -1 +0,0 @@
export * from '@commerce/types/customer'

View File

@ -1,11 +0,0 @@
import * as Core from '@commerce/types/login'
import { LoginBody, LoginTypes } from '@commerce/types/login'
export * from '@commerce/types/login'
export type LoginHook<T extends LoginTypes = LoginTypes> = {
data: null
actionInput: LoginBody
fetcherInput: LoginBody
body: T['body']
}

View File

@ -1 +0,0 @@
export * from '@commerce/types/logout'

View File

@ -1 +0,0 @@
export * from '@commerce/types/page'

View File

@ -1 +0,0 @@
export * from '@commerce/types/product'

View File

@ -1 +0,0 @@
export * from '@commerce/types/signup'

View File

@ -1 +0,0 @@
export * from '@commerce/types/site'

View File

@ -1 +0,0 @@
export * from '@commerce/types/wishlist'

View File

@ -1,14 +0,0 @@
import { SWRHook } from '@commerce/utils/types'
import useCheckout, { UseCheckout } from '@commerce/checkout/use-checkout'
export default useCheckout as UseCheckout<typeof handler>
export const handler: SWRHook<any> = {
fetchOptions: {
query: '',
},
async fetcher({ input, options, fetch }) {},
useHook:
({ useData }) =>
async (input) => ({}),
}

View File

@ -1,15 +0,0 @@
import useAddItem, { UseAddItem } from '@commerce/customer/address/use-add-item'
import { MutationHook } from '@commerce/utils/types'
export default useAddItem as UseAddItem<typeof handler>
export const handler: MutationHook<any> = {
fetchOptions: {
query: '',
},
async fetcher({ input, options, fetch }) {},
useHook:
({ fetch }) =>
() =>
async () => ({}),
}

View File

@ -1,15 +0,0 @@
import useAddItem, { UseAddItem } from '@commerce/customer/card/use-add-item'
import { MutationHook } from '@commerce/utils/types'
export default useAddItem as UseAddItem<typeof handler>
export const handler: MutationHook<any> = {
fetchOptions: {
query: '',
},
async fetcher({ input, options, fetch }) {},
useHook:
({ fetch }) =>
() =>
async () => ({}),
}

View File

@ -1,2 +0,0 @@
export * from '@commerce/product/use-price'
export { default } from '@commerce/product/use-price'

View File

@ -1 +0,0 @@
export * from '@commerce/types/cart'

View File

@ -1 +0,0 @@
export * from '@commerce/types/checkout'

View File

@ -1 +0,0 @@
export * from '@commerce/types/common'

View File

@ -1 +0,0 @@
export * from '@commerce/types/customer'

View File

@ -1,12 +0,0 @@
import * as Core from '@commerce/types/login'
import type { LoginMutationVariables } from '../schema'
import { LoginBody, LoginTypes } from '@commerce/types/login'
export * from '@commerce/types/login'
export type LoginHook<T extends LoginTypes = LoginTypes> = {
data: null
actionInput: LoginBody
fetcherInput: LoginBody
body: T['body']
}

View File

@ -1 +0,0 @@
export * from '@commerce/types/logout'

View File

@ -1 +0,0 @@
export * from '@commerce/types/page'

View File

@ -1 +0,0 @@
export * from '@commerce/types/product'

View File

@ -1 +0,0 @@
export * from '@commerce/types/signup'

View File

@ -1 +0,0 @@
export * from '@commerce/types/site'

View File

@ -1 +0,0 @@
export * from '@commerce/types/wishlist'

17895
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,127 +1,62 @@
{
"name": "nextjs-commerce",
"version": "1.0.0",
"scripts": {
"dev": "NODE_OPTIONS='--inspect' next dev",
"build": "next build",
"start": "next start",
"analyze": "BUNDLE_ANALYZE=both next build",
"lint": "next lint",
"prettier-fix": "prettier --write .",
"find:unused": "npx next-unused",
"generate": "graphql-codegen",
"generate:shopify": "DOTENV_CONFIG_PATH=./.env.local graphql-codegen -r dotenv/config --config framework/shopify/codegen.json",
"generate:vendure": "graphql-codegen --config framework/vendure/codegen.json",
"generate:definitions": "node framework/bigcommerce/scripts/generate-definitions.js",
"generate:kibocommerce": "graphql-codegen --config framework/kibocommerce/codegen.json"
},
"sideEffects": false,
"name": "commerce",
"license": "MIT",
"engines": {
"node": ">=14.x"
"private": true,
"workspaces": [
"site",
"packages/*"
],
"scripts": {
"prettier-fix": "prettier --write ."
},
"dependencies": {
"@chec/commerce.js": "^2.8.0",
"@react-spring/web": "^9.4.1",
"@spree/storefront-api-v2-sdk": "^5.1.1",
"@vercel/fetch": "^6.1.1",
"autoprefixer": "^10.4.2",
"body-scroll-lock": "^4.0.0-beta.0",
"classnames": "^2.3.1",
"cookie": "^0.4.1",
"email-validator": "^2.0.4",
"immutability-helper": "^3.1.1",
"js-cookie": "^3.0.1",
"keen-slider": "^6.6.3",
"lodash.debounce": "^4.0.8",
"lodash.random": "^3.2.0",
"lodash.throttle": "^4.1.1",
"next": "^12.0.8",
"next-seo": "^4.28.1",
"next-themes": "^0.0.15",
"postcss": "^8.4.5",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-fast-marquee": "^1.3.1",
"react-merge-refs": "^1.1.0",
"react-use-measure": "^2.1.1",
"stripe": "^8.196.0",
"swell-js": "^4.0.0-next.0",
"swr": "^1.1.2",
"tabbable": "^5.2.1",
"tailwindcss": "^3.0.13",
"uuidv4": "^6.2.12"
"turbo": {
"baseBranch": "origin/main",
"pipeline": {
"build": {
"dependsOn": [
"^build"
],
"outputs": [
"dist/**"
]
},
"next-commerce#build": {
"dependsOn": [
"^build",
"$COMMERCE_PROVIDER"
],
"outputs": [
".next/**"
]
},
"test": {
"dependsOn": [
"^build"
],
"outputs": []
},
"lint": {
"outputs": []
},
"prettier-fix": {
"outputs": []
},
"dev": {
"cache": false
},
"start": {
"cache": false
}
}
},
"devDependencies": {
"@graphql-codegen/cli": "^1.21.5",
"@graphql-codegen/schema-ast": "^1.18.3",
"@graphql-codegen/typescript": "^1.22.2",
"@graphql-codegen/typescript-operations": "^1.18.1",
"@next/bundle-analyzer": "^12.0.8",
"@types/body-scroll-lock": "^3.1.0",
"@types/chec__commerce.js": "^2.8.4",
"@types/cookie": "^0.4.1",
"@types/js-cookie": "^3.0.1",
"@types/lodash.debounce": "^4.0.6",
"@types/lodash.random": "^3.2.6",
"@types/lodash.throttle": "^4.1.6",
"@types/node": "^17.0.8",
"@types/react": "^17.0.38",
"deepmerge": "^4.2.2",
"eslint": "^8.6.0",
"eslint-config-next": "^12.0.8",
"eslint-config-prettier": "^8.3.0",
"graphql": "^15.5.1",
"husky": "^7.0.4",
"lint-staged": "^12.1.7",
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-preset-env": "^7.2.3",
"prettier": "^2.5.1",
"typescript": "4.5.4"
"turbo": "^1.0.28"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
"pre-commit": "turbo run lint"
}
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx}": [
"eslint",
"prettier --write",
"git add"
],
"**/*.{md,mdx,json}": [
"prettier --write",
"git add"
]
},
"next-unused": {
"alias": {
"@lib/*": [
"lib/*"
],
"@assets/*": [
"assets/*"
],
"@config/*": [
"config/*"
],
"@components/*": [
"components/*"
],
"@utils/*": [
"utils/*"
]
},
"debug": true,
"include": [
"components",
"lib",
"pages"
],
"exclude": [],
"entrypoints": [
"pages"
]
}
}

View File

@ -0,0 +1,2 @@
node_modules
dist

View File

@ -0,0 +1,6 @@
{
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"useTabs": false
}

View File

@ -9,7 +9,7 @@ With the deploy button below you'll be able to have a [BigCommerce](https://www.
If you already have a BigCommerce account and want to use your current store, then copy the `.env.template` file in this directory to `.env.local` in the main directory (which will be ignored by Git):
```bash
cp framework/bigcommerce/.env.template .env.local
cp packages/bigcommerce/.env.template .env.local
```
Then, set the environment variables in `.env.local` to match the ones from your store.

View File

@ -8,16 +8,16 @@
},
"documents": [
{
"./framework/bigcommerce/api/**/*.ts": {
"./src/api/**/*.ts": {
"noRequire": true
}
}
],
"generates": {
"./framework/bigcommerce/schema.d.ts": {
"./schema.d.ts": {
"plugins": ["typescript", "typescript-operations"]
},
"./framework/bigcommerce/schema.graphql": {
"./schema.graphql": {
"plugins": ["schema-ast"]
}
},

View File

@ -0,0 +1,80 @@
{
"name": "@vercel/commerce-bigcommerce",
"version": "0.0.1",
"license": "MIT",
"scripts": {
"build": "rm -fr dist/* && tsc",
"dev": "npm run build -- --watch",
"prettier-fix": "prettier --write .",
"generate:definitions": "node scripts/generate-definitions.js"
},
"sideEffects": false,
"type": "module",
"exports": {
".": "./dist/index.js",
"./*": [
"./dist/*.js",
"./dist/*/index.js"
],
"./next.config": "./dist/next.config.cjs"
},
"typesVersions": {
"*": {
"*": [
"src/*",
"src/*/index"
],
"next.config": [
"dist/next.config.d.cts"
]
}
},
"files": [
"dist"
],
"publishConfig": {
"typesVersions": {
"*": {
"*": [
"dist/*.d.ts",
"dist/*/index.d.ts"
],
"config": [
"dist/next.config.d.cts"
]
}
}
},
"dependencies": {
"@vercel/fetch": "^6.1.1",
"cookie": "^0.4.1",
"immutability-helper": "^3.1.1",
"jsonwebtoken": "^8.5.1",
"lodash.debounce": "^4.0.8",
"uuidv4": "^6.2.12"
},
"peerDependencies": {
"next": "^12",
"react": "^17",
"react-dom": "^17"
},
"devDependencies": {
"@types/cookie": "^0.4.1",
"@types/jsonwebtoken": "^8.5.7",
"@types/lodash.debounce": "^4.0.6",
"@types/node": "^17.0.8",
"@types/react": "^17.0.38",
"lint-staged": "^12.1.7",
"next": "^12.0.8",
"prettier": "^2.5.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"typescript": "^4.5.4"
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx,json}": [
"prettier --write",
"git add"
]
}
}

View File

@ -1,5 +1,5 @@
import { GetAPISchema, createEndpoint } from '@commerce/api'
import cartEndpoint from '@commerce/api/endpoints/cart'
import { GetAPISchema, createEndpoint } from '@vercel/commerce/api'
import cartEndpoint from '@vercel/commerce/api/endpoints/cart'
import type { CartSchema } from '../../../types/cart'
import type { BigcommerceAPI } from '../..'
import getCart from './get-cart'

View File

@ -1,4 +1,4 @@
import { Product } from '@commerce/types/product'
import { Product } from '@vercel/commerce/types/product'
import { ProductsEndpoint } from '.'
const SORT: { [key: string]: string | undefined } = {

View File

@ -1,5 +1,5 @@
import { GetAPISchema, createEndpoint } from '@commerce/api'
import productsEndpoint from '@commerce/api/endpoints/catalog/products'
import { GetAPISchema, createEndpoint } from '@vercel/commerce/api'
import productsEndpoint from '@vercel/commerce/api/endpoints/catalog/products'
import type { ProductsSchema } from '../../../../types/product'
import type { BigcommerceAPI } from '../../..'
import getProducts from './get-products'

View File

@ -1,5 +1,5 @@
import { GetAPISchema, createEndpoint } from '@commerce/api'
import checkoutEndpoint from '@commerce/api/endpoints/checkout'
import { GetAPISchema, createEndpoint } from '@vercel/commerce/api'
import checkoutEndpoint from '@vercel/commerce/api/endpoints/checkout'
import type { CheckoutSchema } from '../../../types/checkout'
import type { BigcommerceAPI } from '../..'
import getCheckout from './get-checkout'

Some files were not shown because too many files have changed in this diff Show More