npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gars_v2

v0.0.1

Published

Geo Assistant Research System

Downloads

2

Readme

electron-boilerplate Build Status Build status

A minimalistic yet comprehensive boilerplate application for Electron runtime. Tested on macOS, Windows and Linux.

This project does not impose on you any framework (like Angular or React). It tries to give you only the 'electron' part of technology stack so you can pick your favorite technologies to build the actual app.

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 a running desktop application on your screen.

Structure of the project

The application is split between two main folders...

src - this folder is intended for files which need to be transpiled or compiled (files which can't be used directly by Electron).

app - contains all static assets (put here images, css, html etc.) which don't need any pre-processing.

The build process compiles all stuff from the src folder and puts it into the app folder, so after the build has finished, your app folder contains the full, runnable application.

Treat src and app folders like two halves of one bigger thing.

The drawback of this design is that app folder contains some files which should be git-ignored and some which shouldn't (see .gitignore file). But thanks to this two-folders split development builds are much (much!) faster.

Development

Starting the app

npm start

Upgrading Electron version

The version of Electron runtime your app is using is declared in package.json:

"devDependencies": {
  "electron": "1.4.7"
}

Side note: Electron authors advise to use fixed version here.

The build pipeline

Build process is founded upon gulp task runner and rollup bundler. There are two entry files for your code: src/background.js and src/app.js. Rollup will follow all import statements starting from those files and compile code of the whole dependency tree into one .js file for each entry point.

You can add as many more entry points as you like (e.g. to split your app into modules).

By the way, rollup has a lot of plugins. You can add them in this file.

Adding npm modules to your app

Remember to respect the split between dependencies and devDependencies in package.json file. Only modules listed in dependencies will be included into distributable app.

Side note: If the module you want to use in your app is a native one (not pure JavaScript but compiled C code or something) you should first run npm install name_of_npm_module --save and then npm run postinstall to rebuild the module for Electron. This needs to be done only once when you're first time installing the module. Later on postinstall script will fire automatically with every npm install.

Working with modules

Thanks to rollup you can (and should) use ES6 modules for all code in src folder. But because ES6 modules still aren't natively supported you can't use them in the app folder.

Use ES6 syntax in the src folder like this:

import myStuff from './my_lib/my_stuff';

But use CommonJS syntax in app folder. So the code from above should look as follows:

var myStuff = require('./my_lib/my_stuff');

Testing

Unit tests

npm test

Using electron-mocha test runner with the chai assertion library. This task searches for all files in src directory which respect pattern *.spec.js.

End to end tests

npm run e2e

Using mocha test runner and spectron. This task searches for all files in e2e directory which respect pattern *.e2e.js.

Code coverage

npm run coverage

Using istanbul code coverage tool.

You can set the reporter(s) by setting ISTANBUL_REPORTERS environment variable (defaults to text-summary and html). The report directory can be set with ISTANBUL_REPORT_DIR (defaults to coverage).

Continuous integration

Electron can be plugged into CI systems. Here two CIs are preconfigured for you. Travis CI tests on macOS and Linux, App Veyor tests on Windows.

Making a release

To package your app into an installer use command:

npm run release

It will start the packaging process for operating system you are running this command on. Ready for distribution file will be outputted to dist directory.

You can create Windows installer only when running on Windows, the same is true for Linux and macOS. So to generate all three installers you need all three operating systems.

All packaging actions are handled by electron-builder. It has a lot of customization options, which you can declare under "build" key in package.json file.

License

Released under the MIT license.