FLUID-5503: Create simple scheme for locating and loading files and resources relative to a module

Metadata

Source
FLUID-5503
Type
Improvement
Priority
Major
Status
Closed
Resolution
Fixed
Assignee
Antranig Basman
Reporter
Antranig Basman
Created
2014-08-31T07:18:25.267-0400
Updated
2018-06-07T07:00:25.787-0400
Versions
N/A
Fixed Versions
N/A
Component
  1. Framework

Description

A lot of brittleness is caused in our projects by having to hard-code path references, sometimes between projects. For example, here is an include from a configuration file, builtIn_config.json from GPII's windows project:

"includes": [
"../../../../node_modules/universal/tests/acceptanceTests/configs/localInstall.json"
]
}

As well as being very hard to interpret, this relative path forces a fixed relative position in the filesystem between the source and target of the reference (the windows project and the universal project).

We should create a simple system whereby modules can register themselves and their base location, and provide interpolation for simple strings of the form, for example, where the above reference would be encoded as

${universal}/tests/acceptanceTests/configs/localInstall.json

At the same time this would also resolve the brittle "self-reference" problem where a module cannot necessarily expect to issue a "require" for itself given it may not have been checked out into a node_modules directory.