feat(node): re-write using node

This commit is contained in:
Haoyu Xu
2023-01-16 14:06:14 -05:00
parent 4b834fe0ff
commit 6d54eb068c
95 changed files with 1341 additions and 2486 deletions

19
lib/yaml.js Normal file
View File

@@ -0,0 +1,19 @@
import path from 'path'
import { parse } from 'yaml'
import fs from 'fs'
export function read(file_dir) {
const include = {
identify: value => value.startsWith('!include'),
tag: '!include',
resolve(str) {
const dir = path.resolve(path.dirname(file_dir), str)
const data = read(dir)
return data
}
}
const file = fs.readFileSync(file_dir, 'utf8')
return parse(file, {
customTags: [include],
})
}