Skip to content

Commit a928d61

Browse files
committed
feat: ESM only & named export
BREAKING CHANGE: The package now exports ESM only and a named export. **Before:** ```js import mergeRefs from "react-merge-refs"; ``` **After:** ```js import { mergeRefs } from "react-merge-refs"; ```
1 parent 048c4ea commit a928d61

18 files changed

+13554
-20361
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
dist/
3+
coverage/

.eslintrc.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"root": true,
3+
"env": {
4+
"browser": true
5+
},
6+
"parser": "@babel/eslint-parser",
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:react-hooks/recommended",
10+
"plugin:react/recommended"
11+
],
12+
"rules": {
13+
"react/prop-types": "off"
14+
},
15+
"settings": {
16+
"react": {
17+
"version": "detect"
18+
}
19+
}
20+
}

.github/workflows/ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-node@v3
16+
- run: npm ci
17+
- run: npm run build
18+
- run: npm run lint
19+
- run: npm test --ci --coverage && npx codecov

.github/workflows/node.js.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules/
2-
/dist/
2+
dist/
3+
coverage/

.npmignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
/*
22
!/dist/**/*.{ts,js,map}
3-
!/src/**/*.tsx?
4-
**/*.test.tsx
3+
**/*.test.tsx?

.prettierignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
coverage/
3+
dist/
4+
package.json
5+
package-lock.json
6+
CHANGELOG.md

CONTRIBUTING.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
# How to Contribute
22

3-
react-merge-refs is a small project, it uses [tsdx](https://github.com/jaredpalmer/tsdx) to simplify the development.
3+
It is a small project, it is widely used but has not a lot of contributors. We're still working out the kinks to make contributing to this project as easy and transparent as possible, but we're not quite there yet. Hopefully this document makes the process for contributing clear and answers some questions that you may have.
44

5-
## [Code of Conduct](https://github.com/gregberge/react-merge-refs/blob/master/CODE_OF_CONDUCT.md)
5+
## [Code of Conduct](https://github.com/gregberge/react-teleporter/blob/main/CODE_OF_CONDUCT.md)
66

7-
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.
7+
We expect project participants to adhere to our Code of Conduct. Please read [the full text](https://github.com/gregberge/react-teleporter/blob/main/CODE_OF_CONDUCT.md) so that you can understand what actions will and will not be tolerated.
88

99
## Open Development
1010

11-
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.
11+
All work on this project happens directly on [GitHub](/). Both core team members and external contributors send pull requests which go through the same review process.
1212

1313
### Workflow and Pull Requests
1414

1515
_Before_ submitting a pull request, please make sure the following is done…
1616

17-
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/
17+
1. Fork the repo and create your branch from `main`. A guide on how to fork a repository: https://help.github.com/articles/fork-a-repo/
1818

1919
Open terminal (e.g. Terminal, iTerm, Git Bash or Git Shell) and type:
2020

2121
```sh-session
22-
$ git clone https://github.com/<your_username>/react-merge-refs
23-
$ cd react-merge-refs
22+
$ git clone https://github.com/gregberge/react-teleporter
23+
$ cd react-teleporter
2424
$ git checkout -b my_branch
2525
```
2626

27-
Note: Replace `<your_username>` with your GitHub username
28-
2927
2. Run `npm install`
3028

31-
```sh
32-
npm install
33-
```
34-
3529
3. If you've added code that should be tested, add tests.
3630

3731
4. If you've changed APIs, update the documentation.
3832

39-
5. Ensure the test suite passes via `npm run test`.
33+
5. Ensure the linting is good via `npm run lint`.
34+
35+
```sh-session
36+
$ npm run lint
37+
```
38+
39+
6. Ensure the test suite passes via `npm run test`.
4040

4141
```sh-session
4242
$ npm run test
@@ -52,10 +52,6 @@ We will be using GitHub Issues for our public bugs. We will keep a close eye on
5252

5353
The best way to get your bug fixed is to provide a reduced test case. Please provide a public repository with a runnable example.
5454

55-
## Code Conventions
56-
57-
This project uses [Prettier](https://prettier.io/).
58-
5955
## License
6056

6157
By contributing to this project, you agree that your contributions will be licensed under its MIT license.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ npm install react-merge-refs
1212

1313
```js
1414
import React from "react";
15-
import mergeRefs from "react-merge-refs";
15+
import { mergeRefs } from "react-merge-refs";
1616

1717
const Example = React.forwardRef(function Example(props, ref) {
1818
const localRef = React.useRef();

babel.config.cjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* eslint-env node */
2+
module.exports = {
3+
presets: [
4+
["@babel/preset-env", { targets: { node: "current" } }],
5+
"@babel/preset-react",
6+
"@babel/preset-typescript",
7+
],
8+
};

jest.config.cjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* eslint-env node */
2+
module.exports = {
3+
testEnvironment: "jsdom",
4+
};

0 commit comments

Comments
 (0)