├── .editorconfig ├── .gitattributes ├── .gitignore ├── .jshintrc ├── LICENSE ├── README.md ├── assets ├── chartbuilder-electron.gif ├── chartbuilder.ai ├── chartbuilder.icns └── chartbuilder.png ├── index.css ├── index.html ├── index.js ├── init.js ├── menus.html └── package.json /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [{package.json,*.yml}] 11 | indent_style = space 12 | indent_size = 2 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false 16 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "esnext": true, 4 | "bitwise": true, 5 | "curly": true, 6 | "immed": true, 7 | "newcap": true, 8 | "noarg": true, 9 | "undef": true, 10 | "unused": "vars", 11 | "strict": true 12 | } 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) mhkeller (http://github.com/mhkeller) 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 13 | all 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 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Chartbuilder Electron 2 | ====================== 3 | 4 | > A desktop version of Quartz's [Chartbuilder app](https://github.com/quartz/chartbuilder). 5 | 6 | ## Download 7 | 8 | Download the latest on the [Releases](https://github.com/mhkeller/chartbuilder-electron/releases) page. If you're on OS X, select the `Darwin` release. Because Chartbuilder isn't on npm, it's currently pegged to the [latest commit](package.json#L31) so we can keep track of what version this was built with. 9 | 10 | ## Why 11 | 12 | In thinking about newsroom adoption, sometimes simply having something in the dock is so much easier than navigating to a (possibly ugly internal) URL. The dock is the new bookmark. 13 | 14 | ![](assets/chartbuilder-electron.gif) 15 | 16 | ## Things to do 17 | 18 | See the [issue tracker](https://github.com/mhkeller/chartbuilder-electron/issues) for more detail. Help welcome! 19 | 20 | * Set up auto-updating with [electron-gh-releases](https://github.com/jenslind/electron-gh-releases) and command-line releases with [publish-release](https://github.com/remixz/publish-release). 21 | * Figure out a way to inject the necessary menu JavaScript into the Chartbuilder JS environment per [docs](https://github.com/atom/electron/blob/master/docs/api/menu.md) without altering that repo. 22 | * Set default download location to something other than `~/Library/Application Support/Chartbuilder/Downloads/`. 23 | 24 | ## Using your customized Chartbuilder build 25 | 26 | If your build is on GitHub and the install and build processes haven't deviated from Chartbuilder 2.0, then fork this repository and replace the dependency information in `package.json` [near line 31](package.json#L31) with your own info. 27 | 28 | For example, if my fork of Chartbuilder lives at `http://github.com/mhkeller/Chartbuilder`, the `package.json` line would look like: 29 | 30 | ````json 31 | "dependencies": { 32 | "chartbuilder": "mhkeller/Chartbuilder", 33 | "electron-debug": "^0.1.1" 34 | }, 35 | ```` 36 | 37 | Then, follow the **Developing** instructions below to create your build. 38 | 39 | **Note on versioning:** You can also add [a commit sha preceeded](https://github.com/mhkeller/chartbuilder-electron/blob/79d653323ce60698fb1b8b61b485a1f1e685f97f/package.json#L31) by a `#` to better keep track of which version of that repository we are pulling, but that is optional. Without a specific commit or branch name, it will pull the latest at the time of building. You can also publish your whitelabelled Chartbuilder to npm and call it with a version number, but that isn't usually desirable since your white-labelled version isn't meant for public distribution. 40 | 41 | For more information on npm dependencies as Git Urls, [check out the npm docs](https://docs.npmjs.com/files/package.json#git-urls-as-dependencies). 42 | 43 | ## Developing 44 | 45 | ### To install everything 46 | 47 | ````shell 48 | npm run init 49 | ```` 50 | 51 | ### To run the app locally 52 | 53 | ````shell 54 | npm start 55 | ```` 56 | 57 | ### To build out the binaries 58 | 59 | ````shell 60 | npm run build 61 | ```` 62 | 63 | Builds the app for OS X, Linux, and Windows, using [electron-packager](https://github.com/maxogden/electron-packager). 64 | 65 | 66 | ## License 67 | 68 | MIT © [mhkeller](http://github.com/mhkeller) 69 | -------------------------------------------------------------------------------- /assets/chartbuilder-electron.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhkeller/chartbuilder-electron/25d7656ac459b7c840eb414dd315548c4446230e/assets/chartbuilder-electron.gif -------------------------------------------------------------------------------- /assets/chartbuilder.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhkeller/chartbuilder-electron/25d7656ac459b7c840eb414dd315548c4446230e/assets/chartbuilder.ai -------------------------------------------------------------------------------- /assets/chartbuilder.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhkeller/chartbuilder-electron/25d7656ac459b7c840eb414dd315548c4446230e/assets/chartbuilder.icns -------------------------------------------------------------------------------- /assets/chartbuilder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhkeller/chartbuilder-electron/25d7656ac459b7c840eb414dd315548c4446230e/assets/chartbuilder.png -------------------------------------------------------------------------------- /index.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | 7 | header { 8 | position: absolute; 9 | width: 500px; 10 | height: 250px; 11 | top: 50%; 12 | left: 50%; 13 | margin-top: -125px; 14 | margin-left: -250px; 15 | text-align: center; 16 | } 17 | 18 | header h1 { 19 | font-family: 'Helvetica Neue', Helvetica, sans-serif; 20 | font-size: 60px; 21 | font-weight: 100; 22 | margin: 0; 23 | padding: 0; 24 | } 25 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Electron boilerplate 6 | 7 | 8 | 9 |
10 |
11 |

Electron boilerplate

12 |
13 |
14 |
15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const app = require('app'); 3 | const BrowserWindow = require('browser-window'); 4 | 5 | // report crashes to the Electron project 6 | require('crash-reporter').start(); 7 | 8 | // adds debug features like hotkeys for triggering dev tools and reload 9 | require('electron-debug')(); 10 | 11 | app.setDataPath(app.getHomeDir()) 12 | 13 | function createMainWindow () { 14 | const win = new BrowserWindow({ 15 | width: 1350, 16 | height: 850, 17 | resizable: true 18 | }); 19 | 20 | win.loadUrl(`file://${__dirname}/node_modules/chartbuilder/build/index.html`); 21 | win.on('closed', onClosed); 22 | 23 | return win; 24 | } 25 | 26 | function onClosed() { 27 | // deref the window 28 | // for multiple windows store them in an array 29 | mainWindow = null; 30 | } 31 | 32 | // prevent window being GC'd 33 | let mainWindow; 34 | 35 | app.on('window-all-closed', function () { 36 | if (process.platform !== 'darwin') { 37 | app.quit(); 38 | } 39 | }); 40 | 41 | app.on('activate-with-no-open-windows', function () { 42 | if (!mainWindow) { 43 | mainWindow = createMainWindow(); 44 | } 45 | }); 46 | 47 | app.on('ready', function () { 48 | mainWindow = createMainWindow(); 49 | }); 50 | -------------------------------------------------------------------------------- /init.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var fs = require('fs') 4 | var cheerio = require('cheerio') 5 | 6 | // Set paths 7 | var index_path = './node_modules/chartbuilder/build/index.html', 8 | menu_path = './menus.html' 9 | 10 | // Read our menu html and our index html 11 | var menus = fs.readFileSync(menu_path, 'utf-8'), 12 | index = fs.readFileSync(index_path, 'utf-8'); 13 | 14 | // Read `index.html` in 15 | var $ = cheerio.load(index) 16 | 17 | // Add menu scripts 18 | var $body = $('body'), 19 | has_menus = $body.find('script#electron-menus').length > 0; 20 | 21 | if (!has_menus) { 22 | $body.append(menus) 23 | // Rewrite `index.html` 24 | fs.writeFileSync(index_path, $.html()) 25 | } 26 | -------------------------------------------------------------------------------- /menus.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chartbuilder-electron", 3 | "productName": "Chartbuilder", 4 | "version": "0.2.1", 5 | "description": "A desktop version of Quartz's Chartbuilder app.", 6 | "license": "MIT", 7 | "main": "index.js", 8 | "repository": "mhkeller/chartbuilder-electron", 9 | "author": { 10 | "name": "mhkeller", 11 | "email": "michael.keller@gmail.com", 12 | "url": "github.com/mhkeller" 13 | }, 14 | "engines": { 15 | "node": ">=0.10.0" 16 | }, 17 | "scripts": { 18 | "start": "electron .", 19 | "init": "npm install && cd ./node_modules/chartbuilder && npm install && npm run build && cd ../.. && ./init.js", 20 | "build": "electron-packager . Chartbuilder --out=dist --overwrite --ignore=dist --prune --asar --all --version=0.29.2 --icon='assets/chartbuilder.icns'" 21 | }, 22 | "files": [ 23 | "index.js", 24 | "index.html", 25 | "index.css" 26 | ], 27 | "keywords": [ 28 | "electron-app" 29 | ], 30 | "dependencies": { 31 | "chartbuilder": "^2.0.0", 32 | "cheerio": "^0.19.0", 33 | "electron-debug": "^0.1.1" 34 | }, 35 | "devDependencies": { 36 | "electron-packager": "^5.0.0", 37 | "electron-prebuilt": "^0.29.2" 38 | } 39 | } 40 | --------------------------------------------------------------------------------