Devs ~ App dependencies - GeoscienceAustralia/egeodesy GitHub Wiki

Files involved when adding a dependency

  1. src/client/app/system.config.ts, tools/config/seed.config.ts
  • PRODUCTION: import all dependency files (blanket approach)
  1. tools/config/seed.config.ts
  • PRODUCTION: mapping for name to file - at SYSTEM_CONFIG_DEV definition
  • (for framework core dependendencies)
  1. tools/config/project.config.ts
  • PRODUCTION: mapping for name to file
  • (for APP dependencies)
  1. karma.conf.js
  • TESTING: import all dependency files (blanket approach)
  1. test-config.js
  • TESTING: mapping for name to file

For every dependency added for dev / production, it needs to also be added for testing (ie. Karma)

How to add a .js external dependency to typescript App

This is based on the Jsonix work we did.

npm install it

npm install <npm lib> --save

Add to project config

In the tools/config/project.config.ts add this to this.NPM_DEPENDENCIES = [ array:

      {src: 'jsonix/jsonix.js', inject: 'libs'},

Create a service for it

Do this once in a service.

# No specific imports 

declare let Jsonix: any;  # So we can work with as typescript

Now just use it

let context: any = new Jsonix.Context(jsonIxMappings, jsonIxOptions);

Fix for testing

Add this to the karma.conf.js file files: [ array:

      'node_modules/jsonix/jsonix.js',

We didn't do this for jsonix, however in some cases it may be necessary. Add an entry to test-config.js.

⚠️ **GitHub.com Fallback** ⚠️