Skip to content

Commit

Permalink
#376 Fix react-native tooling with rimraf
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredpalmer committed Feb 7, 2018
1 parent 54db7ce commit 6a5d963
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"dist"
],
"scripts": {
"postinstall": "rimraf ./node_modules/@types/node",
"test": "jest --env=jsdom",
"test:watch": "npm run test -- --watch",
"start": "cross-env NODE_ENV=development tsc-watch --project tsconfig.base.json --onSuccess \"rollup -c\"",
Expand Down Expand Up @@ -54,7 +55,7 @@
"@types/prop-types": "15.5.1",
"@types/react": "16.0.28",
"@types/react-dom": "16.0.3",
"@types/react-native": "^0.52.5",
"@types/react-native": "^0.52.8",
"@types/react-test-renderer": "15.5.2",
"@types/warning": "^3.0.0",
"all-contributors-cli": "^4.4.0",
Expand All @@ -69,7 +70,7 @@
"prettier": "^1.8.2",
"react": "16.2.0",
"react-dom": "16.2.0",
"rimraf": "2.6.1",
"rimraf": "^2.6.2",
"rollup": "^0.55.3",
"rollup-plugin-commonjs": "8.1.0",
"rollup-plugin-filesize": "1.4.2",
Expand Down
13 changes: 12 additions & 1 deletion src/formik.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as PropTypes from 'prop-types';
import * as React from 'react';
import isEqual from 'lodash.isequal';
import warning from 'warning';
import { GestureResponderEvent } from 'react-native';
import {
isFunction,
Expand All @@ -10,7 +11,17 @@ import {
setDeep,
setNestedObjectValues,
} from './utils';
import warning from 'warning';

/**
* We need to fix a TypeScript x Yarn x React Native bug that occurs
* when you try to use @types/node and @types/react-native in the
* same project. because of how react native's typings have their own
* global declarations for require(). To fix this, Formik removes
* ./node_modules/@types/node upon postinstall and then must declare
* the only parts of @types/node it needs: process.env
*
* @see https://github.com/jaredpalmer/formik/issues/376
*/
declare const process: { env: { NODE_ENV: string } };

/**
Expand Down
14 changes: 4 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
"@types/node" "*"
"@types/react" "*"

"@types/react-native@^0.52.5":
version "0.52.5"
resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.52.5.tgz#115bce4d15b1adb5f951b2f751e77d8e97b0c77b"
"@types/react-native@^0.52.8":
version "0.52.8"
resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.52.8.tgz#dd5aa7c4eb944d7c0b2b249a2bb811aa119f49c6"
dependencies:
"@types/react" "*"

Expand Down Expand Up @@ -3200,18 +3200,12 @@ right-align@^0.1.1:
dependencies:
align-text "^0.1.1"

rimraf@2, rimraf@^2.5.1, rimraf@^2.6.1:
rimraf@2, rimraf@^2.5.1, rimraf@^2.6.1, rimraf@^2.6.2:
version "2.6.2"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36"
dependencies:
glob "^7.0.5"

rimraf@2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d"
dependencies:
glob "^7.0.5"

rollup-plugin-commonjs@8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.1.0.tgz#8ac9a87e6ea4c0d136e3e0e25ef41058957622b0"
Expand Down

0 comments on commit 6a5d963

Please sign in to comment.