Skip to content

Commit da3f24e

Browse files
committed
Added new main entry file for Node. This package is not meant to be used as a node module but will now present a more meaningful error. If the project has been built then it will require the build file. This resolves #208
1 parent a52049f commit da3f24e

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
package-lock.json
2+
13
# Build files #
24
###############
35
build/
46
node_modules/
7+
Auditor/Auditor_with_beacon.js
58

69
# OS generated files #
710
######################

index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
var fs = require('fs');
2+
var scriptPath = __dirname+'/build/HTMLCS.js';
3+
4+
if (fs.existsSync(scriptPath) === true) {
5+
module.exports = require(scriptPath);
6+
} else {
7+
throw new Error('HTMLCS must be built using `grunt build` before it can be required in Nodejs.');
8+
}

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "html_codesniffer",
33
"version": "2.1.1",
44
"description": "HTML_CodeSniffer is a client-side JavaScript that checks a HTML document or source code, and detects violations of a defined coding standard.",
5-
"main": "HTMLCS.js",
5+
"main": "index.js",
66
"keywords": [
77
"htmlcs"
88
],
@@ -20,10 +20,12 @@
2020
"homepage": "http://squizlabs.github.io/HTML_CodeSniffer/",
2121
"dependencies": {
2222
"grunt": "^1.0.0",
23-
"load-grunt-tasks": "~3.5.x",
2423
"grunt-contrib-copy": "^1.0.0",
2524
"grunt-contrib-jshint": "^1.0.0",
26-
"grunt-contrib-uglify": "^2.0.0",
27-
"grunt-contrib-watch": "^1.0.0"
25+
"grunt-contrib-watch": "^1.0.0",
26+
"load-grunt-tasks": "^3.5.2"
27+
},
28+
"devDependencies": {
29+
"grunt-contrib-uglify": "^2.3.0"
2830
}
29-
}
31+
}

0 commit comments

Comments
 (0)