@saltcorn/plugins-loader 1.1.2-beta.9 → 1.1.3-beta.0
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 +2 -2
- package/plugin_installer.js +8 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saltcorn/plugins-loader",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3-beta.0",
|
|
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.1.
|
|
12
|
+
"@saltcorn/data": "1.1.3-beta.0",
|
|
13
13
|
"env-paths": "^2.2.1",
|
|
14
14
|
"npm-registry-fetch": "17.1.0",
|
|
15
15
|
"https-proxy-agent": "^7.0.6"
|
package/plugin_installer.js
CHANGED
|
@@ -46,11 +46,12 @@ const npmInstallNeeded = (oldPckJSON, newPckJSON) => {
|
|
|
46
46
|
);
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
+
const defaultRootFolder = envPaths("saltcorn", { suffix: "plugins" }).data;
|
|
50
|
+
|
|
49
51
|
class PluginInstaller {
|
|
50
52
|
constructor(plugin, opts = Object.create(null)) {
|
|
51
53
|
this.plugin = plugin;
|
|
52
|
-
this.rootFolder =
|
|
53
|
-
opts.rootFolder || envPaths("saltcorn", { suffix: "plugins" }).data;
|
|
54
|
+
this.rootFolder = opts.rootFolder || defaultRootFolder;
|
|
54
55
|
this.tempRootFolder =
|
|
55
56
|
opts.tempRootFolder || envPaths("saltcorn", { suffix: "tmp" }).temp;
|
|
56
57
|
const tokens =
|
|
@@ -70,6 +71,11 @@ class PluginInstaller {
|
|
|
70
71
|
this.envVars = opts.envVars || {};
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
static async cleanPluginsDirectory(opts = Object.create(null)) {
|
|
75
|
+
const rootFolder = opts.rootFolder || defaultRootFolder;
|
|
76
|
+
await rm(rootFolder, { recursive: true, force: true });
|
|
77
|
+
}
|
|
78
|
+
|
|
73
79
|
/**
|
|
74
80
|
* check if the host supports the plugin and return a warning if not
|
|
75
81
|
* @param pckJSON
|