diff --git a/.gitignore b/.gitignore index 8f028e4..07e6e47 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -/node_modules/ -/lib/ +/node_modules diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 53a5757..0000000 --- a/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -/node_modules/ -readme.md -TODO -src/lib/ -Cokefile diff --git a/Cokefile b/Cokefile deleted file mode 100644 index fe81b23..0000000 --- a/Cokefile +++ /dev/null @@ -1,18 +0,0 @@ -const {spawn} = require('child_process') - -const exec = !(cmd, args=[], cb=->) -> - const bin = spawn(cmd, args) - bin.stdout.on \data, !(data) -> - process.stdout.write data - bin.stderr.on \data, !(data) -> - process.stderr.write data - bin.on \exit, cb - -const compile = !(watch_flag="") -> - const coco_flags = "-#{watch_flag}cbo" - exec 'coco', [coco_flags, "./lib/", "./src/lib/"] - exec 'coco', [coco_flags, "./lib/", "./src/shared/chem/"] - -task 'watch', !-> compile('w') - -task 'build', compile diff --git a/readme.md b/README.md similarity index 99% rename from readme.md rename to README.md index 90f8e4b..59311d7 100644 --- a/readme.md +++ b/README.md @@ -732,7 +732,4 @@ class Vec2d # set up dev environment for chem itself: sudo apt-get install libcairo2-dev sudo npm link - - # while developing: - npm run dev diff --git a/bin/chem b/bin/chem deleted file mode 100755 index 2ee5e3d..0000000 --- a/bin/chem +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node - -var path = require('path'); -var fs = require('fs'); -var bin_dir = path.dirname(fs.realpathSync(__filename)); -var chem_path = path.resolve(bin_dir, "..", "lib", "chem"); -require(chem_path).run(); diff --git a/index.js b/index.js new file mode 100755 index 0000000..e20861e --- /dev/null +++ b/index.js @@ -0,0 +1,351 @@ +#!/usr/bin/env node + +exports.run = run; + +var fs = require('fs') + , path = require('path') + , chokidar = require('chokidar') + , Vec2d = require('vec2d').Vec2d + , findit = require('findit') + , spawn = require('child_process').spawn + , jspackage = require('jspackage') + , express = require('express') + , Spritesheet = require('spritesheet') + , Batch = require('batch') + , client_out = userPath("./public/main.js") + , img_path = userPath("./assets/img") + , spritesheet_out = userPath("./public/spritesheet.png") + , animations_json_out = userPath("./public/animations.json") + , objHasOwn = {}.hasOwnProperty; + +var chemfile_path = null; +var all_out_files = [ + client_out, + spritesheet_out, + animations_json_out +]; + +var tasks = { + help: function(){ + process.stderr.write("Usage: \n\n # create a new project\n # possible templates are: meteor, readme, readme-coco\n \n chem init [--example