Pre-compilation des fichiers JSX avant build

This commit is contained in:
wpetit 2015-10-09 14:22:23 +02:00
parent 40707be387
commit f12950df1a
18 changed files with 34 additions and 24 deletions

1
.gitignore vendored
View File

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

View File

@ -15,11 +15,16 @@
global.document = global.window.document; global.document = global.window.document;
global.navigator = global.window.navigator; global.navigator = global.window.navigator;
// Auto transform JSX var isDev = process.env.NODE_ENV === 'development';
require('node-jsx').install();
// Launch application if(isDev) {
require('./js/app.jsx'); // Auto transform JSX
require('node-jsx').install({extension: '.js'});
// Launch application
require('./js/app.js');
} else {
require('./js-compiled/app.js');
}
</script> </script>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,12 +6,17 @@
"devDependencies": { "devDependencies": {
"electron-packager": "^5.1.0", "electron-packager": "^5.1.0",
"electron-prebuilt": "^0.33.6", "electron-prebuilt": "^0.33.6",
"nodeunit": "^0.9.1" "nodeunit": "^0.9.1",
"react-tools": "^0.13.3",
"node-jsx": "^0.13.3"
}, },
"scripts": { "scripts": {
"test": "./node_modules/.bin/nodeunit test", "test": "./node_modules/.bin/nodeunit test",
"start": "./node_modules/.bin/electron .", "start": "./node_modules/.bin/electron .",
"build": "./node_modules/.bin/electron-packager ./ pitaya --platform=linux --arch=ia32,x64 --version=0.33.6 --out=build --overwrite" "compile": "./node_modules/.bin/jsx -x js js js-compiled",
"clean": "rm -rf js-compiled/* build/*",
"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",
"build": "npm run clean && npm run compile && npm run package"
}, },
"dependencies": { "dependencies": {
"bootstrap": "^3.3.5", "bootstrap": "^3.3.5",
@ -20,8 +25,6 @@
"glob": "^5.0.14", "glob": "^5.0.14",
"ini": "^1.3.4", "ini": "^1.3.4",
"lodash": "^3.10.1", "lodash": "^3.10.1",
"minimist": "^1.1.3",
"node-jsx": "^0.13.3",
"react": "^0.13.3", "react": "^0.13.3",
"react-dnd": "^1.1.5", "react-dnd": "^1.1.5",
"react-redux": "^2.0.0", "react-redux": "^2.0.0",