Development
Dependencies
NVM, Node, and npm
For server and client-side app code.
Install nvm.
nvm install # will install version from .nvmrc
nvm use
Golang
Install the latest version of Go
Docker
Install the latest version of Docker
mkcert
Generates certificates for use with our local nginx proxy. On Mac install with homebrew:
brew install mkcert
Otherwise follow the installation instructions here: https://github.com/FiloSottile/mkcert
Install dependencies
Just run ./public/scripts/install_deps
at the root of this repo.
It will install all required npm dependencies (global, shared, public, and private). It also prunes to keep all modules in sync.
Local Proxy
Add the following line to /etc/hosts
:
127.0.0.1 localdev-community.envkey.com
Databases
Create development database:
./public/scripts/create_db
Services
Each of these is usually run in its own terminal pane.
Api
Api runs locally in community open source mode.
$ ./public/scripts/start_api_community_dev
Runs the api server at localdev-community.envkey.com:2999
(curl
as a health check).
client core process
$ ./public/scripts/start_core_process
By default, it runs an express server on 19047 and a local websocket server on 19048.
Can also be run inline in the electron app.
Ui dev server
Builds the EnvKey web app and serves it locally with webpack-dev-server
$ ./public/scripts/start_ui_dev_server
Ui electron app
Requires the api and ui dev server to be running.
If it's the first time you're running the app, or else if something has changed in the electron wrapper public/app/client/electron
(as opposed to the ui itself in public/app/client/ui
), then use:
./public/scripts/build_start_electron
That will build/rebuild electron-specific code before starting.
Otherwise, you can start it without building, which is faster:
./public/scripts/start_electron
If the core process isn't already running, the Electron app will run it inline in its main process.
EnvKey CLI
In development, you can run CLI commands like this:
./public/scripts/cli accounts
For CLI help:
./public/scripts/cli -h
./public/scripts/cli command -h
./public/scripts/cli category -h
./public/scripts/cli category command -h
The CLI relies on the core process, and it will start its own detached core process if one isn't running.
Tests
To run tests, first make sure the api is running in a different terminal pane:
./public/scripts/start_api_community_dev
Then run all the tests:
$ ./public/scripts/test
VSCode Plugins
For the best VSCode experience, install the following plugins:
Prettier - Code formatter
Go
Auto Import
change-case
can also be useful for converting symbols between case formats (camelCase, CONSTANT_CASE, snake_case, etc.)
Updated almost 3 years ago