Skip to content

Instantly share code, notes, and snippets.

@insign
Created June 7, 2017 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save insign/2b82332b25906e5f1d7b3f6c2e8415d7 to your computer and use it in GitHub Desktop.
Save insign/2b82332b25906e5f1d7b3f6c2e8415d7 to your computer and use it in GitHub Desktop.
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