@wocker/mongodb-plugin 1.0.9 → 1.0.11-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/README.md +6 -0
- package/lib/makes/Config.d.ts +2 -0
- package/lib/makes/Config.js +15 -0
- package/lib/services/MongodbService.js +10 -14
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
###### Docker workspace for web projects
|
|
4
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/@wocker/mongodb-plugin)
|
|
6
|
+
[](https://github.com/kearisp/wocker-mongodb-plugin/actions/workflows/publish-latest.yml)
|
|
7
|
+
[](https://github.com/kearisp/wocker-mongodb-plugin/blob/master/LICENSE)
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/@wocker/mongodb-plugin)
|
|
10
|
+
|
|
5
11
|
## Installation
|
|
6
12
|
|
|
7
13
|
**Note:** It is recommended to install Wocker globally to ensure accessibility from any directory in your terminal.
|
package/lib/makes/Config.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FileSystem } from "@wocker/core";
|
|
1
2
|
import { Database, DatabaseProps } from "./Database";
|
|
2
3
|
export type AdminConfig = {
|
|
3
4
|
enabled: boolean;
|
|
@@ -20,4 +21,5 @@ export declare abstract class Config {
|
|
|
20
21
|
removeDatabase(name: string): void;
|
|
21
22
|
abstract save(): void;
|
|
22
23
|
toObject(): ConfigProps;
|
|
24
|
+
static make(fs: FileSystem): Config;
|
|
23
25
|
}
|
package/lib/makes/Config.js
CHANGED
|
@@ -68,5 +68,20 @@ class Config {
|
|
|
68
68
|
admin: this.admin
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
+
static make(fs) {
|
|
72
|
+
const data = fs.exists("config.json")
|
|
73
|
+
? fs.readJSON("config.json")
|
|
74
|
+
: {};
|
|
75
|
+
return new class extends Config {
|
|
76
|
+
save() {
|
|
77
|
+
if (!fs.exists()) {
|
|
78
|
+
fs.mkdir("", {
|
|
79
|
+
recursive: true
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
fs.writeJSON("config.json", this.toObject());
|
|
83
|
+
}
|
|
84
|
+
}(data);
|
|
85
|
+
}
|
|
71
86
|
}
|
|
72
87
|
exports.Config = Config;
|
|
@@ -38,20 +38,7 @@ let MongodbService = class MongodbService {
|
|
|
38
38
|
}
|
|
39
39
|
get config() {
|
|
40
40
|
if (!this._config) {
|
|
41
|
-
|
|
42
|
-
const data = fs.exists("config.json")
|
|
43
|
-
? fs.readJSON("config.json")
|
|
44
|
-
: {};
|
|
45
|
-
this._config = new class extends Config_1.Config {
|
|
46
|
-
save() {
|
|
47
|
-
if (!fs.exists()) {
|
|
48
|
-
fs.mkdir("", {
|
|
49
|
-
recursive: true
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
fs.writeJSON("config.json", this.toObject());
|
|
53
|
-
}
|
|
54
|
-
}(data);
|
|
41
|
+
this._config = Config_1.Config.make(this.pluginConfigService.fs);
|
|
55
42
|
}
|
|
56
43
|
return this._config;
|
|
57
44
|
}
|
|
@@ -321,6 +308,9 @@ let MongodbService = class MongodbService {
|
|
|
321
308
|
"--archive",
|
|
322
309
|
"--gzip"
|
|
323
310
|
], false);
|
|
311
|
+
if (!stream) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
324
314
|
stream.on("data", (chunk) => {
|
|
325
315
|
fileStream.write((0, utils_1.demuxOutput)(chunk));
|
|
326
316
|
});
|
|
@@ -417,6 +407,9 @@ let MongodbService = class MongodbService {
|
|
|
417
407
|
"--gzip",
|
|
418
408
|
"--archive"
|
|
419
409
|
], false);
|
|
410
|
+
if (!stream) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
420
413
|
yield new Promise((resolve, reject) => {
|
|
421
414
|
file.on("data", (data) => {
|
|
422
415
|
stream.write(data);
|
|
@@ -444,6 +437,9 @@ let MongodbService = class MongodbService {
|
|
|
444
437
|
"--quiet",
|
|
445
438
|
"--eval", "db.getMongo().getDBNames().forEach(function(i){print(i)})"
|
|
446
439
|
], false);
|
|
440
|
+
if (!stream) {
|
|
441
|
+
return [];
|
|
442
|
+
}
|
|
447
443
|
const res = yield new Promise((resolve, reject) => {
|
|
448
444
|
let res = "";
|
|
449
445
|
stream.on("data", (chunk) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wocker/mongodb-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11-beta.0",
|
|
4
4
|
"author": "Kris Papercut <krispcut@gmail.com>",
|
|
5
5
|
"description": "Mongodb plugin for wocker",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@wocker/core": "^1.0.
|
|
29
|
+
"@wocker/core": "^1.0.25",
|
|
30
30
|
"@wocker/utils": "^2.0.3",
|
|
31
31
|
"cli-table3": "^0.6.5",
|
|
32
32
|
"date-fns": "^4.1.0"
|