OpenGTD
Setup for development
This is a monorepo managed with Lerna. Sub-modules are located in packages/
. The lerna bootstrap
command installs dependencies of all sub-modules and creates symlinks for dependencies between sub-modules.
npm install npx lerna bootstrap
Note
|
The following commands can either be run at the project root to affect all sub-modules or individually inside of each sub-module. Note that there are inter-module dependencies. If you want to build/start the client or server individually, you first have to build all shared modules. |
Run the application
npm start
Server listens at http://localhost:3001
Client is accessible at http://localhost:3000
This will also watch for changes in the sources of the module(s) and automatically re-compile.
Configuration
The server can be configured by creating the file
packages/server/config.local.json
. Default configuration:
{
"env": "development",
"db": {
"embedded": true,
"host": "localhost",
"port": 27017,
"name": "open-gtd"
},
"port": 3001
}
Only values that should be overriden need to be specified. If
env
=development
and db.embedded
=true
(the default), MongoDB binaries are
automatically downloaded and a server is set up at a free port. To use a regular
MongoDB server, at least the following configuration is needed.
{
"db": {
"embedded": false
}
}
Verify changes before commiting
Run build:
npm run build
Run tests:
npm test
Run linters:
npm run lint
Try to automatically fix linting issues:
npm run fix
Run build, tests and linters:
Note
|
Always run this before submitting a pull-request. If this command does’t complete successfully, a pull-request cannot be merged. |
npm run verify