Skip to content

Development

Colin Mitchell edited this page Dec 8, 2017 · 7 revisions

If you want to run the code, there's a few steps involved. Once you clone the repository, you'll need to install any dependencies, compile a few things with webpack, and compile a couple modules. It will look a little like this:

Step Zero: Install node. If you're using Windows, you also need to install windows-build-tools. Finally, you'll need to install yarn.

OK! Now, clone the code:

git clone [email protected]:muffinista/before-dawn.git
cd ./before-dawn

Then, install all the required modules. Right now, Before Dawn uses yarn to handle dependencies. I'd prefer to use npm (and keep the number of extra packages required to a minimum), but right now, yarn does a better job of handling cross-platform issues. Anyway, install yarn and then run:

yarn install

This should install all the modules required to run and develop the application. It should also compile a few modules to work properly with Electron.

Before Dawn uses webpack to compile code and assets. You can run compilation and boot the app by running yarn run dev

At this point you are ready to run the app!

Code Layout

The root directory of the repo contains a bunch of scripts for building the application, some tool scripts, tests, etc. The code lives in the src/ directory, and here's some highlights:

  • Code for the main process is in src/main. In particular, index.js is the main application code. It handles booting the app, launching things when needed, and detects when it is time to launch a screensaver.
  • src/main/bootstrap.js handles initializing some global variables
  • src/index.ejs is used to generate HTML templates for the windows in the app.
  • src/renderer holds the Javascript needed to run those windows
  • src/renderer/components holds a bunch of Vue components used in the UI
  • src/lib holds a bunch of non-UI framework code.

There's also a test suite in test/

Command-Line Options

There's a few command-line options to make things easier. You can use them like this:

npm start -- --debug --screen=prefs
  • --debug will start the application with the JS console open. Also, if/when a screensaver activates, it will be in a window with the developer tools available, rather than in full screen mode, and the saver won't close when you move the mouse or touch a key -- this can be handy for testing.
  • --screen=prefs will start the app and open the preferences window automatically.
  • --screen=about will open the about window automatically.
  • --screen=saver will open the screensaver automatically.
Clone this wiki locally