Skip to content

Commit

Permalink
chore: use Turborepo & TSUP (#2082)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaellis committed Feb 7, 2023
1 parent ced01ef commit 64cc062
Show file tree
Hide file tree
Showing 33 changed files with 3,647 additions and 433 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bundle-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:

- uses: preactjs/compressed-size-action@v2
with:
pattern: '**/dist/**/*.{mjs,js}'
pattern: '{**/dist/**/*.{mjs,js},packages/types/*.{js,d.ts}}'
21 changes: 17 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,27 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18

- name: Get yarn cache directory path
id: yarn-cache-dir
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Restore yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
run: yarn install

- name: Build
run: yarn build

- name: Typecheck
run: yarn test:ts

Expand All @@ -32,6 +48,3 @@ jobs:

- name: Test (Cypress)
run: yarn test:e2e

- name: Build
run: yarn build
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ report.*.json
.cache
.vercel
.output
.turbo

#
# Remix
#
docs/public/build
docs/api/*
docs/api/*
24 changes: 0 additions & 24 deletions babel.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion demo/src/sandboxes/css-variables/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
"@types/react-dom": "^18.0.10",
"typescript": "^4.9.5"
}
}
}
6 changes: 0 additions & 6 deletions docs/.eslintrc

This file was deleted.

33 changes: 11 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,23 @@
"docs"
]
},
"preconstruct": {
"packages": [
"packages/*",
"targets/*",
"!packages/types"
]
},
"scripts": {
"changeset:add": "changeset add",
"build": "preconstruct build",
"watch": "preconstruct watch",
"dev": "preconstruct dev",
"build": "turbo run build",
"changeset": "changeset",
"clean": "turbo run clean && rm -rf node_modules",
"dev": "turbo run dev --no-cache --parallel --continue",
"docs:dev": "yarn workspace @react-spring/docs dev",
"docs:build": "yarn workspace @react-spring/docs build",
"demo:dev": "yarn workspace @react-spring/demo dev",
"postinstall": "preconstruct dev && remix setup node",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"postinstall": "remix setup node",
"prepare": "husky install",
"test": "yarn test:ts && yarn test:unit && yarn test:e2e",
"test:unit": "jest",
"test:cov": "jest --coverage",
"test:ts": "tsc --noEmit",
"test:e2e": "start-server-and-test 'yarn vite serve packages/parallax/test --host' http-get://localhost:3000 'yarn cypress run'",
"test": "yarn test:ts && yarn test:unit && yarn test:e2e",
"release": "yarn test:ts && yarn test:unit && yarn build && yarn changeset publish && yarn",
"release": "yarn test:ts && yarn test:unit && yarn build && yarn changeset publish",
"vers": "yarn changeset version"
},
"commitlint": {
Expand All @@ -65,10 +59,6 @@
}
},
"devDependencies": {
"@babel/core": "^7.20.12",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@changesets/cli": "^2.26.0",
"@commitlint/cli": "^17.4.2",
"@commitlint/config-conventional": "^17.4.2",
Expand Down Expand Up @@ -115,6 +105,8 @@
"three": "^0.149.0",
"ts-jest": "^27.1.5",
"ts-node": "^10.9.1",
"tsup": "^6.5.0",
"turbo": "^1.7.3",
"typescript": "4.9.5",
"vite": "^3.2.5",
"zdog": "^1.1.3"
Expand All @@ -126,8 +118,5 @@
"type": "opencollective",
"url": "https://opencollective.com/react-spring"
},
"packageManager": "yarn@3.4.1",
"resolutions": {
"@babel/core": "^7.20.12"
}
"packageManager": "yarn@3.4.1"
}
9 changes: 7 additions & 2 deletions packages/animated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"name": "@react-spring/animated",
"version": "9.6.1",
"description": "Animated component props for React",
"main": "dist/react-spring-animated.cjs.js",
"module": "dist/react-spring-animated.esm.js",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist/*",
"README.md",
Expand All @@ -27,6 +28,10 @@
"maintainers": [
"Josh Ellis (https://github.com/joshuaellis)"
],
"scripts": {
"build": "tsup",
"dev": "tsup"
},
"dependencies": {
"@react-spring/shared": "~9.6.1",
"@react-spring/types": "~9.6.1"
Expand Down
12 changes: 12 additions & 0 deletions packages/animated/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'tsup'
import { defaultConfig } from '../../tsup.config.base'

export default defineConfig(opts => {
return defaultConfig(
{
entry: ['src/index.ts'],
outDir: 'dist',
},
opts
)
})
9 changes: 7 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "@react-spring/core",
"version": "9.6.1",
"main": "dist/react-spring-core.cjs.js",
"module": "dist/react-spring-core.esm.js",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist/*",
"README.md",
Expand Down Expand Up @@ -30,6 +31,10 @@
"maintainers": [
"Josh Ellis (https://github.com/joshuaellis)"
],
"scripts": {
"build": "tsup",
"dev": "tsup"
},
"dependencies": {
"@react-spring/animated": "~9.6.1",
"@react-spring/rafz": "~9.6.1",
Expand Down
12 changes: 12 additions & 0 deletions packages/core/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'tsup'
import { defaultConfig } from '../../tsup.config.base'

export default defineConfig(opts => {
return defaultConfig(
{
entry: ['src/index.ts'],
outDir: 'dist',
},
opts
)
})
7 changes: 5 additions & 2 deletions packages/parallax/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "@react-spring/parallax",
"version": "9.6.1",
"main": "dist/react-spring-parallax.cjs.js",
"module": "dist/react-spring-parallax.esm.js",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist/*",
"README.md",
Expand All @@ -27,6 +28,8 @@
"Josh Ellis (https://github.com/joshuaellis)"
],
"scripts": {
"build": "tsup",
"dev": "tsup",
"test": "vite serve ./test"
},
"dependencies": {
Expand Down
12 changes: 12 additions & 0 deletions packages/parallax/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'tsup'
import { defaultConfig } from '../../tsup.config.base'

export default defineConfig(opts => {
return defaultConfig(
{
entry: ['src/index.tsx'],
outDir: 'dist',
},
opts
)
})
11 changes: 8 additions & 3 deletions packages/rafz/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"name": "@react-spring/rafz",
"version": "9.6.1",
"description": "react-spring's fork of rafz one frameloop to rule them all",
"main": "dist/react-spring-rafz.cjs.js",
"module": "dist/react-spring-rafz.esm.js",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist/*",
"README.md",
Expand All @@ -23,5 +24,9 @@
"velocity"
],
"license": "MIT",
"author": "Josh Ellis"
"author": "Josh Ellis",
"scripts": {
"build": "tsup",
"dev": "tsup"
}
}
12 changes: 12 additions & 0 deletions packages/rafz/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'tsup'
import { defaultConfig } from '../../tsup.config.base'

export default defineConfig(opts => {
return defaultConfig(
{
entry: ['src/index.ts'],
outDir: 'dist',
},
opts
)
})
9 changes: 7 additions & 2 deletions packages/react-spring/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "react-spring",
"version": "9.6.1",
"main": "dist/react-spring.cjs.js",
"module": "dist/react-spring.esm.js",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist/*",
"README.md",
Expand Down Expand Up @@ -37,5 +38,9 @@
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"scripts": {
"build": "tsup",
"dev": "tsup"
}
}
12 changes: 12 additions & 0 deletions packages/react-spring/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'tsup'
import { defaultConfig } from '../../tsup.config.base'

export default defineConfig(opts => {
return defaultConfig(
{
entry: ['src/index.ts'],
outDir: 'dist',
},
opts
)
})
9 changes: 7 additions & 2 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"name": "@react-spring/shared",
"version": "9.6.1",
"description": "Globals and shared modules",
"main": "dist/react-spring-shared.cjs.js",
"module": "dist/react-spring-shared.esm.js",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist/*",
"README.md",
Expand Down Expand Up @@ -33,5 +34,9 @@
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"scripts": {
"build": "tsup",
"dev": "tsup"
}
}
12 changes: 12 additions & 0 deletions packages/shared/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'tsup'
import { defaultConfig } from '../../tsup.config.base'

export default defineConfig(opts => {
return defaultConfig(
{
entry: ['src/index.ts'],
outDir: 'dist',
},
opts
)
})
1 change: 1 addition & 0 deletions packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "9.6.1",
"description": "Internal package with TypeScript stuff",
"main": "index.js",
"types": "index.d.ts",
"repository": "pmndrs/react-spring",
"homepage": "https://github.com/pmndrs/react-spring#readme",
"keywords": [
Expand Down

1 comment on commit 64cc062

@vercel
Copy link

@vercel vercel bot commented on 64cc062 Feb 7, 2023

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.