@wocker/ws 1.0.11 → 1.0.12
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/controllers/ProjectController.d.ts +1 -1
- package/lib/controllers/ProjectController.js +19 -11
- package/lib/controllers/ProxyController.js +6 -6
- package/lib/makes/FS.d.ts +0 -2
- package/lib/makes/LineConvertStream.d.ts +0 -2
- package/lib/makes/index.d.ts +0 -1
- package/lib/makes/index.js +0 -1
- package/lib/services/DockerService.d.ts +0 -2
- package/lib/services/ProjectService.d.ts +3 -2
- package/lib/services/ProjectService.js +15 -4
- package/lib/utils/exec.d.ts +0 -1
- package/lib/utils/followProgress.d.ts +0 -5
- package/package.json +3 -4
- package/lib/makes/Preset.d.ts +0 -45
- package/lib/makes/Preset.js +0 -44
|
@@ -10,7 +10,7 @@ export declare class ProjectController {
|
|
|
10
10
|
getScriptNames(): Promise<string[]>;
|
|
11
11
|
init(name: string, type: string, preset: string): Promise<void>;
|
|
12
12
|
projectList(all: boolean): Promise<string>;
|
|
13
|
-
start(name?: string, detach?: boolean, rebuild?: boolean, restart?: boolean): Promise<void>;
|
|
13
|
+
start(name?: string, detach?: boolean, attach?: boolean, rebuild?: boolean, restart?: boolean): Promise<void>;
|
|
14
14
|
stop(name: string): Promise<void>;
|
|
15
15
|
run(name: string, script: string): Promise<void>;
|
|
16
16
|
attach(name?: string): Promise<void>;
|
|
@@ -155,17 +155,19 @@ let ProjectController = class ProjectController {
|
|
|
155
155
|
}
|
|
156
156
|
return table.toString();
|
|
157
157
|
}
|
|
158
|
-
async start(name, detach, rebuild, restart) {
|
|
158
|
+
async start(name, detach, attach, rebuild, restart) {
|
|
159
159
|
if (name) {
|
|
160
160
|
await this.projectService.cdProject(name);
|
|
161
161
|
}
|
|
162
162
|
const project = await this.projectService.get();
|
|
163
163
|
if (rebuild) {
|
|
164
|
-
await this.projectService.
|
|
165
|
-
await this.appEventsService.emit("project:rebuild", project);
|
|
164
|
+
await this.projectService.rebuild(project);
|
|
166
165
|
}
|
|
167
|
-
await this.projectService.start(restart);
|
|
168
|
-
if (
|
|
166
|
+
await this.projectService.start(project, restart);
|
|
167
|
+
if (detach) {
|
|
168
|
+
console.info(chalk_1.default.yellow("Warning: Detach option is deprecated"));
|
|
169
|
+
}
|
|
170
|
+
if (attach) {
|
|
169
171
|
const project = await this.projectService.get();
|
|
170
172
|
const containerName = project.containerName;
|
|
171
173
|
const container = await this.dockerService.getContainer(containerName);
|
|
@@ -180,7 +182,8 @@ let ProjectController = class ProjectController {
|
|
|
180
182
|
if (name) {
|
|
181
183
|
await this.projectService.cdProject(name);
|
|
182
184
|
}
|
|
183
|
-
await this.projectService.
|
|
185
|
+
const project = await this.projectService.get();
|
|
186
|
+
await this.projectService.stop(project);
|
|
184
187
|
}
|
|
185
188
|
async run(name, script) {
|
|
186
189
|
if (name) {
|
|
@@ -275,7 +278,7 @@ let ProjectController = class ProjectController {
|
|
|
275
278
|
const project = await this.projectService.get();
|
|
276
279
|
const container = await this.dockerService.getContainer(project.containerName);
|
|
277
280
|
if (container) {
|
|
278
|
-
await this.projectService.start(true);
|
|
281
|
+
await this.projectService.start(project, true);
|
|
279
282
|
}
|
|
280
283
|
}
|
|
281
284
|
}
|
|
@@ -300,7 +303,7 @@ let ProjectController = class ProjectController {
|
|
|
300
303
|
const project = await this.projectService.get();
|
|
301
304
|
const container = await this.dockerService.getContainer(project.containerName);
|
|
302
305
|
if (container) {
|
|
303
|
-
await this.projectService.start(true);
|
|
306
|
+
await this.projectService.start(project, true);
|
|
304
307
|
}
|
|
305
308
|
}
|
|
306
309
|
}
|
|
@@ -550,18 +553,23 @@ __decorate([
|
|
|
550
553
|
description: "Detach",
|
|
551
554
|
alias: "d"
|
|
552
555
|
})),
|
|
553
|
-
__param(2, (0, core_1.Option)("
|
|
556
|
+
__param(2, (0, core_1.Option)("attach", {
|
|
557
|
+
type: "boolean",
|
|
558
|
+
description: "Attach",
|
|
559
|
+
alias: "a"
|
|
560
|
+
})),
|
|
561
|
+
__param(3, (0, core_1.Option)("build", {
|
|
554
562
|
type: "boolean",
|
|
555
563
|
description: "Build",
|
|
556
564
|
alias: "b"
|
|
557
565
|
})),
|
|
558
|
-
__param(
|
|
566
|
+
__param(4, (0, core_1.Option)("restart", {
|
|
559
567
|
type: "boolean",
|
|
560
568
|
alias: "r",
|
|
561
569
|
description: "Restart"
|
|
562
570
|
})),
|
|
563
571
|
__metadata("design:type", Function),
|
|
564
|
-
__metadata("design:paramtypes", [String, Boolean, Boolean, Boolean]),
|
|
572
|
+
__metadata("design:paramtypes", [String, Boolean, Boolean, Boolean, Boolean]),
|
|
565
573
|
__metadata("design:returntype", Promise)
|
|
566
574
|
], ProjectController.prototype, "start", null);
|
|
567
575
|
__decorate([
|
|
@@ -143,8 +143,8 @@ let ProxyController = class ProxyController {
|
|
|
143
143
|
await project.save();
|
|
144
144
|
const container = await this.dockerService.getContainer(`${project.name}.workspace`);
|
|
145
145
|
if (container) {
|
|
146
|
-
await this.projectService.stop();
|
|
147
|
-
await this.projectService.start();
|
|
146
|
+
await this.projectService.stop(project);
|
|
147
|
+
await this.projectService.start(project);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
async addDomain(name, addDomains) {
|
|
@@ -167,8 +167,8 @@ let ProxyController = class ProxyController {
|
|
|
167
167
|
await project.save();
|
|
168
168
|
const container = await this.dockerService.getContainer(`${project.name}.workspace`);
|
|
169
169
|
if (container) {
|
|
170
|
-
await this.projectService.stop();
|
|
171
|
-
await this.projectService.start();
|
|
170
|
+
await this.projectService.stop(project);
|
|
171
|
+
await this.projectService.start(project);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
async removeDomain(name, removeDomains) {
|
|
@@ -194,8 +194,8 @@ let ProxyController = class ProxyController {
|
|
|
194
194
|
await project.save();
|
|
195
195
|
const container = await this.dockerService.getContainer(`${project.name}.workspace`);
|
|
196
196
|
if (container) {
|
|
197
|
-
await this.projectService.stop();
|
|
198
|
-
await this.projectService.start();
|
|
197
|
+
await this.projectService.stop(project);
|
|
198
|
+
await this.projectService.start(project);
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
async logs() {
|
package/lib/makes/FS.d.ts
CHANGED
package/lib/makes/index.d.ts
CHANGED
package/lib/makes/index.js
CHANGED
|
@@ -15,8 +15,9 @@ declare class ProjectService {
|
|
|
15
15
|
cdProject(name: string): Promise<void>;
|
|
16
16
|
get(): Promise<Project>;
|
|
17
17
|
getContainer(): Promise<import("dockerode").Container>;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
rebuild(project: Project): Promise<void>;
|
|
19
|
+
start(project: Project, restart?: boolean): Promise<void>;
|
|
20
|
+
stop(project: Project): Promise<void>;
|
|
20
21
|
save(project: Project): Promise<void>;
|
|
21
22
|
search(params?: Partial<SearchParams>): Promise<Project[]>;
|
|
22
23
|
searchOne(params?: Partial<SearchParams>): Promise<Project | null>;
|
|
@@ -80,8 +80,20 @@ let ProjectService = class ProjectService {
|
|
|
80
80
|
const project = await this.get();
|
|
81
81
|
return this.dockerService.getContainer(project.containerName);
|
|
82
82
|
}
|
|
83
|
-
async
|
|
84
|
-
|
|
83
|
+
async rebuild(project) {
|
|
84
|
+
await this.stop(project);
|
|
85
|
+
if (project.type === "dockerfile") {
|
|
86
|
+
project.imageName = `project-${project.name}:develop`;
|
|
87
|
+
const images = await this.dockerService.imageLs({
|
|
88
|
+
tag: project.imageName
|
|
89
|
+
});
|
|
90
|
+
if (images.length > 0) {
|
|
91
|
+
await this.dockerService.imageRm(project.imageName);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
await this.appEventsService.emit("project:rebuild", project);
|
|
95
|
+
}
|
|
96
|
+
async start(project, restart) {
|
|
85
97
|
if (project.type === "dockerfile") {
|
|
86
98
|
project.imageName = `project-${project.name}:develop`;
|
|
87
99
|
const images = await this.dockerService.imageLs({
|
|
@@ -126,8 +138,7 @@ let ProjectService = class ProjectService {
|
|
|
126
138
|
}
|
|
127
139
|
await this.appEventsService.emit("project:start", project);
|
|
128
140
|
}
|
|
129
|
-
async stop() {
|
|
130
|
-
const project = await this.get();
|
|
141
|
+
async stop(project) {
|
|
131
142
|
const container = await this.dockerService.getContainer(project.containerName);
|
|
132
143
|
if (!container) {
|
|
133
144
|
return;
|
package/lib/utils/exec.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wocker/ws",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"author": "Kris Papercut <krispcut@gmail.com>",
|
|
5
5
|
"description": "Docker workspace for web projects",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,8 +38,7 @@
|
|
|
38
38
|
"md5": "^2.3.0",
|
|
39
39
|
"os": "^0.1.2",
|
|
40
40
|
"path": "^0.12.7",
|
|
41
|
-
"readable-stream": "^4.1.0"
|
|
42
|
-
"reflect-metadata": "^0.2.1"
|
|
41
|
+
"readable-stream": "^4.1.0"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
44
|
"@types/dockerode": "3.3.23",
|
|
@@ -55,6 +54,6 @@
|
|
|
55
54
|
"eslint-plugin-import": "^2.28.1",
|
|
56
55
|
"eslint-plugin-node": "^11.1.0",
|
|
57
56
|
"eslint-webpack-plugin": "^3.1.0",
|
|
58
|
-
"typescript": "^5.
|
|
57
|
+
"typescript": "^5.5.2"
|
|
59
58
|
}
|
|
60
59
|
}
|
package/lib/makes/Preset.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { EnvConfig } from "@wocker/core";
|
|
2
|
-
import { PresetService, PresetServiceSearchOptions as SearchOptions } from "../services/PresetService";
|
|
3
|
-
type TextOption = {
|
|
4
|
-
type: "string" | "number" | "int";
|
|
5
|
-
message?: string;
|
|
6
|
-
default?: string | number;
|
|
7
|
-
};
|
|
8
|
-
type ConfirmOption = {
|
|
9
|
-
type: "boolean";
|
|
10
|
-
message?: string;
|
|
11
|
-
default?: boolean;
|
|
12
|
-
};
|
|
13
|
-
type SelectOption = {
|
|
14
|
-
type: "select";
|
|
15
|
-
options: string[] | {
|
|
16
|
-
label?: string;
|
|
17
|
-
value: string;
|
|
18
|
-
}[] | {
|
|
19
|
-
[name: string]: string;
|
|
20
|
-
};
|
|
21
|
-
message?: string;
|
|
22
|
-
default?: string;
|
|
23
|
-
};
|
|
24
|
-
type AnyOption = TextOption | ConfirmOption | SelectOption;
|
|
25
|
-
declare class Preset {
|
|
26
|
-
id: string;
|
|
27
|
-
name: string;
|
|
28
|
-
version: string;
|
|
29
|
-
dockerfile?: string;
|
|
30
|
-
buildArgsOptions?: {
|
|
31
|
-
[name: string]: AnyOption;
|
|
32
|
-
};
|
|
33
|
-
envOptions?: {
|
|
34
|
-
[name: string]: AnyOption;
|
|
35
|
-
};
|
|
36
|
-
volumes?: string[];
|
|
37
|
-
volumeOptions?: string[];
|
|
38
|
-
constructor(data: any);
|
|
39
|
-
save(): Promise<void>;
|
|
40
|
-
getImageName(buildArgs?: EnvConfig): string;
|
|
41
|
-
static install(ps: PresetService): void;
|
|
42
|
-
static search(options: SearchOptions): Promise<import("@wocker/core").Preset[]>;
|
|
43
|
-
static searchOne(options: SearchOptions): Promise<import("@wocker/core").Preset>;
|
|
44
|
-
}
|
|
45
|
-
export { Preset };
|
package/lib/makes/Preset.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Preset = void 0;
|
|
4
|
-
let presetService;
|
|
5
|
-
class Preset {
|
|
6
|
-
constructor(data) {
|
|
7
|
-
this.id = data.id;
|
|
8
|
-
this.name = data.name;
|
|
9
|
-
this.version = data.version;
|
|
10
|
-
this.dockerfile = data.dockerfile;
|
|
11
|
-
this.buildArgsOptions = data.buildArgsOptions;
|
|
12
|
-
this.envOptions = data.envOptions;
|
|
13
|
-
this.volumes = data.volumes;
|
|
14
|
-
this.volumeOptions = data.volumeOptions;
|
|
15
|
-
}
|
|
16
|
-
async save() {
|
|
17
|
-
if (!presetService) {
|
|
18
|
-
throw new Error("Dependency is missing");
|
|
19
|
-
}
|
|
20
|
-
return presetService.save(this);
|
|
21
|
-
}
|
|
22
|
-
getImageName(buildArgs) {
|
|
23
|
-
if (!presetService) {
|
|
24
|
-
throw new Error("Dependency is missing");
|
|
25
|
-
}
|
|
26
|
-
return presetService.getImageName(this, buildArgs);
|
|
27
|
-
}
|
|
28
|
-
static install(ps) {
|
|
29
|
-
presetService = ps;
|
|
30
|
-
}
|
|
31
|
-
static search(options) {
|
|
32
|
-
if (!presetService) {
|
|
33
|
-
throw new Error("Dependency is missing");
|
|
34
|
-
}
|
|
35
|
-
return presetService.search(options);
|
|
36
|
-
}
|
|
37
|
-
static searchOne(options) {
|
|
38
|
-
if (!presetService) {
|
|
39
|
-
throw new Error("Dependency is missing");
|
|
40
|
-
}
|
|
41
|
-
return presetService.searchOne(options);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.Preset = Preset;
|