Supression dependance non nécessaire + passage en variables d'environnement
This commit is contained in:
parent
0c5e2443fe
commit
40707be387
22
README.md
22
README.md
@ -19,23 +19,15 @@ npm install
|
|||||||
DEBUG=pitaya* npm start
|
DEBUG=pitaya* npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
## Options
|
## Variables d'environnement
|
||||||
|
|
||||||
```
|
Vous pouvez configurer le comportement de Pitaya en passant des variables d'environnement:
|
||||||
--profile=<chemin_profile> Chemin vers le fichier de profil à charger dans l'application.
|
|
||||||
--edit Ouvrir l'application en mode édition.
|
|
||||||
```
|
|
||||||
|
|
||||||
### Passer des options en développement
|
| Variable | Description | Valeurs possibles | Valeur par défaut |
|
||||||
|
|-------------------|------------------------------------|-------------------|------------------------|
|
||||||
```
|
| PITAYA_MODE | Mode d'exécution de Pitaya | launcher, edit | launcher |
|
||||||
npm start -- [options...]
|
| PITAYA_PROFILE | Chemin du fichier profil à charger | -- | ./default-profile.json |
|
||||||
```
|
| PITAYA_AS_DESKTOP | Afficher Pitaya en mode "Bureau" | 1, 0 | 0 |
|
||||||
|
|
||||||
Exemple:
|
|
||||||
```
|
|
||||||
npm start -- --profile=my-profile.json
|
|
||||||
```
|
|
||||||
|
|
||||||
## Comment construire l'application depuis les sources
|
## Comment construire l'application depuis les sources
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ var App = React.createClass({
|
|||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
|
|
||||||
var editMode = this.props.processOpts.edit || false;
|
var editMode = process.env.PITAYA_MODE === 'edit';
|
||||||
|
|
||||||
var view = editMode ? <EditView /> : <LauncherView />;
|
var view = editMode ? <EditView /> : <LauncherView />;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ var LauncherView = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
var profilePath = this.props.processOpts.profile || DEFAULT_PROFILE;
|
var profilePath = process.env.PITAYA_PROFILE || DEFAULT_PROFILE;
|
||||||
this.props.dispatch(actions.common.loadProfile(profilePath));
|
this.props.dispatch(actions.common.loadProfile(profilePath));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
var redux = require('redux');
|
var redux = require('redux');
|
||||||
var thunkMiddleware = require('redux-thunk');
|
var thunkMiddleware = require('redux-thunk');
|
||||||
var loggerMiddleware = require('redux-logger');
|
|
||||||
var reducers = require('./reducers');
|
var reducers = require('./reducers');
|
||||||
var loggerMiddleware = require('./middlewares/logger');
|
var loggerMiddleware = require('./middlewares/logger');
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
exports.desktopApps = require('./desktop-apps');
|
exports.desktopApps = require('./desktop-apps');
|
||||||
exports.profile = require('./profile');
|
exports.profile = require('./profile');
|
||||||
exports.processOpts = require('./process-opts');
|
|
||||||
exports.theme = require('./theme');
|
exports.theme = require('./theme');
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
var minimist = require('minimist');
|
|
||||||
|
|
||||||
var opts = minimist(process.argv);
|
|
||||||
|
|
||||||
module.exports = function(state, action) {
|
|
||||||
return opts;
|
|
||||||
};
|
|
2
js/util/const.js
Normal file
2
js/util/const.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
exports.EDIT_MODE = 'edit';
|
||||||
|
exports.LAUNCHER_MODE = 'launcher';
|
@ -3,15 +3,5 @@ var util = require('util');
|
|||||||
|
|
||||||
module.exports = function createLogger(namespace) {
|
module.exports = function createLogger(namespace) {
|
||||||
var logger = debug('pitaya:'+namespace);
|
var logger = debug('pitaya:'+namespace);
|
||||||
var isNWContext = 'window' in global;
|
|
||||||
var console = isNWContext ? global.window.console : global.console;
|
|
||||||
logger.log = function() {
|
|
||||||
if(isNWContext) {
|
|
||||||
console.log.apply(console, arguments);
|
|
||||||
} else {
|
|
||||||
var str = util.format.apply(util, arguments);
|
|
||||||
console.log(str);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return logger;
|
return logger;
|
||||||
};
|
};
|
||||||
|
9
main.js
9
main.js
@ -1,5 +1,6 @@
|
|||||||
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 mainWindow = null;
|
var mainWindow = null;
|
||||||
|
|
||||||
@ -13,10 +14,12 @@ app.on('ready', function() {
|
|||||||
var electronScreen = require('screen');
|
var electronScreen = require('screen');
|
||||||
var size = electronScreen.getPrimaryDisplay().workAreaSize;
|
var size = electronScreen.getPrimaryDisplay().workAreaSize;
|
||||||
|
|
||||||
|
var asDesktop = process.env.PITAYA_AS_DESKTOP == 1;
|
||||||
|
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
type: 'desktop',
|
type: asDesktop ? 'desktop' : undefined,
|
||||||
'skip-taskbar': true,
|
'skip-taskbar': asDesktop,
|
||||||
frame: false,
|
frame: !asDesktop,
|
||||||
width: size.width,
|
width: size.width,
|
||||||
height: size.height
|
height: size.height
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user