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
nwjs
my-profile.json
js-compiled

View File

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

View File

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

View File

@ -1,6 +1,6 @@
var React = require('react');
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 DesktopAppItem = React.createClass({

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
var React = require('react/addons');
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 DropTarget = require('react-dnd').DropTarget;
var _ = require('lodash');

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
var app = require('app'); // Module to control application life.
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;

View File

@ -6,12 +6,17 @@
"devDependencies": {
"electron-packager": "^5.1.0",
"electron-prebuilt": "^0.33.6",
"nodeunit": "^0.9.1"
"nodeunit": "^0.9.1",
"react-tools": "^0.13.3",
"node-jsx": "^0.13.3"
},
"scripts": {
"test": "./node_modules/.bin/nodeunit test",
"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": {
"bootstrap": "^3.3.5",
@ -20,8 +25,6 @@
"glob": "^5.0.14",
"ini": "^1.3.4",
"lodash": "^3.10.1",
"minimist": "^1.1.3",
"node-jsx": "^0.13.3",
"react": "^0.13.3",
"react-dnd": "^1.1.5",
"react-redux": "^2.0.0",