forked from su37josephxia/frontend-basic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
37 lines (31 loc) · 909 Bytes
/
build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// const fs = require('fs-ex')
const {sync} = require('globby')
const fs = require('fs-extra')
const {resolve} = require('path')
const build = async () => {
// 删除目录
fs.removeSync('./vuepress/document')
const files = []
files.push(...sync('./**/*.md',{
gitignore:true,
absolute:true
}))
files.push(...sync('./**/assets/*',{
gitignore:true,
// onlyFiles:false,
absolute:true
}))
files
.forEach(srcpath => {
const dstpath = srcpath.replace(resolve('./'),resolve('./vuepress/document/'))
fs.ensureLinkSync(srcpath, dstpath)
})
}
build()
// options is optional
// glob("**/*.js", options, function (er, files) {
// // files is an array of filenames.
// // If the `nonull` option is set, and nothing
// // was found, then files is ["**/*.js"]
// // er is an error object or null.
// })