poku 3.0.1 → 3.0.2-canary.267624e
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/lib/configs/poku.js +1 -1
- package/lib/modules/helpers/create-service.js +4 -4
- package/lib/modules/helpers/get-pids.js +2 -2
- package/lib/modules/helpers/list-files.js +1 -1
- package/lib/services/container.js +8 -8
- package/lib/services/each.d.ts +2 -2
- package/lib/services/each.js +4 -4
- package/lib/services/run-tests.js +1 -1
- package/package.json +1 -1
package/lib/configs/poku.js
CHANGED
|
@@ -111,11 +111,11 @@ const backgroundProcess = (runtime, args, file, options) => new Promise((resolve
|
|
|
111
111
|
catch { }
|
|
112
112
|
});
|
|
113
113
|
/** Starts a file in a background process (useful for servers, APIs, etc.) */
|
|
114
|
-
const startService =
|
|
114
|
+
const startService = (file, options) => {
|
|
115
115
|
const runtimeOptions = (0, get_runner_js_1.runner)(file);
|
|
116
116
|
const runtime = runtimeOptions.shift();
|
|
117
117
|
const runtimeArgs = [...runtimeOptions, file];
|
|
118
|
-
return
|
|
118
|
+
return backgroundProcess(runtime, runtimeArgs, (0, node_path_1.normalize)((0, list_files_js_1.sanitizePath)(file)), options);
|
|
119
119
|
};
|
|
120
120
|
exports.startService = startService;
|
|
121
121
|
/**
|
|
@@ -126,12 +126,12 @@ exports.startService = startService;
|
|
|
126
126
|
*
|
|
127
127
|
* By default it uses **npm**, but you can costumize it using the `runner` option.
|
|
128
128
|
*/
|
|
129
|
-
const startScript =
|
|
129
|
+
const startScript = (script, options) => {
|
|
130
130
|
const runner = options?.runner ?? 'npm';
|
|
131
131
|
const runtimeOptions = (0, get_runner_js_1.scriptRunner)(runner);
|
|
132
132
|
const runtime = runtimeOptions.shift();
|
|
133
133
|
const runtimeArgs = [...runtimeOptions, script];
|
|
134
|
-
return
|
|
134
|
+
return backgroundProcess(runtime, runtimeArgs, script, {
|
|
135
135
|
...options,
|
|
136
136
|
runner,
|
|
137
137
|
});
|
|
@@ -13,9 +13,9 @@ const getPIDsByPorts = async (port) => {
|
|
|
13
13
|
}));
|
|
14
14
|
return PIDs;
|
|
15
15
|
};
|
|
16
|
-
const getPIDsByRange =
|
|
16
|
+
const getPIDsByRange = (startsAt, endsAt) => {
|
|
17
17
|
const ports = (0, pid_js_1.populateRange)(startsAt, endsAt);
|
|
18
|
-
return
|
|
18
|
+
return (0, exports.getPIDs)(ports);
|
|
19
19
|
};
|
|
20
20
|
/** Returns an array containing the ID of all processes listening to the specified port */
|
|
21
21
|
exports.getPIDs = Object.assign(getPIDsByPorts, {
|
|
@@ -38,7 +38,7 @@ const getAllFiles = async (dirPath, files = new Set(), configs) => {
|
|
|
38
38
|
isFullPath = true;
|
|
39
39
|
return [(0, exports.sanitizePath)(dirPath)];
|
|
40
40
|
}
|
|
41
|
-
return
|
|
41
|
+
return (0, promises_1.readdir)((0, exports.sanitizePath)(dirPath));
|
|
42
42
|
}
|
|
43
43
|
catch (error) {
|
|
44
44
|
console.error(error);
|
|
@@ -40,7 +40,7 @@ class DockerContainer {
|
|
|
40
40
|
args.push('--no-cache');
|
|
41
41
|
await runDockerCommand('docker', [...args, '-t', this.tagName, '-f', this.file, this.context], { cwd: this.cwd }, this.verbose);
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
start() {
|
|
44
44
|
const args = ['run'];
|
|
45
45
|
args.push(this.detach !== false ? '-d' : '--init');
|
|
46
46
|
args.push(...['--name', this.containerName]);
|
|
@@ -50,10 +50,10 @@ class DockerContainer {
|
|
|
50
50
|
args.push(...['-e', environment]);
|
|
51
51
|
if (this.envFile)
|
|
52
52
|
args.push(...['--env-file', this.envFile]);
|
|
53
|
-
return
|
|
53
|
+
return runDockerCommand('docker', [...args, this.tagName], { cwd: this.cwd }, this.verbose);
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
return
|
|
55
|
+
stop() {
|
|
56
|
+
return runDockerCommand('docker', ['stop', this.containerName], { cwd: this.cwd }, this.verbose);
|
|
57
57
|
}
|
|
58
58
|
async remove() {
|
|
59
59
|
await runDockerCommand('docker', ['rm', '-f', this.containerName], { cwd: this.cwd }, this.verbose);
|
|
@@ -73,7 +73,7 @@ class DockerCompose {
|
|
|
73
73
|
this.cwd = cwd ? (0, list_files_js_1.sanitizePath)(cwd) : undefined;
|
|
74
74
|
this.verbose = verbose;
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
up() {
|
|
77
77
|
const args = ['compose', '-f', this.file];
|
|
78
78
|
if (this.envFile)
|
|
79
79
|
args.push(...['--env-file', this.envFile]);
|
|
@@ -85,15 +85,15 @@ class DockerCompose {
|
|
|
85
85
|
args.push('--build');
|
|
86
86
|
if (this.serviceName)
|
|
87
87
|
args.push(this.serviceName);
|
|
88
|
-
return
|
|
88
|
+
return runDockerCommand('docker', args, { cwd: this.cwd }, this.verbose);
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
down() {
|
|
91
91
|
const args = ['-f', this.file];
|
|
92
92
|
if (this.envFile)
|
|
93
93
|
args.push(...['--env-file', this.envFile]);
|
|
94
94
|
if (this.projectName)
|
|
95
95
|
args.push(...['-p', this.projectName]);
|
|
96
|
-
return
|
|
96
|
+
return runDockerCommand('docker', ['compose', ...args, 'down'], { cwd: this.cwd }, this.verbose);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
exports.DockerCompose = DockerCompose;
|
package/lib/services/each.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const beforeEach: (fileRelative: string) => Promise<boolean>;
|
|
2
|
-
export declare const afterEach: (fileRelative: string) => Promise<boolean>;
|
|
1
|
+
export declare const beforeEach: (fileRelative: string) => true | Promise<boolean>;
|
|
2
|
+
export declare const afterEach: (fileRelative: string) => true | Promise<boolean>;
|
package/lib/services/each.js
CHANGED
|
@@ -34,15 +34,15 @@ const eachCore = async (type, fileRelative) => {
|
|
|
34
34
|
return false;
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
const beforeEach =
|
|
37
|
+
const beforeEach = (fileRelative) => {
|
|
38
38
|
if (poku_js_1.GLOBAL.configs.beforeEach)
|
|
39
|
-
return
|
|
39
|
+
return eachCore('beforeEach', fileRelative);
|
|
40
40
|
return true;
|
|
41
41
|
};
|
|
42
42
|
exports.beforeEach = beforeEach;
|
|
43
|
-
const afterEach =
|
|
43
|
+
const afterEach = (fileRelative) => {
|
|
44
44
|
if (poku_js_1.GLOBAL.configs.afterEach)
|
|
45
|
-
return
|
|
45
|
+
return eachCore('afterEach', fileRelative);
|
|
46
46
|
return true;
|
|
47
47
|
};
|
|
48
48
|
exports.afterEach = afterEach;
|