diff --git a/.gitignore b/.gitignore index dfe5d7b4..6811e7e1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,10 @@ +package-lock.json + # Build files # ############### build/ node_modules/ +Auditor/Auditor_with_beacon.js # OS generated files # ###################### diff --git a/index.js b/index.js new file mode 100644 index 00000000..a780da32 --- /dev/null +++ b/index.js @@ -0,0 +1,8 @@ +var fs = require('fs'); +var scriptPath = __dirname+'/build/HTMLCS.js'; + +if (fs.existsSync(scriptPath) === true) { + module.exports = require(scriptPath); +} else { + throw new Error('HTMLCS must be built using `grunt build` before it can be required in Nodejs.'); +} \ No newline at end of file diff --git a/package.json b/package.json index 9063fa4a..15159960 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "html_codesniffer", "version": "2.1.1", "description": "HTML_CodeSniffer is a client-side JavaScript that checks a HTML document or source code, and detects violations of a defined coding standard.", - "main": "HTMLCS.js", + "main": "index.js", "keywords": [ "htmlcs" ], @@ -20,10 +20,12 @@ "homepage": "http://squizlabs.github.io/HTML_CodeSniffer/", "dependencies": { "grunt": "^1.0.0", - "load-grunt-tasks": "~3.5.x", "grunt-contrib-copy": "^1.0.0", "grunt-contrib-jshint": "^1.0.0", - "grunt-contrib-uglify": "^2.0.0", - "grunt-contrib-watch": "^1.0.0" + "grunt-contrib-watch": "^1.0.0", + "load-grunt-tasks": "^3.5.2" + }, + "devDependencies": { + "grunt-contrib-uglify": "^2.3.0" } -} +} \ No newline at end of file