mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
26 lines
749 B
JavaScript
26 lines
749 B
JavaScript
const fs = require('fs').promises
|
|
const path = require('path')
|
|
const { camelCase } = require('lodash')
|
|
|
|
;(async () => {
|
|
const srcPath = path.resolve(__dirname, '..', 'src')
|
|
const files = await fs.opendir(
|
|
srcPath
|
|
)
|
|
const code = []
|
|
for await (const file of files) {
|
|
if (file.isDirectory() && !file.name.startsWith('_')) {
|
|
if (await fs.stat(path.resolve(srcPath, file.name, 'styles')).then(() => false).catch(() => {
|
|
return true
|
|
})) continue
|
|
code.push(`export {
|
|
${camelCase(file.name)}Dark,
|
|
${camelCase(file.name)}Light
|
|
} from './${file.name}/styles'\n`)
|
|
// await fs.writeFile(path.resolve(srcPath, file.name, 'styles', 'index.js'), code)
|
|
}
|
|
}
|
|
code.sort()
|
|
console.log(code.join(''))
|
|
})()
|