Skip to content
This repository was archived by the owner on Mar 25, 2022. It is now read-only.

Commit 998c657

Browse files
author
Jesse Katsumata
authored
chore(docs): add badges to readme (#16)
* docs: add badges to readme * docs: fix plugin in README * docs: fix typo
1 parent fb1656d commit 998c657

2 files changed

Lines changed: 26 additions & 23 deletions

File tree

README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# Node.js mock for react-native-config
1+
# react-native-config-node
2+
[![Version][version-badge]][package]
3+
[![semantic-release][semantic-release-badge]](https://github.com/semantic-release/semantic-release)
4+
[![MIT License][license-badge]][license]
5+
6+
Node.js mock for react-native-config
27

38
A mock for [react-native-config](https://github.com/luggg/react-native-config), a module which offers an elegant way to inject environment-specific variables to [react-native](https://facebook.github.io/react-native/).
49

@@ -53,27 +58,15 @@ NODE_ENV=staging mocha --compilers js:./test/lib/babel-register test/spec/*.js
5358

5459
## Jest
5560

56-
In order to use this mock with jest, you will need to add a plugin that renames imported module.
5761

58-
```
59-
npm i babel-plugin-import-rename --save-dev
60-
```
61-
62-
Add the following to your .babelrc
62+
Add the following plugin to your `babel.config.js` or `.babelrc`
6363

6464
```
6565
{
6666
"presets": ["module:metro-react-native-babel-preset"],
6767
"env": {
6868
"test": {
69-
"plugins": [
70-
[
71-
"import-rename",
72-
{
73-
"^react-native-config$": "react-native-config-node"
74-
}
75-
]
76-
]
69+
"plugins": ['react-native-config-node/transform']
7770
}
7871
}
7972
}
@@ -90,13 +83,13 @@ NODE_ENV=staging jest
9083
`react-native-config-node/transform` is a babel-plugin transforming the following code
9184

9285
```js
93-
import Config from `react-native-config`
86+
import Config from 'react-native-config'
9487
```
9588

9689
into
9790

9891
```js
99-
import Config from `react-native-config-node`
92+
import Config from 'react-native-config-node'
10093
```
10194

10295
`react-native-config-node` offers the same API as `react-native-config` using [dotenv](https://www.npmjs.com/package/dotenv).
@@ -105,3 +98,9 @@ import Config from `react-native-config-node`
10598
## License
10699

107100
MIT
101+
102+
[semantic-release-badge]:https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
103+
[license]: https://opensource.org/licenses/MIT
104+
[version-badge]: https://img.shields.io/npm/v/react-native-config-node.svg
105+
[package]: https://www.npmjs.com/package/react-native-config-node
106+
[license-badge]: https://img.shields.io/npm/l/react-native-config-node.svg

package.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,27 @@
22
"name": "react-native-config-node",
33
"version": "0.0.3",
44
"description": "Mock for react-native-config in nodejs environment, used for testing",
5-
"main": "index",
65
"keywords": [
76
"env",
87
"react-native",
98
"12factor",
109
"config"
1110
],
12-
"scripts": {
13-
"test": "mocha test/transform.js && cd test && ./run-test.sh"
14-
},
11+
"homepage": "https://github.com/CureApp/react-native-config-node",
1512
"repository": {
1613
"type": "git",
1714
"url": "https://github.com/CureApp/react-native-config-node.git"
1815
},
19-
"homepage": "https://github.com/CureApp/react-native-config-node",
20-
"author": "CureApp, Inc.",
2116
"license": "MIT",
17+
"author": "CureApp, Inc.",
18+
"main": "index.js",
19+
"files": [
20+
"index.js",
21+
"transform.js"
22+
],
23+
"scripts": {
24+
"test": "mocha test/transform.js && cd test && ./run-test.sh"
25+
},
2226
"dependencies": {
2327
"dotenv": "^8.2.0"
2428
},

0 commit comments

Comments
 (0)