Skip to content
This repository
Browse code

Add support for a ‘make’ command

  • Loading branch information...
commit fbdf02a8713f3f5d8240c7633a7bec429e1ebe7c 1 parent 33bae27
František Hába authored March 07, 2012

Showing 2 changed files with 44 additions and 0 deletions. Show diff stats Hide diff stats

  1. 4  Makefile
  2. 40  tools/compile.js
4  Makefile
... ...
@@ -0,0 +1,4 @@
  1
+all: compile
  2
+
  3
+compile:
  4
+	@node ./tools/compile.js
40  tools/compile.js
... ...
@@ -0,0 +1,40 @@
  1
+var async = require('async');
  2
+var fs = require('fs');
  3
+
  4
+console.log('\nCompiling...');
  5
+
  6
+var files = [
  7
+  './src/intro.js',
  8
+  './src/utils/each.js',
  9
+  './src/utils/isArray.js',
  10
+  './src/utils/isEmpty.js',
  11
+  './src/utils/isObject.js',
  12
+  './src/utils/merge.js',
  13
+  './src/utils/pluck.js',
  14
+  './src/engines/json/intro.js',
  15
+  './src/engines/json/messages.js',
  16
+  './src/engines/json/error.js',
  17
+  './src/engines/json/validators.js',
  18
+  './src/engines/json/validation.js',
  19
+  './src/engines/json/outro.js',
  20
+  './src/amanda.js',
  21
+  './src/outro.js'
  22
+];
  23
+
  24
+var handleError = function(error) {
  25
+  console.log('An error occured.');
  26
+  console.log(error);
  27
+};
  28
+
  29
+async.mapSeries(files, function(fileName, callback) {
  30
+  return fs.readFile(fileName, callback);
  31
+}, function(error, content) {
  32
+
  33
+  if (error) return handleError(error);
  34
+
  35
+  fs.writeFile('./dist/latest.js', content.join('\n\n'), 'utf8', function(error) {
  36
+    if (error) return handleError(error);
  37
+    console.log('Done.\n');
  38
+  });
  39
+
  40
+});

0 notes on commit fbdf02a

Please sign in to comment.
Something went wrong with that request. Please try again.