-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
40 lines (35 loc) · 878 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
38
39
40
const gulp = require("gulp")
const header = require("gulp-header")
const fs = require("fs")
const ignored = [
"package-lock.json",
"node_modules",
"dist",
"src", "cmd", "tests",
".git",
"build.js",
"example.nm" // Temp
]
const currDir = fs.readdirSync(".").filter(file => !ignored.includes(file))
// Adds file headers
const license = fs.readFileSync("./LICENSE")
const pkg = require('./package.json');
const banner = [
`\`\n${license}\n\`\n`,
'/**',
' * Numi - <%= pkg.description %>',
' * @version v<%= pkg.version %>',
' * @link <%= pkg.homepage %>',
' * @license <%= pkg.license %>',
' */\n',
''].join('\n');
gulp.src([
"./src/**/*.js",
"./*.js"
])
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest('./dist/'))
for (const file of currDir) {
const data = fs.readFileSync(file)
fs.writeFileSync(`./dist/${file}`, data)
}