Skip to content
Snippets Groups Projects
Commit 00a30911 authored by mathias.chouet's avatar mathias.chouet
Browse files

Ajout configuration "build" dans package.json

parent eeb7e0fa
No related branches found
No related tags found
1 merge request!47Electron
main.js 0 → 100644
const { app, dialog, BrowserWindow } = require('electron');
let win;
function createWindow () {
// Create the browser window.
win = new BrowserWindow({ width: 800, height: 600 });
// and load the index.html of the app.
win.loadFile("./dist/index.html");
// Hide menu bar.
win.setMenuBarVisibility(false)
// Open the DevTools.
// win.webContents.openDevTools();
// Close the app.
win.on('close', () => {
// @TODO does not render properly on Linux
/* var choice = dialog.showMessageBox(this,
{
type: 'question',
buttons: ['Yes', 'No'],
title: 'Confirm',
message: 'Are you sure you want to quit?'
}
);
if(choice == 1){
e.preventDefault();
} */
win.destroy();
});
// Emitted when the window is closed.
win.on('closed', () => {
win = null;
})
};
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow);
// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (win === null) {
createWindow()
}
});
This diff is collapsed.
{
"name": "nghyd",
"description": "Hydraulic calculators",
"author": "Irstea",
"version": "4.1.0",
"main": "main.js",
"homepage": "http://cassiopee.g-eau.net",
"license": "MIT",
"build": {
"appId": "fr.irstea.cassiopee",
"productName": "Cassiopee",
"linux": {
"target": "deb"
},
"deb": {
"maintainer": "irstea"
},
"mac": {
"target": "dmg"
},
"win": {
"target": "nsis"
}
},
"scripts": {
"ng": "ng",
"start": "npm run preprocess; ng serve --host 0.0.0.0",
"prod": "npm run preprocess; ng serve --host 0.0.0.0 --prod",
"build": "npm run preprocess; ng build --prod --build-optimizer=false",
"electron": "electron .",
"electron-dist": "electron-builder",
"electron-clean-dist": "rm dist/nghyd*",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
......@@ -66,6 +89,8 @@
"@types/jasminewd2": "^2.0.6",
"@types/node": "^8.10.42",
"codelyzer": "^4.5.0",
"electron": "^5.0.1",
"electron-builder": "^20.40.2",
"jasmine-core": "~3.3.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^3.1.4",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment