Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Sapletta committed Feb 7, 2020
1 parent f25db0c commit 10c1496
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 10 deletions.
93 changes: 90 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ Node on linux

Start

node ./app.js
node promagen.js


## compiling code with nexe
https://github.com/nexe/nexe
Expand All @@ -58,21 +59,107 @@ install
compile

nexe app.js
nexe promagen.js --build
nexe -i promagen.js --build -o promagen.exe -r 1.0.1 --verbose

nexe --build -o promagen -r "./views/**/*" -r "./src/**/*" -r "./public/**/*" --verbose
nexe .\promagen.js --build -o promagen.exe --verbose


## Wix toolset
https://github.com/wixtoolset
https://github.com/wixtoolset/wix3/releases/tag/wix3112rtm


## nasm repair

download:
https://www.nasm.us/pub/nasm/releasebuilds/2.14rc16/win64/nasm-2.14rc16-installer-x64.exe

start /wait nasm.exe /S
ps: $env:path="C:\Program Files\nasm;$($env:path)"

## Electron
https://github.com/electron/simple-samples/blob/master/prices/package.json

npm i -g electron-builder

### Electron package module
https://github.com/Urucas/electron-packager-interactive

npm install -g electron-packager-interactive

### packager
https://www.npmjs.com/package/electron-packager

electron-packager .

## Electron pack
https://medium.com/jstack-eu/using-electron-with-react-and-node-b498fbf23272

npm run electron-pack
electron-builder -c.extraMetadata.main='./app.js'

### Builder
https://stackoverflow.com/questions/36515099/how-to-package-an-electron-app-into-a-single-executable
electron-builder

electron-builder --publish --win

stworzenie instalatora w folderze dist

electron-builder --win

# install build dependency modules
npm install nan
npm install node-gyp

### electron logs

npm i electron-log

### Elctron with boxedapp
https://www.boxedapp.com/boxedapppacker/usecases/pack_node_webkit_app_into_single_exe.html

## NW JS

npm install -g nw

### NW examples
https://github.com/zcbenz/nw-sample-apps/tree/master/file-explorer

## elctron logs
## Shell execute file
https://ourcodeworld.com/articles/read/154/how-to-execute-an-exe-file-system-application-using-electron-framework

var child = require('child_process').execFile;
var executablePath = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe";
var parameters = ["--incognito"];

child(executablePath, parameters, function(err, data) {
console.log(err)
console.log(data.toString());
});

## Problem with vcbuild.bat
run in powershell

npm install --global windows-build-tools


## ProMaGen
versions:
+ desktop: local with nexe and electron window
+ express
+ electron
+ server: only express service, works on external domain
+ express
+ nexe
+ mobile: server + optimisation for mobile devices
+ express
+ nexe
+ https://github.com/Urucas/slideout

npm i electron-log
## About processes
https://nodejs.org/api/child_process.html

36 changes: 32 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
"productName": "ProMaGen One",
"version": "1.0.1",
"repository": "promagen/one",
"description": "compilated version of express app",
"homepage": "https://promagen.com",
"bugs": {
"url": "https://github.com/promagen/one/issues"
},
"author": {
"name": "Tom Promagen",
"email": "[email protected]"
},
"description": "portable version of express app",
"keywords": [
"Project",
"Manager",
Expand All @@ -14,15 +22,31 @@
"terminal",
"bash",
"shell",
"scripts"
"scripts",
"portable",
"electron",
"express",
"pwa"
],
"private": true,
"scripts": {
"electron-pack": "electron-builder -c.extraMetadata.main='./app.js'",
"preelectron-pack": "npm run react-build && npm run server-build",
"nexe": "nexe --build",
"start": "electron .",
"start1": "node start-electron.js",
"start4": ".\\node_modules\\node\\bin\\node.exe start-electron.js",
"build1": "electron-builder -p --win",
"pack": "electron-builder --dir",
"dist": "electron-builder",
"pack2": "electron-packager ./ one --all --out ~/Desktop/One --version 0.30.2 --overwrite --icon=./app/img/app-icon.icns",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"electron": "^8.0.0"
"electron": "^8.0.0",
"electron-packager": "*",
"electron-builder": "^22.3.2",
"nexe": "*"
},
"main": "app.js",
"dependencies": {
Expand All @@ -31,20 +55,24 @@
"cookie-parser": "~1.4.3",
"debug": "~2.6.9",
"electron-log": "^4.0.6",
"electron-positioner": "^4.1.0",
"express": "~4.16.0",
"fs-path": "0.0.24",
"http-errors": "~1.6.2",
"ini": "^1.3.5",
"linebyline": "^1.3.0",
"morgan": "~1.9.0",
"nexe": "^3.3.2",
"nan": "^2.14.0",
"node-gyp": "^6.1.0",
"opn": "^5.3.0",
"os-homedir": "^1.0.2",
"papaparse": "^4.6.0",
"pug": "^2.0.4",
"shelljs": "^0.8.2"
},
"build": {
"appId": "com.electron.promagen-one",
"target": "portable",
"extraResources": "node_modules",
"files": [
"!node_modules"
Expand Down
49 changes: 46 additions & 3 deletions src/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ module.exports = function () {
const app = electron.app; // Module to control application life.
const BrowserWindow = electron.BrowserWindow; // Module to create native browser window.



const log = require('electron-log'); // the app to write to the console, as well as a file located at ~/Library/Logs/[productName]
const path = require('path');
const web = require('./web'); // Start Express web app based on Express
Expand Down Expand Up @@ -39,28 +41,31 @@ module.exports = function () {
function createWindow() {
// Create the browser window.
const mainWindow = new BrowserWindow({
autoHideMenuBar: true,
width: 1280,
height: 720,
// backgroundcolor: '#2e2c29',
// autoHideMenuBar: true,
// useContentSize: true,
title: productName
title: productName,
// webPreferences: {
// nodeIntegration: true
// preload: path.join(__dirname, 'public/electron/preload.js')
// }
});

// log.info(mainWindow);

// var localurl = 'http://localhost:' + localConfig.port + '/';
var localurl = 'http://localhost:' + localConfig.port + '/electron/index.html';
var localurl = 'http://localhost:' + localConfig.port + '/';
// var localurl = 'http://localhost:' + localConfig.port + '/electron/index.html';
// var localurl = url.format({
// // pathname: 'localhost:' + localConfig.port + '/electron/index.html',
// pathname: 'localhost:' + localConfig.port + '',
// protocol: 'http:',
// slashes: true
// });
console.log(localurl);

var localfile = './public/electron/index.html';
// localfile = path.join(__dirname, localfile);
console.log(localfile);
Expand All @@ -77,6 +82,44 @@ module.exports = function () {

// Open the DevTools.
// mainWindow.webContents.openDevTools()

var Positioner = require('electron-positioner'); // https://github.com/jenslind/electron-positioner
var positioner = new Positioner(mainWindow)

// Moves the window top right on the screen.
positioner.move('topRight')

// Returns `{x,y}`
// positioner.calculate('trayCenter', trayBounds)

/*
A string telling where to place the window. Allowed values:
trayLeft
trayBottomLeft
trayRight
trayBottomRight
trayCenter
trayBottomCenter
topLeft
topRight
bottomLeft
bottomRight
topCenter
bottomCenter
leftCenter
rightCenter
center
trayBounds
Tray bounds, only needed for the following positions:
trayLeft
trayBottomLeft
trayRight
trayBottomRight
trayCenter
trayBottomCenter
*/
}


Expand Down

0 comments on commit 10c1496

Please sign in to comment.