1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const command_1 = require("@oclif/command");
|
4 | const fs = require('fs');
|
5 | var helper = require('../helper');
|
6 | const path = require('path');
|
7 | var compile = require("node-elm-compiler").compile;
|
8 | const { exec } = require('child_process');
|
9 | const chokidar = require('chokidar');
|
10 | class 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 |
|
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 | }
|
26 | Dev.description = 'describe the command here';
|
27 | Dev.flags = {
|
28 | help: command_1.flags.help({ char: 'h' }),
|
29 | };
|
30 | Dev.args = [{ name: 'file' }];
|
31 | exports.default = Dev;
|