Reusable runtime config

21 views
Skip to first unread message

Robert Krahn

unread,
Mar 4, 2016, 7:03:44 PM3/4/16
to SystemJS
I would like to provide a SystemJS config for my projects that can be re-used and merged without requiring manual changes.

1. Let's say I'm in my first project and want to test it from its root directory. I have a lively.ast/test.html that loads the lively.ast project via

var livelyAstConfig = {
  "map": {
    "lively.ast": "./",
    "./": {
      "acorn": "lively.ast/node_modules/acorn",
      "lively.lang": "lively.ast/node_modules/lively.lang/index.js",
      "escodegen": "lively.ast/dist/escodegen.browser"
    }
  },
  "packages": {
    "lively.ast/node_modules/acorn": {"main": "dist/acorn.js", "format": "cjs", "configured": true},
    "lively.ast/dist/escodegen.browser.js": {"format": "global", "configured": true}
  }
}


2. Now I want to use the lively.ast project from another-project (note: I don't want to bundle it). Ideally what I would like to do is:

deepMerge(livelyAstConfig, anotherProjectConfig)

to inform another-project about the dependency. For that to work right now I manually need to change livelyAstConfig before merging to sth like

{
  "map": {
    "lively.ast": "node_modules/lively.ast",
    "node_modules/lively.ast": { ... }
  },
  ...
}


Is there a best practice for how to specify / parameterize configurations to make them reusable?

Thanks,
Robert
Reply all
Reply to author
Forward
0 new messages