@@ -3,59 +3,59 @@ var pJKeys = [{
3
3
name :'name' ,
4
4
validate :function ( name ) { return ! ! name . match ( / ^ c o d e r o a d - [ A - Z a - z 0 - 9 \- ] + $ / ) ; } ,
5
5
msg :'must be kebabcased and start with "coderoad"' ,
6
- example :'coderoad-tutorial -name' ,
6
+ example :'" coderoad-tut -name" ' ,
7
7
} , {
8
8
name :'version' ,
9
9
validate :function ( version ) { return ! ! version . match ( / ^ [ 0 - 9 ] + \. [ 0 - 9 ] + \. [ 0 - 9 ] + $ / ) ; } ,
10
10
msg :'must be 3 numbers separated by dots' ,
11
- example :'0.1.0' ,
11
+ example :'" 0.1.0" ' ,
12
12
} , {
13
13
name :'main' ,
14
14
validate :function ( main ) { return main === 'coderoad.json' ; } ,
15
15
msg :'must point to coderoad.json' ,
16
- example :'coderoad.json' ,
16
+ example :'" coderoad.json" ' ,
17
17
} , {
18
18
name :'description' ,
19
19
validate :function ( desc ) { return typeof desc === 'string' && desc . length > 3 ; } ,
20
20
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." '
22
22
} , {
23
23
name :'keywords' ,
24
24
validate :function ( keywords ) { return Array . isArray ( keywords ) && ! ! keywords . length && keywords . includes ( 'coderoad' ) ; } ,
25
25
msg :'must be an array containing "coderoad"' ,
26
- example :'["coderoad", "tutorial", "js"]' ,
26
+ example :'[\n "coderoad",\n "tutorial",\n "js"\n ]' ,
27
27
} , {
28
28
name :'author' ,
29
29
validate :function ( author ) { return typeof author === 'string' && author . length > 2 ; } ,
30
30
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)" ' ,
32
32
} , {
33
33
name :'config' ,
34
34
validate :function ( config ) { return typeof config === 'object' ; } ,
35
35
msg :'must be an object' ,
36
- example :'"config": { "language": "JS", "runner": "mocha-coderoad"}' ,
36
+ example :'{\n "language": "JS",\n "runner": "mocha-coderoad"\n }' ,
37
37
} , {
38
38
name :'files' ,
39
39
validate :function ( files ) { return Array . isArray ( files ) && files . includes ( 'coderoad.json' ) && files . includes ( 'tutorial' ) ; } ,
40
40
msg :'must be an array including "coderoad.json" & "tutorial"' ,
41
- example :'["coderoad.json", "tutorial"]' ,
41
+ example :'[\n "coderoad.json",\n "tutorial"\n ]' ,
42
42
} , {
43
43
name :'engines' ,
44
44
validate :function ( engines ) { return typeof engines === 'object' && ! ! engines . node && ! ! engines . node . match ( / ^ ( > = ) ? [ 0 - 9 ] + / ) ; } ,
45
45
msg :'must specify a valid node version' ,
46
- example :'"engines": { "node": ">=0.10.3"}' ,
46
+ example :'{\n "node": ">=0.10.3"\n }' ,
47
47
} , {
48
48
name :'language' ,
49
49
config :true ,
50
50
validate :function ( lang ) { return typeof lang === 'string' && ! ! lang . length ; } ,
51
51
msg :'must specify a programming language' ,
52
- example :'JS ' ,
52
+ example :'"JS" ' ,
53
53
} , {
54
54
name :'runner' ,
55
55
config :true ,
56
56
validate :function ( runner ) { return typeof runner === 'string' && ! ! runner . length ; } ,
57
57
msg :'must specify a test runner' ,
58
- example :'mocha-coderoad' ,
58
+ example :'" mocha-coderoad" ' ,
59
59
} , {
60
60
name :'repository' ,
61
61
optional :true ,
@@ -66,20 +66,20 @@ var pJKeys = [{
66
66
repo . hasOwnProperty ( 'url' ) && typeof repo . url === 'string' ;
67
67
} ,
68
68
msg :'should have a valid repository' ,
69
- example :'https:/ /github.com/shmck/coderoad-tutorial-name' ,
69
+ example :'" https:\/\ /github.com/shmck/coderoad-tutorial-name" ' ,
70
70
} , {
71
71
name :'bugs' ,
72
72
optional :true ,
73
73
validate :function ( bugs ) { return typeof bugs === 'object' &&
74
74
bugs . hasOwnProperty ( 'url' ) && typeof bugs . url === 'string' ; } ,
75
75
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 }'
77
77
} , {
78
78
name :'license' ,
79
79
optional :true ,
80
80
validate :function ( license ) { return typeof license === 'string' && ! ! license . length ; } ,
81
81
msg :'should have a valid license (ex: MIT, ISC, etc.)' ,
82
- example :'MIT' ,
82
+ example :'" MIT" ' ,
83
83
} ] ;
84
84
function validatePackageJson ( pj ) {
85
85
var errors = [ ] ;