bozon new ironmanFollow the dialog, answer some basic questions about your app, and once auto-running node_modules installed your new Electron application is ready for your input. This generates basic application skeleton which is pretty straightforward:
config/directory to contain `settings.json` and other env specific and platform specific configuration files.There are two package.json files. First one is for development and is placed under the path: `ironman/package.json`. Here you declare dependencies for your development environment and build scripts. This file is not distributed with real application.Second one is a real application manifest that can be found under the path: `ironman/app/package.json`. It gets updated with settings hash generated from configuration and distributed with real application.At this point you can easily run application with:
bozon startThis will simply compile your app code and launch electron-prebuilt with it inside.### TestingBozon is using spectron framework and mocha spec runner for feature testing Electron applications. All unit and feature tests live under./specs directory and can be run all at once or individually. Simply run tests with:
bozon test spec/unit/storage_spec.jsNote that feature tests are performed on real packaged applications; that’s why it requires code compiling and packaging the app to `.tmp/` directory and could take some time. While running simple unit tests is a lot faster, because all you need to do is simply require a module you want to test.## PackagingIn order to package your Electron application into a real desktop application, bozon uses electron-builder. Settings for electron-builder (like resources for different platforms) are defined in main package.json file under **build** section. It takes only one simple step for developers to package their application:
bozon package osxAnd bozon does the rest for you. First, application source code is compiled for a defined platform with specific settings. You can find the build under `./builds/production` directory. Then, bozon uses electron-builder to package platform build to `./packages` directory.To make this work like a charm, bozon uses **two package.json structure** as it is also recommended by electron-builder.The concept is pretty simple:– **package.json** in root directory is for development. Here you declare dependencies for your development environment, build scripts and runtime dependencies to run your app in development mode with `bozon start`.– **app/package.json** is meant to be used at application runtime. `App` directory is the only one distributed with real application, thus this is the place where you define your runtime dependencies for production before packaging application.Of course, this leads to some duplication (you’ll have to define runtime dependencies in both files), but this also provides flexibility and allows to configure which node modules should be packaged to application, instead of distributing entire node_modules directory with all dependencies that are used for development.### Conclusion Electron is pretty young technology – stable version 1.0 was released less than a month ago – and a lot of improvements and infrastructural tools are still to come. But it already allows building quite cool desktop applications and community is doing great progress on making setup and development even more easy and interesting. Try starting your new Electron application with bozon and tell us what you think. Feedback is really appreciated!