new build method with Apple notarize, electron-build programatic API
This commit is contained in:
@@ -1,32 +1,10 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const basefile = path.join(__dirname, '../../')
|
||||
const package = fs.readFileSync(basefile + 'package.json')
|
||||
const data = JSON.parse(package)
|
||||
const version = data.version
|
||||
const codename = data.codename
|
||||
let ver = `${version} (${codename})`
|
||||
if (process.argv.indexOf('--automatic') === -1) {
|
||||
let input = require('readline-sync').question('version string [empty: ' + ver + ' (default)]? ')
|
||||
if (input) {
|
||||
ver = input
|
||||
}
|
||||
}
|
||||
var pwa = false
|
||||
if (process.argv.indexOf('--pwa') > 0) {
|
||||
var pwa = true
|
||||
}
|
||||
var store = false
|
||||
if (process.argv.indexOf('--store') > 0) {
|
||||
var store = true
|
||||
}
|
||||
|
||||
function main(ver, basefile, pwa, store) {
|
||||
function construct(ver, basefile, pwa, store) {
|
||||
const execSync = require('child_process').execSync
|
||||
let gitHash = execSync('git rev-parse HEAD')
|
||||
.toString()
|
||||
.trim()
|
||||
fs.writeFileSync(basefile + 'git', gitHash)
|
||||
console.log('Constructing view files ' + ver)
|
||||
const langs = ['ja', 'ja-KS', 'en', 'bg', 'cs', 'de',
|
||||
'es-AR', 'it-IT', 'zh-CN', 'fr-FR', 'zh-TW', 'no-NO', 'pt-BR', 'ru-RU', 'es-ES','pl-PL', 'ps']
|
||||
@@ -172,23 +150,4 @@ function main(ver, basefile, pwa, store) {
|
||||
}
|
||||
}
|
||||
}
|
||||
main(ver, basefile, pwa, store)
|
||||
|
||||
//if --watch, to yarn dev
|
||||
if (process.argv.indexOf('--watch') !== -1) {
|
||||
const chokidar = require('chokidar')
|
||||
console.log(
|
||||
'watch mode(not hot-watch): when construction files are changed, refresh view files but not reload. Please reload manually.'
|
||||
)
|
||||
const watcher = chokidar.watch(basefile + 'view/make', {
|
||||
ignored: 'view/make/make.js',
|
||||
persistent: true
|
||||
})
|
||||
watcher.on('ready', function () {
|
||||
console.log('watching...')
|
||||
watcher.on('change', function (path) {
|
||||
console.log(path + ' changed.')
|
||||
main(ver, basefile)
|
||||
})
|
||||
})
|
||||
}
|
||||
module.exports = construct
|
44
app/view/make/makeCli.js
Normal file
44
app/view/make/makeCli.js
Normal file
@@ -0,0 +1,44 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const construct = require('./make.js')
|
||||
const basefile = path.join(__dirname, '../../')
|
||||
const package = fs.readFileSync(basefile + 'package.json')
|
||||
const data = JSON.parse(package)
|
||||
const version = data.version
|
||||
const codename = data.codename
|
||||
let ver = `${version} (${codename})`
|
||||
if (process.argv.indexOf('--prompt') != -1) {
|
||||
let input = require('readline-sync').question('version string [empty: ' + ver + ' (default)]? ')
|
||||
if (input) {
|
||||
ver = input
|
||||
}
|
||||
}
|
||||
var pwa = false
|
||||
if (process.argv.indexOf('--pwa') > 0) {
|
||||
var pwa = true
|
||||
}
|
||||
var store = false
|
||||
if (process.argv.indexOf('--store') > 0) {
|
||||
var store = true
|
||||
}
|
||||
|
||||
construct(ver, basefile, pwa, store)
|
||||
|
||||
//if --watch, to yarn dev
|
||||
if (process.argv.indexOf('--watch') !== -1) {
|
||||
const chokidar = require('chokidar')
|
||||
console.log(
|
||||
'watch mode(not hot-watch): when construction files are changed, refresh view files but not reload. Please reload manually.'
|
||||
)
|
||||
const watcher = chokidar.watch(basefile + 'view/make', {
|
||||
ignored: 'view/make/make.js',
|
||||
persistent: true
|
||||
})
|
||||
watcher.on('ready', function () {
|
||||
console.log('watching...')
|
||||
watcher.on('change', function (path) {
|
||||
console.log(path + ' changed.')
|
||||
construct(ver, basefile)
|
||||
})
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user