-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also modernize the project and migrate it to gregberge/react-merge-refs.
- Loading branch information
Showing
20 changed files
with
4,912 additions
and
2,864 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github: gregberge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## 👉 [Please follow one of these issue templates](https://github.com/gregberge/react-merge-refs/issues/new/choose) 👈 | ||
|
||
Note: to keep the backlog clean and actionable, issues may be immediately closed if they do not follow one of the above issue templates. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
name: 🐛 Bug report | ||
about: Create a report to help us improve | ||
--- | ||
|
||
## 🐛 Bug Report | ||
|
||
A clear and concise description of what the bug is. | ||
|
||
## To Reproduce | ||
|
||
Steps to reproduce the behavior: | ||
|
||
## Expected behavior | ||
|
||
A clear and concise description of what you expected to happen. | ||
|
||
## Link to repl or repo (highly encouraged) | ||
|
||
Please provide a minimal repository on GitHub. | ||
|
||
Issues without a reproduction link are likely to stall. | ||
|
||
## Run `npx envinfo --system --binaries --npmPackages react-merge-refs,react,react-dom --markdown --clipboard` | ||
|
||
Paste the results here: | ||
|
||
```bash | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: 🚀 Feature Proposal | ||
about: Submit a proposal for a new feature | ||
--- | ||
|
||
## 🚀 Feature Proposal | ||
|
||
A clear and concise description of what the feature is. | ||
|
||
## Motivation | ||
|
||
Please outline the motivation for the proposal. | ||
|
||
## Example | ||
|
||
Please provide an example for how this feature would be used. | ||
|
||
## Pitch | ||
|
||
Why does this feature belong in the react-merge-refs ecosystem? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
name: 💬 Questions / Help | ||
about: If you have questions, please read full readme first | ||
--- | ||
|
||
## 💬 Questions and Help | ||
|
||
This project project is young, but please before asking your question: | ||
|
||
- Read carefully the README of the project | ||
- Search if your answer has already been answered in old issues | ||
|
||
After you can submit your question and we will be happy to help you! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
name: 💥 Regression Report | ||
about: Report unexpected behavior that worked in previous versions | ||
--- | ||
|
||
## 💥 Regression Report | ||
|
||
A clear and concise description of what the regression is. | ||
|
||
## Last working version | ||
|
||
Worked up to version: | ||
|
||
Stopped working in version: | ||
|
||
## To Reproduce | ||
|
||
Steps to reproduce the behavior: | ||
|
||
## Expected behavior | ||
|
||
A clear and concise description of what you expected to happen. | ||
|
||
## Link to repl or repo (highly encouraged) | ||
|
||
Please provide a minimal repository on GitHub. | ||
|
||
Issues without a reproduction link are likely to stall. | ||
|
||
## `npx envinfo --system --binaries --npmPackages react-merge-refs,react,react-dom --markdown --clipboard` | ||
|
||
Paste the results here: | ||
|
||
```bash | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. --> | ||
|
||
## Summary | ||
|
||
<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? --> | ||
|
||
## Test plan | ||
|
||
<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* | ||
!/dist/**/*.js | ||
!/src/**/*.js | ||
*.test.js | ||
!/dist/**/*.{ts,js,map} | ||
!/src/**/*.tsx? | ||
**/*.test.tsx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
language: node_js | ||
|
||
node_js: | ||
- 10 | ||
- 14 | ||
|
||
branches: | ||
only: | ||
- "master" | ||
|
||
notifications: | ||
email: false | ||
|
||
cache: | ||
yarn: true | ||
directories: | ||
- 'node_modules' | ||
- "node_modules" | ||
|
||
git: | ||
depth: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# How to Contribute | ||
|
||
react-merge-refs is a small project, it uses [tsdx](https://github.com/jaredpalmer/tsdx) to simplify the development. | ||
|
||
## [Code of Conduct](https://github.com/gregberge/react-merge-refs/blob/master/CODE_OF_CONDUCT.md) | ||
|
||
We expect project participants to adhere to our Code of Conduct. Please read [the full text](https://github.com/gregberge/react-merge-refs/blob/master/CODE_OF_CONDUCT.md) so that you can understand what actions will and will not be tolerated. | ||
|
||
## Open Development | ||
|
||
All work on react-merge-refs happens directly on [GitHub](/). Both core team members and external contributors send pull requests which go through the same review process. | ||
|
||
### Workflow and Pull Requests | ||
|
||
_Before_ submitting a pull request, please make sure the following is done… | ||
|
||
1. Fork the repo and create your branch from `master`. A guide on how to fork a repository: https://help.github.com/articles/fork-a-repo/ | ||
|
||
Open terminal (e.g. Terminal, iTerm, Git Bash or Git Shell) and type: | ||
|
||
```sh-session | ||
$ git clone https://github.com/<your_username>/react-merge-refs | ||
$ cd react-merge-refs | ||
$ git checkout -b my_branch | ||
``` | ||
|
||
Note: Replace `<your_username>` with your GitHub username | ||
|
||
2. This project uses [Yarn](https://code.fb.com/web/yarn-a-new-package-manager-for-javascript/) for running development scripts. If you haven't already done so, please [install yarn](https://yarnpkg.com/en/docs/install). | ||
|
||
3. Run `yarn install`. On Windows: To install [Yarn](https://yarnpkg.com/en/docs/install#windows-tab) on Windows you may need to download either node.js or Chocolatey<br /> | ||
|
||
```sh | ||
yarn install | ||
``` | ||
|
||
To check your version of Yarn and ensure it's installed you can type: | ||
|
||
```sh | ||
yarn --version | ||
``` | ||
|
||
4. If you've added code that should be tested, add tests. | ||
|
||
5. If you've changed APIs, update the documentation. | ||
|
||
6. Ensure the test suite passes via `yarn test`. | ||
|
||
```sh-session | ||
$ yarn test | ||
``` | ||
|
||
## Bugs | ||
|
||
### Where to Find Known Issues | ||
|
||
We will be using GitHub Issues for our public bugs. We will keep a close eye on this and try to make it clear when we have an internal fix in progress. Before filing a new issue, try to make sure your problem doesn't already exist. | ||
|
||
### Reporting New Issues | ||
|
||
The best way to get your bug fixed is to provide a reduced test case. Please provide a public repository with a runnable example. | ||
|
||
## Code Conventions | ||
|
||
This project uses [Prettier](https://prettier.io/). | ||
|
||
## License | ||
|
||
By contributing to this project, you agree that your contributions will be licensed under its MIT license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,21 @@ | ||
Copyright 2019 Smooth Code | ||
MIT License | ||
|
||
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: | ||
Copyright (c) 2020 Greg Bergé | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
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 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. | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,28 +10,32 @@ | |
"author": "Greg Bergé <[email protected]>", | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"umd:main": "dist/index.umd.js", | ||
"module": "dist/index.mjs", | ||
"source": "src/index.js", | ||
"module": "dist/react-merge-refs.esm.js", | ||
"typings": "dist/index.d.ts", | ||
"repository": "github:gregberge/react-merge-refs", | ||
"funding": { | ||
"type": "github", | ||
"url": "https://github.com/sponsors/gregberge" | ||
}, | ||
"scripts": { | ||
"test": "jest", | ||
"prebuild": "rm -rf dist/", | ||
"build": "microbundle --external react", | ||
"prepublishOnly": "yarn build", | ||
"release": "standard-version && conventional-github-releaser --preset angular" | ||
"release": "standard-version && conventional-github-releaser --preset angular", | ||
"start": "tsdx watch", | ||
"test": "tsdx test", | ||
"build": "tsdx build" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.6.0", | ||
"@babel/preset-env": "^7.6.0", | ||
"@babel/preset-react": "^7.0.0", | ||
"@testing-library/react": "^9.1.4", | ||
"babel-core": "^7.0.0-0", | ||
"babel-jest": "^24.9.0", | ||
"@testing-library/react": "^10.4.7", | ||
"@types/react": "^16.9.34", | ||
"@types/react-dom": "^16.9.7", | ||
"conventional-github-releaser": "^3.1.3", | ||
"jest": "^24.9.0", | ||
"microbundle": "^0.11.0", | ||
"react": "^16.9.0", | ||
"react-dom": "^16.9.0", | ||
"standard-version": "^7.0.0" | ||
"jest": "^26.1.0", | ||
"microbundle": "^0.12.3", | ||
"react": "^16.13.1", | ||
"react-dom": "^16.13.1", | ||
"standard-version": "^8.0.2", | ||
"tsdx": "^0.13.2", | ||
"tslib": "^2.0.0", | ||
"typescript": "^3.8.3" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as React from "react"; | ||
import { render } from "@testing-library/react"; | ||
import mergeRefs from "."; | ||
|
||
test("mergeRefs", () => { | ||
const Dummy = React.forwardRef(function Dummy(_, ref) { | ||
React.useImperativeHandle(ref, () => "refValue"); | ||
return null; | ||
}); | ||
const refAsFunc = jest.fn(); | ||
const refAsObj = { current: undefined }; | ||
const Example: React.FC<{ visible: boolean }> = ({ visible }) => { | ||
return visible ? <Dummy ref={mergeRefs([refAsObj, refAsFunc])} /> : null; | ||
}; | ||
const { rerender } = render(<Example visible />); | ||
expect(refAsFunc).toHaveBeenCalledTimes(1); | ||
expect(refAsFunc).toHaveBeenCalledWith("refValue"); | ||
expect(refAsObj.current).toBe("refValue"); | ||
rerender(<Example visible={false} />); | ||
expect(refAsFunc).toHaveBeenCalledTimes(2); | ||
expect(refAsFunc).toHaveBeenCalledWith(null); | ||
expect(refAsObj.current).toBe(null); | ||
}); |
Oops, something went wrong.