A desktop CSV editor for data publishers
JavaScript HTML CSS
Latest commit eed14ef Jan 6, 2017 @Floppy Floppy committed on GitHub Merge pull request #133 from chris48s/issue75
Accept filename as positional argument to enable 'open with..' functionality

README.md

Stories in Ready Build Status Dependency Status

Comma Chameleon

A desktop CSV editor with validation magic - Built with electron.js

Download app

Choose a platform from the Releases page

Development setup

you can use npm to install all relevant packages using the following set of commands

brew install node
npm install
npm install -g bower
bower install

Then to open the app run:

npm start

This will download the non-js dependencies (namely CSVlint.sh), build the handlebars views (from comma-chameleon/views-content) and start the app.

Architecture

Comma Chameleon is built using Electron.js, a framework that allows developers to build desktop applications using web technology.

There are two parts of the application, the main process and the renderer process. The main process deals with things like carrying out file operations, validating CSVs, rendering views, and exporting to Github. The renderer acts very much like client side javascript in a web browser, dealing with things like presentation, and user interactions.

IPC messaging

Electron passes and listens for messages between main and renderer using the IPC module, one for the main process and one for the renderer process.

For example, when importing an Excel file, the main process reads the Excel file and opens a new window in the renderer process. Once the window has opened, the main process sends the worksheet names to the renderer process, which are then displayed to the user. Once a user selects a worksheet, the renderer process sends a message back to the main process, and the main process converts the relevant worksheet to CSV and loads it into a new window.

Views

To keep things DRY, the HTML views are written using Handlebars, see the views-content folder. The views are then built using the page-build.js script, which also gets run when the app is started with the npm start command.

External (non-js) dependencies

Comma Chameleon relies on CSVlint.sh to carry out CSV validation. This is not included in the repo, and is downloaded and installed by the build.js script. As with the page build script, this script is also run when the app is started with the npm start command.

Testing

Electron-Mocha has been adopted for testing, it enables both DOM and node.js testing and provides command line options to enable testing of both.

Assuming you have installed electron-mocha globally (via npm i electron-mocha -g), you can run the tests like this:

npm run test

Or to run the main and renderer tests separately, you can run:

npm run test-main  # run tests for the runtime components provided by Electron
npm run test-renderer # run tests that execute client side

Otherwise you can run:

electron-mocha test/main/
electron-mocha --renderer test/renderer/ # run tests that execute client side

Building a new package

(This assumes you're running OSX)

brew install wine # This allows us to specify the icon for Windows pacakges
npm i electron-packager -g
gulp build

You can also build a package for a specific platform by running gulp build --platform={one of 'linux', 'darwin' or 'win32'}.