feat(directory): add react assets

This commit is contained in:
Haoyu Xu
2023-01-16 19:14:39 -05:00
parent c31a5fcdf9
commit 5404c1ff52
13 changed files with 838 additions and 3 deletions

27
directory/config.js Normal file
View File

@@ -0,0 +1,27 @@
import path from 'path'
import { parse } from 'yaml'
import fs from 'fs'
function read_yaml(file_dir) {
const include = {
identify: value => value.startsWith('!include'),
tag: '!include',
resolve(str) {
const dir = path.resolve(BASEDIR, str)
const data = read_yaml(dir)
return data
}
}
const file = fs.readFileSync(file_dir, 'utf8')
return parse(file, {
customTags: [include],
})
}
const BASEDIR = path.resolve(__dirname, '..')
const CONFIG = read_yaml(path.join(BASEDIR, 'config.yaml'))
export default {
basedir: BASEDIR,
...CONFIG
}