-
Notifications
You must be signed in to change notification settings - Fork 40
/
build-app.js
32 lines (30 loc) · 1.01 KB
/
build-app.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
const packager = require('electron-packager')
const rimraf = require('rimraf')
const fs = require('fs')
const path = require('path')
const packageJson = JSON.parse(fs.readFileSync('./package.json'))
const out = path.normalize(`./release/${packageJson.version}`)
if (!fs.existsSync('./release')) {
fs.mkdirSync('./release')
}
if (!fs.existsSync(out)) {
fs.mkdirSync(out)
}
packager({
name: 'Net64+',
dir: './build',
out,
arch: 'x64',
platform: 'win32',
appVersion: packageJson.version,
icon: './build/img/icon.ico',
overwrite: true
}, (err, appPaths) => {
if (err) throw err
fs.writeFileSync(path.join(appPaths[0], 'resources/app/package.json'), JSON.stringify(packageJson))
fs.mkdirSync(path.join(appPaths[0], `patches`))
fs.readdirSync('./build/patches').map(val => `./build/patches/${val}`).forEach(file => {
fs.createReadStream(file).pipe(fs.createWriteStream(path.join(appPaths[0], `patches/${file.split('patches/')[1]}`)))
})
rimraf(path.join(appPaths[0], 'resources/app/patches'), () => {})
})