@wocker/ws 1.0.1

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.
Files changed (164) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +155 -0
  3. package/bin/ws.js +13 -0
  4. package/lib/App.d.ts +13 -0
  5. package/lib/App.js +52 -0
  6. package/lib/controllers/ImageController.d.ts +8 -0
  7. package/lib/controllers/ImageController.js +29 -0
  8. package/lib/controllers/ProjectController.d.ts +64 -0
  9. package/lib/controllers/ProjectController.js +561 -0
  10. package/lib/controllers/index.d.ts +2 -0
  11. package/lib/controllers/index.js +27 -0
  12. package/lib/env.d.ts +7 -0
  13. package/lib/env.js +24 -0
  14. package/lib/index.d.ts +3 -0
  15. package/lib/index.js +31 -0
  16. package/lib/makes/Controller.d.ts +5 -0
  17. package/lib/makes/Controller.js +12 -0
  18. package/lib/makes/Docker.d.ts +58 -0
  19. package/lib/makes/Docker.js +418 -0
  20. package/lib/makes/FS.d.ts +37 -0
  21. package/lib/makes/FS.js +317 -0
  22. package/lib/makes/LineConvertStream.d.ts +13 -0
  23. package/lib/makes/LineConvertStream.js +45 -0
  24. package/lib/makes/Logger.d.ts +7 -0
  25. package/lib/makes/Logger.js +39 -0
  26. package/lib/makes/Model.d.ts +5 -0
  27. package/lib/makes/Model.js +16 -0
  28. package/lib/makes/MySQL.d.ts +15 -0
  29. package/lib/makes/MySQL.js +31 -0
  30. package/lib/makes/Plugin.d.ts +13 -0
  31. package/lib/makes/Plugin.js +43 -0
  32. package/lib/makes/Repository.d.ts +11 -0
  33. package/lib/makes/Repository.js +25 -0
  34. package/lib/makes/index.d.ts +6 -0
  35. package/lib/makes/index.js +71 -0
  36. package/lib/models/Preset.d.ts +19 -0
  37. package/lib/models/Preset.js +60 -0
  38. package/lib/models/Project.d.ts +38 -0
  39. package/lib/models/Project.js +151 -0
  40. package/lib/models/index.d.ts +2 -0
  41. package/lib/models/index.js +27 -0
  42. package/lib/plugins/LocaltunnelPlugin.d.ts +36 -0
  43. package/lib/plugins/LocaltunnelPlugin.js +273 -0
  44. package/lib/plugins/MaildevPlugin.d.ts +10 -0
  45. package/lib/plugins/MaildevPlugin.js +45 -0
  46. package/lib/plugins/MariadbPlugin.d.ts +25 -0
  47. package/lib/plugins/MariadbPlugin.js +297 -0
  48. package/lib/plugins/MongodbPlugin.d.ts +20 -0
  49. package/lib/plugins/MongodbPlugin.js +271 -0
  50. package/lib/plugins/NgrokPlugin.d.ts +37 -0
  51. package/lib/plugins/NgrokPlugin.js +248 -0
  52. package/lib/plugins/PageKitePlugin.d.ts +31 -0
  53. package/lib/plugins/PageKitePlugin.js +158 -0
  54. package/lib/plugins/PostgresPlugin.d.ts +16 -0
  55. package/lib/plugins/PostgresPlugin.js +94 -0
  56. package/lib/plugins/PresetPlugin.d.ts +19 -0
  57. package/lib/plugins/PresetPlugin.js +164 -0
  58. package/lib/plugins/ProjectPlugin.d.ts +12 -0
  59. package/lib/plugins/ProjectPlugin.js +54 -0
  60. package/lib/plugins/ProxmoxPlugin.d.ts +9 -0
  61. package/lib/plugins/ProxmoxPlugin.js +55 -0
  62. package/lib/plugins/ProxyPlugin.d.ts +33 -0
  63. package/lib/plugins/ProxyPlugin.js +257 -0
  64. package/lib/plugins/RedisPlugin.d.ts +10 -0
  65. package/lib/plugins/RedisPlugin.js +42 -0
  66. package/lib/plugins/ServeoPlugin.d.ts +36 -0
  67. package/lib/plugins/ServeoPlugin.js +260 -0
  68. package/lib/plugins/TestPlugin.d.ts +10 -0
  69. package/lib/plugins/TestPlugin.js +75 -0
  70. package/lib/plugins/index.d.ts +14 -0
  71. package/lib/plugins/index.js +159 -0
  72. package/lib/services/AppConfigService.d.ts +18 -0
  73. package/lib/services/AppConfigService.js +77 -0
  74. package/lib/services/AppEventsService.d.ts +13 -0
  75. package/lib/services/AppEventsService.js +29 -0
  76. package/lib/services/ProjectService.d.ts +13 -0
  77. package/lib/services/ProjectService.js +91 -0
  78. package/lib/services/index.d.ts +3 -0
  79. package/lib/services/index.js +38 -0
  80. package/lib/types/Config.d.ts +11 -0
  81. package/lib/types/Config.js +5 -0
  82. package/lib/types/EnvConfig.d.ts +3 -0
  83. package/lib/types/EnvConfig.js +5 -0
  84. package/lib/types/index.d.ts +2 -0
  85. package/lib/types/index.js +27 -0
  86. package/lib/utils/buildOptions.d.ts +1 -0
  87. package/lib/utils/buildOptions.js +12 -0
  88. package/lib/utils/demuxOutput.d.ts +2 -0
  89. package/lib/utils/demuxOutput.js +25 -0
  90. package/lib/utils/escapeRegExp.d.ts +2 -0
  91. package/lib/utils/escapeRegExp.js +10 -0
  92. package/lib/utils/exec.d.ts +2 -0
  93. package/lib/utils/exec.js +44 -0
  94. package/lib/utils/fetch.d.ts +5 -0
  95. package/lib/utils/fetch.js +37 -0
  96. package/lib/utils/followProgress.d.ts +6 -0
  97. package/lib/utils/followProgress.js +80 -0
  98. package/lib/utils/format-size-units.d.ts +1 -0
  99. package/lib/utils/format-size-units.js +19 -0
  100. package/lib/utils/get-config.d.ts +2 -0
  101. package/lib/utils/get-config.js +20 -0
  102. package/lib/utils/get-cursor-position.d.ts +4 -0
  103. package/lib/utils/get-cursor-position.js +34 -0
  104. package/lib/utils/image-build.d.ts +13 -0
  105. package/lib/utils/image-build.js +34 -0
  106. package/lib/utils/index.d.ts +21 -0
  107. package/lib/utils/index.js +236 -0
  108. package/lib/utils/injectVariables.d.ts +5 -0
  109. package/lib/utils/injectVariables.js +17 -0
  110. package/lib/utils/parse-table.d.ts +2 -0
  111. package/lib/utils/parse-table.js +27 -0
  112. package/lib/utils/promptConfirm.d.ts +6 -0
  113. package/lib/utils/promptConfirm.js +21 -0
  114. package/lib/utils/promptGroup.d.ts +16 -0
  115. package/lib/utils/promptGroup.js +39 -0
  116. package/lib/utils/promptSelect.d.ts +12 -0
  117. package/lib/utils/promptSelect.js +47 -0
  118. package/lib/utils/promptText.d.ts +13 -0
  119. package/lib/utils/promptText.js +53 -0
  120. package/lib/utils/set-config.d.ts +2 -0
  121. package/lib/utils/set-config.js +18 -0
  122. package/lib/utils/spawn.d.ts +2 -0
  123. package/lib/utils/spawn.js +24 -0
  124. package/lib/utils/tty.d.ts +2 -0
  125. package/lib/utils/tty.js +10 -0
  126. package/lib/utils/volumeFormat.d.ts +6 -0
  127. package/lib/utils/volumeFormat.js +15 -0
  128. package/lib/utils/volumeParse.d.ts +2 -0
  129. package/lib/utils/volumeParse.js +16 -0
  130. package/package.json +90 -0
  131. package/plugins/localtunnel/Dockerfile +37 -0
  132. package/plugins/localtunnel/Ubuntu.dockerfile +34 -0
  133. package/plugins/localtunnel/config.json +3 -0
  134. package/plugins/maildev/Dockerfile +5 -0
  135. package/plugins/maildev/config.json +3 -0
  136. package/plugins/mariadb/admin/conf/config.user.inc.php +9 -0
  137. package/plugins/ngrok/Dockerfile +2 -0
  138. package/plugins/pagekite/Dockerfile +3 -0
  139. package/plugins/proxmox/Dockerfile +35 -0
  140. package/plugins/proxy/Dockerfile +7 -0
  141. package/plugins/proxy/config.json +3 -0
  142. package/plugins/serveo/Dockerfile +17 -0
  143. package/presets/apache/.docker/apache2/apache2.conf +230 -0
  144. package/presets/apache/.docker/apache2/mods-available/mpm_prefork.conf +16 -0
  145. package/presets/apache/.docker/apache2/sites-available/000-default.conf.conf +21 -0
  146. package/presets/apache/Dockerfile +110 -0
  147. package/presets/apache/bin/compare-version +3 -0
  148. package/presets/apache/config.json +47 -0
  149. package/presets/go/Dockerfile +19 -0
  150. package/presets/go/config.json +13 -0
  151. package/presets/node/Dockerfile +37 -0
  152. package/presets/node/config.json +36 -0
  153. package/presets/php-apache/Dockerfile +133 -0
  154. package/presets/php-apache/bin/compare-version +3 -0
  155. package/presets/php-apache/config.json +56 -0
  156. package/presets/php-apache/etc/apache2/apache2.conf +230 -0
  157. package/presets/php-apache/etc/apache2/mods-available/mpm_prefork.conf +16 -0
  158. package/presets/php-apache/etc/apache2/sites-available/000-default.conf +21 -0
  159. package/presets/shopify/Dockerfile +160 -0
  160. package/presets/shopify/bin/compare-version +3 -0
  161. package/presets/shopify/config.json +24 -0
  162. package/presets/shopify/etc/apache2/apache2.conf +230 -0
  163. package/presets/shopify/etc/apache2/mods-available/mpm_prefork.conf +16 -0
  164. package/presets/shopify/etc/apache2/sites-available/000-default.conf +21 -0
