Skip to content

Commit

Permalink
Monorepo with Turborepo (vercel#651)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
lfades and jaredpalmer authored Feb 1, 2022
1 parent d0ef346 commit 0afe686
Show file tree
Hide file tree
Showing 1,647 changed files with 23,279 additions and 33,664 deletions.
39 changes: 0 additions & 39 deletions .env.template

This file was deleted.

14 changes: 9 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -34,3 +35,6 @@ yarn-error.log*

# vercel
.vercel

# Turborepo
.turbo
5 changes: 3 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Every package defines its prettier config
node_modules
.next
public
packages
site
10 changes: 1 addition & 9 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,5 @@
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"useTabs": false,
"overrides": [
{
"files": ["framework/saleor/**/*"],
"options": {
"printWidth": 120
}
}
]
"useTabs": false
}
7 changes: 6 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
22 changes: 5 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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.

Expand All @@ -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

Expand Down
27 changes: 0 additions & 27 deletions codegen.bigcommerce.json

This file was deleted.

33 changes: 0 additions & 33 deletions codegen.json

This file was deleted.

59 changes: 0 additions & 59 deletions framework/bigcommerce/README.md

This file was deleted.

26 changes: 0 additions & 26 deletions framework/bigcommerce/api/endpoints/cart/index.ts

This file was deleted.

18 changes: 0 additions & 18 deletions framework/bigcommerce/api/endpoints/catalog/products/index.ts

This file was deleted.

18 changes: 0 additions & 18 deletions framework/bigcommerce/api/endpoints/checkout/index.ts

This file was deleted.

18 changes: 0 additions & 18 deletions framework/bigcommerce/api/endpoints/customer/index.ts

This file was deleted.

18 changes: 0 additions & 18 deletions framework/bigcommerce/api/endpoints/login/index.ts

This file was deleted.

Loading

0 comments on commit 0afe686

Please sign in to comment.