<commit_before>#! /usr/bin/env node

const Gaze = require('gaze').Gaze;
const path = require('path');

// Process info
const flags = require('minimist')(process.argv.slice(2), {boolean: true});
const files = flags._;

// Print usage
if (flags.h) process.stdout.write(require('./help/usage'));
if (flags.help) process.stdout.write([
  require('./help/synopsis'),
  require('./help/what-it-does'),
  require('./help/options'),
].join('\n\n'));

// Exit early
if (flags.h || flags.help) process.exit(0);

// Watch
const cwd = process.cwd();
const gaze = new Gaze('**/*.elm');

gaze.on('all', (_, filePath) => {
  console.log(path.relative(cwd, filePath));
});<commit_msg>Spawn elm-reactor<commit_after>#! /usr/bin/env node

const Gaze = require('gaze').Gaze;
const path = require('path');
const spawnSync = require('child_process').spawnSync;

// Process info
const flags = require('minimist')(process.argv.slice(2), {boolean: true});

// Print usage
if (flags.h) process.stdout.write(require('./help/usage'));
if (flags.help) process.stdout.write([
  require('./help/synopsis'),
  require('./help/what-it-does'),
  require('./help/options'),
].join('\n\n'));

// Exit early
if (flags.h || flags.help) process.exit(0);

// Spawn elm-reactor
const reactorArgs = flags._;
const cwd = process.cwd();
const reactor = spawnSync('elm-reactor', {stdio: 'inherit'});
if (reactor.error) {
  if (reactor.error.code = 'ENOENT') {
    process.stderr.write(
`elm-live: I can’t find the command \`elm-reactor\`! Looks like elm-platform
  isn’t installed. Make sure you’ve followed the steps at http://npm.im/elm
  and that you can call \`elm-reactor\` on your command line.

  If that fails, have a look at open issues:
  https://github.com/tomekwi/elm-live/issues .

`
    );
    process.exit(1);
  } else {
    throw reactor.error;
  }
};

// Watch
const gaze = new Gaze('**/*.elm');

gaze.on('all', (_, filePath) => {
  console.log(path.relative(cwd, filePath));
});
{'fraction_non_alphanumeric': 0.2033811475409836, 'fraction_numerical': 0.0025614754098360654, 'mean_word_length': 3.9948849104859336, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4462342', 'n_tokens_mistral': 691, 'n_tokens_neox': 686, 'n_words': 159}