Skip to content

Commit

Permalink
feat: ESM only & named export
Browse files Browse the repository at this point in the history
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";
```
  • Loading branch information
gregberge committed Jun 19, 2022
1 parent 048c4ea commit a928d61
Show file tree
Hide file tree
Showing 18 changed files with 13,554 additions and 20,361 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
coverage/
20 changes: 20 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"root": true,
"env": {
"browser": true
},
"parser": "@babel/eslint-parser",
"extends": [
"eslint:recommended",
"plugin:react-hooks/recommended",
"plugin:react/recommended"
],
"rules": {
"react/prop-types": "off"
},
"settings": {
"react": {
"version": "detect"
}
}
}
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: npm ci
- run: npm run build
- run: npm run lint
- run: npm test --ci --coverage && npx codecov
29 changes: 0 additions & 29 deletions .github/workflows/node.js.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
/dist/
dist/
coverage/
3 changes: 1 addition & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/*
!/dist/**/*.{ts,js,map}
!/src/**/*.tsx?
**/*.test.tsx
**/*.test.tsx?
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
coverage/
dist/
package.json
package-lock.json
CHANGELOG.md
32 changes: 14 additions & 18 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
# How to Contribute

react-merge-refs is a small project, it uses [tsdx](https://github.com/jaredpalmer/tsdx) to simplify the development.
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.

## [Code of Conduct](https://github.com/gregberge/react-merge-refs/blob/master/CODE_OF_CONDUCT.md)
## [Code of Conduct](https://github.com/gregberge/react-teleporter/blob/main/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.
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.

## 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.
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.

### 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/
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/

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 clone https://github.com/gregberge/react-teleporter
$ cd react-teleporter
$ git checkout -b my_branch
```

Note: Replace `<your_username>` with your GitHub username

2. Run `npm install`

```sh
npm install
```

3. If you've added code that should be tested, add tests.

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

5. Ensure the test suite passes via `npm run test`.
5. Ensure the linting is good via `npm run lint`.

```sh-session
$ npm run lint
```

6. Ensure the test suite passes via `npm run test`.

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

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.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ npm install react-merge-refs

```js
import React from "react";
import mergeRefs from "react-merge-refs";
import { mergeRefs } from "react-merge-refs";

const Example = React.forwardRef(function Example(props, ref) {
const localRef = React.useRef();
Expand Down
8 changes: 8 additions & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* eslint-env node */
module.exports = {
presets: [
["@babel/preset-env", { targets: { node: "current" } }],
"@babel/preset-react",
"@babel/preset-typescript",
],
};
4 changes: 4 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* eslint-env node */
module.exports = {
testEnvironment: "jsdom",
};
Loading

0 comments on commit a928d61

Please sign in to comment.