@@ -128,16 +128,16 @@ const renderTemplate = name => {
128128 const demo = fs . readFileSync ( path . join ( __dirname , demoPath ) ) . toString ( ) ;
129129
130130 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 / , '' ) ;
133133
134134 if ( componentsInPrototype . includes ( componentName ) ) {
135135 return ;
136136 }
137137
138- const componentPath = path . join ( __dirname , `../components/${ name . replace ( / ^ a - / , '' ) } ` ) ;
138+ const componentPath = path . join ( __dirname , `../components/${ n . replace ( / ^ a - / , '' ) } ` ) ;
139139 if ( fs . existsSync ( componentPath ) ) {
140- components [ componentName ] = name . replace ( / ^ a - / , '' ) ;
140+ components [ componentName ] = n . replace ( / ^ a - / , '' ) ;
141141 }
142142 } ) ;
143143 } ) ;
@@ -185,6 +185,11 @@ chokidar.watch(configPath, { ignoreInitial: true }).on('change', async () => {
185185 renderTemplate ( devComponent ) ;
186186} ) ;
187187
188+ testWatcher = chokidar . watch ( path . join ( __dirname , `../components/test` ) ) ;
189+ testWatcher . on ( 'change' , ( ) => {
190+ renderTemplate ( devComponent ) ;
191+ } ) ;
192+
188193renderTemplate ( devComponent ) ;
189194
190195const compiler = webpack ( devWebpack ) ;
0 commit comments