MCPcopy Create free account
hub / github.com/apache/skywalking-nodejs / installNormal

Method installNormal

src/core/PluginInstaller.ts:88–120  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86 isPluginEnabled = (name: string): boolean => !name.match(config.reDisablePlugins);
87
88 installNormal(): void {
89 fs.readdirSync(this.pluginDir)
90 .filter((file) => !(file.endsWith('.d.ts') || file.endsWith('.js.map')))
91 .forEach((file) => {
92 if (file.replace(/(?:Plugin)?\.js$/i, '').match(config.reDisablePlugins)) {
93 logger.info(`Plugin ${file} not installed because it is disabled`);
94 return;
95 }
96
97 let plugin;
98 const pluginFile = path.join(this.pluginDir, file);
99
100 try {
101 plugin = this.require(pluginFile).default as SwPlugin;
102 const { isSupported, version } = this.checkModuleVersion(plugin);
103
104 if (!isSupported) {
105 logger.info(`Plugin ${plugin.module} ${version} doesn't satisfy the supported version ${plugin.versions}`);
106 return;
107 }
108
109 logger.info(`Installing plugin ${plugin.module} ${plugin.versions}`);
110
111 plugin.install(this);
112 } catch (e) {
113 if (plugin) {
114 logger.error(`Error installing plugin ${plugin.module} ${plugin.versions}`);
115 } else {
116 logger.error(`Error processing plugin ${pluginFile}`);
117 }
118 }
119 });
120 }
121
122 private checkBundledModuleVersion = (
123 plugin: SwPlugin,

Callers 1

installMethod · 0.95

Calls 2

errorMethod · 0.80
installMethod · 0.65

Tested by

no test coverage detected