From 074861623e1b69cb12a6dd84d996a1dadbf79983 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Fri, 1 Jul 2022 20:35:02 -0700 Subject: [PATCH] Fix workflows and monorepo deps * Remove 'react' packages from monorepo dependencies. * Ensure 'react-native-web' package is built first. --- .codesandbox/ci.json | 2 +- .github/CONTRIBUTING.md | 4 +- .github/workflows/performance.yml | 2 +- .github/workflows/react-integration.yml | 8 +-- .github/workflows/tests.yml | 8 +-- LICENSE | 21 ++++++ README.md | 5 +- package-lock.json | 87 ++++++------------------- package.json | 7 +- packages/benchmarks/package.json | 4 +- packages/react-native-web/README.md | 2 +- 11 files changed, 63 insertions(+), 87 deletions(-) create mode 100644 LICENSE diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json index cf8a30c7..fb402b75 100644 --- a/.codesandbox/ci.json +++ b/.codesandbox/ci.json @@ -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" } diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index c53f72e2..bf305938 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -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. diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index 630963cc..2f8b4bcd 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -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 }}" diff --git a/.github/workflows/react-integration.yml b/.github/workflows/react-integration.yml index 8525de4d..6e105bb7 100644 --- a/.github/workflows/react-integration.yml +++ b/.github/workflows/react-integration.yml @@ -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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 820790f1..0c1479b9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..12405805 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md index 83283066..9b12bd4c 100644 --- a/README.md +++ b/README.md @@ -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 ` 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 diff --git a/package-lock.json b/package-lock.json index b54980ad..7fb0f6f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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": { diff --git a/package.json b/package.json index 9c9de545..8e708e3b 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/packages/benchmarks/package.json b/packages/benchmarks/package.json index 5a3ab6c1..1f416140 100644 --- a/packages/benchmarks/package.json +++ b/packages/benchmarks/package.json @@ -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": { diff --git a/packages/react-native-web/README.md b/packages/react-native-web/README.md index 9589280a..39d1aad6 100644 --- a/packages/react-native-web/README.md +++ b/packages/react-native-web/README.md @@ -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.