Skip to content

Commit

Permalink
download react-is from npm manually
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Oct 3, 2019
1 parent 66769c2 commit 915b0ca
Show file tree
Hide file tree
Showing 3 changed files with 224 additions and 22 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"mkdirp": "^0.5.1",
"ncp": "^2.0.0",
"object-assign": "^4.1.1",
"pacote": "^9.5.6",
"prettier": "1.13.7",
"prop-types": "^15.6.2",
"random-seed": "^0.3.0",
Expand Down Expand Up @@ -100,7 +101,7 @@
"lint": "node ./scripts/tasks/eslint.js",
"lint-build": "node ./scripts/rollup/validate/index.js",
"extract-errors": "yarn build --type=dev --extract-errors",
"postinstall": "node node_modules/fbjs-scripts/node/check-dev-engines.js package.json && node ./scripts/flow/createFlowConfigs.js",
"postinstall": "node node_modules/fbjs-scripts/node/check-dev-engines.js package.json && node ./scripts/flow/createFlowConfigs.js && node ./scripts/yarn/downloadReactIsForPrettyFormat.js",
"debug-test": "cross-env NODE_ENV=development node --inspect-brk node_modules/.bin/jest --config ./scripts/jest/config.source.js --runInBand",
"test": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.source.js",
"test-persistent": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.source-persistent.js",
Expand Down
30 changes: 30 additions & 0 deletions scripts/yarn/downloadReactIsForPrettyFormat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict';

const path = require('path');
const pacote = require('pacote');
const rimraf = require('rimraf');
const prettyFormatPkg = require('pretty-format/package.json');
const prettyFormatPkgPath = require.resolve('pretty-format/package.json');

const reactIsDependencyVersion = prettyFormatPkg.dependencies['react-is'];

if (!reactIsDependencyVersion) {
throw new Error('Unable to find `react-is` dependency in `pretty-format`');
}

const prettyFormatNodeModulesReactIsDir = path.join(
path.dirname(prettyFormatPkgPath),
'node_modules/react-is'
);

rimraf.sync(prettyFormatNodeModulesReactIsDir);

pacote
.extract(
`react-is@${reactIsDependencyVersion}`,
prettyFormatNodeModulesReactIsDir
)
.catch(error => {
console.error(error);
process.exitCode = 1;
});
Loading

0 comments on commit 915b0ca

Please sign in to comment.