OED Developer Documentation

npm scripts

This information is for developers of the OED software so this information is not usually of interest to a general user.

The update to the Redux Toolkit (RTK) is not yet reflected in the documentation. As a result, some information may be out of date.

OED has many scripts to support its use for development and sometimes in production settings. These can be run by executing npm run [SCRIPT] in the web docker compose service (e.g. docker compose run --rm web npm run [SCRIPT] [args]) or by entering the OED web container as a developer.

App actions:

Note these are not standard ways for developers to run parts of OED but can be used at times or in scripts.

  • start starts the NodeJS webserver.
  • start:dev starts the NodeJS webserver with Nodemon, so it restarts automatically.
  • webpack:dev runs Webpack in development mode and dynamically rebuilding the client-side application when files change.
  • webpack:build runs Webpack once in production mode.
  • webpack runs Webpack once in development mode.

Validation and CI actions:

  • check runs all the below non-test checks (that is, all static checks)
  • check:header ensures that there are no source files without MPL headers.
  • check:typescript ensures that there are no JavaScript source files in the TypeScript portion of the project.
  • check:types runs the TypeScript compiler without emitting code (i.e. just checks for type errors).
  • check:lint runs TSLint against the project to ensure style conformity.
  • test runs the automated test suite on the server.
  • testsome <path to desired test file where can have multiple times> runs the automated test on the provided test file(s).

Administration:

Note many of these are described in more detail on the installation page (this is for site setup and not for developers but the information may be useful to some developers).

  • createdb creates the database schema in an uninitialized database. It will not update the schema for some parts of OED on major changes.
  • migratedb should upgrade the database after upgrading the software to a new version.
  • addMamacMeters adds meters from a CSV file.
  • updateMamacMeters fetches new data from previously imported Mamac meters.
  • updateEgaugeMeters fetches new data from previously setup eGauge meters.
  • refreshReadingViews aggregates readings data in the database for daily graphing has the latest data.
  • refreshDailyReadingViews same as refreshReadingViews but using newer names.
  • refreshHourlyReadingViews aggregates readings data in the database for hourly graphing has the latest data.
  • refreshAllReadingViews does both the refreshDailyReadingViews and refreshHourlyReadingViews.
  • createUser creates a new user. If given no arguments, it is interactive; you can also pass the username and password as command line arguments. This is not normally used any more since the admin web page allows adding/modifying users except on initial site setup .
  • editUser edits the password of an existing user. This is not normally used any more since the admin web page allows adding/modifying users except or reset a password.
  • sendLogEmail sends an email with the latest errors/warnings to the specified email.
  • developerdb creates DB functions for developers to shift meter data for compare testing.
  • updateCikAndViews causes a running OED to redo the cik in the DB and to update the daily and hourly views due to this change.
  • obvius:showConfigfiles shows the Obvius config files stored in the DB; usually for debugging.
  • obvius:purgeConfigfiles deletes the Obvius config files stored in the DB; usually for debugging and is destructive.

Test data

Developers interested in how to create the test data and related script should consult the testing page.