@@ -128,16 +128,16 @@ const renderTemplate = name => {
128
128
const demo = fs . readFileSync ( path . join ( __dirname , demoPath ) ) . toString ( ) ;
129
129
130
130
const componentsInDemo = demo . match ( / a - ( \w + ( - \w + ) * ) / g) || [ ] ;
131
- componentsInDemo . forEach ( name => {
132
- const componentName = name . replace ( / - ( \w ) / g, ( $ , $1 ) => $1 . toUpperCase ( ) ) . replace ( / ^ a / , '' ) ;
131
+ componentsInDemo . forEach ( n => {
132
+ const componentName = n . replace ( / - ( \w ) / g, ( $ , $1 ) => $1 . toUpperCase ( ) ) . replace ( / ^ a / , '' ) ;
133
133
134
134
if ( componentsInPrototype . includes ( componentName ) ) {
135
135
return ;
136
136
}
137
137
138
- const componentPath = path . join ( __dirname , `../components/${ name . replace ( / ^ a - / , '' ) } ` ) ;
138
+ const componentPath = path . join ( __dirname , `../components/${ n . replace ( / ^ a - / , '' ) } ` ) ;
139
139
if ( fs . existsSync ( componentPath ) ) {
140
- components [ componentName ] = name . replace ( / ^ a - / , '' ) ;
140
+ components [ componentName ] = n . replace ( / ^ a - / , '' ) ;
141
141
}
142
142
} ) ;
143
143
} ) ;
@@ -185,6 +185,11 @@ chokidar.watch(configPath, { ignoreInitial: true }).on('change', async () => {
185
185
renderTemplate ( devComponent ) ;
186
186
} ) ;
187
187
188
+ testWatcher = chokidar . watch ( path . join ( __dirname , `../components/test` ) ) ;
189
+ testWatcher . on ( 'change' , ( ) => {
190
+ renderTemplate ( devComponent ) ;
191
+ } ) ;
192
+
188
193
renderTemplate ( devComponent ) ;
189
194
190
195
const compiler = webpack ( devWebpack ) ;
0 commit comments