Skip to content

Commit

Permalink
Replace Yarn with pnpm (#2748)
Browse files Browse the repository at this point in the history
* build: use pnpm

* build: add rimraf dep

* build: add npmrc

* fix: add some missing dependencies

* build: add missing deps for test

* fix: mess with test deps

* build: add deps to get docsite running
  • Loading branch information
darthtrevino committed Sep 4, 2020
1 parent d641504 commit 046def8
Show file tree
Hide file tree
Showing 26 changed files with 25,278 additions and 24,330 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ jobs:
with:
node-version: 12.x

- run: yarn install
- run: yarn build
- run: npm i -g pnpm
- run: pnpm install
- run: pnpm build
- run: yarn lerna run build_site --scope react-dnd-documentation

- name: deploy
Expand Down
73 changes: 3 additions & 70 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,78 +18,11 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

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

- uses: actions/cache@v1
name: Cache yarn cache
id: cache-yarn-cache
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}

- uses: actions/cache@v1
name: Cache Jest cache
id: cache-jest-cache
with:
path: .jest-cache
key: ${{ runner.os }}-${{ matrix.node-version }}-jest

- uses: actions/cache@v1
name: Cache node_modules
id: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-${{ hashFiles('**/yarn.lock') }}

- uses: actions/cache@v1
name: Cache dnd-core/lib
id: cache-dnd-core
with:
path: packages/core/dnd-core/lib
key: ${{ runner.os }}-${{ matrix.node-version }}-dnd-core-${{ hashFiles('packages/core/dnd-core/**') }}

- uses: actions/cache@v1
name: Cache html5-backend/lib
id: cache-html5-backend
with:
path: packages/core/html5-backend/lib
key: ${{ runner.os }}-${{ matrix.node-version }}-html5-backend-${{ hashFiles('packages/core/html5-backend/**') }}

- uses: actions/cache@v1
name: Cache react-dnd/lib
id: cache-react-dnd
with:
path: packages/core/react-dnd/lib
key: ${{ runner.os }}-${{ matrix.node-version }}-react-dnd-${{ hashFiles('packages/core/react-dnd/**') }}

- uses: actions/cache@v1
name: Cache touch-backend/lib
id: cache-touch-backend
with:
path: packages/core/touch-backend/lib
key: ${{ runner.os }}-${{ matrix.node-version }}-touch-backend-${{ hashFiles('packages/core/touch-backend/**') }}

- uses: actions/cache@v1
name: Cache test-backend/lib
id: cache-test-backend
with:
path: packages/core/test-backend/lib
key: ${{ runner.os }}-${{ matrix.node-version }}-test-backend-${{ hashFiles('packages/testing/test-backend/**') }}

- uses: actions/cache@v1
name: Cache test-utils/lib
id: cache-test-utils
with:
path: packages/core/test-utils/lib
key: ${{ runner.os }}-${{ matrix.node-version }}-test-utils-${{ hashFiles('packages/testing/test-utils/**') }}

- run: yarn install
- run: npm i -g pnpm
- run: pnpm install
name: Install Dependencies
if: steps.cache-yarn-cache.outputs.cache-hit != 'true' || steps.cache-node-modules.outputs.cache-hit != 'true'

