Skip to content

Commit

Permalink
Turborepo (#1296)
Browse files Browse the repository at this point in the history
* chore: gh actions

* chore: gitignore

* chore: lerna packages

* feat: config turbo

* feat: move docs to apps

* feat: move theme to packages

* chore: yarn lock

* fix: ci

* feat: add lint as step of workflows

* fix: using eslint from vtex instead tsdx

* fix: size step on ci workflow

* fix: release cd name
  • Loading branch information
emersonlaurentino authored May 30, 2022
1 parent 9ffcded commit b1540be
Show file tree
Hide file tree
Showing 297 changed files with 554 additions and 409 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dist/
coverage/
.vscode/
.cache/
.turbo/

# generated js files
packages/gatsby-*/**/*.js
Expand All @@ -14,4 +15,4 @@ __generated__/
# declaration files
packages/gatsby-*/**/*.d.ts

docs/*
apps/docs/*
72 changes: 23 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,69 +2,43 @@
name: CI

on:
workflow_dispatch:
push:
branches-ignore:
- main
- master

jobs:
lint:
name: Lint
build:
name: FastStore CI
timeout-minutes: 15
runs-on: ubuntu-latest
# To use Remote Caching, uncomment the next lines and follow the steps below.
# env:
# TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
# TURBO_TEAM: ${{ secrets.TURBO_TEAM }}

steps:
- name: Checkout repo
- name: Check out code
uses: actions/checkout@v2

- name: Use Node 16.x
uses: actions/setup-node@v1
with:
node-version: '16.x'

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1

- name: Lint
run: yarn lint

test:
name: Test
runs-on: ubuntu-latest
fetch-depth: 2

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Use Node 16.x
uses: actions/setup-node@v1
- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: '16.x'
node-version: 16
cache: 'yarn'

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1

- name: Test
run: yarn test --ci --maxWorkers=2

size:
name: Size Limit
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Use Node 16.x
uses: actions/setup-node@v1
with:
node-version: '16.x'

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1
- name: Install dependencies
run: yarn

- name: Build
run: yarn build --scope "@vtex/gatsby-plugin-thumbor" --scope "@faststore/ui" --scope "@faststore/sdk" --ci
run: yarn build

- name: Size Limit
- name: Size
run: yarn size

- name: Lint
run: yarn lint

- name: Test
run: yarn test
78 changes: 25 additions & 53 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,81 +1,53 @@
# This Action should run on master and verify lint, test, and then publish the version on npm
# This Action should run on main branch and verify lint, test, and then publish the version on npm
name: CD

on:
push:
branches:
- main
- master

jobs:
lint:
name: Lint
build:
name: FastStore CD
timeout-minutes: 15
runs-on: ubuntu-latest
# To use Remote Caching, uncomment the next lines and follow the steps below.
# env:
# TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
# TURBO_TEAM: ${{ secrets.TURBO_TEAM }}

steps:
- name: Checkout repo
- name: Check out code
uses: actions/checkout@v2

- name: Use Node 16.x
uses: actions/setup-node@v1
with:
node-version: '16.x'

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1

- name: Lint
run: yarn lint

test:
needs: lint
name: Test
runs-on: ubuntu-latest
fetch-depth: 2

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Use Node 16.x
uses: actions/setup-node@v1
- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: '16.x'
node-version: 16
cache: 'yarn'

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1
- name: Install dependencies
run: yarn

- name: Test
run: yarn test --ci --maxWorkers=2

publish:
needs: test
name: Publish
runs-on: ubuntu-latest
- name: Build
run: yarn build

steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
token: ${{ secrets.VTEX_GITHUB_BOT_TOKEN }}
- name: Size
run: yarn size

- name: Use Node 16.x
uses: actions/setup-node@v1
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: Lint
run: yarn lint

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1
- name: Test
run: yarn test

- name: Configure CI Git User
run: |
git config user.name vtexgithubbot
git config user.email vtexgithubbot@github.com
- name: Build
run: yarn build

- name: Publish package
- name: Publish
run: lerna publish patch --yes --no-verify-access --ignore-scripts --conventional-commits
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.turbo
.docusaurus

# Logs
logs
*.log
Expand Down Expand Up @@ -34,6 +37,7 @@ build/Release

# bundle
dist/
build/
storybook-static/

# Dependency directories
Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ public/
coverage/
.vscode/
.cache/
.turbo/
__generated__/
docs/
apps/docs/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 1 addition & 5 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,5 @@
}
},
"changelogPreset": "angular",
"packages": [
"packages/*",
"themes/*",
"docs"
]
"packages": ["packages/*", "apps/*"]
}
23 changes: 8 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
{
"name": "faststore",
"version": "0.0.0",
"description": "Digital commerce toolkit for frontend developers.",
"main": "index.js",
"repository": "git@github.com:vtex/faststore.git",
"license": "MIT",
"private": true,
"scripts": {
"build": "lerna run build",
"build-themes": "lerna run build --scope '@vtex/theme-*' || true",
"build-docs": "lerna run build --include-dependencies --scope docs",
"build-storybook": "yarn build-themes && yarn workspace @faststore/ui build-storybook",
"storybook": "yarn workspace @faststore/ui storybook",
"clean": "lerna clean && lerna run clean",
"format": "prettier --write \"packages/**/*.{ts,tsx,json}\"",
"lint": "eslint packages/ --ext .ts,.tsx",
"test": "lerna run test --",
"bootstrap": "lerna bootstrap",
"build": "turbo run build",
"dev": "turbo run dev --parallel --no-cache",
"lint": "turbo run lint",
"test": "turbo run test",
"size": "turbo run size",
"format": "prettier --write \"**/*.{ts,tsx,json}\"",
"release": "lerna version minor --yes && lerna publish from-git --yes",
"size": "lerna run size",
"generate-ui-component": "yarn plop --plopfile generators/plopfile.ts"
},
"workspaces": [
"packages/*",
"themes/*",
"docs"
"apps/*"
],
"husky": {
"hooks": {
Expand Down Expand Up @@ -53,6 +45,7 @@
"lint-staged": "^10.5.1",
"plop": "^2.7.6",
"prettier": "^2.2.1",
"turbo": "latest",
"typescript": "^4.1.2"
},
"resolutions": {
Expand Down
1 change: 0 additions & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"develop:no-server": "concurrently \"yarn generate -w\" \"tsdx watch\"",
"build": "graphql-codegen --config codegen.yml && tsdx build",
"test": "tsdx test",
"lint": "tsdx lint",
"generate": "graphql-codegen --config codegen.yml"
},
"dependencies": {
Expand Down
1 change: 0 additions & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"develop": "tsdx watch",
"build": "tsdx build",
"test": "tsdx test",
"lint": "tsdx lint",
"size": "size-limit",
"analyze": "size-limit --why"
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://turborepo.org/schema.json",
"baseBranch": "origin/main",
"pipeline": {
"build": {
"outputs": ["dist/**", "build/**", ".docusaurus/**"],
"dependsOn": ["^build"]
},
"test": {
"dependsOn": ["^build"],
"outputs": []
},
"lint": {
"outputs": []
},
"start": {},
"size": {},
"develop": {
"cache": false
},
"dev": {
"cache": false
}
}
}
Loading

1 comment on commit b1540be

@vercel
Copy link

@vercel vercel bot commented on b1540be May 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.