node-pluginsmanager 2.5.1 → 3.0.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/LICENSE +13 -13
- package/README.md +84 -79
- package/lib/cjs/PluginsManager.d.ts +11 -11
- package/lib/cjs/PluginsManager.js +55 -88
- package/lib/cjs/checkers/checkFunction.d.ts +1 -1
- package/lib/cjs/checkers/checkNonEmptyArray.d.ts +1 -1
- package/lib/cjs/checkers/checkNonEmptyString.d.ts +1 -1
- package/lib/cjs/checkers/checkOrchestrator.js +5 -1
- package/lib/cjs/cmd/cmd.js +13 -4
- package/lib/cjs/cmd/git/gitInstall.js +1 -1
- package/lib/cjs/cmd/stdToString.d.ts +1 -1
- package/lib/cjs/cmd/stdToString.js +9 -2
- package/lib/cjs/createPluginByDirectory.d.ts +1 -1
- package/lib/cjs/createPluginByDirectory.js +11 -7
- package/lib/cjs/extractGithub.d.ts +1 -1
- package/lib/cjs/extractGithub.js +2 -2
- package/lib/cjs/initSortedPlugins.d.ts +1 -1
- package/lib/cjs/loadSortedPlugins.d.ts +1 -1
- package/lib/cjs/loadSortedPlugins.js +9 -9
- package/package.json +95 -89
package/LICENSE
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
Copyright (c) 2023, Sébastien Vidal
|
|
2
|
-
|
|
3
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
4
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
5
|
-
copyright notice and this permission notice appear in all copies.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
8
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
9
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
10
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
11
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
12
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
13
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
1
|
+
Copyright (c) 2023, Sébastien Vidal
|
|
2
|
+
|
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
4
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
5
|
+
copyright notice and this permission notice appear in all copies.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
8
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
9
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
10
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
11
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
12
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
13
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,79 +1,84 @@
|
|
|
1
|
-
# node-pluginsmanager
|
|
2
|
-
A plugins manager
|
|
3
|
-
|
|
4
|
-
[](https://sonarcloud.io/summary/new_code?id=Psychopoulet_node-pluginsmanager)
|
|
5
|
+
[](https://github.com/Psychopoulet/node-pluginsmanager/issues)
|
|
6
|
+
[](https://github.com/Psychopoulet/node-pluginsmanager/pulls)
|
|
7
|
+
|
|
8
|
+
[](https://sonarcloud.io/summary/new_code?id=Psychopoulet_node-pluginsmanager)
|
|
9
|
+
[](https://sonarcloud.io/summary/new_code?id=Psychopoulet_node-pluginsmanager)
|
|
10
|
+
[](https://sonarcloud.io/summary/new_code?id=Psychopoulet_node-pluginsmanager)
|
|
11
|
+
[](https://sonarcloud.io/summary/new_code?id=Psychopoulet_node-pluginsmanager)
|
|
12
|
+
[](https://sonarcloud.io/summary/new_code?id=Psychopoulet_node-pluginsmanager)
|
|
13
|
+
|
|
14
|
+
[](https://snyk.io/test/github/Psychopoulet/node-pluginsmanager)
|
|
15
|
+
|
|
16
|
+
> please note that this version is only usable with node-pluginsmanager-plugin 3.x.x && 4.x.x
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
$ npm install node-pluginsmanager
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
* simply manage plugins (extended from [node-pluginsmanager-plugin](https://github.com/Psychopoulet/node-pluginsmanager-plugin)) to interact with specifics hardwares / API / whatever
|
|
27
|
+
* install plugins manually or via github & initialize them
|
|
28
|
+
* update plugins via github
|
|
29
|
+
* uninstall plugins and release there resources
|
|
30
|
+
* run plugins' middlewares for server, to create specifics rules
|
|
31
|
+
* check plugins' modules' versions
|
|
32
|
+
|
|
33
|
+
## Architecture
|
|
34
|
+
|
|
35
|
+
### Plugin
|
|
36
|
+
|
|
37
|
+

|
|
38
|
+
|
|
39
|
+
### Routes
|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
## Content
|
|
44
|
+
|
|
45
|
+
[check the TypeScript definition file](https://github.com/Psychopoulet/node-pluginsmanager/blob/master/lib/index.d.ts)
|
|
46
|
+
|
|
47
|
+
## Events
|
|
48
|
+
|
|
49
|
+
* ``` on("error", (err: Error) => void) : this ``` fires if an error occurs
|
|
50
|
+
|
|
51
|
+
* ``` on("loading", (plugin: Orchestrator, data?: any) => void) : this ``` fires if a plugin starts load
|
|
52
|
+
* ``` on("loaded", (plugin: Orchestrator, data?: any) => void) : this ``` fires if a plugin ends load
|
|
53
|
+
* ``` on("allloaded", (data?: any) => void) : this ``` fires if all the plugins are loaded
|
|
54
|
+
|
|
55
|
+
* ``` on("initializing", (plugin: Orchestrator, data?: any) => void) : this ``` fires if a plugin starts init
|
|
56
|
+
* ``` on("initialized", (plugin: Orchestrator, data?: any) => void) : this ``` fires if a plugin ends init
|
|
57
|
+
* ``` on("allinitialized", (data?: any) => void) : this ``` fires if all the plugins are initialized
|
|
58
|
+
|
|
59
|
+
* ``` on("released", (plugin: Orchestrator, data?: any) => void) : this ``` fires if a plugin is released
|
|
60
|
+
* ``` on("allreleased", (data?: any) => void) : this ``` fires if all the plugins are released
|
|
61
|
+
|
|
62
|
+
* ``` on("destroyed", (pluginName: string, data?: any) => void) : this ``` fires if a plugin is destroyed
|
|
63
|
+
* ``` on("alldestroyed", (data?: any) => void) : this ``` fires if all the plugins are destroyed
|
|
64
|
+
|
|
65
|
+
* ``` on("installed", (pluginName: string, data?: any) => void) : this ``` fires if a plugin is installed
|
|
66
|
+
* ``` on("updated", (plugin: Orchestrator, data?: any) => void) : this ``` fires if a plugin is updated
|
|
67
|
+
* ``` on("uninstalled", (pluginName: string, data?: any) => void) : this ``` fires if a plugin is uninstalled
|
|
68
|
+
|
|
69
|
+
## Examples
|
|
70
|
+
|
|
71
|
+
[check the TypeScript compilation tests](https://github.com/Psychopoulet/node-pluginsmanager/blob/master/test/typescript/compilation.ts)
|
|
72
|
+
|
|
73
|
+
## Tests
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
$ git clone git://github.com/Psychopoulet/node-pluginsmanager.git
|
|
77
|
+
$ cd ./node-pluginsmanager
|
|
78
|
+
$ npm install
|
|
79
|
+
$ npm run-script tests
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
[ISC](LICENSE)
|
|
@@ -5,19 +5,19 @@ import type { Server as WebSocketServer } from "ws";
|
|
|
5
5
|
import type { Server as SocketIOServer } from "socket.io";
|
|
6
6
|
interface iPluginManagerOptions {
|
|
7
7
|
"directory"?: string;
|
|
8
|
-
"
|
|
8
|
+
"externalResourcesDirectory"?: string;
|
|
9
9
|
"logger"?: tLogger | null;
|
|
10
10
|
}
|
|
11
|
-
type tBeforeAllMethodCallback = (...data:
|
|
11
|
+
type tBeforeAllMethodCallback = (...data: unknown[]) => Promise<void> | void;
|
|
12
12
|
export default class PluginsManager extends EventEmitter {
|
|
13
13
|
protected _beforeLoadAll: tBeforeAllMethodCallback | null;
|
|
14
14
|
protected _beforeInitAll: tBeforeAllMethodCallback | null;
|
|
15
15
|
protected _logger: tLogger | null;
|
|
16
16
|
protected _orderedPluginsNames: string[];
|
|
17
17
|
directory: string;
|
|
18
|
-
|
|
18
|
+
externalResourcesDirectory: string;
|
|
19
19
|
plugins: Orchestrator[];
|
|
20
|
-
constructor(options
|
|
20
|
+
constructor(options?: iPluginManagerOptions);
|
|
21
21
|
getPluginsNames(): string[];
|
|
22
22
|
setOrder(pluginsNames: string[]): Promise<void>;
|
|
23
23
|
getOrder(): string[];
|
|
@@ -26,13 +26,13 @@ export default class PluginsManager extends EventEmitter {
|
|
|
26
26
|
appMiddleware(req: IncomingMessage, res: ServerResponse, next: () => void): void;
|
|
27
27
|
socketMiddleware(server: WebSocketServer | SocketIOServer): void;
|
|
28
28
|
beforeLoadAll(callback: tBeforeAllMethodCallback): Promise<void>;
|
|
29
|
-
loadAll(...data:
|
|
30
|
-
destroyAll(...data:
|
|
29
|
+
loadAll(...data: unknown[]): Promise<void>;
|
|
30
|
+
destroyAll(...data: unknown[]): Promise<void>;
|
|
31
31
|
beforeInitAll(callback: tBeforeAllMethodCallback): Promise<void>;
|
|
32
|
-
initAll(...data:
|
|
33
|
-
releaseAll(...data:
|
|
34
|
-
installViaGithub(user: string, repo: string, ...data:
|
|
35
|
-
updateViaGithub(plugin: Orchestrator, ...data:
|
|
36
|
-
uninstall(plugin: Orchestrator, ...data:
|
|
32
|
+
initAll(...data: unknown[]): Promise<void>;
|
|
33
|
+
releaseAll(...data: unknown[]): Promise<void>;
|
|
34
|
+
installViaGithub(user: string, repo: string, ...data: unknown[]): Promise<Orchestrator>;
|
|
35
|
+
updateViaGithub(plugin: Orchestrator, ...data: unknown[]): Promise<Orchestrator>;
|
|
36
|
+
uninstall(plugin: Orchestrator, ...data: unknown[]): Promise<string>;
|
|
37
37
|
}
|
|
38
38
|
export {};
|
|
@@ -30,31 +30,39 @@ const npmInstall_1 = __importDefault(require("./cmd/npm/npmInstall"));
|
|
|
30
30
|
const npmUpdate_1 = __importDefault(require("./cmd/npm/npmUpdate"));
|
|
31
31
|
// consts
|
|
32
32
|
const DEFAULT_PLUGINS_DIRECTORY = (0, node_path_1.join)((0, node_os_1.homedir)(), "node-pluginsmanager-plugins");
|
|
33
|
-
const
|
|
33
|
+
const DEFAULT_RESOURCES_DIRECTORY = (0, node_path_1.join)((0, node_os_1.homedir)(), "node-pluginsmanager-resources");
|
|
34
34
|
// module
|
|
35
35
|
class PluginsManager extends node_events_1.default {
|
|
36
|
+
// attributes
|
|
37
|
+
// protected
|
|
38
|
+
_beforeLoadAll;
|
|
39
|
+
_beforeInitAll;
|
|
40
|
+
_logger;
|
|
41
|
+
_orderedPluginsNames;
|
|
42
|
+
// public
|
|
43
|
+
directory; // plugins location (must be writable). default : join(homedir(), "node-pluginsmanager-plugins")
|
|
44
|
+
externalResourcesDirectory; // external resources locations (sqlite, files, cache, etc...) (must be writable). default : join(homedir(), "node-pluginsmanager-resources")
|
|
45
|
+
plugins; // plugins' Orchestrators
|
|
36
46
|
// constructor
|
|
37
|
-
constructor(options) {
|
|
47
|
+
constructor(options = {}) {
|
|
38
48
|
super();
|
|
49
|
+
// mandatory props
|
|
50
|
+
if ("object" !== typeof options) {
|
|
51
|
+
throw new ReferenceError("\"options\" must be a non-null object");
|
|
52
|
+
}
|
|
39
53
|
// protected
|
|
40
54
|
this._beforeLoadAll = null;
|
|
41
55
|
this._beforeInitAll = null;
|
|
42
56
|
this._orderedPluginsNames = [];
|
|
43
|
-
this._logger =
|
|
44
|
-
? options.logger
|
|
45
|
-
: null;
|
|
57
|
+
this._logger = "function" === typeof options.logger ? options.logger : null;
|
|
46
58
|
// public
|
|
47
59
|
this.plugins = [];
|
|
48
|
-
this.directory = options
|
|
49
|
-
|
|
50
|
-
: DEFAULT_PLUGINS_DIRECTORY;
|
|
51
|
-
this.externalRessourcesDirectory = options && "undefined" !== typeof options.externalRessourcesDirectory
|
|
52
|
-
? options.externalRessourcesDirectory
|
|
53
|
-
: DEFAULT_RESSOURCES_DIRECTORY;
|
|
60
|
+
this.directory = options.directory ?? DEFAULT_PLUGINS_DIRECTORY;
|
|
61
|
+
this.externalResourcesDirectory = options.externalResourcesDirectory ?? DEFAULT_RESOURCES_DIRECTORY;
|
|
54
62
|
}
|
|
55
63
|
// public
|
|
56
64
|
getPluginsNames() {
|
|
57
|
-
return
|
|
65
|
+
return this.plugins.map((plugin) => {
|
|
58
66
|
return plugin.name;
|
|
59
67
|
});
|
|
60
68
|
}
|
|
@@ -78,19 +86,17 @@ class PluginsManager extends node_events_1.default {
|
|
|
78
86
|
return !errors.length ? Promise.resolve() : Promise.reject(new Error(errors.join("\r\n")));
|
|
79
87
|
}).then(() => {
|
|
80
88
|
this._orderedPluginsNames = pluginsNames;
|
|
81
|
-
return Promise.resolve();
|
|
82
89
|
});
|
|
83
90
|
}
|
|
84
91
|
getOrder() {
|
|
85
92
|
return [...this._orderedPluginsNames];
|
|
86
93
|
}
|
|
87
94
|
checkAllModules() {
|
|
88
|
-
|
|
89
|
-
return
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
};
|
|
93
|
-
return _checkPluginsModules();
|
|
95
|
+
return Promise.all(this.plugins.map((plugin) => {
|
|
96
|
+
return this.checkModules(plugin);
|
|
97
|
+
})).then(() => {
|
|
98
|
+
return Promise.resolve();
|
|
99
|
+
});
|
|
94
100
|
}
|
|
95
101
|
checkModules(plugin) {
|
|
96
102
|
return (0, checkAbsoluteDirectory_1.default)("checkModules/directory", this.directory).then(() => {
|
|
@@ -116,7 +122,7 @@ class PluginsManager extends node_events_1.default {
|
|
|
116
122
|
return next();
|
|
117
123
|
}
|
|
118
124
|
else {
|
|
119
|
-
|
|
125
|
+
function _recursiveNext(i) {
|
|
120
126
|
if (i < plugins.length) {
|
|
121
127
|
return () => {
|
|
122
128
|
return plugins[i].appMiddleware(req, res, _recursiveNext(i + 1));
|
|
@@ -126,8 +132,8 @@ class PluginsManager extends node_events_1.default {
|
|
|
126
132
|
else {
|
|
127
133
|
return next;
|
|
128
134
|
}
|
|
129
|
-
}
|
|
130
|
-
return plugins[0].appMiddleware(req, res, _recursiveNext(
|
|
135
|
+
}
|
|
136
|
+
return plugins[0].appMiddleware(req, res, _recursiveNext(1)); // must start at index "1", cause the "0" is executed here
|
|
131
137
|
}
|
|
132
138
|
}
|
|
133
139
|
// middleware for socket to add bilateral push events
|
|
@@ -142,7 +148,6 @@ class PluginsManager extends node_events_1.default {
|
|
|
142
148
|
beforeLoadAll(callback) {
|
|
143
149
|
return (0, checkFunction_1.default)("beforeLoadAll/callback", callback).then(() => {
|
|
144
150
|
this._beforeLoadAll = callback;
|
|
145
|
-
return Promise.resolve();
|
|
146
151
|
});
|
|
147
152
|
}
|
|
148
153
|
// load all plugins asynchronously, using "data" in arguments for "load" plugin's Orchestrator method
|
|
@@ -156,11 +161,11 @@ class PluginsManager extends node_events_1.default {
|
|
|
156
161
|
});
|
|
157
162
|
// create dir if not exist
|
|
158
163
|
}).then(() => {
|
|
159
|
-
return (0, checkNonEmptyString_1.default)("initAll/
|
|
160
|
-
return (0, promises_1.mkdir)(this.
|
|
164
|
+
return (0, checkNonEmptyString_1.default)("initAll/externalResourcesDirectory", this.externalResourcesDirectory).then(() => {
|
|
165
|
+
return (0, promises_1.mkdir)(this.externalResourcesDirectory, {
|
|
161
166
|
"recursive": true
|
|
162
167
|
}).then(() => {
|
|
163
|
-
return (0, checkAbsoluteDirectory_1.default)("initAll/
|
|
168
|
+
return (0, checkAbsoluteDirectory_1.default)("initAll/externalResourcesDirectory", this.externalResourcesDirectory);
|
|
164
169
|
});
|
|
165
170
|
});
|
|
166
171
|
// ensure loop
|
|
@@ -184,7 +189,7 @@ class PluginsManager extends node_events_1.default {
|
|
|
184
189
|
return (0, promises_1.readdir)(this.directory);
|
|
185
190
|
// load all
|
|
186
191
|
}).then((files) => {
|
|
187
|
-
return (0, loadSortedPlugins_1.default)(this.directory, this.
|
|
192
|
+
return (0, loadSortedPlugins_1.default)(this.directory, this.externalResourcesDirectory, files, this.plugins, this._orderedPluginsNames, this.emit.bind(this), this._logger, ...data);
|
|
188
193
|
// sort plugins
|
|
189
194
|
}).then(() => {
|
|
190
195
|
this.plugins.sort((a, b) => {
|
|
@@ -198,51 +203,35 @@ class PluginsManager extends node_events_1.default {
|
|
|
198
203
|
return 0;
|
|
199
204
|
}
|
|
200
205
|
});
|
|
201
|
-
return Promise.resolve();
|
|
202
206
|
// end
|
|
203
207
|
}).then(() => {
|
|
204
208
|
this.emit("allloaded", ...data);
|
|
205
|
-
return Promise.resolve();
|
|
206
209
|
});
|
|
207
210
|
}
|
|
208
211
|
// after releasing, destroy packages data & free "plugins" list, using "data" in arguments for "destroy" plugin's Orchestrator method
|
|
209
212
|
destroyAll(...data) {
|
|
210
|
-
return Promise.
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
return this.plugins[i].destroy().then(() => {
|
|
216
|
-
this.emit("destroyed", pluginName, ...data);
|
|
217
|
-
return Promise.resolve();
|
|
218
|
-
// loop
|
|
219
|
-
}).then(() => {
|
|
220
|
-
return _destroyPlugin(i - 1);
|
|
221
|
-
});
|
|
222
|
-
}) : Promise.resolve();
|
|
223
|
-
};
|
|
224
|
-
return _destroyPlugin();
|
|
225
|
-
// end
|
|
226
|
-
}).then(() => {
|
|
213
|
+
return Promise.all(this.plugins.map((plugin) => {
|
|
214
|
+
return plugin.destroy().then(() => {
|
|
215
|
+
this.emit("destroyed", plugin.name, ...data);
|
|
216
|
+
});
|
|
217
|
+
})).then(() => {
|
|
227
218
|
this.plugins = [];
|
|
228
219
|
this.emit("alldestroyed", ...data);
|
|
229
|
-
return Promise.resolve();
|
|
230
220
|
// remove all external resources
|
|
231
221
|
}).then(() => {
|
|
232
|
-
return (0, rmdirp_1.default)(this.
|
|
222
|
+
return (0, rmdirp_1.default)(this.externalResourcesDirectory);
|
|
233
223
|
});
|
|
234
224
|
}
|
|
235
225
|
// add a function executed before initializing all plugins
|
|
236
226
|
beforeInitAll(callback) {
|
|
237
227
|
return (0, checkFunction_1.default)("beforeInitAll/callback", callback).then(() => {
|
|
238
228
|
this._beforeInitAll = callback;
|
|
239
|
-
return Promise.resolve();
|
|
240
229
|
});
|
|
241
230
|
}
|
|
242
231
|
// initialize all plugins asynchronously, using "data" in arguments for "init" plugin's Orchestrator method
|
|
243
232
|
initAll(...data) {
|
|
244
233
|
return (0, checkAbsoluteDirectory_1.default)("initAll/directory", this.directory).then(() => {
|
|
245
|
-
return (0, checkAbsoluteDirectory_1.default)("initAll/
|
|
234
|
+
return (0, checkAbsoluteDirectory_1.default)("initAll/externalResourcesDirectory", this.externalResourcesDirectory);
|
|
246
235
|
}).then(() => {
|
|
247
236
|
// execute _beforeInitAll
|
|
248
237
|
return "function" !== typeof this._beforeInitAll ? Promise.resolve() : new Promise((resolve, reject) => {
|
|
@@ -260,29 +249,16 @@ class PluginsManager extends node_events_1.default {
|
|
|
260
249
|
// end
|
|
261
250
|
}).then(() => {
|
|
262
251
|
this.emit("allinitialized", ...data);
|
|
263
|
-
return Promise.resolve();
|
|
264
252
|
});
|
|
265
253
|
}
|
|
266
254
|
// release a plugin (keep package but destroy Mediator & Server), using "data" in arguments for "release" plugin's Orchestrator method
|
|
267
255
|
releaseAll(...data) {
|
|
268
|
-
return Promise.
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
}).then(() => {
|
|
274
|
-
this.emit("released", this.plugins[i], ...data);
|
|
275
|
-
return Promise.resolve();
|
|
276
|
-
// loop
|
|
277
|
-
}).then(() => {
|
|
278
|
-
return _releasePlugin(i - 1);
|
|
279
|
-
}) : Promise.resolve();
|
|
280
|
-
};
|
|
281
|
-
return _releasePlugin();
|
|
282
|
-
// end
|
|
283
|
-
}).then(() => {
|
|
256
|
+
return Promise.all(this.plugins.map((plugin) => {
|
|
257
|
+
return plugin.release(...data).then(() => {
|
|
258
|
+
this.emit("released", plugin, ...data);
|
|
259
|
+
});
|
|
260
|
+
})).then(() => {
|
|
284
261
|
this.emit("allreleased", ...data);
|
|
285
|
-
return Promise.resolve();
|
|
286
262
|
});
|
|
287
263
|
}
|
|
288
264
|
// install a plugin via github repo, using "data" in arguments for "install" and "init" plugin's Orchestrator methods
|
|
@@ -301,11 +277,9 @@ class PluginsManager extends node_events_1.default {
|
|
|
301
277
|
});
|
|
302
278
|
});
|
|
303
279
|
}).then((directory) => {
|
|
304
|
-
return
|
|
305
|
-
return (0, gitInstall_1.default)(directory, user, repo);
|
|
306
|
-
}).then(() => {
|
|
280
|
+
return (0, gitInstall_1.default)(directory, user, repo).then(() => {
|
|
307
281
|
// install dependencies & execute install script
|
|
308
|
-
return (0, createPluginByDirectory_1.default)(directory, this.
|
|
282
|
+
return (0, createPluginByDirectory_1.default)(directory, this.externalResourcesDirectory, this._logger, ...data);
|
|
309
283
|
// check plugin modules versions
|
|
310
284
|
}).then((plugin) => {
|
|
311
285
|
return this.checkModules(plugin).then(() => {
|
|
@@ -330,14 +304,12 @@ class PluginsManager extends node_events_1.default {
|
|
|
330
304
|
});
|
|
331
305
|
});
|
|
332
306
|
}).catch((err) => {
|
|
333
|
-
return
|
|
334
|
-
(0,
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
return err ? reject(err) : resolve();
|
|
340
|
-
});
|
|
307
|
+
return (0, checkAbsoluteDirectory_1.default)("installViaGithub/plugindirectory", directory).then(() => {
|
|
308
|
+
return (0, rmdirp_1.default)(directory);
|
|
309
|
+
}).then(() => {
|
|
310
|
+
return Promise.reject(err);
|
|
311
|
+
}).catch(() => {
|
|
312
|
+
return Promise.reject(err);
|
|
341
313
|
});
|
|
342
314
|
});
|
|
343
315
|
});
|
|
@@ -373,12 +345,11 @@ class PluginsManager extends node_events_1.default {
|
|
|
373
345
|
}).then(() => {
|
|
374
346
|
this.emit("destroyed", pluginName, ...data);
|
|
375
347
|
this.plugins.splice(key, 1);
|
|
376
|
-
return Promise.resolve();
|
|
377
348
|
});
|
|
378
349
|
// download plugin
|
|
379
350
|
}).then(() => {
|
|
380
351
|
return (0, gitUpdate_1.default)(directory).then(() => {
|
|
381
|
-
return (0, createPluginByDirectory_1.default)(directory, this.
|
|
352
|
+
return (0, createPluginByDirectory_1.default)(directory, this.externalResourcesDirectory, this._logger, ...data);
|
|
382
353
|
});
|
|
383
354
|
// check plugin modules versions
|
|
384
355
|
}).then((_plugin) => {
|
|
@@ -425,20 +396,17 @@ class PluginsManager extends node_events_1.default {
|
|
|
425
396
|
// release plugin
|
|
426
397
|
}).then(() => {
|
|
427
398
|
return plugin.release(...data).then(() => {
|
|
428
|
-
return (0, rmdirp_1.default)((0, node_path_1.join)(this.
|
|
399
|
+
return (0, rmdirp_1.default)((0, node_path_1.join)(this.externalResourcesDirectory, pluginName));
|
|
429
400
|
}).then(() => {
|
|
430
401
|
this.emit("released", plugin, ...data);
|
|
431
402
|
return plugin.destroy(...data);
|
|
432
403
|
}).then(() => {
|
|
433
404
|
this.emit("destroyed", pluginName, ...data);
|
|
434
405
|
this.plugins.splice(key, 1);
|
|
435
|
-
return Promise.resolve();
|
|
436
406
|
});
|
|
437
407
|
// update dependencies & execute update script
|
|
438
408
|
}).then(() => {
|
|
439
|
-
return
|
|
440
|
-
return plugin.uninstall(...data);
|
|
441
|
-
}).then(() => {
|
|
409
|
+
return plugin.uninstall(...data).then(() => {
|
|
442
410
|
this.emit("uninstalled", pluginName, ...data);
|
|
443
411
|
return (0, rmdirp_1.default)(directory);
|
|
444
412
|
});
|
|
@@ -448,4 +416,3 @@ class PluginsManager extends node_events_1.default {
|
|
|
448
416
|
}
|
|
449
417
|
}
|
|
450
418
|
exports.default = PluginsManager;
|
|
451
|
-
;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function isFunction(dataName: string, data:
|
|
1
|
+
export default function isFunction(dataName: string, data: unknown): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function isNonEmptyArray(dataName: string, data:
|
|
1
|
+
export default function isNonEmptyArray(dataName: string, data: unknown): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function isNonEmptyString(dataName: string, data:
|
|
1
|
+
export default function isNonEmptyString(dataName: string, data: unknown): Promise<void>;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
/*
|
|
3
|
+
eslint-disable @typescript-eslint/unbound-method
|
|
4
|
+
*/
|
|
5
|
+
// => @typescript-eslint/unbound-method is disabled to allow check on data (no need for js context)
|
|
3
6
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
7
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
8
|
};
|
|
6
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
10
|
exports.default = checkOrchestrator;
|
|
11
|
+
// deps
|
|
8
12
|
// natives
|
|
9
13
|
const node_events_1 = __importDefault(require("node:events"));
|
|
10
14
|
// locals
|
package/lib/cjs/cmd/cmd.js
CHANGED
|
@@ -20,18 +20,27 @@ function cmd(directory, command, params) {
|
|
|
20
20
|
return (0, checkNonEmptyArray_1.default)("cmd/params", params);
|
|
21
21
|
}).then(() => {
|
|
22
22
|
return new Promise((resolve, reject) => {
|
|
23
|
-
let
|
|
23
|
+
let errMsg = "";
|
|
24
|
+
let outMsg = "";
|
|
24
25
|
const mySpawn = (0, node_child_process_1.spawn)(command, params, {
|
|
25
26
|
"cwd": directory,
|
|
26
27
|
"windowsHide": true,
|
|
27
28
|
"shell": true
|
|
28
29
|
}).on("error", (err) => {
|
|
29
|
-
|
|
30
|
+
errMsg += (0, stdToString_1.default)(err);
|
|
30
31
|
}).on("close", (code) => {
|
|
31
|
-
|
|
32
|
+
if (0 < errMsg.length) {
|
|
33
|
+
return code ? reject(new Error(errMsg)) : resolve();
|
|
34
|
+
}
|
|
35
|
+
return code ? reject(new Error(outMsg)) : resolve();
|
|
32
36
|
});
|
|
37
|
+
mySpawn.stdout.setEncoding("utf8");
|
|
38
|
+
mySpawn.stdout.on("data", (msg) => {
|
|
39
|
+
outMsg += (0, stdToString_1.default)(msg);
|
|
40
|
+
});
|
|
41
|
+
mySpawn.stderr.setEncoding("utf8");
|
|
33
42
|
mySpawn.stderr.on("data", (msg) => {
|
|
34
|
-
|
|
43
|
+
errMsg += (0, stdToString_1.default)(msg);
|
|
35
44
|
});
|
|
36
45
|
});
|
|
37
46
|
});
|
|
@@ -16,7 +16,7 @@ function gitInstall(directory, user, repo) {
|
|
|
16
16
|
return (0, checkNonEmptyString_1.default)("cmd/git/install/directory", directory).then(() => {
|
|
17
17
|
return new Promise((resolve, reject) => {
|
|
18
18
|
(0, checkDirectory_1.default)("cmd/git/install/directory", directory).then(() => {
|
|
19
|
-
reject(new Error("\"" + directory + "\"
|
|
19
|
+
reject(new Error("\"" + directory + "\" already exists"));
|
|
20
20
|
}).catch(() => {
|
|
21
21
|
resolve();
|
|
22
22
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function stdToString(msg:
|
|
1
|
+
export default function stdToString(msg: unknown): string;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
/*
|
|
3
|
+
eslint-disable @typescript-eslint/no-base-to-string
|
|
4
|
+
*/
|
|
5
|
+
// => @typescript-eslint/no-base-to-string is disabled to force stringifying a potential object
|
|
3
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
7
|
exports.default = stdToString;
|
|
8
|
+
// module
|
|
5
9
|
function stdToString(msg) {
|
|
6
10
|
if ("object" !== typeof msg) {
|
|
7
11
|
return String(msg);
|
|
@@ -9,7 +13,10 @@ function stdToString(msg) {
|
|
|
9
13
|
else if (msg instanceof Buffer) {
|
|
10
14
|
return msg.toString("utf8");
|
|
11
15
|
}
|
|
16
|
+
else if (msg.message) {
|
|
17
|
+
return msg.message;
|
|
18
|
+
}
|
|
12
19
|
else {
|
|
13
|
-
return
|
|
20
|
+
return String(msg);
|
|
14
21
|
}
|
|
15
22
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Orchestrator, tLogger } from "node-pluginsmanager-plugin";
|
|
2
|
-
export default function createPluginByDirectory(directory: string,
|
|
2
|
+
export default function createPluginByDirectory(directory: string, externalResourcesDirectory: string, logger: tLogger | null, ...data: unknown[]): Promise<Orchestrator>;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
/*
|
|
3
|
+
eslint-disable @typescript-eslint/no-var-requires
|
|
4
|
+
*/
|
|
5
|
+
// => @typescript-eslint/no-var-requires is disabled to allow plugin load
|
|
3
6
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
7
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
8
|
};
|
|
6
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
10
|
exports.default = createPluginByDirectory;
|
|
11
|
+
// deps
|
|
8
12
|
// natives
|
|
9
13
|
const node_path_1 = require("node:path");
|
|
10
14
|
// locals
|
|
@@ -12,22 +16,22 @@ const checkAbsoluteDirectory_1 = __importDefault(require("./checkers/checkAbsolu
|
|
|
12
16
|
const checkOrchestrator_1 = __importDefault(require("./checkers/checkOrchestrator"));
|
|
13
17
|
const checkFunction_1 = __importDefault(require("./checkers/checkFunction"));
|
|
14
18
|
// module
|
|
15
|
-
function createPluginByDirectory(directory,
|
|
19
|
+
function createPluginByDirectory(directory, externalResourcesDirectory, logger, ...data) {
|
|
16
20
|
return (0, checkAbsoluteDirectory_1.default)("createPluginByDirectory/directory", directory).then(() => {
|
|
17
|
-
return (0, checkAbsoluteDirectory_1.default)("createPluginByDirectory/
|
|
21
|
+
return (0, checkAbsoluteDirectory_1.default)("createPluginByDirectory/externalResourcesDirectory", externalResourcesDirectory);
|
|
18
22
|
}).then(() => {
|
|
19
23
|
return new Promise((resolve, reject) => {
|
|
20
24
|
try {
|
|
21
25
|
resolve(require(directory));
|
|
22
26
|
}
|
|
23
27
|
catch (e) {
|
|
24
|
-
reject(e);
|
|
28
|
+
reject(e instanceof Error ? e : new Error(String(e)));
|
|
25
29
|
}
|
|
26
30
|
}).then((Plugin) => {
|
|
27
|
-
if (Plugin.Orchestrator) {
|
|
31
|
+
if (["function", "object"].includes(typeof Plugin.Orchestrator)) {
|
|
28
32
|
return Promise.resolve(Plugin.Orchestrator);
|
|
29
33
|
}
|
|
30
|
-
else if (Plugin.default) {
|
|
34
|
+
else if (["function", "object"].includes(typeof Plugin.default)) {
|
|
31
35
|
return Promise.resolve(Plugin.default);
|
|
32
36
|
}
|
|
33
37
|
else {
|
|
@@ -38,7 +42,7 @@ function createPluginByDirectory(directory, externalRessourcesDirectory, logger,
|
|
|
38
42
|
const pluginBaseNameDirectory = (0, node_path_1.basename)(directory);
|
|
39
43
|
const plugin = new Plugin({
|
|
40
44
|
// usefull for inherited Orchestrators
|
|
41
|
-
"
|
|
45
|
+
"externalResourcesDirectory": (0, node_path_1.join)(externalResourcesDirectory, pluginBaseNameDirectory),
|
|
42
46
|
"logger": logger,
|
|
43
47
|
// useless, setted in inherited Orchestrators
|
|
44
48
|
"packageFile": "",
|
|
@@ -3,5 +3,5 @@ interface OrchestratorExtended extends Orchestrator {
|
|
|
3
3
|
"github"?: string;
|
|
4
4
|
"repository"?: string | Record<string, string>;
|
|
5
5
|
}
|
|
6
|
-
export default function extractGithub(plugin: OrchestratorExtended): string;
|
|
6
|
+
export default function extractGithub(plugin: OrchestratorExtended): string | null;
|
|
7
7
|
export {};
|
package/lib/cjs/extractGithub.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.default = extractGithub;
|
|
5
5
|
// module
|
|
6
6
|
function extractGithub(plugin) {
|
|
7
|
-
let github =
|
|
7
|
+
let github = null;
|
|
8
8
|
if ("object" === typeof plugin) {
|
|
9
9
|
if ("string" === typeof plugin.github) {
|
|
10
10
|
github = plugin.github;
|
|
@@ -16,5 +16,5 @@ function extractGithub(plugin) {
|
|
|
16
16
|
github = plugin.repository.url;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
return github;
|
|
19
|
+
return github ?? null;
|
|
20
20
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Orchestrator } from "node-pluginsmanager-plugin";
|
|
2
|
-
export default function initSortedPlugins(plugins: Orchestrator[], orderedPluginsNames: string[], emit: (eventName: string, ...subdata:
|
|
2
|
+
export default function initSortedPlugins(plugins: Orchestrator[], orderedPluginsNames: string[], emit: (eventName: string, ...subdata: unknown[]) => void, ...data: unknown[]): Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Orchestrator, tLogger } from "node-pluginsmanager-plugin";
|
|
2
|
-
export default function loadSortedPlugins(globalDirectory: string,
|
|
2
|
+
export default function loadSortedPlugins(globalDirectory: string, externalResourcesDirectory: string, files: string[], loadedPlugins: Orchestrator[], orderedPluginsNames: string[], emit: (eventName: string, ...subdata: unknown[]) => void, logger: tLogger | null, ...data: unknown[]): Promise<void>;
|
|
@@ -11,7 +11,7 @@ const node_path_1 = require("node:path");
|
|
|
11
11
|
const createPluginByDirectory_1 = __importDefault(require("./createPluginByDirectory"));
|
|
12
12
|
// private
|
|
13
13
|
// methods
|
|
14
|
-
function _loadPlugin(globalDirectory,
|
|
14
|
+
function _loadPlugin(globalDirectory, externalResourcesDirectory, pluginFileName, loadedPlugins, emit, logger, ...data) {
|
|
15
15
|
// is already loaded ?
|
|
16
16
|
const plugin = loadedPlugins.find((p) => {
|
|
17
17
|
return pluginFileName === p.name;
|
|
@@ -20,7 +20,7 @@ function _loadPlugin(globalDirectory, externalRessourcesDirectory, pluginFileNam
|
|
|
20
20
|
return plugin ? Promise.resolve() : Promise.resolve().then(() => {
|
|
21
21
|
emit("loading", pluginFileName, ...data);
|
|
22
22
|
const directory = (0, node_path_1.join)(globalDirectory, pluginFileName);
|
|
23
|
-
return (0, createPluginByDirectory_1.default)(directory,
|
|
23
|
+
return (0, createPluginByDirectory_1.default)(directory, externalResourcesDirectory, logger, ...data);
|
|
24
24
|
// emit event
|
|
25
25
|
}).then((createdPlugin) => {
|
|
26
26
|
emit("loaded", createdPlugin, ...data);
|
|
@@ -28,16 +28,16 @@ function _loadPlugin(globalDirectory, externalRessourcesDirectory, pluginFileNam
|
|
|
28
28
|
return Promise.resolve();
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
function _loadPlugins(globalDirectory,
|
|
31
|
+
function _loadPlugins(globalDirectory, externalResourcesDirectory, pluginsToLoad, loadedPlugins, emit, logger, i, ...data) {
|
|
32
32
|
return i < pluginsToLoad.length ? Promise.resolve().then(() => {
|
|
33
|
-
return _loadPlugin(globalDirectory,
|
|
33
|
+
return _loadPlugin(globalDirectory, externalResourcesDirectory, pluginsToLoad[i], loadedPlugins, emit, logger, ...data);
|
|
34
34
|
// loop
|
|
35
35
|
}).then(() => {
|
|
36
|
-
return _loadPlugins(globalDirectory,
|
|
36
|
+
return _loadPlugins(globalDirectory, externalResourcesDirectory, pluginsToLoad, loadedPlugins, emit, logger, i + 1, ...data);
|
|
37
37
|
}) : Promise.resolve();
|
|
38
38
|
}
|
|
39
39
|
// module
|
|
40
|
-
function loadSortedPlugins(globalDirectory,
|
|
40
|
+
function loadSortedPlugins(globalDirectory, externalResourcesDirectory, files, loadedPlugins, orderedPluginsNames, emit, logger, ...data) {
|
|
41
41
|
// if no files, does not run
|
|
42
42
|
return !files.length ? Promise.resolve() : Promise.resolve().then(() => {
|
|
43
43
|
const sortedPluginsNames = [];
|
|
@@ -45,13 +45,13 @@ function loadSortedPlugins(globalDirectory, externalRessourcesDirectory, files,
|
|
|
45
45
|
const plugin = files.find((p) => {
|
|
46
46
|
return p === pluginName;
|
|
47
47
|
});
|
|
48
|
-
if (plugin) {
|
|
48
|
+
if ("string" === typeof plugin) {
|
|
49
49
|
sortedPluginsNames.push(pluginName);
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
// first, sorted plugins
|
|
53
53
|
return sortedPluginsNames.length
|
|
54
|
-
? _loadPlugins(globalDirectory,
|
|
54
|
+
? _loadPlugins(globalDirectory, externalResourcesDirectory, sortedPluginsNames, loadedPlugins, emit, logger, 0, ...data)
|
|
55
55
|
: Promise.resolve();
|
|
56
56
|
}).then(() => {
|
|
57
57
|
const unsortedPluginsNames = [
|
|
@@ -71,7 +71,7 @@ function loadSortedPlugins(globalDirectory, externalRessourcesDirectory, files,
|
|
|
71
71
|
];
|
|
72
72
|
// then, all other plugins, asynchronously
|
|
73
73
|
return unsortedPluginsNames.length
|
|
74
|
-
? _loadPlugins(globalDirectory,
|
|
74
|
+
? _loadPlugins(globalDirectory, externalResourcesDirectory, unsortedPluginsNames, loadedPlugins, emit, logger, 0, ...data)
|
|
75
75
|
: Promise.resolve();
|
|
76
76
|
});
|
|
77
77
|
}
|
package/package.json
CHANGED
|
@@ -1,89 +1,95 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
"name": "node-pluginsmanager",
|
|
4
|
-
"version": "
|
|
5
|
-
"description": "A plugins manager",
|
|
6
|
-
|
|
7
|
-
"type": "commonjs",
|
|
8
|
-
"typings": "./lib/cjs/main.d.cts",
|
|
9
|
-
"main": "./lib/cjs/main.cjs",
|
|
10
|
-
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"require": {
|
|
14
|
-
"types": "./lib/cjs/main.d.cts",
|
|
15
|
-
"default": "./lib/cjs/main.cjs"
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
"scripts": {
|
|
21
|
-
|
|
22
|
-
"prepare": "npx husky",
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
1
|
+
{
|
|
2
|
+
|
|
3
|
+
"name": "node-pluginsmanager",
|
|
4
|
+
"version": "3.0.0",
|
|
5
|
+
"description": "A plugins manager.",
|
|
6
|
+
|
|
7
|
+
"type": "commonjs",
|
|
8
|
+
"typings": "./lib/cjs/main.d.cts",
|
|
9
|
+
"main": "./lib/cjs/main.cjs",
|
|
10
|
+
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"require": {
|
|
14
|
+
"types": "./lib/cjs/main.d.cts",
|
|
15
|
+
"default": "./lib/cjs/main.cjs"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
"scripts": {
|
|
21
|
+
|
|
22
|
+
"prepare": "npx husky || true",
|
|
23
|
+
|
|
24
|
+
"lint-back": "npx eslint --config .eslintrc-back.js --ext .ts,.cts,.mts ./lib/src/**/*",
|
|
25
|
+
"lint-tests": "npx eslint --config .eslintrc-tests.js --ext .js,.cjs,.mjs ./test/**/*.js",
|
|
26
|
+
"lint": "npm run lint-back && npm run lint-tests",
|
|
27
|
+
|
|
28
|
+
"clean-back": "npx rimraf ./lib/cjs",
|
|
29
|
+
"clean": "npm run clean-back",
|
|
30
|
+
|
|
31
|
+
"build-back": "npm run clean-back && npx tsc --project ./tsconfig.json",
|
|
32
|
+
"build": "npm run build-back",
|
|
33
|
+
|
|
34
|
+
"check-requires": "npx used-deps-analyzer ./package.json ./lib/src --no-dev",
|
|
35
|
+
"check-updates": "npx check-version-modules",
|
|
36
|
+
"unit-tests": "npm run build && npx nyc --reporter=html --reporter=text mocha",
|
|
37
|
+
|
|
38
|
+
"tests": "npm run lint && npm run check-requires && npm run check-updates && npm run unit-tests"
|
|
39
|
+
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
"files": [
|
|
43
|
+
"/lib/cjs"
|
|
44
|
+
],
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=22.22.0"
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"check-version-modules": "2.2.2"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/express": "5.0.6",
|
|
54
|
+
"@types/node": "25.5.0",
|
|
55
|
+
"@types/socket.io": "3.0.2",
|
|
56
|
+
"@types/ws": "8.18.1",
|
|
57
|
+
"eslint-plugin-personnallinter": "git+ssh://git@github.com/Psychopoulet/eslint-plugin-personnallinter",
|
|
58
|
+
"express": "5.2.1",
|
|
59
|
+
"husky": "9.1.7",
|
|
60
|
+
"mocha": "11.7.5",
|
|
61
|
+
"node-pluginsmanager-plugin": "6.5.0",
|
|
62
|
+
"nyc": "18.0.0",
|
|
63
|
+
"proxyquire": "2.1.3",
|
|
64
|
+
"rimraf": "6.1.3",
|
|
65
|
+
"socket.io": "4.8.3",
|
|
66
|
+
"typescript": "5.9.3",
|
|
67
|
+
"used-deps-analyzer": "0.2.0",
|
|
68
|
+
"ws": "8.19.0"
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
"husky": {
|
|
72
|
+
"hooks": {
|
|
73
|
+
"pre-commit": "npm run lint",
|
|
74
|
+
"pre-push": "npm run unit-tests"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
"keywords": [
|
|
79
|
+
"plugin",
|
|
80
|
+
"manage",
|
|
81
|
+
"gestion"
|
|
82
|
+
],
|
|
83
|
+
"author": "Sébastien VIDAL",
|
|
84
|
+
"license": "ISC",
|
|
85
|
+
|
|
86
|
+
"homepage": "https://github.com/Psychopoulet/node-pluginsmanager#readme",
|
|
87
|
+
"repository": {
|
|
88
|
+
"type": "git",
|
|
89
|
+
"url": "git://github.com/Psychopoulet/node-pluginsmanager.git"
|
|
90
|
+
},
|
|
91
|
+
"bugs": {
|
|
92
|
+
"url": "https://github.com/Psychopoulet/node-pluginsmanager/issues"
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
}
|