@@ -0,0 +1,58 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import Dockerode from "dockerode";
4
+ type ContainerRunOptions = {
5
+ name: string;
6
+ image: string;
7
+ restart?: "always";
8
+ projectId?: string;
9
+ tty?: boolean;
10
+ links?: string[];
11
+ env?: {
12
+ [key: string]: string;
13
+ };
14
+ networkMode?: string;
15
+ extraHosts?: any;
16
+ volumes?: string[];
17
+ ports?: string[];
18
+ cmd?: string[];
19
+ };
20
+ type ImageBuildOptions = {
21
+ tag: string;
22
+ buildArgs?: {
23
+ [key: string]: string;
24
+ };
25
+ labels?: {
26
+ [key: string]: string;
27
+ };
28
+ context: string;
29
+ src: string;
30
+ };
31
+ declare class Docker {
32
+ static docker: Dockerode;
33
+ static exec(name: string, args: string[], tty?: boolean): Promise<import("stream").Duplex>;
34
+ static getImage(name: string): Promise<Dockerode.Image>;
35
+ static getContainer(name: any): Promise<Dockerode.Container>;
36
+ static removeContainer(name: string): Promise<void>;
37
+ static getContainerList(options?: {
38
+ name?: string;
39
+ projectId?: string;
40
+ }): Promise<Dockerode.ContainerInfo[]>;
41
+ static attach(name: string): Promise<void>;
42
+ static attachStream(stream: NodeJS.ReadWriteStream): Promise<void>;
43
+ static imageExists(tag: string): Promise<boolean>;
44
+ static imageLs(options?: {
45
+ tag?: string;
46
+ reference?: string;
47
+ labels?: {
48
+ [key: string]: string;
49
+ };
50
+ }): Promise<Dockerode.ImageInfo[]>;
51
+ static imageBuild(options: ImageBuildOptions): Promise<void>;
52
+ static imageBuild2(options: ImageBuildOptions): Promise<NodeJS.ReadableStream>;
53
+ static imageRm(name: string): Promise<void>;
54
+ static pullImage(tag: string): Promise<void>;
55
+ static createContainer(options: ContainerRunOptions): Promise<Dockerode.Container>;
56
+ static containerRun(options: ContainerRunOptions, attach?: boolean): Promise<Dockerode.Container>;
57
+ }
58
+ export { Docker };
@@ -0,0 +1,418 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Docker = void 0;
7
+ var _dockerode = _interopRequireDefault(require("dockerode"));
8
+ var _imageBuild = require("../utils/image-build");
9
+ var _followProgress = require("../utils/followProgress");
10
+ var _FS = require("./FS");
11
+ var _Logger = require("./Logger");
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ const docker = new _dockerode.default({
14
+ socketPath: "/var/run/docker.sock"
15
+ });
16
+ class Docker {
17
+ static docker = docker;
18
+ static async exec(name, args, tty = true) {
19
+ const container = docker.getContainer(name);
20
+ const exec = await container.exec({
21
+ AttachStdin: true,
22
+ AttachStdout: true,
23
+ AttachStderr: tty,
24
+ Tty: tty,
25
+ Cmd: args
26
+ });
27
+ const stream = await exec.start({
28
+ hijack: true,
29
+ stdin: tty,
30
+ Tty: tty
31
+ });
32
+ if (tty) {
33
+ stream.setEncoding("utf-8");
34
+ process.stdin.resume();
35
+ if (process.stdin.setRawMode) {
36
+ process.stdin.setRawMode(true);
37
+ }
38
+ process.stdin.setEncoding("utf-8");
39
+ process.stdin.pipe(stream);
40
+ stream.pipe(process.stdout);
41
+ stream.on("error", err => {
42
+ _Logger.Logger.error(err.message);
43
+ });
44
+ stream.on("end", async () => {
45
+ process.stdin.setRawMode(false);
46
+ });
47
+ stream.on("end", async () => {
48
+ process.exit();
49
+ });
50
+ }
51
+
52
+ // setTimeout(() => {
53
+ // Logger.info("Exit");
54
+ //
55
+ // process.exit();
56
+ // }, 4000);
57
+
58
+ return stream;
59
+ }
60
+ static async getImage(name) {
61
+ // let images = await exec(
62
+ // "docker image ls" +
63
+ // " --filter=reference=\"" + name + "\""
64
+ // ).then((res:any) => {
65
+ // let pos = {
66
+ // 0: "repository",
67
+ // 1: "tag",
68
+ // 2: "imageId",
69
+ // 3: "created",
70
+ // 4: "size"
71
+ // };
72
+ //
73
+ // res = res.stdout.split("\n").filter((line) => {
74
+ // return line.split(new RegExp("\\s\\s+")).filter((item) => {
75
+ // return item !== "";
76
+ // }).length > 0;
77
+ // }).map((line, index) => {
78
+ // if(index === 0) {
79
+ // return null;
80
+ // }
81
+ //
82
+ // let data = line.split(new RegExp("\\s\\s+"));
83
+ //
84
+ // let row = {};
85
+ //
86
+ // for(let i in data) {
87
+ // let name = pos[i];
88
+ //
89
+ // row[name] = data[i];
90
+ // }
91
+ //
92
+ // return row;
93
+ // }).filter((line) => {
94
+ // if(!line) {
95
+ // return false;
96
+ // }
97
+ //
98
+ // return true;
99
+ // });
100
+ //
101
+ // return res;
102
+ // }).catch((err:any) => {
103
+ // console.error(err);
104
+ //
105
+ // return [];
106
+ // });
107
+ //
108
+ // return lodash.get(images, "[0]", null);
109
+
110
+ return docker.getImage(name);
111
+ }
112
+ static async getContainer(name) {
113
+ const containers = await docker.listContainers({
114
+ all: true,
115
+ filters: {
116
+ name: [name]
117
+ }
118
+ });
119
+ const container = containers.find(container => {
120
+ return container.Names.indexOf("/" + name) >= 0;
121
+ });
122
+ if (container) {
123
+ return docker.getContainer(container.Id);
124
+ }
125
+ return null;
126
+ // let res = await utils.exec(
127
+ // "docker container ls" +
128
+ // " --filter=name=\"" + name + "\""
129
+ // );
130
+
131
+ // let containers = utils.parseTable(res.stdout, {
132
+ // 0: "containerId",
133
+ // 1: "image",
134
+ // 2: "command",
135
+ // 3: "created",
136
+ // 4: "status",
137
+ // 5: "ports",
138
+ // 6: "names"
139
+ // });
140
+
141
+ // await new Promise((resolve) => {
142
+ // docker.listContainers({
143
+ // "all": true
144
+ // }, (err, containers) => {
145
+ // console.log(containers);
146
+ //
147
+ // resolve();
148
+ // });
149
+ // });
150
+ }
151
+
152
+ static async removeContainer(name) {
153
+ const container = await Docker.getContainer(name);
154
+ if (!container) {
155
+ return;
156
+ }
157
+ const {
158
+ State: {
159
+ Status
160
+ }
161
+ } = await container.inspect();
162
+ if (Status === "running") {
163
+ try {
164
+ await container.stop();
165
+ } catch (err) {
166
+ _Logger.Logger.error("Docker.removeContainer: ", err.message);
167
+ }
168
+ }
169
+ try {
170
+ await container.remove();
171
+ } catch (err) {
172
+ _Logger.Logger.error("Docker.removeContainer: ", err.message);
173
+ }
174
+ }
175
+ static async getContainerList(options) {
176
+ const {
177
+ name,
178
+ projectId
179
+ } = options || {};
180
+ const filters = {};
181
+ if (name) {
182
+ filters.name = [`/${name}`];
183
+ }
184
+ if (projectId) {
185
+ if (!filters.label) {
186
+ filters.label = [];
187
+ }
188
+ filters.label.push(`projectId=${projectId}`);
189
+ }
190
+ return docker.listContainers({
191
+ all: true,
192
+ filters: JSON.stringify(filters)
193
+ });
194
+ }
195
+ static async attach(name) {
196
+ const container = await Docker.getContainer(name);
197
+ const stream = await container.attach({
198
+ logs: true,
199
+ stream: true,
200
+ hijack: true,
201
+ stdin: true,
202
+ stdout: true,
203
+ stderr: true
204
+ });
205
+ process.stdin.resume();
206
+ process.stdin.setEncoding("utf8");
207
+ process.stdin.setRawMode(true);
208
+ process.stdin.pipe(stream);
209
+ process.stdin.on("data", data => {
210
+ if (data.toString() === "\u0003") {
211
+ process.stdin.setRawMode(false);
212
+ }
213
+ });
214
+ stream.setEncoding("utf8");
215
+ stream.pipe(process.stdout);
216
+ const [width, height] = process.stdout.getWindowSize();
217
+ await container.resize({
218
+ w: width,
219
+ h: height
220
+ });
221
+ stream.on("end", async () => {
222
+ process.exit();
223
+ });
224
+ process.stdout.on("resize", () => {
225
+ const [width, height] = process.stdout.getWindowSize();
226
+ container.resize({
227
+ w: width,
228
+ h: height
229
+ });
230
+ });
231
+ }
232
+ static async attachStream(stream) {
233
+ process.stdin.resume();
234
+ process.stdin.setEncoding("utf8");
235
+ process.stdin.pipe(stream);
236
+ if (process.stdin.isTTY) {
237
+ process.stdin.setRawMode(true);
238
+ }
239
+ stream.setEncoding("utf8");
240
+ stream.pipe(process.stdout);
241
+ const end = () => {
242
+ process.stdin.pause();
243
+ process.stdin.unpipe(stream);
244
+ if (process.stdin.isTTY) {
245
+ process.stdin.setRawMode(false);
246
+ }
247
+ stream.unpipe(process.stdout);
248
+ };
249
+ await new Promise((resolve, reject) => {
250
+ stream.on("end", end);
251
+ stream.on("error", end);
252
+ stream.on("end", resolve);
253
+ stream.on("error", reject);
254
+ });
255
+ }
256
+ static async imageExists(tag) {
257
+ const image = docker.getImage(tag);
258
+ try {
259
+ await image.inspect();
260
+ return true;
261
+ } catch (ignore) {
262
+ return false;
263
+ }
264
+ }
265
+ static async imageLs(options) {
266
+ const {
267
+ tag,
268
+ reference,
269
+ labels
270
+ } = options || {};
271
+ const filters = {};
272
+ if (reference) {
273
+ filters.reference = [...(filters.reference || []), reference];
274
+ }
275
+ if (tag) {
276
+ filters.reference = [...(filters.reference || []), tag];
277
+ }
278
+ if (labels) {
279
+ filters.label = [];
280
+ for (const i in labels) {
281
+ filters.label.push(`${i}=${labels[i]}`);
282
+ }
283
+ }
284
+ return docker.listImages({
285
+ filters: JSON.stringify(filters)
286
+ });
287
+ }
288
+ static async imageBuild(options) {
289
+ // await docker.buildImage({
290
+ // context:
291
+ // });
292
+
293
+ await (0, _imageBuild.imageBuild)(options);
294
+ }
295
+ static async imageBuild2(options) {
296
+ const {
297
+ tag,
298
+ labels = {},
299
+ buildArgs = {},
300
+ context,
301
+ src
302
+ } = options;
303
+ const files = await _FS.FS.readdirFiles(context, {
304
+ recursive: true
305
+ });
306
+ const stream = await docker.buildImage({
307
+ context,
308
+ src: files
309
+ }, {
310
+ t: tag,
311
+ labels,
312
+ dockerfile: src,
313
+ buildargs: buildArgs
314
+ });
315
+ return stream;
316
+ }
317
+ static async imageRm(name) {
318
+ const image = await docker.getImage(name);
319
+ if (!image) {
320
+ return;
321
+ }
322
+ await image.remove();
323
+ }
324
+ static async pullImage(tag) {
325
+ const isExists = await this.imageExists(tag);
326
+ if (isExists) {
327
+ return;
328
+ }
329
+ const stream = await docker.pull(tag, {});
330
+ await (0, _followProgress.followProgress)(stream);
331
+ }
332
+ static async createContainer(options) {
333
+ const {
334
+ name,
335
+ tty,
336
+ image,
337
+ projectId,
338
+ restart,
339
+ extraHosts,
340
+ networkMode,
341
+ links = [],
342
+ env = {},
343
+ volumes = [],
344
+ ports = [],
345
+ cmd = []
346
+ } = options;
347
+ return await docker.createContainer({
348
+ name,
349
+ Image: image,
350
+ Hostname: name,
351
+ Labels: {
352
+ ...(projectId ? {
353
+ projectId
354
+ } : {})
355
+ },
356
+ AttachStdin: true,
357
+ AttachStdout: true,
358
+ AttachStderr: true,
359
+ OpenStdin: true,
360
+ StdinOnce: false,
361
+ Tty: tty,
362
+ Cmd: cmd,
363
+ Env: Object.keys(env).map(key => {
364
+ const value = env[key];
365
+ return `${key}=${value}`;
366
+ }),
367
+ ExposedPorts: ports.reduce((res, value) => {
368
+ const [,, containerPort] = /(\d+):(\d+)/.exec(value) || [];
369
+ if (containerPort) {
370
+ res[`${containerPort}/tcp`] = {};
371
+ }
372
+ return res;
373
+ }, {}),
374
+ HostConfig: {
375
+ NetworkMode: networkMode,
376
+ ExtraHosts: extraHosts,
377
+ ...(restart ? {
378
+ RestartPolicy: {
379
+ Name: restart
380
+ }
381
+ } : {}),
382
+ Binds: volumes,
383
+ PortBindings: ports.reduce((res, value) => {
384
+ const [, hostPort, containerPort] = /(\d+):(\d+)/.exec(value) || [];
385
+ if (hostPort && containerPort) {
386
+ res[`${containerPort}/tcp`] = [{
387
+ HostPort: hostPort
388
+ }];
389
+ }
390
+ return res;
391
+ }, {})
392
+ },
393
+ NetworkingConfig: {
394
+ EndpointsConfig: networkMode === "host" ? {} : {
395
+ workspace: {
396
+ Links: links
397
+ }
398
+ }
399
+ }
400
+ });
401
+ }
402
+ static async containerRun(options, attach = false) {
403
+ const container = await Docker.createContainer(options);
404
+ if (attach) {
405
+ const stdout = await container.attach({
406
+ // logs: true,
407
+ stream: true,
408
+ stdin: true,
409
+ stdout: true,
410
+ stderr: true
411
+ });
412
+ stdout.pipe(process.stdout);
413
+ }
414
+ await container.start();
415
+ return container;
416
+ }
417
+ }
418
+ exports.Docker = Docker;
@@ -0,0 +1,37 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ import * as fs from "fs";
5
+ import { Stats, BigIntStats, PathLike, PathOrFileDescriptor, WriteFileOptions, MakeDirectoryOptions, RmOptions } from "fs";
6
+ import { PassThrough } from "readable-stream";
7
+ type ReaddirFilesOptions = {
8
+ recursive?: boolean;
9
+ };
10
+ declare class FS {
11
+ static access(path: PathLike): Promise<any>;
12
+ static exists(path: PathLike): Promise<boolean>;
13
+ static existsSync(path: PathLike): boolean;
14
+ static mkdir(dirPath: string, options?: MakeDirectoryOptions): Promise<void>;
15
+ static mkdirSync(path: any, options?: MakeDirectoryOptions): string;
16
+ static readdir(path: PathLike): Promise<string[]>;
17
+ static readdirFiles(path: string, options?: ReaddirFilesOptions): Promise<string[]>;
18
+ static appendFile(path: PathOrFileDescriptor, data: any, options?: WriteFileOptions): Promise<unknown>;
19
+ static appendFileSync(path: PathOrFileDescriptor, data: any, options?: WriteFileOptions): void;
20
+ static read(): void;
21
+ static readBytes(filePath: PathLike, position?: number | bigint, size?: number | bigint): Promise<Buffer>;
22
+ static readFile(filePath: PathLike | number): Promise<Buffer>;
23
+ static readFileSync(filePath: PathLike): Buffer;
24
+ static writeFile(filePath: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options?: WriteFileOptions): Promise<void>;
25
+ static writeFileSync(path: PathLike, data: any, options?: WriteFileOptions): void;
26
+ static createWriteStream(path: PathLike): fs.WriteStream;
27
+ static readJSON(filePath: PathLike | number): Promise<any>;
28
+ static writeJSON(filePath: PathLike | number, data: any): Promise<void>;
29
+ static unlink(filePath: PathLike): Promise<void>;
30
+ static watch(filename: PathLike, options?: any): fs.FSWatcher;
31
+ static stat(filename: PathLike, options?: Parameters<typeof fs.stat>[1]): Promise<Stats | BigIntStats>;
32
+ static createReadStream(path: PathLike, options?: Parameters<typeof fs.createReadStream>[1]): fs.ReadStream;
33
+ static createReadLinesStream(path: PathLike, count?: number): PassThrough;
34
+ static copyFile(src: PathLike, dest: PathLike): Promise<void>;
35
+ static rm(path: PathLike, options?: RmOptions): Promise<unknown>;
36
+ }
37
+ export { FS };