Browse Source

Pre-compilation des fichiers JSX avant build

feature/remote-launch
William Petit 3 years ago
parent
commit
f12950df1a

+ 1
- 0
.gitignore View File

@@ -7,3 +7,4 @@ dist
7 7
 build
8 8
 nwjs
9 9
 my-profile.json
10
+js-compiled

+ 9
- 4
index.html View File

@@ -15,11 +15,16 @@
15 15
       global.document = global.window.document;
16 16
       global.navigator = global.window.navigator;
17 17
 
18
-      // Auto transform JSX
19
-      require('node-jsx').install();
18
+      var isDev = process.env.NODE_ENV === 'development';
20 19
 
21
-      // Launch application
22
-      require('./js/app.jsx');
20
+      if(isDev) {
21
+        // Auto transform JSX
22
+        require('node-jsx').install({extension: '.js'});
23
+        // Launch application
24
+        require('./js/app.js');
25
+      } else {
26
+        require('./js-compiled/app.js');
27
+      }
23 28
 
24 29
     </script>
25 30
 

js/app.jsx → js/app.js View File

@@ -1,6 +1,6 @@
1 1
 var React = require('react');
2
-var LauncherView = require('./components/launcher/launcher-view.jsx');
3
-var EditView = require('./components/edit/edit-view.jsx');
2
+var LauncherView = require('./components/launcher/launcher-view.js');
3
+var EditView = require('./components/edit/edit-view.js');
4 4
 var Provider = require('react-redux').Provider;
5 5
 var connect = require('react-redux').connect;
6 6
 var store = require('./store');

js/components/common/app-icon.jsx → js/components/common/app-icon.js View File


js/components/edit/desktop-app-item.jsx → js/components/edit/desktop-app-item.js View File

@@ -1,6 +1,6 @@
1 1
 var React = require('react');
2 2
 var Util = require('../../util');
3
-var AppIcon = require('../common/app-icon.jsx');
3
+var AppIcon = require('../common/app-icon.js');
4 4
 var DragSource = require('react-dnd').DragSource;
5 5
 
