react-native-navigation的迁移库

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. const _ = require('lodash');
  2. const exec = require('shell-utils').exec;
  3. const release = _.includes(process.argv, '--release');
  4. run();
  5. function run() {
  6. try {
  7. const conf = release ? `release` : `debug`;
  8. exec.execSync(`detox build --configuration ios.sim.${conf}`);
  9. exec.execAsync(`sleep 10`).then(() => {
  10. exec.execAsync(`open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app`);
  11. });
  12. startRecording();
  13. exec.execSync(`detox test --configuration ios.sim.${conf} ${process.env.CI ? '--cleanup' : ''}`);
  14. } finally {
  15. stopRecording();
  16. }
  17. }
  18. function startRecording() {
  19. const screenId = exec.execSyncRead(`ffmpeg -f avfoundation -list_devices true -i "" 2>&1 | grep "Capture screen 0" | sed -e "s/.*\\[//" -e "s/\\].*//"`);
  20. exec.execAsync(`ffmpeg -f avfoundation -i "${screenId}:none" out.avi`);
  21. }
  22. function stopRecording() {
  23. exec.execSync(`ps -ef | grep ffmpeg`);
  24. exec.execSync(`killall ffmpeg || true`);
  25. exec.execSync(`ls -l out.avi`);
  26. exec.execAsync(`sleep 10`).then(() => {
  27. exec.execSync(`ls -l out.avi`);
  28. const json = require('./../package.json');
  29. json.name = 'fix-travis-rnn';
  30. json.version = `0.0.${Date.now()}`;
  31. require('fs').writeFileSync('./package.json', JSON.stringify(json, null, 2), { encoding: 'utf-8' });
  32. exec.execSync(`npm run release`);
  33. });
  34. }