Sourcemaps

This commit is contained in:
Alexander Yakovlev 2017-07-31 22:22:54 +07:00
parent 0b4a0a2e01
commit 4cba17fa4b
3 changed files with 8 additions and 4 deletions

View File

@ -2,5 +2,6 @@ node_modules
src
npm-debug.log
lib/index.js
lib/index.coffee
test
Cakefile

View File

@ -17,7 +17,7 @@ for source in sources
sourcestring += 'src/'+source+' '
task 'watch', 'Watch source files and build changes', ->
watch = spawn "coffee", ['-c', '-w', '--no-header', '-j', 'lib/index.js', sourcestring]
watch = spawn "coffee", ['-c', '-w', '-m', '--no-header', '-j', 'lib/index.js', sourcestring]
watch.stdout.on 'data', (data) -> console.log data.toString().trim()
task 'compile', 'Compile all CoffeeScript files', ->
@ -26,16 +26,19 @@ task 'compile', 'Compile all CoffeeScript files', ->
fs.mkdirSync 'lib'
# run coffee-script compile
exec "cat #{sourcestring} | coffee --compile --stdio --no-header > lib/index.js", (err, stdout, stderr) ->
exec "cat #{sourcestring} > lib/index.coffee"
exec "coffee --compile --map --no-header lib/index.coffee", (err, stdout, stderr) ->
if err
util.log err
process.exit 1 # abort npm packaging
fs.unlink("lib/index.coffee", () -> )
util.log "Compiled CoffeeScript."
task 'build', 'Compile and minify all CoffeeScript files', ->
invoke 'compile'
exec "closure-compiler --compilation_level ECMASCRIPT5 --compilation_level SIMPLE --js_output_file lib/index.min.js lib/index.js", (err) ->
exec 'closure-compiler --compilation_level ECMASCRIPT5 --compilation_level SIMPLE --create_source_map=lib/index.min.js.map --js_output_file lib/index.min.js lib/index.js', (err) ->
if err
util.log err
process.exit 1 # abort npm packaging
fs.appendFileSync('lib/index.min.js', "\n//# sourceMappingURL=index.min.js.map")
util.log "Minified JavaScript."

View File

@ -1,6 +1,6 @@
{
"name": "salet",
"version": "1.8.3",
"version": "1.8.4",
"description": "A general client-side framework for cybertext interactive fiction games.",
"keywords": ["ifiction", "interactive fiction", "games", "coffee-script", "text", "menu"],
"homepage": "https://salet.su",