├── .gitignore ├── LICENSE.md ├── README.md ├── index.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2016 Jhen-Jie Hong 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # hyperterm-install-devtools 2 | 3 | > Install DevTools extension via Chrome Web Store on [HyperTerm](https://hyperterm.org), used [electron-devtools-installer](https://github.com/GPMDP/electron-devtools-installer). 4 | 5 | ![Screenshot](https://cloud.githubusercontent.com/assets/3001525/16935410/cbc9aa9e-4d91-11e6-9d59-61317b6644d1.png) 6 | 7 | > Use [React Developer Tools](https://github.com/facebook/react-devtools) on web page (Open DevTools by [hyperterm-open-devtools](https://www.npmjs.com/package/hyperterm-open-devtools)) 8 | 9 | ## Install 10 | 11 | Add `hyperterm-install-devtools` to the plugins list in your `~/.hyperterm.js` config file. 12 | 13 | ## Config of install extensions 14 | 15 | You can set `installDevTools` in `~/.hyperterm.js` config file: 16 | 17 | ``` 18 | config: { 19 | ... 20 | installDevTools: { 21 | extensions: [ 22 | 'REACT_DEVELOPER_TOOLS', 23 | 'REDUX_DEVTOOLS' 24 | ], 25 | forceDownload: false 26 | } 27 | } 28 | ``` 29 | 30 | You need restart app to apply the config. 31 | 32 | See [`What extensions can I use`](https://github.com/GPMDP/electron-devtools-installer#what-extensions-can-i-use) for more information. 33 | 34 | ## License 35 | 36 | [MIT](LICENSE.md) 37 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const { BrowserWindow } = require('electron') 2 | const installer = require('electron-devtools-installer') 3 | 4 | const notify = (title, body) => { 5 | const win = BrowserWindow.getAllWindows()[0]; 6 | if (win) { 7 | win.webContents.executeJavaScript(` 8 | new Notification('${title}', { 9 | body: '${body}' 10 | }) 11 | `) 12 | } 13 | } 14 | 15 | const install = (extensions, forceDownload, index = 0) => { 16 | let id = extensions[index] 17 | if (installer[id]) id = installer[id] 18 | if (!extensions[index]) return 19 | 20 | const next = () => install(extensions, forceDownload, index + 1) 21 | 22 | installer.default(id, forceDownload) 23 | .then(next) 24 | .catch(err => { 25 | notify('Install extension', err) 26 | next() 27 | }) 28 | } 29 | 30 | exports.onApp = app => { 31 | const { installDevTools: config } = app.config.getConfig() 32 | if (!config || !Array.isArray(config.extensions)) return 33 | const { extensions, forceDownload } = config 34 | 35 | install(extensions, !!forceDownload) 36 | } 37 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hyperterm-install-devtools", 3 | "version": "1.1.0", 4 | "description": "Install DevTools extension via Chrome Web Store on HyperTerm", 5 | "main": "index.js", 6 | "scripts": {}, 7 | "repository": { 8 | "type": "git", 9 | "url": "git+https://github.com/jhen0409/hyperterm-install-devtools.git" 10 | }, 11 | "keywords": [ 12 | "hyperterm", 13 | "install", 14 | "chrome", 15 | "devtools", 16 | "extension", 17 | "electron-devtools-installer" 18 | ], 19 | "author": "Jhen ", 20 | "license": "MIT", 21 | "dependencies": { 22 | "electron-devtools-installer": "^2.0.0" 23 | } 24 | } 25 | --------------------------------------------------------------------------------