@saltcorn/plugins-loader 1.6.0-beta.5 → 1.6.0-beta.7

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/plugins-loader",
3
- "version": "1.6.0-beta.5",
3
+ "version": "1.6.0-beta.7",
4
4
  "description": "Saltcorn plugin loader",
5
5
  "homepage": "https://saltcorn.com",
6
6
  "scripts": {
@@ -9,7 +9,7 @@
9
9
  "clean": "echo 'No TypeScript build'"
10
10
  },
11
11
  "dependencies": {
12
- "@saltcorn/data": "1.6.0-beta.5",
12
+ "@saltcorn/data": "1.6.0-beta.7",
13
13
  "env-paths": "^2.2.1",
14
14
  "npm-registry-fetch": "17.1.0",
15
15
  "https-proxy-agent": "^7.0.6"
@@ -58,9 +58,10 @@ const npmInstallNeeded = (oldPckJSON, newPckJSON) => {
58
58
 
59
59
  const defaultRootFolder = envPaths("saltcorn", { suffix: "plugins" }).data;
60
60
 
61
- // tracks local plugins already copied in this process
62
- // is only checked in the master process
61
+ // tracks plugins already installed in this process (master process only)
63
62
  const installedLocalPlugins = new Set();
63
+ const installedGitPlugins = new Set();
64
+ const installedGithubPlugins = new Set();
64
65
 
65
66
  /**
66
67
  * Find the most recently created localversion_<timestamp> directory for a local plugin.
@@ -267,9 +268,13 @@ class PluginInstaller {
267
268
  }
268
269
  break;
269
270
  case "github":
270
- if (this.force || !folderExists) {
271
+ if (
272
+ (this.force || !folderExists) &&
273
+ (!installedGithubPlugins.has(this.pluginDir) || this.reloadModule)
274
+ ) {
271
275
  getState().log(6, "downloading from github");
272
276
  await downloadFromGithub(this.plugin, this.rootFolder, this.tempDir);
277
+ installedGithubPlugins.add(this.pluginDir);
273
278
  wasLoaded = true;
274
279
  }
275
280
  break;
@@ -288,10 +293,14 @@ class PluginInstaller {
288
293
  }
289
294
  break;
290
295
  case "git":
291
- if (this.force || !folderExists) {
296
+ if (
297
+ (this.force || !folderExists) &&
298
+ (!installedGitPlugins.has(this.pluginDir) || this.reloadModule)
299
+ ) {
292
300
  getState().log(6, "downloading from git");
293
301
  await gitPullOrClone(this.plugin, this.tempDir);
294
302
  this.pckJsonPath = join(this.pluginDir, "package.json");
303
+ installedGitPlugins.add(this.pluginDir);
295
304
  wasLoaded = true;
296
305
  }
297
306
  break;