Skip to content

Instantly share code, notes, and snippets.

@insign insign/all.js
Created Jun 7, 2017

Embed
What would you like to do?
Teste de promisses
let os = require('os')
let nativefier = require('nativefier').default
let c = require('colors')
let icon = './src/icon.png'
let options = {
name: 'Gmail Desktop',
targetUrl: 'https://mail.google.com/mail/mu/?mui=ca',
version: '0.0.3',
electronVersion: '1.7.2',
disableDevTools: true,
out: './builds/',
overwrite: true,
icon: icon,
counter: true,
minWidth: 800,
minHeight: 600,
singleInstance: true,
showMenuBar: false,
// maximize: true,
// crashReporter: 'https://electron-crash-reporter.appspot.com/5086233617235968/create/',
inject: [
'./src/gmail.js',
'./src/gmail.css',
]
}
module.exports = {
build: (ops, resolve, reject) => {
Object.assign(options, ops)
let platform = options.platform !== undefined ? options.platform : os.platform()
if (platform === 'darwin' || platform === 'osx' || platform === 'mac') {
icon = './src/icon.icns'
} else if (platform === 'win32' || platform === 'windows') {
icon = './src/icon.ico'
}
nativefier(options, (error, appPath) => {
if (error) {
console.error(error.red.bold)
if (typeof reject === 'function') reject(error)
return
}
if (typeof resolve === 'function') resolve(appPath)
console.log('Build:'.bold.green, appPath)
})
}
}
let all = require('./all')
let commandExists = require('command-exists').sync;
let os = require('os');
console.log('➜ Starting building'.green.bold)
let build = {
osx: (next) => {
console.log('🍏 Building for OSX x64...')
new Promise((on, off) => {
all.build({platform: 'darwin', arch: 'x64'}, on, off)
}).then(() => {
if (typeof next === 'function') next()
})
},
linux64: (next) => {
console.log('🐧 Building for Linux...')
new Promise((on, off) => {
console.log('🐧 x64'.bold)
all.build({platform: 'linux', arch: 'x64'}, on, off)
}).then(() => {
if (typeof next === 'function') next()
})
}
}
build.osx(function() {build.linux64()})
// // console.log('🐧 ia32'.bold)
// all.build({platform: 'linux', arch: 'ia32'})
// console.log('🚪 Building for Windows...')
// // console.log('🚪 x64'.bold)
// all.build({platform: 'win32', arch: 'x64'})
// // console.log('🚪 ia32'.bold)
// all.build({platform: 'win32', arch: 'ia32'})
// // console.log('➜ Process of building were done!'.green)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.