- run: yarn test
- run: pnpm ci
name: Execute Tests
env:
CI: true
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
link-workspace-packages=true
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
dist/
lib/
build/
pnpm-lock.yaml
pnpm-workspace.yaml
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"lerna": "2.9.0",
"version": "11.1.3",
"npmClient": "yarn",
"npmClient": "pnpm",
"useWorkspaces": true,
"packages": [
"packages/documentation/*",
Expand Down
116 changes: 53 additions & 63 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
},
"homepage": "https://github.com/react-dnd/react-dnd",
"scripts": {
"clean": "lerna run clean --parallel",
"build": "lerna run build --stream",
"preinstall": "npx only-allow pnpm",
"postinstall": "shx rm -rf node_modules/@types/react-native",
"clean": "pnpm run clean -r --parallel",
"build": "pnpm run build -r --stream",
"unit_test": "jest",
"jest:watch": "jest --watch",
"jest:cov": "jest --coverage",
Expand All @@ -50,16 +52,17 @@
"release_canary": "lerna publish -c --preid next --yes",
"release": "run-s clean test go_no_go release:packages changelog",
"release:packages": "lerna publish",
"test_modules": "CI=true lerna run test --stream",
"test_modules": "CI=true pnpm run test -r --stream",
"go_no_go": "node scripts/go_no_go.js",
"test": "run-s clean lint build test_modules jest:cov",
"ci": "run-s clean lint build test_modules jest:cov",
"prettify:source": "prettier 'packages/*/*/src/**/*.ts*'",
"prettify": "prettier 'packages/*/**/*.js' 'examples/**/*.js' 'site/**/*.js'",
"prettify": "pretty-quick --fix",
"precommit:lint": "lint-staged",
"precommit:format": "pretty-quick --staged",
"start": "lerna run --parallel --stream start",
"start_docs": "lerna run --stream start --scope react-dnd-documentation",
"watch": "lerna run --parallel --stream watch"
"start": "pnpm run -r --parallel --stream start",
"start_docs": "pnpm run --stream --scope react-dnd-documentation start",
"watch": "pnpm run -r --parallel --stream watch",
"git-is-clean": "git diff-index --quiet HEAD"
},
"husky": {
"hooks": {
Expand All @@ -68,46 +71,53 @@
}
},
"devDependencies": {
"@babel/cli": "^7.7.5",
"@babel/core": "^7.7.5",
"@babel/plugin-proposal-class-properties": "^7.7.4",
"@babel/plugin-proposal-object-rest-spread": "^7.7.4",
"@babel/preset-env": "^7.7.5",
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@rollup/plugin-commonjs": "^13.0.0",
"@rollup/plugin-node-resolve": "^8.0.0",
"@rollup/plugin-replace": "^2.3.2",
"@types/enzyme": "^3.10.4",
"@types/jest": "^26.0.0",
"@typescript-eslint/eslint-plugin": "^3.0.0",
"@typescript-eslint/parser": "^3.0.0",
"alex": "^8.0.1",
"conventional-changelog-cli": "^2.0.27",
"enzyme-adapter-react-16": "^1.15.1",
"enzyme": "^3.10.0",
"@babel/cli": "^7.11.6",
"@babel/core": "^7.11.6",
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/plugin-proposal-object-rest-spread": "^7.11.0",
"@babel/preset-env": "^7.11.5",
"@commitlint/cli": "^9.1.2",
"@commitlint/config-conventional": "^9.1.2",
"@rollup/plugin-commonjs": "^15.0.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"@rollup/plugin-replace": "^2.3.3",
"@types/enzyme": "^3.10.5",
"@types/jest": "^26.0.13",
"@typescript-eslint/eslint-plugin": "^4.0.1",
"@typescript-eslint/parser": "^4.0.1",
"alex": "^9.0.1",
"conventional-changelog-cli": "^2.1.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.4",
"eslint": "^7.8.1",
"eslint-config-prettier": "^6.11.0",
"eslint-config-react-app": "^5.2.1",
"eslint-plugin-no-for-of-loops": "^1.0.1",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react-hooks": "^4.0.2",
"eslint-plugin-react": "^7.20.0",
"eslint": "^7.1.0",
"husky": "^4.x",
"inquirer": "^7.0.0",
"jest-environment-jsdom": "^26.0.0",
"jest": "^26.0.1",
"lerna": "^3.19.0",
"lint-staged": "^10.0.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.0",
"husky": "^4.2.5",
"inquirer": "^7.3.3",
"jest": "^26.4.2",
"jest-environment-jsdom": "^26.3.0",
"lerna": "^3.22.1",
"lint-staged": "^10.3.0",
"markdown-spellcheck": "^1.3.1",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.1",
"pretty-quick": "^2.0.1",
"replace-in-file": "^6.0.0",
"rollup-plugin-terser": "^6.1.0",
"rollup": "^2.6.1",
"ts-jest": "^26.0.0",
"typescript": "^3.7.2"
"prettier": "^2.1.1",
"pretty-quick": "^3.0.0",
"react-dnd": "^11.1.3",
"react-dnd-test-utils": "11.1.3",
"react-dnd-html5-backend": "11.1.3",
"react-dnd-touch-backend": "11.1.3",
"react-dnd-test-backend": "11.1.3",
"replace-in-file": "^6.1.0",
"rimraf": "^3.0.2",
"rollup": "^2.26.10",
"rollup-plugin-terser": "^7.0.2",
"shx": "^0.3.2",
"ts-jest": "^26.3.0",
"typescript": "^4.0.2"
},
"jest": {
"clearMocks": true,
Expand All @@ -125,14 +135,6 @@
"<rootDir>/packages/core/",
"<rootDir>/packages/testing/"
],
"moduleNameMapper": {
"^dnd-core$": "dnd-core/dist/cjs",
"^react-dnd$": "react-dnd/dist/cjs",
"^react-dnd-html5-backend$": "html5-backend/dist/cjs",
"^react-dnd-touch-backend$": "touch-backend/dist/cjs",
"^react-dnd-test-backend$": "react-dnd-test-backend/dist/cjs",
"^react-dnd-test-utils$": "react-dnd-test-utils/dist/cjs"
},
"collectCoverageFrom": [
"packages/core/**/*.{ts,tsx}",
"!**/node_modules/**",
Expand Down Expand Up @@ -185,17 +187,5 @@
}
}
]
},
"workspaces": {
"packages": [
"packages/alternative_builds/umd",
"packages/alternative_builds/cjs/*",
"packages/documentation/*",
"packages/testing/*",
"packages/core/*"
],
"nohoist": [
"react-dnd-documentation/**"
]
}
}
1 change: 1 addition & 0 deletions packages/core/react-dnd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"start": "../../../scripts/watch_package.sh"
},
"dependencies": {
"@react-dnd/invariant": "^2.0.0",
"@react-dnd/shallowequal": "^2.0.0",
"@types/hoist-non-react-statics": "^3.3.1",
"dnd-core": "^11.1.3",
Expand Down
4 changes: 1 addition & 3 deletions packages/documentation/cra-test/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
*.log*
3 changes: 2 additions & 1 deletion packages/documentation/cra-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"react-dnd-examples-hooks": "^11.1.3",
"react-dnd-html5-backend": "^11.1.3",
"react-dom": "^16.12.0",
"react-scripts": "^3.2.0"
"react-scripts": "^3.2.0",
"lodash": "^4.17.20"
},
"devDependencies": {
"babel-eslint": "^10.1.0"
Expand Down
34 changes: 17 additions & 17 deletions packages/documentation/cra-test/public/index.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<!--
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Expand All @@ -19,20 +19,20 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
To begin the development, run `npm start` or `pnpm start`.
To create a production bundle, use `npm run build` or `pnpm build`.
-->
</body>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ React DnD is test-friendly. The whole drag and drop interaction, including the r

There are several different approaches to testing React components. React DnD is not opinionated and lets you use any of them. **Not all approaches require that the browser event system be available.**

A few test examples are included with the React DnD inside its `examples` folder. Run `yarn` and `yarn test` inside the `react-dnd` root folder to start them.
A few test examples are included with the React DnD inside its `examples` folder. Run `pnpm install` and `pnpm test` inside the `react-dnd` root folder to start them.

### Testing the Components in Isolation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ This part assumes you are at least somewhat familiar with the concepts presented
We're going to start by installing React DnD and the HTML5 backend for it:

```
yarn add react-dnd react-dnd-html5-backend
npm install react-dnd react-dnd-html5-backend
```

In the future, you might want to explore alternative third-party backends, such as the [touch backend](https://npmjs.com/package/react-dnd-touch-backend), but this is out of scope of this tutorial.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This is the primary backend supported by React-DnD. It uses [the HTML5 drag and
### Installation

```
yarn add react-dnd-html5-backend
npm install react-dnd-html5-backend
```

### Extras
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The test backend lets you test the drag and drop interaction of your components
The test backend comes in a separate package:

```
yarn add --dev react-dnd-test-backend
npm install -D react-dnd-test-backend
```

### Usage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The HTML5 backend does not support the touch events. So it will not work on tabl
Run the following command to install the touch backend.

```
yarn add react-dnd-touch-backend
npm install react-dnd-touch-backend
```

### Usage
Expand Down
Loading

0 comments on commit 046def8

Please sign in to comment.