Browse Source

Passage à electron 1.6.5

Benjamin Gaudé 7 months ago
parent
commit
ac60596bb3
7 changed files with 19 additions and 20 deletions
  1. 7 5
      main.js
  2. 3 4
      package.json
  3. 2 5
      src/app.js
  4. 2 2
      src/components/edit/profile-menu.js
  5. 1 1
      src/store/actions/launcher.js
  6. 3 3
      src/util/app.js
  7. 1 0
      src/util/profile.js

+ 7 - 5
main.js

@@ -1,6 +1,8 @@
1
-var app = require('app');  // Module to control application life.
2
-var BrowserWindow = require('browser-window');  // Module to create native browser window.
3
-var Menu = require('menu');
1
+var app = require('electron').app;  // Module to control application life.
2
+//var BrowserWindow = require('browser-window');  // Module to create native browser window
3
+var BrowserWindow = require('electron').BrowserWindow;
4
+
5
+var Menu = require('electron').menu;
4 6
 var isDev = process.env.NODE_ENV === 'development';
5 7
 var Util = require('./'+(isDev ? 'src': 'dist')+'/util');
6 8
 
@@ -16,7 +18,7 @@ app.on('window-all-closed', function() {
16 18
 
17 19
 app.on('ready', function() {
18 20
   // Create the browser window.
19
-  var electronScreen = require('screen');
21
+  var electronScreen = require('electron').screen;
20 22
   var workArea = electronScreen.getPrimaryDisplay().workArea;
21 23
 
22 24
   var asDesktop = process.env.PITAYA_AS_DESKTOP == 1;
@@ -37,7 +39,7 @@ app.on('ready', function() {
37 39
   }
38 40
 
39 41
   // and load the index.html of the app.
40
-  mainWindow.loadUrl('file://' + __dirname + '/index.html');
42
+  mainWindow.loadURL('file://' + __dirname + '/index.html');
41 43
 
42 44
   mainWindow.on('closed', function() {
43 45
     mainWindow = null;

+ 3 - 4
package.json

@@ -4,11 +4,10 @@
4 4
   "private": "true",
5 5
   "main": "main.js",
6 6
   "devDependencies": {
7
-    "electron-packager": "^5.1.0",
8
-    "electron-prebuilt": "^0.37.5",
7
+    "electron": "^1.6.5",
8
+    "node-jsx": "^0.13.3",
9 9
     "nodeunit": "^0.9.1",
10
-    "react-tools": "^0.13.3",
11
-    "node-jsx": "^0.13.3"
10
+    "react-tools": "^0.13.3"
12 11
   },
13 12
   "scripts": {
14 13
     "test": "./node_modules/.bin/nodeunit test",

+ 2 - 5
src/app.js

@@ -31,10 +31,7 @@ function select(state) {
31 31
 // Connect App to Redux store
32 32
 App = connect(select)(App);
33 33
 
34
-ReactDOM.render(
35
-  <Provider store={store}>
36
-    <App />
37
-  </Provider>
38
-  ,
34
+
35
+ReactDOM.render(<Provider store={store}><App /></Provider>,
39 36
   document.getElementById('pitaya')
40 37
 );

+ 2 - 2
src/components/edit/profile-menu.js

@@ -2,7 +2,7 @@
2 2
 var React = require('react');
3 3
 var connect = require('react-redux').connect;
4 4
 var actions = require('../../store/actions');
5
-var dialog = require('remote').require('dialog');
5
+var dialog = require('electron').remote.dialog;
6 6
 
7 7
 var ProfileMenu = React.createClass({
8 8
 
@@ -57,7 +57,7 @@ var ProfileMenu = React.createClass({
57 57
     },
58 58
 
59 59
     showSaveProfileDialog: function(defaultPath) {
60
-
60
+      
61 61
       return new Promise(function(resolve) {
62 62
         dialog.showSaveDialog(
63 63
           {

+ 1 - 1
src/store/actions/launcher.js

@@ -1,6 +1,6 @@
1 1
 var Util = require('../../util');
2 2
 var logger = Util.Logger;
3
-var remote = require('remote');
3
+var remote = require('electron').Remote;
4 4
 
5 5
 var RUN_APP = exports.RUN_APP = 'RUN_APP';
6 6
 var RUN_APP_SUCCESS = exports.RUN_APP_SUCCESS = 'RUN_APP_SUCCESS';

+ 3 - 3
src/util/app.js

@@ -1,8 +1,9 @@
1
-var ipc = require('ipc');
1
+//var ipc = require('ipc');
2
+var ipc = require('electron').ipcMain;
2 3
 var isMainProcess = process.type === 'browser';
3
-
4 4
 var QUIT_CMD = 'app-util:quit';
5 5
 
6
+
6 7
 exports.quit = function(exitCode) {
7 8
   if(isMainProcess) {
8 9
     process.exit(exitCode);
@@ -13,7 +14,6 @@ exports.quit = function(exitCode) {
13 14
 
14 15
 // Main process, setup listeners
15 16
 if(isMainProcess) {
16
-
17 17
   ipc.on(QUIT_CMD, function(evt, exitCode) {
18 18
     exports.quit(exitCode);
19 19
   });

+ 1 - 0
src/util/profile.js

@@ -24,6 +24,7 @@ exports.load = function(profileUrl, withImports) {
24 24
 
25 25
       for(var node, item = iterator.next(); !item.done; item = iterator.next()) {
26 26
         node = item.value.node;
27
+
27 28
         // For each import found, load the partial and "mount" it on the current item
28 29
         if(node.import) {
29 30
           var importPath = path.resolve(path.dirname(profileUrl), node.import)