Add mechanism for NPM package auto-discovery
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -48,6 +48,12 @@ export function appPath(...parts: PathLike[]): UniversalPath {
|
||||
* The main application container.
|
||||
*/
|
||||
export class Application extends Container {
|
||||
public static readonly NODE_MODULES_INJECTION = 'extollo/npm'
|
||||
|
||||
public static get NODE_MODULES_PROVIDER(): string {
|
||||
return process.env.EXTOLLO_NPM || 'pnpm'
|
||||
}
|
||||
|
||||
public static getContainer(): Container {
|
||||
const existing = <Container | undefined> globalRegistry.getGlobal('extollo/injector')
|
||||
if ( !existing ) {
|
||||
@@ -205,6 +211,7 @@ export class Application extends Container {
|
||||
this.setupLogging()
|
||||
|
||||
this.registerFactory(new CacheFactory()) // FIXME move this somewhere else?
|
||||
this.registerSingleton(Application.NODE_MODULES_INJECTION, Application.NODE_MODULES_PROVIDER)
|
||||
|
||||
this.make<Logging>(Logging).debug(`Application root: ${this.baseDir}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user