File tree Expand file tree Collapse file tree 3 files changed +14
-32
lines changed Expand file tree Collapse file tree 3 files changed +14
-32
lines changed Original file line number Diff line number Diff line change 10
10
- stage : check contract format
11
11
script :
12
12
- |
13
- contractErrors=$(node checkContract.js);
14
- if [[ $contractErrors != 0 ]]; then
15
- echo "Formatting errors! Please check your object keys spellings, commas and or other things that might invalidate your JSON and try again";
16
- exit 1;
17
- else
18
- echo "No errors";
19
- exit 0;
20
- fi
13
+ node checkContract.js;
21
14
- stage : check token format
22
15
script :
23
16
- |
24
- tokenErrors=$(node checkToken.js);
25
- if [[ $tokenErrors != 0 ]]; then
26
- echo "Formatting errors! Please check your object keys spellings, commas and or other things that might invalidate your JSON and try again";
27
- exit 1;
28
- else
29
- echo "No errors";
30
- exit 0;
31
- fi
17
+ node checkToken.js;
Original file line number Diff line number Diff line change 1
- const fs = require ( "fs" ) ;
2
- const contractsDirectory = " ./src/contracts/" ;
3
- const Schema = require ( " validate" ) ;
1
+ const fs = require ( 'fs' ) ;
2
+ const contractsDirectory = ' ./src/contracts/' ;
3
+ const Schema = require ( ' validate' ) ;
4
4
const contract = new Schema ( {
5
5
name : {
6
6
type : String ,
@@ -20,20 +20,19 @@ const contract = new Schema({
20
20
}
21
21
} ) ;
22
22
23
- let errors = 0 ;
24
-
25
23
function run ( ) {
24
+ let errors = 0 ;
26
25
fs . readdirSync ( contractsDirectory ) . forEach ( folder => {
27
26
fs . readdirSync ( `${ contractsDirectory } /${ folder } ` ) . forEach ( file => {
28
27
const obj = JSON . parse (
29
- fs . readFileSync ( `${ contractsDirectory } /${ folder } /${ file } ` , " utf8" )
28
+ fs . readFileSync ( `${ contractsDirectory } /${ folder } /${ file } ` , ' utf8' )
30
29
) ;
31
30
if ( contract . validate ( obj ) === false ) {
32
- errors ++ ;
31
+ process . exit ( 1 ) ;
33
32
}
34
33
} ) ;
35
34
} ) ;
36
- return errors ;
35
+ process . exit ( 0 ) ;
37
36
}
38
37
39
38
run ( ) ;
Original file line number Diff line number Diff line change 1
- const fs = require ( "fs" ) ;
2
- const tokensDirectory = " ./src/tokens/" ;
3
- const Schema = require ( " validate" ) ;
1
+ const fs = require ( 'fs' ) ;
2
+ const tokensDirectory = ' ./src/tokens/' ;
3
+ const Schema = require ( ' validate' ) ;
4
4
const token = new Schema ( {
5
5
symbol : {
6
6
type : String ,
@@ -93,20 +93,17 @@ const token = new Schema({
93
93
}
94
94
} ) ;
95
95
96
- let errors = 0 ;
97
-
98
96
function run ( ) {
99
97
fs . readdirSync ( tokensDirectory ) . forEach ( folder => {
100
98
fs . readdirSync ( `${ tokensDirectory } /${ folder } ` ) . forEach ( file => {
101
99
const obj = JSON . parse (
102
- fs . readFileSync ( `${ tokensDirectory } /${ folder } /${ file } ` , " utf8" )
100
+ fs . readFileSync ( `${ tokensDirectory } /${ folder } /${ file } ` , ' utf8' )
103
101
) ;
104
102
if ( token . validate ( obj ) === false ) {
105
- errors ++ ;
103
+ process . exit ( 1 ) ;
106
104
}
107
105
} ) ;
108
106
} ) ;
109
- return errors ;
110
107
}
111
108
112
109
run ( ) ;
You can’t perform that action at this time.
0 commit comments