From b849737d01bc5bce6eecc205d5dc61a2709c88dc Mon Sep 17 00:00:00 2001 From: Jesse Katsumata Date: Wed, 8 Apr 2020 18:17:19 +0900 Subject: [PATCH 1/3] docs: add badges to readme --- README.md | 26 +++++++++++++++----------- package.json | 16 ++++++++++------ 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 625c52b..efd4ef4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ -# Node.js mock for react-native-config +# react-native-config-node +[![Version][version-badge]][package] +[![semantic-release][semantic-release-badge]](https://github.com/semantic-release/semantic-release) +[![MIT License][license-badge]][license] + +Node.js mock for react-native-config 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/). @@ -66,14 +71,7 @@ Add the following to your .babelrc "presets": ["module:metro-react-native-babel-preset"], "env": { "test": { - "plugins": [ - [ - "import-rename", - { - "^react-native-config$": "react-native-config-node" - } - ] - ] + "plugins": ['react-native-config-node/transform'] } } } @@ -90,13 +88,13 @@ NODE_ENV=staging jest `react-native-config-node/transform` is a babel-plugin transforming the following code ```js -import Config from `react-native-config` +import Config from 'react-native-config' ``` into ```js -import Config from `react-native-config-node` +import Config from 'react-native-config-node' ``` `react-native-config-node` offers the same API as `react-native-config` using [dotenv](https://www.npmjs.com/package/dotenv). @@ -105,3 +103,9 @@ import Config from `react-native-config-node` ## License MIT + +[semantic-release-badge]:https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg +[license]: https://opensource.org/licenses/MIT +[version-badge]: https://img.shields.io/npm/v/react-native-config-node.svg +[package]: https://www.npmjs.com/package/react-native-config-node +[license-badge]: https://img.shields.io/npm/l/react-naative-config-node.svg?style=flat-square diff --git a/package.json b/package.json index 9ecb7ad..f7cc0d3 100644 --- a/package.json +++ b/package.json @@ -2,23 +2,27 @@ "name": "react-native-config-node", "version": "0.0.3", "description": "Mock for react-native-config in nodejs environment, used for testing", - "main": "index", "keywords": [ "env", "react-native", "12factor", "config" ], - "scripts": { - "test": "mocha test/transform.js && cd test && ./run-test.sh" - }, + "homepage": "https://github.com/CureApp/react-native-config-node", "repository": { "type": "git", "url": "https://github.com/CureApp/react-native-config-node.git" }, - "homepage": "https://github.com/CureApp/react-native-config-node", - "author": "CureApp, Inc.", "license": "MIT", + "author": "CureApp, Inc.", + "main": "index.js", + "files": [ + "index.js", + "transform.js" + ], + "scripts": { + "test": "mocha test/transform.js && cd test && ./run-test.sh" + }, "dependencies": { "dotenv": "^8.2.0" }, From 7d0f65580a3a838d5839df37a4a6ca909146c8cb Mon Sep 17 00:00:00 2001 From: Jesse Katsumata Date: Wed, 8 Apr 2020 18:18:45 +0900 Subject: [PATCH 2/3] docs: fix plugin in README --- README.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/README.md b/README.md index efd4ef4..c9a4091 100644 --- a/README.md +++ b/README.md @@ -58,13 +58,8 @@ NODE_ENV=staging mocha --compilers js:./test/lib/babel-register test/spec/*.js ## Jest -In order to use this mock with jest, you will need to add a plugin that renames imported module. -``` -npm i babel-plugin-import-rename --save-dev -``` - -Add the following to your .babelrc +Add the following plugin to your `babel.config.js` or `.babelrc` ``` { From 994c54f22ffe9db7c287dfbc4288e221a0bba16f Mon Sep 17 00:00:00 2001 From: Jesse Katsumata Date: Wed, 8 Apr 2020 18:21:03 +0900 Subject: [PATCH 3/3] docs: fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c9a4091..66ff306 100644 --- a/README.md +++ b/README.md @@ -103,4 +103,4 @@ MIT [license]: https://opensource.org/licenses/MIT [version-badge]: https://img.shields.io/npm/v/react-native-config-node.svg [package]: https://www.npmjs.com/package/react-native-config-node -[license-badge]: https://img.shields.io/npm/l/react-naative-config-node.svg?style=flat-square +[license-badge]: https://img.shields.io/npm/l/react-native-config-node.svg