1. /**
    
  2.  * Copyright (c) Meta Platforms, Inc. and affiliates.
    
  3.  *
    
  4.  * This source code is licensed under the MIT license found in the
    
  5.  * LICENSE file in the root directory of this source tree.
    
  6.  */
    
  7. 
    
  8. 'use strict';
    
  9. 
    
  10. process.on('unhandledRejection', err => {
    
  11.   throw err;
    
  12. });
    
  13. 
    
  14. const chalk = require('chalk');
    
  15. const runFlow = require('../flow/runFlow');
    
  16. const inlinedHostConfigs = require('../shared/inlinedHostConfigs');
    
  17. 
    
  18. // This script is using `flow status` for a quick check with a server.
    
  19. // Use it for local development.
    
  20. 
    
  21. const primaryRenderer = inlinedHostConfigs.find(
    
  22.   info => info.isFlowTyped && info.shortName === process.argv[2]
    
  23. );
    
  24. if (!primaryRenderer) {
    
  25.   console.log(
    
  26.     'The ' +
    
  27.       chalk.red('yarn flow') +
    
  28.       ' command now requires you to pick a primary renderer:'
    
  29.   );
    
  30.   console.log();
    
  31.   inlinedHostConfigs.forEach(rendererInfo => {
    
  32.     if (rendererInfo.isFlowTyped) {
    
  33.       console.log('  * ' + chalk.cyan('yarn flow ' + rendererInfo.shortName));
    
  34.     }
    
  35.   });
    
  36.   console.log();
    
  37.   console.log(
    
  38.     'If you are not sure, run ' + chalk.green('yarn flow dom-node') + '.'
    
  39.   );
    
  40.   console.log(
    
  41.     'This will still typecheck non-DOM packages, although less precisely.'
    
  42.   );
    
  43.   console.log();
    
  44.   console.log('Note that checks for all renderers will run on CI.');
    
  45.   console.log(
    
  46.     'You can also do this locally with ' +
    
  47.       chalk.cyan('yarn flow-ci') +
    
  48.       ' but it will be slow.'
    
  49.   );
    
  50.   console.log();
    
  51.   process.exit(1);
    
  52. }
    
  53. 
    
  54. runFlow(primaryRenderer.shortName, ['status']);