Skip to content

Commit

Permalink
0.1.0
Browse files Browse the repository at this point in the history
- show dropdown menu, instead of electron webview
    - default sync interval is 60 seconds, should use less CPU
  • Loading branch information
gabrielcsapo committed Jul 15, 2017
1 parent 94e045c commit b2f981b
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 212 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ typings/
temp
.DS_Store
package-lock.json
release
dist
5 changes: 5 additions & 0 deletions CHANGELOG.md
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
Binary file modified assets/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 0 additions & 9 deletions index.html

This file was deleted.

48 changes: 48 additions & 0 deletions index.js
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())
})
});
72 changes: 0 additions & 72 deletions log.js

This file was deleted.

101 changes: 0 additions & 101 deletions main.js

This file was deleted.

55 changes: 26 additions & 29 deletions package.json
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"
}
}

0 comments on commit b2f981b

Please sign in to comment.