Fix workflows and monorepo deps

* Remove 'react' packages from monorepo dependencies.
* Ensure 'react-native-web' package is built first.
This commit is contained in:
Nicolas Gallagher
2022-07-01 20:35:02 -07:00
parent e9badc3e38
commit 074861623e
11 changed files with 63 additions and 87 deletions

View File

@@ -1,6 +1,6 @@
{
"packages": ["packages/react-native-web", "packages/babel-plugin-react-native-web"],
"buildCommand": "compile",
"buildCommand": "build",
"sandboxes": ["/packages/react-native-web-examples/"],
"node": "16"
}

View File

@@ -14,7 +14,7 @@ Fork, then clone the repo:
git clone https://github.com/your-username/react-native-web.git
```
Install dependencies (requires Node.js >= 14.0):
Install dependencies (requires Node.js >= 16.0):
```
npm install
@@ -86,7 +86,7 @@ Run all the automated tests:
npm run test
```
### New Features
## New Features
Please open an issue with a proposal for a new feature or refactoring before starting on the work. We don't want you to waste your efforts on a pull request that we won't want to accept.

View File

@@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v2
- uses: necolas/compressed-size-action@master
with:
build-script: "build -w react-native-web"
build-script: "compile"
exclude: "./packages/react-native-web/dist/cjs/{index.js,**/*.js}"
pattern: "./packages/react-native-web/dist/{index.js,**/*.js}"
repo-token: "${{ secrets.GITHUB_TOKEN }}"

View File

@@ -12,9 +12,9 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'
node-version: '16.x'
- run: npm install
# Install next-tagged versions
- run: npm update react@next react-dom@next
# Only run the unit tests
# Update react-native-web to use react@next
- run: npm update react@next react-dom@next -w react-native-web
# Run the unit tests
- run: npm run unit

View File

@@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'
node-version: '16.x'
- run: npm install
- run: npm run format
@@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'
node-version: '16.x'
- run: npm install
- run: npm run flow
@@ -34,7 +34,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'
node-version: '16.x'
- run: npm install
- run: npm run lint
@@ -44,6 +44,6 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'
node-version: '16.x'
- run: npm install
- run: npm run unit

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Nicolas Gallagher.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,5 +1,7 @@
# Development monorepo
This is the development monorepo for "React Native for Web" and related projects.
## Structure
* `.github`
@@ -23,7 +25,8 @@
* Use `npm run dev -w <package-name>` to run the dev script for a specific package.
* `test`
* Use `npm run test` to run tests for every package.
* Use `npm run test` to run tests for every package.
More details can be found in the contributing guide below.
## Contributing

87
package-lock.json generated
View File

@@ -9,6 +9,7 @@
"version": "0.0.0",
"license": "MIT",
"workspaces": [
"packages/react-native-web",
"packages/*"
],
"devDependencies": {
@@ -45,10 +46,7 @@
"lint-staged": "^10.5.4",
"minimist": "^1.2.6",
"npm-run-all": "^4.1.3",
"prettier": "^2.2.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-test-renderer": "^17.0.2"
"prettier": "^2.2.1"
}
},
"node_modules/@11ty/dependency-tree": {
@@ -13161,36 +13159,6 @@
"resolved": "packages/react-native-web-examples",
"link": true
},
"node_modules/react-shallow-renderer": {
"version": "16.14.1",
"resolved": "https://registry.npmjs.org/react-shallow-renderer/-/react-shallow-renderer-16.14.1.tgz",
"integrity": "sha512-rkIMcQi01/+kxiTE9D3fdS959U1g7gs+/rborw++42m1O9FAQiNI/UNRZExVUoAOprn4umcXf+pFRou8i4zuBg==",
"dev": true,
"license": "MIT",
"dependencies": {
"object-assign": "^4.1.1",
"react-is": "^16.12.0 || ^17.0.0"
},
"peerDependencies": {
"react": "^16.0.0 || ^17.0.0"
}
},
"node_modules/react-test-renderer": {
"version": "17.0.2",
"resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-17.0.2.tgz",
"integrity": "sha512-yaQ9cB89c17PUb0x6UfWRs7kQCorVdHlutU1boVPEsB8IDZH6n9tHxMacc3y0JoXOJUsZb/t/Mb8FUWMKaM7iQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"object-assign": "^4.1.1",
"react-is": "^17.0.2",
"react-shallow-renderer": "^16.13.1",
"scheduler": "^0.20.2"
},
"peerDependencies": {
"react": "17.0.2"
}
},
"node_modules/read-pkg": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz",
@@ -15850,7 +15818,7 @@
}
},
"packages/babel-plugin-react-native-web": {
"version": "0.18.2",
"version": "0.18.3",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.12.13",
@@ -15862,10 +15830,12 @@
"dependencies": {
"classnames": "^2.3.1",
"d3-scale-chromatic": "^2.0.0",
"react-native-web": "0.18.2"
"react": ">=17.0.2",
"react-dom": ">=17.0.2",
"react-native-web": "0.18.3"
},
"devDependencies": {
"babel-plugin-react-native-web": "0.18.2",
"babel-plugin-react-native-web": "0.18.3",
"css-loader": "^5.0.2",
"style-loader": "^2.0.0",
"url-loader": "^4.1.1",
@@ -15879,7 +15849,7 @@
"license": "MIT"
},
"packages/react-native-web": {
"version": "0.18.2",
"version": "0.18.3",
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.18.6",
@@ -15897,7 +15867,7 @@
}
},
"packages/react-native-web-docs": {
"version": "0.18.2",
"version": "0.18.3",
"devDependencies": {
"@11ty/eleventy": "^1.0.0",
"@11ty/eleventy-navigation": "^0.3.2",
@@ -15918,18 +15888,19 @@
}
},
"packages/react-native-web-examples": {
"version": "0.18.2",
"version": "0.18.3",
"license": "MIT",
"dependencies": {
"babel-plugin-react-native-web": "0.18.2",
"next": "^12.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-native-web": "0.18.2"
"react-native-web": "0.18.3"
},
"devDependencies": {
"@babel/core": "^7.12.13",
"@babel/preset-flow": "^7.12.13"
"@babel/preset-flow": "^7.12.13",
"babel-plugin-react-native-web": "0.18.3"
}
},
"packages/react-native-web/node_modules/@babel/runtime": {
@@ -19084,11 +19055,13 @@
"benchmarks": {
"version": "file:packages/benchmarks",
"requires": {
"babel-plugin-react-native-web": "0.18.2",
"babel-plugin-react-native-web": "0.18.3",
"classnames": "^2.3.1",
"css-loader": "^5.0.2",
"d3-scale-chromatic": "^2.0.0",
"react-native-web": "0.18.2",
"react": ">=17.0.2",
"react-dom": ">=17.0.2",
"react-native-web": "0.18.3",
"style-loader": "^2.0.0",
"url-loader": "^4.1.1",
"webpack": "^5.21.2",
@@ -25359,33 +25332,11 @@
"requires": {
"@babel/core": "^7.12.13",
"@babel/preset-flow": "^7.12.13",
"babel-plugin-react-native-web": "0.18.2",
"babel-plugin-react-native-web": "0.18.3",
"next": "^12.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-native-web": "0.18.2"
}
},
"react-shallow-renderer": {
"version": "16.14.1",
"resolved": "https://registry.npmjs.org/react-shallow-renderer/-/react-shallow-renderer-16.14.1.tgz",
"integrity": "sha512-rkIMcQi01/+kxiTE9D3fdS959U1g7gs+/rborw++42m1O9FAQiNI/UNRZExVUoAOprn4umcXf+pFRou8i4zuBg==",
"dev": true,
"requires": {
"object-assign": "^4.1.1",
"react-is": "^16.12.0 || ^17.0.0"
}
},
"react-test-renderer": {
"version": "17.0.2",
"resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-17.0.2.tgz",
"integrity": "sha512-yaQ9cB89c17PUb0x6UfWRs7kQCorVdHlutU1boVPEsB8IDZH6n9tHxMacc3y0JoXOJUsZb/t/Mb8FUWMKaM7iQ==",
"dev": true,
"requires": {
"object-assign": "^4.1.1",
"react-is": "^17.0.2",
"react-shallow-renderer": "^16.13.1",
"scheduler": "^0.20.2"
"react-native-web": "0.18.3"
}
},
"read-pkg": {

View File

@@ -5,6 +5,7 @@
"scripts": {
"clean": "del-cli ./packages/*/dist",
"build": "npm run clean && npm run build --workspaces --if-present",
"compile": "npm run build",
"dev": "npm run dev --workspaces --if-present",
"flow": "flow --flowconfig-name ./configs/.flowconfig",
"format": "prettier --check --ignore-path ./configs/.prettierignore \"**/*.js\"",
@@ -55,12 +56,10 @@
"lint-staged": "^10.5.4",
"minimist": "^1.2.6",
"npm-run-all": "^4.1.3",
"prettier": "^2.2.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-test-renderer": "^17.0.2"
"prettier": "^2.2.1"
},
"workspaces": [
"packages/react-native-web",
"packages/*"
],
"husky": {

View File

@@ -5,11 +5,13 @@
"scripts": {
"clean": "del-cli ./dist",
"build": "NODE_ENV=production npm run dev",
"dev": "npm run clean && mkdir -p dist && cp -f index.html dist/index.html && ./node_modules/.bin/webpack-cli --config ./webpack.config.js"
"dev": "npm run clean && mkdir -p dist && cp -f index.html dist/index.html && webpack --config ./webpack.config.js"
},
"dependencies": {
"classnames": "^2.3.1",
"d3-scale-chromatic": "^2.0.0",
"react": ">=17.0.2",
"react-dom": ">=17.0.2",
"react-native-web": "0.18.3"
},
"devDependencies": {

View File

@@ -10,7 +10,7 @@ The [documentation site](https://necolas.github.io/react-native-web/) ([source](
## Example
The [examples app](https://pk4zn6v4o0.sse.codesandbox.io/) ([source](https://github.com/necolas/react-native-web/blob/master/packages/react-native-web-examples)) demonstrates many available features. Fork the [codesandbox](https://codesandbox.io/s/github/necolas/react-native-web/tree/master/packages/react-native-web-examples)) to make changes and see the results.
The [examples app](https://pk4zn6v4o0.sse.codesandbox.io/) ([source](https://github.com/necolas/react-native-web/blob/master/packages/react-native-web-examples)) demonstrates many available features. Fork the [codesandbox](https://codesandbox.io/s/github/necolas/react-native-web/tree/master/packages/react-native-web-examples) to make changes and see the results.
You'll notice that there is no reference to `react-dom` in components. The `App` component that is shown below is defined using the APIs and Components of React Native, but it can also be rendered on the web using React Native for Web.