react-native-navigation的迁移库

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. const shellUtils = require('shell-utils');
  2. function installNavigation() {
  3. shellUtils.exec.execSync(`mkdir -p ./node_modules/react-native-navigation`);
  4. const navigationTar = shellUtils.exec.execSyncRead(`cd .. && npm pack`);
  5. shellUtils.exec.execSync(`tar -xf ../${navigationTar} -C ./node_modules/react-native-navigation --strip 1`);
  6. shellUtils.exec.execSync(`rm ../${navigationTar}`);
  7. if (!process.env.CI) {
  8. hardlinkNavigation();
  9. }
  10. }
  11. function copyNodeModulesFromNavigation() {
  12. shellUtils.exec.execSync(`cp -Rf ../node_modules ./`);
  13. }
  14. function removeHardlinks() {
  15. shellUtils.exec.execSync(`hardlink ./node_modules/react-native-navigation/ -u || true`);
  16. }
  17. function removeNodeModules() {
  18. shellUtils.exec.execSync(`rm -rf ./node_modules || true`);
  19. }
  20. function ignoreReactWarnings() {
  21. shellUtils.exec.execSync(`./scripts/ignoreReactWarnings.rb`);
  22. }
  23. function hardlinkNavigation() {
  24. shellUtils.exec.execSync(`hardlink ../ ./node_modules/react-native-navigation/ || true`);
  25. }
  26. function fixRN38() {
  27. shellUtils.exec.execSync(`node ./scripts/fixRN38.js`);
  28. }
  29. function run() {
  30. removeHardlinks();
  31. removeNodeModules();
  32. copyNodeModulesFromNavigation();
  33. installNavigation();
  34. ignoreReactWarnings();
  35. fixRN38();
  36. }
  37. run();