Skip to content
Permalink
Browse files

build system

  • Loading branch information...
pravdomil committed Mar 3, 2016
1 parent bf19329 commit 8770ed65840574e03208b8049c145426027f9441
Showing with 109 additions and 24 deletions.
  1. +1 −1 .gitignore
  2. +9 −0 distribution/build.js
  3. +42 −0 distribution/prebuild.js
  4. +57 −23 package.json
@@ -1,2 +1,2 @@
/node_modules
/distribution
/distribution/*/*
@@ -0,0 +1,9 @@
'use strict'

var path = require('path')

process.chdir(path.join(__dirname, '..'))

var pjson = require(path.join(__dirname, '../package.json'))

require('electron-packager')(pjson.electronPackagerOpts, e => console.log(e ? e : 'done'))
@@ -0,0 +1,42 @@
'use strict'

// Rebuild native modules
//
// 1) run first under Win machine
// electron-prebuild and electron-rebuild must install globally
// 2) then under Mac machine
//

var fs = require('fs')
var path = require('path')
var child_process = require('child_process')

// change dir
process.chdir(path.join(__dirname, '..'))

if(process.platform == "win32") {

// update packages
child_process.execSync('npm update -g electron-prebuild', { stdio: [0, 1, 2] })
child_process.execSync('npm update -g electron-rebuild', { stdio: [0, 1, 2] })

// rebuild
child_process.execSync('electron-rebuild -w serialport -m .', { stdio: [0, 1, 2] })

// correct naming
var bin = path.join(path.dirname(require.resolve('serialport')), 'build', 'Release')
var getDirectories = p => fs.readdirSync(p).filter(f => fs.statSync(path.join(p, f)).isDirectory())

getDirectories(bin).forEach(p => {
if(!p.match(/^electron-/)) return
var o = path.join(bin, p)
var n = path.join(bin, p.replace(/electron-[^-]+/, `node-v${process.versions.modules}`))
fs.renameSync(o, n)
})

} else if(process.platform == "darwin") {

// rebuild
process.chdir(path.dirname(require.resolve('serialport')))
child_process.execSync('npm run install')
}
@@ -1,32 +1,66 @@
{
"name": "pra-control",
"version": "1.0.0",
"description": "Send awesome gCodes to your machine.",
"productName": "PraControl",
"name": "pra-control",
"version": "1.0.0",
"description": "Send awesome gCodes to your machine.",
"productName": "PraControl",
"keywords": ["gCode", "control", "serial", "awesome", "rembased"],

"author": { "name": "Pravdomil Toman", "email": "info@pravdomil.cz", "url": "http://pravdomil.cz" },
"contributors": [
"contributors": [
{ "name": "Pravdomil Toman", "email": "info@pravdomil.cz", "url": "http://pravdomil.cz" }
],
],

"homepage": "http://pracontrol.pravdomil.cz",
"homepage": "http://pracontrol.pravdomil.cz",
"repository": { "type": "git", "url": "https://github.com/pravdomil/pra-control" },
"bugs": "https://github.com/pravdomil/pra-control/issues",
"featureRequest": "https://github.com/pravdomil/pra-control/issues/new",
"pullRequest": "https://github.com/pravdomil/pra-control/pull/new",
"donate": "https://salt.bountysource.com/checkout/amount?team=pracontrol",
"bugs": "https://github.com/pravdomil/pra-control/issues",
"featureRequest": "https://github.com/pravdomil/pra-control/issues/new",
"pullRequest": "https://github.com/pravdomil/pra-control/pull/new",
"donate": "https://salt.bountysource.com/checkout/amount?team=pracontrol",

"main": "_main/index.js",
"scripts": {
"start": "electron .",
},
"dependencies": {
"less": "*",
"serialport": "*"
},
"devDependencies": {
"electron-prebuilt": "*"
},
"license": "MIT"
"main": "_main/index.js",
"scripts": {
"start": "electron .",
"predist": "node distribution/prebuild",
"dist": "node distribution/build"
},
"dependencies": {
"less": "*",
"serialport": "*"
},
"devDependencies": {
"electron-prebuilt": "*",
"electron-packager": "*"
},
"license": "MIT",

"electronPackagerOpts": {
"dir": ".",
"out": "distribution",
"ignore": [
"^(?!$|/_main|/_renderer|/node_modules|/package.json$)",
"/\\.[^/]*"
],
"overwrite": true,

"arch": "x64",
"platform": "win32,darwin",

"asar": true,
"prune": true,

"app-bundle-id": "pravdomil.pra-control",
"app-version": "1.0.0",
"app-category-type": "public.app-category.utilities",
"icon": "resources/icon",
"app-copyright": "",

"version-string": {
"CompanyName": "Pravdomil.cz",
"ProductName": "PraControl",
"FileDescription": "Send awesome gCodes!",
"InternalName": "",
"OriginalFilename": "",
"LegalCopyright": ""
}
}
}

0 comments on commit 8770ed6

Please sign in to comment.
You can’t perform that action at this time.