提交 97e355de 编写于 作者: J Jason Park

Remove a temporary file used to mass rename

上级 60fcab5b
const fs = require('fs');
const path = require('path');
const componentsDir = path.resolve(__dirname, 'src', 'core', 'renderers');
const components = fs.readdirSync(componentsDir);
for (const component of components) {
if (!fs.statSync(path.resolve(componentsDir, component)).isDirectory()) continue;
const newJs = path.resolve(componentsDir, component, 'index.js');
fs.renameSync(path.resolve(componentsDir, component, 'index.jsx'), newJs);
const content = fs.readFileSync(newJs, { encoding: 'utf8' });
fs.writeFileSync(newJs, content.replace('stylesheet.module.scss', `${component}.module.scss`), { encoding: 'utf8' });
if (fs.existsSync(path.resolve(componentsDir, component, 'stylesheet.module.scss'))) fs.renameSync(path.resolve(componentsDir, component, 'stylesheet.module.scss'), path.resolve(componentsDir, component, `${component}.module.scss`));
}
console.log(components);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册