Use `npm scripts` for a dev cleaner workflow
parent
e6e1ce0a79
commit
21a3cd472e
14
README.md
14
README.md
|
@ -240,23 +240,13 @@ git submodule update --init
|
|||
npm test
|
||||
```
|
||||
|
||||
Browser:
|
||||
|
||||
```
|
||||
bin/prepare-tests
|
||||
karma start
|
||||
```
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
All validation functions are generated using doT templates in [dot](https://github.com/epoberezkin/ajv/tree/master/lib/dot) folder. Templates are precompiled so doT is not a run-time dependency.
|
||||
|
||||
`bin/compile-dots` - compiles templates to [dotjs](https://github.com/epoberezkin/ajv/tree/master/lib/dotjs) folder (please use node 0.10 to compile - 0.12 is fully supported but it inserts some empty comments in function parameters when Function constructor is called).
|
||||
`npm run build` - compiles templates to [dotjs](https://github.com/epoberezkin/ajv/tree/master/lib/dotjs) folder (please use node 0.10 to compile - 0.12 is fully supported but it inserts some empty comments in function parameters when Function constructor is called).
|
||||
|
||||
`bin/watch-dots` - automatically compiles templates when files in dot folder change
|
||||
|
||||
`bin/git-hook` - installs symbolic link to pre-commit hook that will compile templates and run tests.
|
||||
`npm run watch` - automatically compiles templates when files in dot folder change
|
||||
|
||||
|
||||
## Changes history
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
node ./bin/compile-dots.js
|
|
@ -1,3 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
browserify -r ./lib/ajv.js:ajv -o ajv.bundle.js
|
|
@ -1,7 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
hook=.git/hooks/pre-commit
|
||||
[ -e "$hook" ] || [ -h "$hook" ] && rm $hook
|
||||
ln -s $(pwd)/bin/pre-commit $hook
|
|
@ -1,6 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
bin/compile-dots
|
||||
npm run test-spec
|
|
@ -1,2 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
./node_modules/.bin/watch 'node bin/compile-dots.js' ./lib/dot
|
13
package.json
13
package.json
|
@ -6,9 +6,12 @@
|
|||
"scripts": {
|
||||
"test-spec": "mocha spec/*.spec.js -R spec",
|
||||
"test-cov": "istanbul cover -x '**/spec/**' node_modules/mocha/bin/_mocha -- spec/*.spec.js -R spec",
|
||||
"build": "node bin/compile-dots.js",
|
||||
"test": "npm run build && npm run test-cov",
|
||||
"prepublish": "npm run build"
|
||||
"bundle": "browserify -r ./lib/ajv.js:ajv -o ajv.bundle.js",
|
||||
"build": "node scripts/compile-dots.js",
|
||||
"test-browser": "scripts/prepare-tests && karma start --single-run --browsers PhantomJS",
|
||||
"test": "npm run build && npm run test-cov && npm run test-browser",
|
||||
"prepublish": "npm run build",
|
||||
"watch": "watch 'npm run build' ./lib/dot"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -29,6 +32,7 @@
|
|||
"json-stable-stringify": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^11.0.1",
|
||||
"chai": "^3.0.0",
|
||||
"dot": "^1.0.3",
|
||||
"glob": "^5.0.10",
|
||||
|
@ -38,8 +42,11 @@
|
|||
"karma": "^0.13.3",
|
||||
"karma-chrome-launcher": "^0.2.0",
|
||||
"karma-mocha": "^0.2.0",
|
||||
"karma-phantomjs-launcher": "^0.2.1",
|
||||
"karma-sauce-launcher": "^0.2.14",
|
||||
"mocha": "^2.2.5",
|
||||
"phantomjs": "^1.9.18",
|
||||
"pre-commit": "^1.1.1",
|
||||
"require-globify": "^1.2.1",
|
||||
"watch": "^0.16.0"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue