-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
27 lines (23 loc) · 870 Bytes
/
Copy pathbuild.js
File metadata and controls
27 lines (23 loc) · 870 Bytes
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
const argv = require('minimist')(process.argv.slice(2))
const browserify = require('browserify')
const fs = require('fs')
const path = require('path')
const uglifyify = require('uglifyify')
const html = require('simple-html-index')
// get entry
var entry = argv._[0]
var title = argv._[1]
var appicon = argv._[2]
if (!entry) { entry = '1'}
if (!title) { title = entry}
if (!appicon) { appicon = ''}
const entryFilename = entry + '.js'
const entryFile = path.resolve(__dirname, 'src', entryFilename)
var b = browserify()
b.add(entryFile)
b.transform(require('babelify').configure({ presets: ["@babel/preset-env"] }))
b.transform(uglifyify, { global: true })
b.bundle()
.pipe(fs.createWriteStream('static/' + entryFilename))
html({ title: title, entry: entryFilename, css: '../main.css', appicon: appicon })
.pipe(fs.createWriteStream('static/' + entry + '.html'))