UNPKG

1.17 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const command_1 = require("@oclif/command");
4const fs = require('fs');
5var helper = require('../helper');
6const path = require('path');
7var compile = require("node-elm-compiler").compile;
8const { exec } = require('child_process');
9const chokidar = require('chokidar');
10class Dev extends command_1.Command {
11 async run() {
12 const { args, flags } = this.parse(Dev);
13 var execOnWatch = true;
14 exec("stack exec server");
15 // One-liner for current directory, ignores .dotfiles
16 chokidar.watch(process.cwd() + "\\elm", { ignored: /(^|[\/\\])\../ }).on('all', (event, path) => {
17 if (execOnWatch === false) {
18 return;
19 }
20 helper.execWithOutput('elm make elm/Main.elm --output=static/index.js');
21 execOnWatch = false;
22 setTimeout(function () { execOnWatch = true; }, 6000);
23 });
24 }
25}
26Dev.description = 'describe the command here';
27Dev.flags = {
28 help: command_1.flags.help({ char: 'h' }),
29};
30Dev.args = [{ name: 'file' }];
31exports.default = Dev;