6 6
 var DesktopAppItem = React.createClass({

js/components/edit/desktop-app-list.jsx → js/components/edit/desktop-app-list.js View File

@@ -1,6 +1,6 @@
1 1
 var React = require('react');
2 2
 var Util = require('../../util');
3
-var DesktopAppItem = require('./desktop-app-item.jsx');
3
+var DesktopAppItem = require('./desktop-app-item.js');
4 4
 var path = require('path');
5 5
 var debug = require('../../util/debug')('pitaya:desktop-app-list');
6 6
 

js/components/edit/edit-view.jsx → js/components/edit/edit-view.js View File

@@ -1,10 +1,10 @@
1 1
 var React = require('react');
2 2
 var connect = require('react-redux').connect;
3
-var ProfileTree = require('./profile-tree.jsx');
4
-var DesktopAppList = require('./desktop-app-list.jsx');
5
-var ItemForm = require('./item-form.jsx');
6
-var IconThemeSelector = require('./icon-theme-selector.jsx');
7
-var ProfileMenu = require('./profile-menu.jsx');
3
+var ProfileTree = require('./profile-tree.js');
4
+var DesktopAppList = require('./desktop-app-list.js');
5
+var ItemForm = require('./item-form.js');
6
+var IconThemeSelector = require('./icon-theme-selector.js');
7
+var ProfileMenu = require('./profile-menu.js');
8 8
 var tree = require('../../util/tree');
9 9
 
10 10
 var actions = require('../../store/actions');

js/components/edit/icon-theme-selector.jsx → js/components/edit/icon-theme-selector.js View File


js/components/edit/item-form.jsx → js/components/edit/item-form.js View File


js/components/edit/profile-menu.jsx → js/components/edit/profile-menu.js View File


js/components/edit/profile-tree.jsx → js/components/edit/profile-tree.js View File

@@ -1,7 +1,7 @@
1 1
 var React = require('react');
2 2
 var connect = require('react-redux').connect;
3 3
 var actions = require('../../store/actions');
4
-var TreeItem = require('./tree-item.jsx');
4
+var TreeItem = require('./tree-item.js');
5 5
 
6 6
 var TreeNode = React.createClass({
7 7
 

js/components/edit/tree-item.jsx → js/components/edit/tree-item.js View File

@@ -1,6 +1,6 @@
1 1
 var React = require('react/addons');
2 2
 var classNames = require('classnames');
3
-var AppIcon = require('../common/app-icon.jsx');
3
+var AppIcon = require('../common/app-icon.js');
4 4
 var DragSource = require('react-dnd').DragSource;
5 5
 var DropTarget = require('react-dnd').DropTarget;
6 6
 var _ = require('lodash');

js/components/launcher/app-item.jsx → js/components/launcher/app-item.js View File

@@ -1,5 +1,5 @@
1 1
 var React = require('react');
2
-var AppIcon = require('../common/app-icon.jsx');
2
+var AppIcon = require('../common/app-icon.js');
3 3
 
4 4
 module.exports = React.createClass({
5 5
 

js/components/launcher/app-list.jsx → js/components/launcher/app-list.js View File

@@ -1,5 +1,5 @@
1 1
 var React = require('react');
2
-var AppItem = require('./app-item.jsx');
2
+var AppItem = require('./app-item.js');
3 3
 
4 4
 module.exports = React.createClass({
5 5
 

js/components/launcher/category-header.jsx → js/components/launcher/category-header.js View File


js/components/launcher/launcher-view.jsx → js/components/launcher/launcher-view.js View File

@@ -1,6 +1,6 @@
1 1
 var React = require('react');
2
-var CategoryHeader = require('./category-header.jsx');
3
-var AppList = require('./app-list.jsx');
2
+var CategoryHeader = require('./category-header.js');
3
+var AppList = require('./app-list.js');
4 4
 var AnimateMixin = require('../mixins/animate');
5 5
 var actions = require('../../store/actions');
6 6
 var connect = require('react-redux').connect;

+ 2
- 1
main.js View File

@@ -1,6 +1,7 @@
1 1
 var app = require('app');  // Module to control application life.
2 2
 var BrowserWindow = require('browser-window');  // Module to create native browser window.
3
-var constants = require('./js/util/const');
3
+var isDev = process.env.NODE_ENV === 'development';
4
+var constants = require('./'+(isDev ? 'js': 'js-compiled')+'/util/const');
4 5
 
5 6
 var mainWindow = null;
6 7
 

+ 7
- 4
package.json View File

@@ -6,12 +6,17 @@
6 6
   "devDependencies": {
7 7
     "electron-packager": "^5.1.0",
8 8
     "electron-prebuilt": "^0.33.6",
9
-    "nodeunit": "^0.9.1"
9
+    "nodeunit": "^0.9.1",
10
+    "react-tools": "^0.13.3",
11
+    "node-jsx": "^0.13.3"
10 12
   },
11 13
   "scripts": {
12 14
     "test": "./node_modules/.bin/nodeunit test",
13 15
     "start": "./node_modules/.bin/electron .",
14
-    "build": "./node_modules/.bin/electron-packager ./ pitaya --platform=linux --arch=ia32,x64 --version=0.33.6 --out=build --overwrite"
16
+    "compile": "./node_modules/.bin/jsx -x js js js-compiled",
17
+    "clean": "rm -rf js-compiled/* build/*",
18
+    "package": "./node_modules/.bin/electron-packager ./ pitaya --prune --ignore=js/ --platform=linux --arch=x64,ia32 --version=0.33.6 --out=build --overwrite --app-version 0.0.0",
19
+    "build": "npm run clean && npm run compile && npm run package"
15 20
   },
16 21
   "dependencies": {
17 22
     "bootstrap": "^3.3.5",
@@ -20,8 +25,6 @@
20 25
     "glob": "^5.0.14",
21 26
     "ini": "^1.3.4",
22 27
     "lodash": "^3.10.1",
23
-    "minimist": "^1.1.3",
24
-    "node-jsx": "^0.13.3",
25 28
     "react": "^0.13.3",
26 29
     "react-dnd": "^1.1.5",
27 30
     "react-redux": "^2.0.0",

Loading…
Cancel
Save