mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
24 lines
801 B
JavaScript
24 lines
801 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
|
|
)
|
|
for await (const file of files) {
|
|
if (file.isDirectory() && !file.name.startsWith('_')) {
|
|
console.log(file.name)
|
|
if (await fs.stat(path.resolve(srcPath, file.name, 'styles')).then(() => false).catch(() => {
|
|
return true
|
|
})) continue
|
|
const code =
|
|
`export { default as ${camelCase(file.name)}Dark } from './dark.js'\n` +
|
|
`export { default as ${camelCase(file.name)}Light } from './light.js'\n`
|
|
console.log(file.name)
|
|
await fs.writeFile(path.resolve(srcPath, file.name, 'styles', 'index.js'), code)
|
|
}
|
|
}
|
|
})()
|