schmidtk / opensphere-jscodeshift

Scripts designed to migrate OpenSphere code toward ES6 modules, by performing abstract syntax tree (AST) transforms on JavaScript.
Apache License 2.0
1 stars 1 forks source link

feat(opensphere): add support to convert implicit require()'s #2

Closed glennkitchellcaci closed 4 years ago

glennkitchellcaci commented 4 years ago

Provides configuration point for replacing modules/provides that are assumed to be available; e.g. os.settings.get(...). Supports non-matching requires (e.g. require('os.config.Settings'); and/or singletons using getInstance().

To get more configs into the implicit require replacements list, create a file ../my-project-directory/.jscodeshift.json with the format: {"globals": { "my.global.namespace": {"require": "my.alternate.namespace", "singleton": false}}} where "require" defaults to match the key when undefined and "singleton" defaults to false when undefined.

Potential future improvements include: