node-pluginsmanager 3.5.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -285,7 +285,10 @@ class PluginsManager extends node_events_1.default {
285
285
  }).then((directory) => {
286
286
  // download plugin
287
287
  return Promise.resolve().then(() => {
288
- return (0, gitInstall_1.default)(directory, user, repo);
288
+ this._logger?.("info", "Downloading plugin...", false, repo);
289
+ return (0, gitInstall_1.default)(directory, user, repo).then(() => {
290
+ this._logger?.("success", "Download success", false, repo);
291
+ });
289
292
  // check if plugin directory is created
290
293
  }).then(() => {
291
294
  return (0, isDirectory_1.default)(directory).then((isPluginADirectory) => {
@@ -307,6 +310,11 @@ class PluginsManager extends node_events_1.default {
307
310
  return JSON.parse(content);
308
311
  });
309
312
  }).then((packageData) => {
313
+ // check if the plugin has a valid name
314
+ if ("string" !== typeof packageData.name || "" === packageData.name.trim()) {
315
+ throw new Error("\"" + repo + "\" plugin has no valid name");
316
+ }
317
+ const pluginName = packageData.name;
310
318
  // check if the plugin has a valid entry point
311
319
  if ("string" !== typeof packageData.main || "" === packageData.main.trim()) {
312
320
  throw new Error("\"" + repo + "\" plugin has no valid entry point");
@@ -326,18 +334,27 @@ class PluginsManager extends node_events_1.default {
326
334
  if ("string" !== typeof scripts.build || "" === scripts.build.trim()) {
327
335
  throw new Error("\"" + repo + "\" plugin has no build script registered");
328
336
  }
337
+ this._logger?.("info", "Installing dev dependencies...", false, pluginName);
329
338
  // install plugin with dependencies
330
339
  return (0, npmInstall_1.default)(directory, true).then(() => {
340
+ this._logger?.("success", "Plugin installed successfully", false, pluginName);
341
+ this._logger?.("info", "Building plugin...", false, pluginName);
331
342
  return (0, npmBuild_1.default)(directory);
332
343
  // remove dev dependencies
333
344
  }).then(() => {
334
- return (0, rmdirp_1.default)((0, node_path_1.join)(directory, "node_modules"));
345
+ this._logger?.("debug", "Removing dev dependencies...", false, pluginName);
346
+ return (0, rmdirp_1.default)((0, node_path_1.join)(directory, "node_modules")).then(() => {
347
+ this._logger?.("success", "Dev dependencies removed successfully", false, pluginName);
348
+ });
335
349
  });
336
350
  }).then(() => {
337
351
  if ("object" !== typeof packageData.dependencies || null === packageData.dependencies || 0 >= Object.keys(packageData.dependencies).length) {
338
352
  return Promise.resolve();
339
353
  }
340
- return (0, npmInstall_1.default)(directory);
354
+ this._logger?.("debug", "Installing dependencies...", false, pluginName);
355
+ return (0, npmInstall_1.default)(directory).then(() => {
356
+ this._logger?.("success", "Dependencies installed successfully", false, pluginName);
357
+ });
341
358
  });
342
359
  });
343
360
  // create plugin
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
 
3
3
  "name": "node-pluginsmanager",
4
- "version": "3.5.0",
4
+ "version": "3.5.1",
5
5
  "description": "A plugins manager.",
6
6
 
7
7
  "type": "commonjs",