desktop watcher

This commit is contained in:
antelle 2016-08-13 17:28:06 +03:00
parent ab3eaf00a4
commit 6b9b6f741f
4 changed files with 13 additions and 18 deletions

View File

@ -296,10 +296,10 @@ module.exports = function(grunt) {
interrupt: true,
debounceDelay: 500
},
scripts: {
files: ['app/scripts/**/*.js', 'app/templates/**/*.hbs'],
tasks: ['webpack']
},
// scripts: {
// files: ['app/scripts/**/*.js', 'app/templates/**/*.hbs'],
// tasks: ['webpack']
// },
styles: {
files: 'app/styles/**/*.scss',
tasks: ['sass']
@ -670,10 +670,6 @@ module.exports = function(grunt) {
'concurrent:dev-server'
]);
grunt.registerTask('dev-desktop', 'Start watcher for desktop app', [
'watch'
]);
grunt.registerTask('desktop', 'Build web and desktop apps for all platforms', [
'default',
'build-desktop'

View File

@ -44,8 +44,8 @@ The app can be built with grunt: `grunt` (html file will be in `dist/`).
Desktop apps are built with `grunt desktop`. This works only in mac osx as it builds dmg; requires wine.
To run Electron app without building installer, install electron package (`npm install electron-prebuilt -g`), build the app with `grunt` and start in this way:
```bash
$ grunt
$ electron electron --htmlpath=tmp
$ grunt && grunt dev
$ npm run-script electron
```
For debug build:

View File

@ -10,16 +10,14 @@ var mainWindow = null,
openFile = process.argv.filter(arg => /\.kdbx$/i.test(arg))[0],
ready = false,
restartPending = false,
htmlPath = path.join(__dirname, 'index.html'),
mainWindowPosition = {},
updateMainWindowPositionTimeout = null,
windowPositionFileName = path.join(app.getPath('userData'), 'window-position.json');
process.argv.forEach(arg => {
if (arg.lastIndexOf('--htmlpath=', 0) === 0) {
htmlPath = path.resolve(arg.replace('--htmlpath=', ''), 'index.html');
}
});
let htmlPath = process.argv.filter(arg => arg.startsWith('--htmlpath=')).map(arg => arg.replace('--htmlpath=', ''))[0];
if (!htmlPath) {
htmlPath = 'file://' + path.join(__dirname, 'index.html');
}
app.on('window-all-closed', () => {
if (restartPending) {
@ -115,7 +113,7 @@ function createMainWindow() {
}
});
setMenu();
mainWindow.loadURL('file://' + htmlPath);
mainWindow.loadURL(htmlPath);
mainWindow.setContentProtection(true);
mainWindow.webContents.on('dom-ready', () => {
setTimeout(() => {

View File

@ -60,7 +60,8 @@
"start": "grunt",
"test": "grunt test",
"postinstall": "cd electron && npm install",
"copy-beta": "grunt && sed 's/<html manifest=\"manifest.appcache\">//' dist/index.html > ../keeweb-beta/diy/index.html && cd ../keeweb-beta && git add diy/index.html && git commit -a -m 'beta' && git push origin master"
"copy-beta": "grunt && sed 's/<html manifest=\"manifest.appcache\">//' dist/index.html > ../keeweb-beta/diy/index.html && cd ../keeweb-beta && git add diy/index.html && git commit -a -m 'beta' && git push origin master",
"electron": "electron electron --htmlpath=http://localhost:8085/tmp/"
},
"author": {
"name": "Antelle",