├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── bin.js ├── cli.js ├── index.js ├── package.json └── usage.js /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 21 | .grunt 22 | 23 | # node-waf configuration 24 | .lock-wscript 25 | 26 | # Compiled binary addons (http://nodejs.org/api/addons.html) 27 | build/Release 28 | 29 | # Dependency directories 30 | node_modules 31 | jspm_packages 32 | 33 | # Optional npm cache directory 34 | .npm 35 | 36 | # Optional REPL history 37 | .node_repl_history 38 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 'node' 4 | sudo: false 5 | cache: 6 | directories: 7 | - node_modules 8 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # dti change log 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). 6 | 7 | 8 | ## [1.1.0](https://github.com/hypermodules/dti/releases/v1.1.0) 9 | 10 | - Add update notifications with [yeoman/update-notifier](https://github.com/yeoman/update-notifier) 11 | 12 | ## [1.0.3](https://github.com/hypermodules/dti/releases/v1.0.3) 13 | 14 | - Add example to usage instructions. 15 | - Always update to the latest version of devtools when installing. 16 | 17 | ## [1.0.2](https://github.com/hypermodules/dti/releases/v1.0.2) 18 | 19 | - Sort `list` command results 20 | - Fix permissions for `cli.js` (`chmod +x`) 21 | 22 | ## [1.0.1](https://github.com/hypermodules/dti/releases/v1.0.1) 23 | 24 | - Documentation updates 25 | 26 | ## [1.0.0](https://github.com/hypermodules/dti/releases/v1.0.0) 27 | 28 | - Initial release 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 hypermodules 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dti 2 | 3 | [![Build Status](https://travis-ci.org/hypermodules/dti.svg?branch=master)](https://travis-ci.org/hypermodules/dti) 4 | 5 | Command-line [Electron](https://github.com/electron/electron) Developer Tools Installer. 6 | 7 | - List out developer tools that are available for electron. 8 | - List what devtools you have installed, and what version is installed. 9 | - Easily install and uninstall developer tools into your electron development environment, directly from the chrome webstore. 10 | 11 | ### Installation 12 | 13 | ``` 14 | npm install -g dti 15 | ``` 16 | 17 | You should now have the `dti` command available to you in the command line. 18 | 19 | ### Usage 20 | 21 | ``` 22 | dti [] 23 | 24 | Quickly install and uninstall electron developer tools. 25 | 26 | list list available electron devtools 27 | installed list currently installed devtools and their versions 28 | install install devtools using a list of short names 29 | uninstall uninstall devtools using a list of short names 30 | 31 | Example: dti install devtron react redux 32 | ``` 33 | 34 | Currently supported devtools: 35 | 36 | - angular 37 | - backbone 38 | - devtron 39 | - ember 40 | - jquery 41 | - react 42 | - reactPerf 43 | - redux 44 | - vuejs 45 | 46 | ### FAQ 47 | 48 | #### Why is this a global CLI tool, and why does it bundle electron? 49 | 50 | `electron`/`electron-prebuilt` installs developer tools in a shared preference folder. As a result, devtools are shared between different development projects on your system. Project local dependencies are generally preferable but electron happens to just work this way. 51 | 52 | #### Why didn't it work? 53 | 54 | Make sure you quit out of any running processes of electron/electron-prebuilt. Sometimes the install silently fails if these are running. 55 | 56 | ### See also 57 | 58 | - [electron-devtools-installer](https://www.npmjs.com/package/electron-devtools-installer) 59 | 60 | ### License 61 | 62 | [MIT](LICENSE) 63 | -------------------------------------------------------------------------------- /bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env electron 2 | 3 | const dti = require('./') 4 | const { app } = require('electron') 5 | const argv = require('minimist')(process.argv.slice(2)) 6 | const inspect = require('util').inspect 7 | const usage = require('./usage') 8 | 9 | const command = argv._.shift() 10 | 11 | function cli (cb) { 12 | switch (command) { 13 | case 'list': 14 | Object.keys(dti.tools).sort().forEach(tool => console.log(tool)) 15 | return cb() 16 | case 'installed': 17 | const installed = dti.installed() 18 | for (const key in installed) { 19 | const name = dti.longNames[key] ? dti.longNames[key] : key 20 | console.log(`${name}: ${inspect(installed[key])}`) 21 | } 22 | return cb() 23 | case 'install': 24 | dti.install(argv._, err => { 25 | if (err) { 26 | console.error(err) 27 | } 28 | return cb() 29 | }) 30 | break 31 | case 'uninstall': 32 | dti.uninstall(argv._) 33 | return cb() 34 | default: 35 | console.log(usage) 36 | return cb() 37 | } 38 | } 39 | 40 | app.on('ready', cli.bind(null, app.quit)) 41 | -------------------------------------------------------------------------------- /cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var electron = require('electron') 4 | var path = require('path') 5 | var proc = require('child_process') 6 | var updateNotifier = require('update-notifier') 7 | var pkg = require('./package.json') 8 | 9 | updateNotifier({ pkg }).notify() 10 | 11 | var binPath = path.join(__dirname, 'bin.js') 12 | 13 | var args = process.argv.slice(2) 14 | 15 | var child = proc.spawn(electron, [binPath].concat(args), { stdio: 'inherit' }) 16 | child.on('close', function (code) { 17 | process.exit(code) 18 | }) 19 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const edi = require('electron-devtools-installer') 2 | const { default: installExtension } = edi 3 | const devtron = require('devtron') 4 | const { BrowserWindow } = require('electron') 5 | const series = require('run-series') 6 | 7 | const tools = { 8 | ember: { 9 | installer: 'edi', 10 | id: edi.EMBER_INSPECTOR, 11 | longName: 'Ember Inspector' 12 | }, 13 | react: { 14 | installer: 'edi', 15 | id: edi.REACT_DEVELOPER_TOOLS, 16 | longName: 'React Developer Tools' 17 | }, 18 | backbone: { 19 | installer: 'edi', 20 | id: edi.BACKBONE_DEBUGGER, 21 | longName: 'Backbone Debugger' 22 | }, 23 | jquery: { 24 | installer: 'edi', 25 | id: edi.JQUERY_DEBUGGER, 26 | longName: 'jQuery Debugger' 27 | }, 28 | angular: { 29 | installer: 'edi', 30 | id: edi.ANGULARJS_BATARANG, 31 | longName: 'AngularJS Batarang' 32 | }, 33 | vuejs: { 34 | installer: 'edi', 35 | id: edi.VUEJS_DEVTOOLS, 36 | longName: 'Vue.js devtools' 37 | }, 38 | redux: { 39 | installer: 'edi', 40 | id: edi.REDUX_DEVTOOLS, 41 | longName: 'Redux DevTools' 42 | }, 43 | reactPerf: { 44 | installer: 'edi', 45 | id: edi.REACT_PERF, 46 | longName: 'React Perf' 47 | }, 48 | devtron: { 49 | installer: 'devtron', 50 | longName: 'devtron' 51 | } 52 | } 53 | 54 | exports.tools = tools 55 | 56 | const longNames = {} 57 | 58 | for (const key in tools) { 59 | longNames[tools[key].longName] = key 60 | } 61 | 62 | exports.longNames = longNames 63 | 64 | const installers = { 65 | devtron: installDevtron, 66 | edi: installEDI 67 | } 68 | 69 | function installDevtron (toolObj, cb) { 70 | devtron.install() 71 | process.nextTick(cb) 72 | } 73 | 74 | function installEDI (toolObj, cb) { 75 | installExtension(toolObj.id, true).then(name => { 76 | console.log(`installed ${name}`) 77 | return cb(null) 78 | }).catch(err => { 79 | return cb(err) 80 | }) 81 | } 82 | 83 | function makeInstallers (t, cb) { 84 | if (!t) return [] 85 | return t.map(tool => { 86 | const toolObj = tools[tool] 87 | if (!toolObj) { 88 | console.log(`${tool} is not an available devtool`) 89 | return null 90 | } 91 | const installer = installers[toolObj.installer] 92 | return installer.bind(null, toolObj) 93 | }).filter(installer => typeof installer === 'function') 94 | } 95 | 96 | function installed () { 97 | return BrowserWindow.getDevToolsExtensions() 98 | } 99 | 100 | exports.installed = installed 101 | 102 | function install (t, cb) { 103 | const seriesWorkers = makeInstallers(t, cb) 104 | series(seriesWorkers, cb) 105 | } 106 | 107 | exports.install = install 108 | 109 | function uninstall (shortNames) { 110 | if (!shortNames) shortNames = [] 111 | shortNames.map(name => tools[name] ? tools[name].longName : name).forEach(longName => { 112 | try { 113 | BrowserWindow.removeDevToolsExtension(longName) 114 | console.log(`Uninstalled ${longName}`) 115 | } catch (e) { 116 | console.error(e) 117 | } 118 | }) 119 | } 120 | 121 | exports.uninstall = uninstall 122 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dti", 3 | "version": "1.1.0", 4 | "description": "Command-line Electron Developer Tools Installer.", 5 | "main": "index.js", 6 | "bin": { 7 | "dti": "./cli.js" 8 | }, 9 | "scripts": { 10 | "test": "dependency-check . && standard | snazzy" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/hypermodules/dti.git" 15 | }, 16 | "keywords": [ 17 | "cli", 18 | "electron", 19 | "devtools", 20 | "developer", 21 | "tools", 22 | "installer" 23 | ], 24 | "author": "Bret Comnes", 25 | "license": "MIT", 26 | "bugs": { 27 | "url": "https://github.com/hypermodules/dti/issues" 28 | }, 29 | "homepage": "https://github.com/hypermodules/dti#readme", 30 | "dependencies": { 31 | "devtron": "^1.4.0", 32 | "electron": "^2.0.0", 33 | "electron-devtools-installer": "^2.0.1", 34 | "minimist": "^1.2.0", 35 | "run-series": "^1.1.4", 36 | "update-notifier": "^2.1.0" 37 | }, 38 | "devDependencies": { 39 | "dependency-check": "^3.0.0", 40 | "snazzy": "^8.0.0", 41 | "standard": "^12.0.0" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /usage.js: -------------------------------------------------------------------------------- 1 | module.exports = `dti [] 2 | 3 | Quickly install and uninstall electron developer tools. 4 | 5 | list list available electron devtools 6 | installed list currently installed devtools and their versions 7 | install install devtools using a list of short names 8 | uninstall uninstall devtools using a list of short names 9 | 10 | Example: dti install devtron react redux 11 | 12 | Please send bugs and PRs to https://github.com/hypermodules/dti` 13 | --------------------------------------------------------------------------------