-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- show dropdown menu, instead of electron webview - default sync interval is 60 seconds, should use less CPU
- Loading branch information
1 parent
94e045c
commit b2f981b
Showing
8 changed files
with
80 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,4 +59,4 @@ typings/ | |
temp | ||
.DS_Store | ||
package-lock.json | ||
release | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
# 0.1.0 (07/04/2017) | ||
|
||
- show dropdown menu, instead of electron webview | ||
- default sync interval is 60 seconds, should use less CPU | ||
|
||
# 0.0.1 (07/04/2017) | ||
|
||
- quick and easy working example |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
const { app, BrowserWindow, ipcMain, Tray, Menu, MenuItem, shell } = require('electron'); | ||
|
||
const path = require('path') | ||
const local = require('local-npm'); | ||
|
||
const assetsDir = path.join(__dirname, 'assets'); | ||
const tempDir = path.join(__dirname, 'temp'); | ||
|
||
const server = local({ | ||
directory: tempDir, | ||
port: 5678, | ||
pouchPort: 3040, | ||
logLevel: 'error', | ||
remote: 'https://registry.npmjs.org', | ||
remoteSkim: 'https://replicate.npmjs.com', | ||
url: 'http://127.0.0.1:5080', | ||
syncInterval: 60000 | ||
}, () => { | ||
console.log('listening!'); | ||
}); | ||
|
||
let tray; | ||
|
||
app.on('ready', () => { | ||
tray = new Tray(path.resolve(__dirname, './assets/cloudTemplate.png')); | ||
|
||
var requests = 0; | ||
var sync = 0; | ||
function getMenu() { | ||
return Menu.buildFromTemplate([ | ||
{label: 'http://localhost:5678', click: function() { shell.openExternal('http://localhost:5678/_browse') } }, | ||
{label: `requests: ${requests}`, type: 'normal'}, | ||
{label: `sync: ${sync}`, type: 'normal'} | ||
]); | ||
} | ||
|
||
process.on('request', (args) => { | ||
++requests; | ||
}) | ||
|
||
process.on('sync', (args) => { | ||
sync = args[1]; | ||
}) | ||
|
||
tray.on('click', function() { | ||
tray.popUpContextMenu(getMenu()) | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,28 @@ | ||
{ | ||
"name": "local-npm-daemon", | ||
"version": "0.0.1", | ||
"description": "An electron application to run local-npm", | ||
"main": "main.js", | ||
"scripts": { | ||
"start": "electron .", | ||
"build": "electron-packager . --overwrite --platform=linux,darwin --arch=x64 --icon=./assets/logo.icns --prune=true --out=release", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/gabrielcsapo/local-npm-daemon.git" | ||
}, | ||
"author": "Gabriel J. Csapo <[email protected]>", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/gabrielcsapo/local-npm-daemon/issues" | ||
}, | ||
"homepage": "https://github.com/gabrielcsapo/local-npm-daemon#readme", | ||
"devDependencies": { | ||
"devtron": "^1.4.0", | ||
"electron-packager": "^8.7.2", | ||
"electron-prebuilt": "^1.4.13" | ||
}, | ||
"dependencies": { | ||
"electron-debug": "^1.2.0", | ||
"electron-is-dev": "^0.2.0", | ||
"local-npm": "^2.1.0" | ||
} | ||
"name": "local-npm-daemon", | ||
"version": "0.1.0", | ||
"description": "An electron application to run local-npm", | ||
"main": "index.js", | ||
"scripts": { | ||
"start": "electron .", | ||
"build": "electron-rebuild && electron-packager . --overwrite --platform=linux,darwin --arch=x64 --icon=./assets/logo.icns --prune=true --out=dist --ignore=temp" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/gabrielcsapo/local-npm-daemon.git" | ||
}, | ||
"author": "Gabriel J. Csapo <[email protected]>", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/gabrielcsapo/local-npm-daemon/issues" | ||
}, | ||
"homepage": "https://github.com/gabrielcsapo/local-npm-daemon#readme", | ||
"devDependencies": { | ||
"electron": "^1.6.11", | ||
"electron-packager": "^8.7.2", | ||
"electron-rebuild": "^1.5.11" | ||
}, | ||
"dependencies": { | ||
"local-npm": "^2.2.0" | ||
} | ||
} |