switching to 'Compiled' messages after the code has finished compiling on --watch ...
This commit is contained in:
parent
3bcca99cba
commit
4ecb1bb2ed
|
@ -153,9 +153,6 @@
|
||||||
if (curr.mtime.getTime() === prev.mtime.getTime()) {
|
if (curr.mtime.getTime() === prev.mtime.getTime()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (options.compile) {
|
|
||||||
puts(("Compiled " + source));
|
|
||||||
}
|
|
||||||
return fs.readFile(source, function(err, code) {
|
return fs.readFile(source, function(err, code) {
|
||||||
return compileScript(source, code.toString(), base);
|
return compileScript(source, code.toString(), base);
|
||||||
});
|
});
|
||||||
|
@ -172,7 +169,11 @@
|
||||||
dir = options.output ? path.join(options.output, baseDir) : srcDir;
|
dir = options.output ? path.join(options.output, baseDir) : srcDir;
|
||||||
jsPath = path.join(dir, filename);
|
jsPath = path.join(dir, filename);
|
||||||
compile = function() {
|
compile = function() {
|
||||||
return fs.writeFile(jsPath, js);
|
return fs.writeFile(jsPath, js, function(err) {
|
||||||
|
if (options.compile && options.watch) {
|
||||||
|
return puts(("Compiled " + source));
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
return path.exists(dir, function(exists) {
|
return path.exists(dir, function(exists) {
|
||||||
if (exists) {
|
if (exists) {
|
||||||
|
|
|
@ -255,7 +255,6 @@
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
this.expressions[idx] = last.makeReturn();
|
this.expressions[idx] = last.makeReturn();
|
||||||
// unless last.containsPureStatement()
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
// An **Expressions** is the only node that can serve as the root.
|
// An **Expressions** is the only node that can serve as the root.
|
||||||
|
|
|
@ -114,7 +114,6 @@ compileStdio: ->
|
||||||
watch: (source, base) ->
|
watch: (source, base) ->
|
||||||
fs.watchFile source, {persistent: true, interval: 500}, (curr, prev) ->
|
fs.watchFile source, {persistent: true, interval: 500}, (curr, prev) ->
|
||||||
return if curr.mtime.getTime() is prev.mtime.getTime()
|
return if curr.mtime.getTime() is prev.mtime.getTime()
|
||||||
puts "Compiled $source" if options.compile
|
|
||||||
fs.readFile source, (err, code) -> compileScript(source, code.toString(), base)
|
fs.readFile source, (err, code) -> compileScript(source, code.toString(), base)
|
||||||
|
|
||||||
# Write out a JavaScript source file with the compiled code. By default, files
|
# Write out a JavaScript source file with the compiled code. By default, files
|
||||||
|
@ -122,11 +121,13 @@ watch: (source, base) ->
|
||||||
# directory can be customized with `--output`.
|
# directory can be customized with `--output`.
|
||||||
writeJs: (source, js, base) ->
|
writeJs: (source, js, base) ->
|
||||||
filename: path.basename(source, path.extname(source)) + '.js'
|
filename: path.basename(source, path.extname(source)) + '.js'
|
||||||
srcDir: path.dirname source
|
srcDir: path.dirname source
|
||||||
baseDir: srcDir.substring base.length
|
baseDir: srcDir.substring base.length
|
||||||
dir: if options.output then path.join options.output, baseDir else srcDir
|
dir: if options.output then path.join options.output, baseDir else srcDir
|
||||||
jsPath: path.join dir, filename
|
jsPath: path.join dir, filename
|
||||||
compile: -> fs.writeFile jsPath, js
|
compile: ->
|
||||||
|
fs.writeFile jsPath, js, (err) ->
|
||||||
|
puts "Compiled $source" if options.compile and options.watch
|
||||||
path.exists dir, (exists) ->
|
path.exists dir, (exists) ->
|
||||||
if exists then compile() else exec "mkdir -p $dir", compile
|
if exists then compile() else exec "mkdir -p $dir", compile
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue