Code Monkey home page Code Monkey logo

elate's Introduction

Elate

The Dropbox media browser!

Quick start

The only development dependency of this project is Node.js. So just make sure you have it installed. Then type few commands known to every Node developer...

git clone https://github.com/szwacz/electron-boilerplate.git
cd electron-boilerplate
npm install
npm start

... and boom! You have running desktop application on your screen.

Structure of the project

There are two package.json files:

1. For development

Sits on path: electron-boilerplate/package.json. Here you declare dependencies for your development environment and build scripts. This file is not distributed with real application!

Also here you declare the version of Electron runtime you want to use:

"devDependencies": {
  "electron-prebuilt": "^0.34.0"
}

2. For your application

Sits on path: electron-boilerplate/app/package.json. This is real manifest of your application. Declare your app dependencies here.

OMG, but seriously why there are two package.json?

  1. Native npm modules (those written in C, not JavaScript) need to be compiled, and here we have two different compilation targets for them. Those used in application need to be compiled against electron runtime, and all devDependencies need to be compiled against your locally installed node.js. Thanks to having two files this is trivial.
  2. When you package the app for distribution there is no need to add up to size of the app with your devDependencies. Here those are always not included (because reside outside the app directory).

Project's folders

  • app - code of your application goes here.
  • config - place where you can declare environment specific stuff for your app.
  • build - in this folder lands built, runnable application.
  • releases - ready for distribution installers will land here.
  • resources - resources needed for particular operating system.
  • tasks - build and development environment scripts.
  • data - when developing databases and cofig files will be stored here.

Development

Installation

npm install

It will also download Electron runtime, and install dependencies for second package.json file inside app folder.

Starting the app

npm start

Adding npm modules to your app

Remember to add your dependency to app/package.json file, so do:

cd app
npm install name_of_npm_module --save

Native npm modules

Want to use native modules? This objective needs some extra work (rebuilding module for Electron). In this boilerplate it's fully automated, just use special command instead of standard npm install something when want to install native module.

npm run install-native -- name_of_native_module

This script when run first time will add electron-rebuild to your project. After that everything is wired and no further maintenance is necessary.

Working with modules

How about being future proof and using ES6 modules all the time in your app? Thanks to rollup you can do that. It will transpile the imports to proper require() statements, so even though ES6 modules aren't natively supported yet you can start using them today.

You can use it on those kinds of modules:

// Modules authored by you
import { myStuff } from './my_lib/my_stuff';
// Node.js native
import fs from 'fs';
// Electron native
import { app } from 'electron';
// Loaded from npm
import moment from 'moment';

Including files to your project

The build script copies files from app to build directory and the application is started from build. Therefore if you want to use any special file/folder in your app make sure it will be copied via some of glob patterns in tasks/build.js:

var paths = {
  copyFromAppDir: [
    './node_modules/**',
    './vendor/**',
    './**/*.html',
    './**/*.+(jpg|png|svg)'
  ],
}

Unit tests

electron-boilerplate has preconfigured jasmine test runner. To run the tests go with standard:

npm test

You don't have to declare paths to spec files in any particular place. The runner will search through the project for all *.spec.js files and include them automatically.

Making a release

Note: There are various icon and bitmap files in resources directory.

To make ready for distribution installer use command:

npm run release

It will start the packaging process for every operating system (Mac, Windows and Linux).

Windows only

Building Windows apps from non-Windows platforms

Building the app and creating the installer for windows requires editing the Electron.exe file. On OS X, you can install what you need using Homebrew:

brew install wine makensis mono

Creating the app DMG

This can only be done on osx at the moment.

License

Copyright (c) 2016 Giuseppe Germinaro

elate's People

Contributors

giuge avatar

Stargazers

 avatar

elate's Issues

Implement app activation with serial number

This may have some server side requirements. If we end up using fastspring they let you generate an activation code server side. This looks like a good solution so we can just call the API to handle codes.

Fix DB sync

The sync with Dropbox needs to get rid of pictures that are not in the user Dropbox account anymore.

Enhance how we handle the correct window to show

At the moment the import library window shows up before we show the app. This is because we wait to get the full library before showing the app and the state is incomplete. We need a better way to handle this.

App seems not to work correctly on windows

The app starts fine but it has problems with loading the correct window and reading the database file. This could be potentially fixed with #2.

Let's fix 2 and then we'll come back to this.

Clean gulp tasks

We need to split gulp tasks based on what they do. At the moment we have one giant release task that does everything. We should split into:

  • Release Mac
  • Release Windows
  • Rename Files (?)
  • Clean Release (?)

We don't need the last two tasks if we are able to do this in the release:platform task.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.