Skip to content

Commit

Permalink
build: support turbo build flow (#425)
Browse files Browse the repository at this point in the history
* example: add package `name` for all examples project

* chore(test): rename `test` dir name to `testing` for match

* example: set all example as private package

* chore(test): remove `test` pkg file

* ci: add `examples/*` package json check

* ci: use `turbo` instead pnpm exec

* ci(turbo): add turbo cache for github actions

* ci: fix node version and set expires mark step name

* example: add new repo name

* chore: update lock file

* ci: force check turbo perf
  • Loading branch information
fz6m authored and sorrycc committed Jun 23, 2022
1 parent 63f0c50 commit 6eda3d7
Show file tree
Hide file tree
Showing 41 changed files with 592 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# http://editorconfig.org
# 🎨 http://editorconfig.org
root = true

[*]
Expand Down
25 changes: 22 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,49 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: [14.x, 16.x]
node-version: [14.x, 16.x]
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node_version }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_version }}
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org/'

- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node${{ matrix.node-version }}-
- name: Install pnpm
uses: pnpm/action-setup@v2.1.0
with:
version: latest
run_install: true

# We use week in the turbo cache key to keep the cache from infinitely growing
- name: Get cache expires mark
id: get-week
run: echo ::set-output name=WEEK::$(date +%U)

- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v2
with:
path: .turbo
key: turbo-${{ github.job }}-${{ runner.os }}-node${{ matrix.node-version }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ runner.os }}-node${{ matrix.node-version }}-
turbo-${{ github.job }}-${{ runner.os }}-node${{ matrix.node-version }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}-
- run: pnpm build
- run: pnpm tsc --noEmit
- run: pnpm test
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@
/.umi-production
/dist
.DS_Store
.turbo
*.tsbuildinfo
2 changes: 2 additions & 0 deletions examples/ant-design-pro/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@example/ant-design-pro",
"private": true,
"scripts": {
"dev": "umipro dev",
"start": "npm run dev"
Expand Down
2 changes: 2 additions & 0 deletions examples/api-route-demo/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@example/api-route-demo",
"private": true,
"scripts": {
"build": "umi build",
"dev": "umi dev",
Expand Down
2 changes: 2 additions & 0 deletions examples/bigfish/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@example/bigfish",
"private": true,
"scripts": {
"build": "umipro build",
"dev": "umipro dev",
Expand Down
2 changes: 2 additions & 0 deletions examples/boilerplate/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@example/boilerplate",
"private": true,
"scripts": {
"build": "umi build",
"dev": "umi dev",
Expand Down
2 changes: 2 additions & 0 deletions examples/bug-mfsu-fast-refresh/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@example/bug-mfsu-fast-refresh",
"private": true,
"scripts": {
"dev": "umi dev",
"start": "npm run dev"
Expand Down
2 changes: 2 additions & 0 deletions examples/bundler-vite-demo/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@example/bundler-vite-demo",
"private": true,
"scripts": {
"dev": "bundler-vite dev",
"start": "npm run dev"
Expand Down
2 changes: 2 additions & 0 deletions examples/bundler-webpack-demo/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@example/bundler-webpack-demo",
"private": true,
"scripts": {
"dev": "bundler-webpack dev",
"start": "npm run dev"
Expand Down
2 changes: 2 additions & 0 deletions examples/libs/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@example/libs",
"private": true,
"scripts": {
"dev": "umi dev",
"start": "npm run dev"
Expand Down
2 changes: 2 additions & 0 deletions examples/mfsu-circular-dependency/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@example/mfsu-circular-dependency",
"private": true,
"scripts": {
"dev": "bundler-webpack dev",
"start": "npm run dev"
Expand Down
2 changes: 2 additions & 0 deletions examples/mfsu-independent/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@example/mfsu-independent",
"private": true,
"scripts": {
"build": "webpack",
"dev": "webpack serve --config webpack.config.js",
Expand Down
3 changes: 2 additions & 1 deletion examples/qiankun-slave/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "app1",
"name": "@example/qiankun-slave",
"private": true,
"scripts": {
"dev": "umipro dev",
"start": "npm run dev"
Expand Down
2 changes: 2 additions & 0 deletions examples/react-query/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@example/react-query",
"private": true,
"scripts": {
"build": "umi build",
"dev": "umi dev",
Expand Down
2 changes: 2 additions & 0 deletions examples/react-three-fiber/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@example/react-three-fiber",
"private": true,
"scripts": {
"build": "umi build",
"dev": "umi dev",
Expand Down
2 changes: 2 additions & 0 deletions examples/remix/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@example/remix",
"private": true,
"scripts": {
"dev": "umi dev",
"start": "npm run dev"
Expand Down
2 changes: 2 additions & 0 deletions examples/test-test/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@example/test-test",
"private": true,
"scripts": {
"start": "npm run dev",
"test": "jest"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@example/tmp-swc-transpiler",
"private": true,
"scripts": {
"build": "umi build",
"dev": "umi dev",
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions examples/with-tailwindcss/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@example/with-tailwindcss",
"private": true,
"scripts": {
"build": "umi build",
"dev": "umi dev",
Expand Down
2 changes: 2 additions & 0 deletions examples/with-unocss/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@example/with-unocss",
"private": true,
"scripts": {
"build": "umi build",
"dev": "umi dev",
Expand Down
2 changes: 2 additions & 0 deletions examples/with-valtio/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "@example/with-valtio",
"private": true,
"scripts": {
"build": "umi build",
"dev": "umi dev",
Expand Down
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
"private": true,
"scripts": {
"bootstrap": "esno scripts/bootstrap.ts",
"build": "pnpm -r --filter ./packages run build",
"build:extra": "pnpm -r --filter ./packages run build:extra",
"build:release": "pnpm -r --filter ./packages run build -- --declarationMap false",
"build": "esno scripts/turbo.ts --cmd build",
"build:extra": "esno scripts/turbo.ts --cmd build:extra",
"build:force": "esno scripts/turbo.ts --cmd build --no-cache",
"build:release": "esno scripts/turbo.ts --cmd build --no-cache -- --declarationMap false",
"check:packageFiles": "esno scripts/checkPackageFiles.ts",
"dep:update": "npx only-allow pnpm && pnpm up --interactive --latest --recursive",
"dev": "pnpm -r --filter ./packages --parallel run dev",
"doc:build": "pnpm --filter ./packages/plugin-docs build:extra && umi build",
"doc:dev": "esno scripts/startDocsSite.ts",
"dep:update": "pnpm up --interactive --latest --recursive",
"dev": "esno scripts/turbo.ts --cmd dev",
"doc:build": "pnpm doc:deps && umi build",
"doc:deps": "esno scripts/turbo.ts --cmd build:extra --scope @umijs/plugin-docs",
"doc:dev": "pnpm doc:deps && umi dev",
"format": "prettier --write .",
"preinstall": "npx only-allow pnpm",
"postinstall": "esno scripts/postinstall.ts",
Expand Down Expand Up @@ -61,6 +63,7 @@
"resolve": "^1.22.0",
"rimraf": "^3.0.2",
"ts-node": "^10.6.0",
"turbo": "^1.1.4",
"typescript": "^4.6.2",
"uglify-js": "^3.15.2",
"umi": "workspace:*",
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"types": "dist/index.d.ts",
"files": [
"dist",
"client"
"client",
"compiled"
],
"scripts": {
"build": "pnpm tsc",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@umijs/test",
"version": "4.0.0-rc.5",
"description": "@umijs/test",
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/test#readme",
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/testing#readme",
"bugs": "https://github.com/umijs/umi-next/issues",
"repository": {
"type": "git",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 6eda3d7

Please sign in to comment.