react-native-yarn-workspaces-v2
Version:
React Native support for Yarn Workspaces.
33 lines (28 loc) • 784 B
JavaScript
const fs = require('fs');
const path = require('path');
const { symlinkPackage } = require('./utils');
const symlinkNecessaryPackages = projectPath => {
/**
* These are the packages which the react-native package use.
*/
const necessaryPkgs = [
'react-native',
'@react-native-community/cli-platform-android',
'@react-native-community/cli-platform-ios',
'hermes-engine',
'jsc-android'
];
const extras = JSON.parse(
fs.readFileSync(path.join(projectPath, 'package.json')).toString()
)['workspaces-symlink'];
if (extras) {
necessaryPkgs.push(...extras);
}
for (const pkg of necessaryPkgs) {
symlinkPackage(projectPath, pkg);
}
};
if (module === require.main) {
symlinkNecessaryPackages(path.resolve());
}