From f3185a3cf96b35343756e4390f1bc439ae3888e4 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Wed, 15 Jan 2020 19:37:53 +0800 Subject: [PATCH] chore: update build config --- build/config.js | 2 +- build/dev.js | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/build/config.js b/build/config.js index fd0be0d9c..9d3a82e64 100644 --- a/build/config.js +++ b/build/config.js @@ -1,3 +1,3 @@ module.exports = { - devComponent: 'select', + devComponent: 'input', }; diff --git a/build/dev.js b/build/dev.js index 56a58033a..6232e00c1 100644 --- a/build/dev.js +++ b/build/dev.js @@ -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);