File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change 21
21
"lint" : " eslint . && prettier . --check && npm run validate-rules" ,
22
22
"bundle" : " ./build.sh" ,
23
23
"generate-rule-schema" : " ts-node scripts/generate-rule-schema.ts" ,
24
- "validate-rules" : " ts-node scripts/validate-rules.ts" ,
24
+ "validate-rules" : " npm run generate-rule-schema && ts-node scripts/validate-rules.ts" ,
25
25
"watch" : " npm run prepublish && chokidar \" lib\" \" addon\" \" rules/autoconsent\" \" rules/filterlist.txt\" --ignore 'lib/filterlist-engine.ts' -c \" npm run prepublish\" " ,
26
26
"create-rule" : " node rules/create-rule.mjs" ,
27
27
"test" : " playwright test" ,
Original file line number Diff line number Diff line change 1
1
import Ajv , { ErrorObject } from 'ajv' ;
2
2
import { readdirSync , readFileSync , existsSync } from 'fs' ;
3
3
import path from 'path' ;
4
- import { execSync } from 'child_process' ;
5
4
6
5
function formatErrors ( errors : ErrorObject [ ] ) {
7
6
if ( ! Array . isArray ( errors ) ) {
@@ -10,11 +9,10 @@ function formatErrors(errors: ErrorObject[]) {
10
9
return errors . map ( ( item ) => `${ item . instancePath } : ${ item . message } ` ) . join ( ', ' ) ;
11
10
}
12
11
13
- // Check if schema exists, if not generate it
14
12
const schemaPath = path . join ( __dirname , '../rules/schema.json' ) ;
15
13
if ( ! existsSync ( schemaPath ) ) {
16
- console . log ( ' Schema not found, generating...' ) ;
17
- execSync ( 'ts-node scripts/generate-rule-schema.ts' ) ;
14
+ console . error ( ` Schema file does not exist at: ${ schemaPath } ` ) ;
15
+ process . exit ( 1 ) ;
18
16
}
19
17
20
18
const schema = JSON . parse ( readFileSync ( schemaPath , 'utf8' ) ) ;
You can’t perform that action at this time.
0 commit comments