chore: update build config

pull/1731/head
tangjinzhou 2020-01-15 19:37:53 +08:00
parent 6186c7e83d
commit f3185a3cf9
2 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,3 @@
module.exports = {
devComponent: 'select',
devComponent: 'input',
};

View File

@ -128,16 +128,16 @@ const renderTemplate = name => {
const demo = fs.readFileSync(path.join(__dirname, demoPath)).toString();
const componentsInDemo = demo.match(/a-(\w+(-\w+)*)/g) || [];
componentsInDemo.forEach(name => {
const componentName = name.replace(/-(\w)/g, ($, $1) => $1.toUpperCase()).replace(/^a/, '');
componentsInDemo.forEach(n => {
const componentName = n.replace(/-(\w)/g, ($, $1) => $1.toUpperCase()).replace(/^a/, '');
if (componentsInPrototype.includes(componentName)) {
return;
}
const componentPath = path.join(__dirname, `../components/${name.replace(/^a-/, '')}`);
const componentPath = path.join(__dirname, `../components/${n.replace(/^a-/, '')}`);
if (fs.existsSync(componentPath)) {
components[componentName] = name.replace(/^a-/, '');
components[componentName] = n.replace(/^a-/, '');
}
});
});
@ -185,6 +185,11 @@ chokidar.watch(configPath, { ignoreInitial: true }).on('change', async () => {
renderTemplate(devComponent);
});
testWatcher = chokidar.watch(path.join(__dirname, `../components/test`));
testWatcher.on('change', () => {
renderTemplate(devComponent);
});
renderTemplate(devComponent);
const compiler = webpack(devWebpack);