@saltcorn/plugins-loader 1.1.0-beta.2 → 1.1.0-beta.20
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/download_utils.js +4 -2
- package/package.json +2 -2
- package/plugin_installer.js +21 -9
- package/stable_versioning.js +2 -2
package/download_utils.js
CHANGED
|
@@ -69,13 +69,15 @@ const loadTarball = (rootFolder, url, name) => {
|
|
|
69
69
|
} else
|
|
70
70
|
reject(
|
|
71
71
|
new Error(
|
|
72
|
-
`Error downloading tarball: http code ${redirect.statusCode}`
|
|
72
|
+
`Error downloading tarball from ${url}: http code ${redirect.statusCode}`
|
|
73
73
|
)
|
|
74
74
|
);
|
|
75
75
|
});
|
|
76
76
|
} else if (res.statusCode !== 200)
|
|
77
77
|
reject(
|
|
78
|
-
new Error(
|
|
78
|
+
new Error(
|
|
79
|
+
`Error downloading tarball from ${url}: http code ${res.statusCode}`
|
|
80
|
+
)
|
|
79
81
|
);
|
|
80
82
|
else {
|
|
81
83
|
const filePath = await writeTarball(res);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saltcorn/plugins-loader",
|
|
3
|
-
"version": "1.1.0-beta.
|
|
3
|
+
"version": "1.1.0-beta.20",
|
|
4
4
|
"description": "Saltcorn plugin loader",
|
|
5
5
|
"homepage": "https://saltcorn.com",
|
|
6
6
|
"scripts": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"env-paths": "^2.2.0",
|
|
13
13
|
"npm-registry-fetch": "17.1.0",
|
|
14
|
-
"@saltcorn/data": "1.1.0-beta.
|
|
14
|
+
"@saltcorn/data": "1.1.0-beta.20"
|
|
15
15
|
},
|
|
16
16
|
"author": "Christian Hugo",
|
|
17
17
|
"license": "MIT",
|
package/plugin_installer.js
CHANGED
|
@@ -111,10 +111,10 @@ class PluginInstaller {
|
|
|
111
111
|
await this.movePlugin(wasInstalled);
|
|
112
112
|
if (await tarballExists(this.rootFolder, this.plugin))
|
|
113
113
|
await removeTarball(this.rootFolder, this.plugin);
|
|
114
|
+
pckJSON = await readPackageJson(this.pckJsonPath);
|
|
115
|
+
const msg = this.checkEngineWarning(pckJSON);
|
|
116
|
+
if (msg && !msgs.includes(msg)) msgs.push(msg);
|
|
114
117
|
}
|
|
115
|
-
pckJSON = await readPackageJson(this.pckJsonPath);
|
|
116
|
-
const msg = this.checkEngineWarning(pckJSON);
|
|
117
|
-
if (msg && !msgs.includes(msg)) msgs.push(msg);
|
|
118
118
|
};
|
|
119
119
|
await installer();
|
|
120
120
|
let module = null;
|
|
@@ -125,15 +125,21 @@ class PluginInstaller {
|
|
|
125
125
|
// but without a valid node modules folder
|
|
126
126
|
module = await this.loadMainFile(pckJSON);
|
|
127
127
|
} catch (e) {
|
|
128
|
-
getState().log(
|
|
129
|
-
2,
|
|
130
|
-
`Error loading plugin ${this.plugin.name}. Removing and trying again.`
|
|
131
|
-
);
|
|
132
128
|
if (force) {
|
|
129
|
+
getState().log(
|
|
130
|
+
2,
|
|
131
|
+
`Error loading plugin ${this.plugin.name}. Removing and trying again.`
|
|
132
|
+
);
|
|
133
133
|
await this.remove();
|
|
134
134
|
pckJSON = null;
|
|
135
135
|
await installer();
|
|
136
|
-
}
|
|
136
|
+
} else
|
|
137
|
+
getState().log(
|
|
138
|
+
2,
|
|
139
|
+
`Error loading plugin ${this.plugin.name}. Trying again with reload flag. ` +
|
|
140
|
+
"A server restart may be required."
|
|
141
|
+
);
|
|
142
|
+
|
|
137
143
|
module = await this.loadMainFile(pckJSON, true);
|
|
138
144
|
loadedWithReload = true;
|
|
139
145
|
}
|
|
@@ -287,7 +293,13 @@ class PluginInstaller {
|
|
|
287
293
|
});
|
|
288
294
|
}
|
|
289
295
|
child.on("exit", (exitCode, signal) => {
|
|
290
|
-
|
|
296
|
+
if (exitCode !== 0) {
|
|
297
|
+
reject(
|
|
298
|
+
new Error(
|
|
299
|
+
`NPM install failed for ${pckJSON.name} with exit code ${exitCode}`
|
|
300
|
+
)
|
|
301
|
+
);
|
|
302
|
+
} else resolve();
|
|
291
303
|
});
|
|
292
304
|
child.on("error", (msg) => {
|
|
293
305
|
reject(msg);
|
package/stable_versioning.js
CHANGED
|
@@ -17,7 +17,7 @@ const doCheck = (pluginVersion, versionInfos, scVersion) => {
|
|
|
17
17
|
getState().log(4, `invalid saltcorn version: ${scVersion}`);
|
|
18
18
|
return true;
|
|
19
19
|
}
|
|
20
|
-
return semver.satisfies(scVersion, scEngine);
|
|
20
|
+
return semver.satisfies(scVersion, scEngine, { includePrerelease: true });
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -83,7 +83,7 @@ const isEngineSatisfied = (scEngine, scVersion) => {
|
|
|
83
83
|
getState().log(4, `invalid saltcorn version: ${scVersion}`);
|
|
84
84
|
return true;
|
|
85
85
|
}
|
|
86
|
-
return semver.satisfies(safeScVersion, scEngine);
|
|
86
|
+
return semver.satisfies(safeScVersion, scEngine, { includePrerelease: true });
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
/**
|