Thursday, 11 May 2017

Dependencies conception with package.json

We have an "home framework" on my company for client part (a web software). This framework is a mono-bloc with many modules. We have many and many projects "SPA" which use this framework. We have 3 use cases :

  • The SPA is executed in a portal. In this mode, the SPA is in IFrame, it communicate with portal with post message. Framework is loaded by a CDN.
  • The SPA is integrated in the portal. In this mode, the SPA communicate with portal directly. The Framework is loaded by CDN.
  • The SPA is in "mobile" mode. In this mode, a "fake portal" is given, without iframe. The framework is embedded by the SPA.

In the first case, module version is called "agent", and when it run directly in portal it called "phantom".

In the portal, there is another module version, called "manager". Agent communicate with him manager.

We wants to have a package.json for SPAs like :

dependencies : [
    "module-agent-interfaces": "2.x"
]

And for portal :

dependencies : [
    "module-manager": "2.x"
]

But we wants to have these three compilations mode. I don't know any mecanism to give, at compilation:

  • "module-agent" in first mode
  • "module-phantom" in second and third mode

We have a deliverable "module-agent-interfaces" because we use typescript.

Can you help me to resolve this issue? We wants to use standards mecanisms.



via Chklang

No comments:

Post a Comment