@@ -3,59 +3,59 @@ var pJKeys = [{
33 name : 'name' ,
44 validate : function ( name ) { return ! ! name . match ( / ^ c o d e r o a d - [ A - Z a - z 0 - 9 \- ] + $ / ) ; } ,
55 msg : 'must be kebabcased and start with "coderoad"' ,
6- example : 'coderoad-tutorial -name' ,
6+ example : '" coderoad-tut -name" ' ,
77 } , {
88 name : 'version' ,
99 validate : function ( version ) { return ! ! version . match ( / ^ [ 0 - 9 ] + \. [ 0 - 9 ] + \. [ 0 - 9 ] + $ / ) ; } ,
1010 msg : 'must be 3 numbers separated by dots' ,
11- example : '0.1.0' ,
11+ example : '" 0.1.0" ' ,
1212 } , {
1313 name : 'main' ,
1414 validate : function ( main ) { return main === 'coderoad.json' ; } ,
1515 msg : 'must point to coderoad.json' ,
16- example : 'coderoad.json' ,
16+ example : '" coderoad.json" ' ,
1717 } , {
1818 name : 'description' ,
1919 validate : function ( desc ) { return typeof desc === 'string' && desc . length > 3 ; } ,
2020 msg : 'must be long enough to describe a package' ,
21- example : 'CodeRoad tutorial on ES2015 new features.'
21+ example : '" CodeRoad tutorial on ES2015 new features." '
2222 } , {
2323 name : 'keywords' ,
2424 validate : function ( keywords ) { return Array . isArray ( keywords ) && ! ! keywords . length && keywords . includes ( 'coderoad' ) ; } ,
2525 msg : 'must be an array containing "coderoad"' ,
26- example : '["coderoad", "tutorial", "js"]' ,
26+ example : '[\n "coderoad",\n "tutorial",\n "js"\n ]' ,
2727 } , {
2828 name : 'author' ,
2929 validate : function ( author ) { return typeof author === 'string' && author . length > 2 ; } ,
3030 msg : 'must have an author name and optional email' ,
31- example : 'Shawn McKay <me@email.com> (http://blog)' ,
31+ example : '" Shawn McKay <me@email.com> (http://blog)" ' ,
3232 } , {
3333 name : 'config' ,
3434 validate : function ( config ) { return typeof config === 'object' ; } ,
3535 msg : 'must be an object' ,
36- example : '"config": { "language": "JS", "runner": "mocha-coderoad"}' ,
36+ example : '{\n "language": "JS",\n "runner": "mocha-coderoad"\n }' ,
3737 } , {
3838 name : 'files' ,
3939 validate : function ( files ) { return Array . isArray ( files ) && files . includes ( 'coderoad.json' ) && files . includes ( 'tutorial' ) ; } ,
4040 msg : 'must be an array including "coderoad.json" & "tutorial"' ,
41- example : '["coderoad.json", "tutorial"]' ,
41+ example : '[\n "coderoad.json",\n "tutorial"\n ]' ,
4242 } , {
4343 name : 'engines' ,
4444 validate : function ( engines ) { return typeof engines === 'object' && ! ! engines . node && ! ! engines . node . match ( / ^ ( > = ) ? [ 0 - 9 ] + / ) ; } ,
4545 msg : 'must specify a valid node version' ,
46- example : '"engines": { "node": ">=0.10.3"}' ,
46+ example : '{\n "node": ">=0.10.3"\n }' ,
4747 } , {
4848 name : 'language' ,
4949 config : true ,
5050 validate : function ( lang ) { return typeof lang === 'string' && ! ! lang . length ; } ,
5151 msg : 'must specify a programming language' ,
52- example : 'JS ' ,
52+ example : '"JS" ' ,
5353 } , {
5454 name : 'runner' ,
5555 config : true ,
5656 validate : function ( runner ) { return typeof runner === 'string' && ! ! runner . length ; } ,
5757 msg : 'must specify a test runner' ,
58- example : 'mocha-coderoad' ,
58+ example : '" mocha-coderoad" ' ,
5959 } , {
6060 name : 'repository' ,
6161 optional : true ,
@@ -66,20 +66,20 @@ var pJKeys = [{
6666 repo . hasOwnProperty ( 'url' ) && typeof repo . url === 'string' ;
6767 } ,
6868 msg : 'should have a valid repository' ,
69- example : 'https:/ /github.com/shmck/coderoad-tutorial-name' ,
69+ example : '" https:\/\ /github.com/shmck/coderoad-tutorial-name" ' ,
7070 } , {
7171 name : 'bugs' ,
7272 optional : true ,
7373 validate : function ( bugs ) { return typeof bugs === 'object' &&
7474 bugs . hasOwnProperty ( 'url' ) && typeof bugs . url === 'string' ; } ,
7575 msg : 'should have a link to where to post bugs' ,
76- example : '"bugs": { "url": "https:/ /github.com/shmck/coderoad-tutorial -name" }'
76+ example : '{\n "url": "https:\/\ /github.com/shmck/coderoad-tut -name"\n }'
7777 } , {
7878 name : 'license' ,
7979 optional : true ,
8080 validate : function ( license ) { return typeof license === 'string' && ! ! license . length ; } ,
8181 msg : 'should have a valid license (ex: MIT, ISC, etc.)' ,
82- example : 'MIT' ,
82+ example : '" MIT" ' ,
8383 } ] ;
8484function validatePackageJson ( pj ) {
8585 var errors = [ ] ;
0 commit comments