@saltcorn/plugins-loader 0.9.5-beta.13 → 0.9.5-beta.15

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": "0.9.5-beta.13",
3
+ "version": "0.9.5-beta.15",
4
4
  "description": "Saltcorn plugin loader",
5
5
  "homepage": "https://saltcorn.com",
6
6
  "scripts": {
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "env-paths": "^2.2.0",
13
- "@saltcorn/data": "0.9.5-beta.13"
13
+ "@saltcorn/data": "0.9.5-beta.15"
14
14
  },
15
15
  "author": "Christian Hugo",
16
16
  "license": "MIT",
@@ -88,7 +88,7 @@ class PluginInstaller {
88
88
  version: pckJSON.version,
89
89
  plugin_module: module,
90
90
  location: this.pluginDir,
91
- name: this.name,
91
+ name: this.plugin.name,
92
92
  loadedWithReload,
93
93
  };
94
94
  }
@@ -199,6 +199,7 @@ class PluginInstaller {
199
199
  }
200
200
 
201
201
  async npmInstall(pckJSON) {
202
+ getState().log(5, `NPM install plugin: ${pckJSON.name}`);
202
203
  const isWindows = process.platform === "win32";
203
204
  if (
204
205
  Object.keys(pckJSON.dependencies || {}).length > 0 ||
@@ -222,12 +223,24 @@ class PluginInstaller {
222
223
 
223
224
  async movePlugin() {
224
225
  const isWindows = process.platform === "win32";
226
+ const copyMove = async () => {
227
+ await cp(this.tempDir, this.pluginDir, { recursive: true, force: true });
228
+ try {
229
+ await rm(this.tempDir, { recursive: true });
230
+ } catch (error) {
231
+ getState().log(2, `Error removing temp folder ${this.tempDir}`);
232
+ }
233
+ };
225
234
  if (await pathExists(this.pluginDir))
226
235
  await rm(this.pluginDir, { recursive: true });
227
236
  await mkdir(this.pluginDir, { recursive: true });
228
- if (!isWindows) await rename(this.tempDir, this.pluginDir);
229
- else
230
- await cp(this.tempDir, this.pluginDir, { recursive: true, force: true });
237
+ if (!isWindows) {
238
+ try {
239
+ await rename(this.tempDir, this.pluginDir);
240
+ } catch (error) {
241
+ await copyMove();
242
+ }
243
+ } else await copyMove();
231
244
  }
232
245
  }
233
246