@@ -10,9 +10,6 @@ const rootDir = path.resolve(__dirname, '..', '..');
10
10
const doc = path . resolve ( rootDir , 'doc' , 'api' , 'addons.md' ) ;
11
11
const verifyDir = path . resolve ( rootDir , 'test' , 'addons' ) ;
12
12
13
- const changed = [ ] ;
14
- const checkOnly = process . argv . includes ( '--check' ) ;
15
-
16
13
let id = 0 ;
17
14
let currentHeader ;
18
15
@@ -79,6 +76,12 @@ for (const header in addons) {
79
76
} )
80
77
} ) ;
81
78
79
+ try {
80
+ fs . mkdirSync ( dir ) ;
81
+ } catch ( e ) {
82
+ strictEqual ( e . code , 'EEXIST' ) ;
83
+ }
84
+
82
85
for ( const file of files ) {
83
86
let content ;
84
87
try {
@@ -88,29 +91,13 @@ for (const header in addons) {
88
91
}
89
92
90
93
// Only update when file content has changed to prevent unneeded rebuilds.
91
- if ( content === file . content ) continue ;
92
- changed . push ( file ) ;
93
-
94
- if ( checkOnly ) continue ;
95
-
96
- try {
97
- fs . mkdirSync ( dir ) ;
98
- } catch ( e ) {
99
- strictEqual ( e . code , 'EEXIST' ) ;
94
+ if ( content !== file . content ) {
95
+ fs . writeFileSync ( file . path , file . content ) ;
96
+ console . log ( 'wrote' , file . path ) ;
100
97
}
101
-
102
- fs . writeFileSync ( file . path , file . content ) ;
103
- console . log ( 'wrote' , file . path ) ;
104
98
}
105
99
}
106
100
107
- if ( checkOnly && changed . length > 0 ) {
108
- console . error ( 'The following files are out of date:' ) ;
109
- for ( const { path } of changed ) console . error ( ' ' , path ) ;
110
- console . error ( 'Run `node tools/doc/addon-verify.js` to update.' ) ;
111
- process . exit ( 1 ) ;
112
- }
113
-
114
101
function boilerplate ( name , content ) {
115
102
return `'use strict';
116
103
const common = require('../../common');
0 commit comments