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
|
||||
```
|
||||
|
||||
## Options
|
||||
## Variables d'environnement
|
||||
|
||||
```
|
||||
--profile=<chemin_profile> Chemin vers le fichier de profil à charger dans l'application.
|
||||
--edit Ouvrir l'application en mode édition.
|
||||
```
|
||||
Vous pouvez configurer le comportement de Pitaya en passant des variables d'environnement:
|
||||
|
||||
### Passer des options en développement
|
||||
|
||||
```
|
||||
npm start -- [options...]
|
||||
```
|
||||
|
||||
Exemple:
|
||||
```
|
||||
npm start -- --profile=my-profile.json
|
||||
```
|
||||
| Variable | Description | Valeurs possibles | Valeur par défaut |
|
||||
|-------------------|------------------------------------|-------------------|------------------------|
|
||||
| PITAYA_MODE | Mode d'exécution de Pitaya | launcher, edit | launcher |
|
||||
| PITAYA_PROFILE | Chemin du fichier profil à charger | -- | ./default-profile.json |
|
||||
| PITAYA_AS_DESKTOP | Afficher Pitaya en mode "Bureau" | 1, 0 | 0 |
|
||||
|
||||
## Comment construire l'application depuis les sources
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ var App = React.createClass({
|
|||
|
||||
render: function() {
|
||||
|
||||
var editMode = this.props.processOpts.edit || false;
|
||||
var editMode = process.env.PITAYA_MODE === 'edit';
|
||||
|
||||
var view = editMode ? <EditView /> : <LauncherView />;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ var LauncherView = React.createClass({
|
|||
},
|
||||
|
||||
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));
|
||||
},
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
var redux = require('redux');
|
||||
var thunkMiddleware = require('redux-thunk');
|
||||
var loggerMiddleware = require('redux-logger');
|
||||
var reducers = require('./reducers');
|
||||
var loggerMiddleware = require('./middlewares/logger');
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
exports.desktopApps = require('./desktop-apps');
|
||||
exports.profile = require('./profile');
|
||||
exports.processOpts = require('./process-opts');
|
||||
exports.theme = require('./theme');
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
var minimist = require('minimist');
|
||||
|
||||
var opts = minimist(process.argv);
|
||||
|
||||
module.exports = function(state, action) {
|
||||
return opts;
|
||||
};
|
|
@ -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) {
|
||||
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;
|
||||
};
|
||||
|
|
9
main.js
9
main.js
|
@ -1,5 +1,6 @@
|
|||
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 mainWindow = null;
|
||||
|
||||
|
@ -13,10 +14,12 @@ app.on('ready', function() {
|
|||
var electronScreen = require('screen');
|
||||
var size = electronScreen.getPrimaryDisplay().workAreaSize;
|
||||
|
||||
var asDesktop = process.env.PITAYA_AS_DESKTOP == 1;
|
||||
|
||||
mainWindow = new BrowserWindow({
|
||||
type: 'desktop',
|
||||
'skip-taskbar': true,
|
||||
frame: false,
|
||||
type: asDesktop ? 'desktop' : undefined,
|
||||
'skip-taskbar': asDesktop,
|
||||
frame: !asDesktop,
|
||||
width: size.width,
|
||||
height: size.height
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue