Permalink
Browse files

add npm dependencies. simplify Makefile. remove jshint checks. remove…

… unnecessary build files.
  • Loading branch information...
trevnorris committed Mar 7, 2012
1 parent d0cd1b0 commit 3fa6ea35ee48fc977e1427e7ddde4c22c3ba07a4
Showing with 64 additions and 7,284 deletions.
  1. +1 −0 .gitignore
  2. +36 −53 Makefile
  3. +0 −39 build/jshint-check.js
  4. +0 −3,871 build/lib/jshint.js
  5. +0 −1,315 build/lib/parse-js.js
  6. +0 −1,666 build/lib/process.js
  7. +0 −22 build/lib/squeeze-more.js
  8. +0 −26 build/md2html.js
  9. +0 −7 build/post-compile.js
  10. +0 −285 build/uglify.js
  11. +27 −0 package.json
View
@@ -1 +1,2 @@
dist
+node_modules
View
@@ -1,67 +1,50 @@
-SRC_DIR = src
-TEST_DIR = test
-BUILD_DIR = build
-
-PREFIX = .
-DIST_DIR = ${PREFIX}/dist
-
-JS_ENGINE ?= `which node nodejs`
-COMPILER = ${JS_ENGINE} ${BUILD_DIR}/uglify.js --unsafe
-
-BASE_FILES = ${SRC_DIR}/core.js\
- ${SRC_DIR}/distribution.js\
- ${SRC_DIR}/special.js\
- ${SRC_DIR}/linearalgebra.js
-
-JS = ${DIST_DIR}/jstat.js
-JS_MIN = ${DIST_DIR}/jstat.min.js
+NODE_PATH ?= ./node_modules
+DIST_DIR = ./dist
+JS_COMPILER = $(NODE_PATH)/uglify-js/bin/uglifyjs
+JS_TESTER = $(NODE_PATH)/vows/bin/vows
DOC_DIR = doc
-DOC_LIST = `ls ${DOC_DIR}/md/`
+BUILD_DIR = build
+DOC_LIST = `ls $(DOC_DIR)/md/`
+JS_ENGINE ?= `which node nodejs`
all: clean core doc
-core: jstat min lint
- @@echo "jStat build complete."
-
-${DIST_DIR}:
- @@mkdir -p ${DIST_DIR}
-
-jstat: ${JS}
+clean:
+ @echo 'Cleaning up build files'
+ @rm -rf dist
-${JS}: ${DIST_DIR}
- @@echo "Building" ${JS}
- @@cat ${BASE_FILES} > ${JS}
+core: jstat.js jstat.min.js
-lint: jstat
- @@if test ! -z ${JS_ENGINE}; then \
- echo "Checking jStat against JSHint..."; \
- ${JS_ENGINE} ${BUILD_DIR}/jshint-check.js; \
- else \
- echo "You must have NodeJS installed in order to test jStat against JSHint."; \
- fi
+jstat.js: \
+ src/core.js \
+ src/special.js \
+ src/distribution.js \
+ src/linearalgebra.js
+ @echo 'Building jStat'
+ @mkdir -p $(DIST_DIR)
+ @cat $^ > $(DIST_DIR)/$@
-min: jstat ${JS_MIN}
+jstat.min.js: jstat.js
+ @echo 'Minifying jStat'
+ @$(JS_COMPILER) < $(DIST_DIR)/$< > $(DIST_DIR)/$@
doc:
- @@echo 'Generating documentation...'
- @@mkdir -p ${DIST_DIR}/docs/assets
- @@cp ${DOC_DIR}/assets/*.css ${DIST_DIR}/docs/assets/
- @@cp ${DOC_DIR}/assets/*.js ${DIST_DIR}/docs/assets/
- @@for i in ${DOC_LIST}; do \
- ${JS_ENGINE} ${BUILD_DIR}/doctool.js ${DOC_DIR}/assets/template.html ${DOC_DIR}/md/$${i} ${DIST_DIR}/docs/$${i%.*}.html; \
+ @echo 'Generating documentation'
+ @mkdir -p $(DIST_DIR)/docs/assets
+ @cp $(DOC_DIR)/assets/*.css $(DIST_DIR)/docs/assets/
+ @cp $(DOC_DIR)/assets/*.js $(DIST_DIR)/docs/assets/
+ @for i in $(DOC_LIST); do \
+ $(JS_ENGINE) $(BUILD_DIR)/doctool.js $(DOC_DIR)/assets/template.html $(DOC_DIR)/md/$${i} $(DIST_DIR)/docs/$${i%.*}.html; \
done
-${JS_MIN}: ${JS}
- @@if test ! -z ${JS_ENGINE}; then \
- echo "Minifying jStat" ${JS_MIN}; \
- ${COMPILER} ${JS} > ${JS_MIN}; \
- else \
- echo "You must have NodeJS installed in order to minify jStat."; \
- fi
+install:
+ @echo 'Downloading necessary libraries for build'
+ @mkdir -p node_modules
+ @npm install
-clean:
- @@echo "Removing Distribution directory:" ${DIST_DIR}
- @@rm -rf ${DIST_DIR}
+test: clean core
+ @echo 'Running jStat unit tests'
+ @$(JS_TESTER)
-.PHONY: all jstat lint min doc clean core
+.PHONY: clean core doc install test
View
@@ -1,39 +0,0 @@
-var JSHINT = require("./lib/jshint").JSHINT,
- print = require("util").print,
- src = require("fs").readFileSync("dist/jstat.js", "utf8");
-
-JSHINT( src, {
- browser: true,
- curly : false,
- eqnull : true,
- forin : true,
- laxbreak : true,
- maxerr : 10000,
- newcap : false,
- undef : true
-});
-
-var ok = {
- "The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype." : true,
- "Unnecessary semicolon." : true,
- "Don't make functions within a loop." : true
-};
-
-var e = JSHINT.errors, found = 0, w;
-
-for ( var i = 0; i < e.length; i++ ) {
- w = e[i];
-
- if ( !ok[ w.reason ]){
- found++;
- print( "\n" + w.evidence + "\n" );
- print( " Problem at line " + w.line + " character " + w.character + ": " + w.reason );
- };
-}
-
-if ( found > 0 ) {
- print( "\n" + found + " Error(s) found.\n" );
-
-} else {
- print( "JSHint check passed.\n" );
-}
Oops, something went wrong.

0 comments on commit 3fa6ea3

Please sign in to comment.