build: 删除 build.less.ts 文件

This commit is contained in:
就眠儀式
2022-02-25 10:10:33 +08:00
parent 18990ef594
commit 30a1a33b06
5 changed files with 68 additions and 34 deletions

View File

@@ -1,32 +0,0 @@
/**
* merge less file
* <p>
*/
var fs = require('fs');
var { resolve } = require('path');
// @ts-ignore
const inputDir = resolve(process.cwd(), './src/component')
// @ts-ignore
const inputsArray = fs.readdirSync(inputDir).filter((name) => {
const componentDir = resolve(inputDir, name)
const isDir = fs.lstatSync(componentDir).isDirectory()
return isDir && fs.readdirSync(componentDir).includes('index.ts')
})
var content = fs.readFileSync("./src/theme/variable.less").toString() + '\n\n';
content += fs.readFileSync("./src/theme/index.less").toString() + '\n\n';
inputsArray.forEach(function (f) {
var path = "./src/component/" + f + "/index.less";
fs.exists(path, function (exists) {
if (exists) {
var c = fs.readFileSync(path);
content += c.toString() + '\n\n';
// @ts-ignore
content = content.replaceAll(/\@import.*?\;/g, "");
fs.writeFileSync('./lib/index.less', content);
}
});
})