@wocker/ws 1.0.7 → 1.0.9
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/bin/ws.js +2 -13
- package/lib/AppModule.d.ts +6 -0
- package/lib/AppModule.js +100 -0
- package/lib/controllers/CompletionController.d.ts +6 -0
- package/lib/controllers/CompletionController.js +32 -0
- package/lib/controllers/DebugController.d.ts +7 -0
- package/lib/controllers/DebugController.js +44 -0
- package/lib/controllers/ImageController.d.ts +5 -8
- package/lib/controllers/ImageController.js +27 -12
- package/lib/controllers/PluginController.d.ts +11 -13
- package/lib/controllers/PluginController.js +93 -54
- package/lib/controllers/PresetController.d.ts +10 -15
- package/lib/controllers/PresetController.js +111 -27
- package/lib/controllers/ProjectController.d.ts +27 -70
- package/lib/controllers/ProjectController.js +357 -306
- package/lib/controllers/ProxyController.d.ts +15 -25
- package/lib/controllers/ProxyController.js +157 -102
- package/lib/controllers/index.d.ts +2 -0
- package/lib/controllers/index.js +2 -0
- package/lib/main.d.ts +3 -0
- package/lib/main.js +30 -0
- package/lib/makes/FS.d.ts +15 -5
- package/lib/makes/FS.js +42 -9
- package/lib/makes/Http.d.ts +18 -0
- package/lib/makes/{Plugin.js → Http.js} +45 -34
- package/lib/makes/Logger.d.ts +2 -2
- package/lib/makes/Logger.js +19 -8
- package/lib/makes/Preset.d.ts +5 -6
- package/lib/makes/Preset.js +19 -8
- package/lib/makes/index.d.ts +1 -6
- package/lib/makes/index.js +1 -6
- package/lib/plugins/ElasticSearchPlugin.d.ts +5 -6
- package/lib/plugins/ElasticSearchPlugin.js +19 -8
- package/lib/plugins/LocaltunnelPlugin.d.ts +8 -8
- package/lib/plugins/LocaltunnelPlugin.js +25 -10
- package/lib/plugins/MaildevPlugin.d.ts +5 -6
- package/lib/plugins/MaildevPlugin.js +21 -8
- package/lib/plugins/MongodbPlugin.d.ts +5 -5
- package/lib/plugins/MongodbPlugin.js +26 -11
- package/lib/plugins/NgrokPlugin.d.ts +7 -6
- package/lib/plugins/NgrokPlugin.js +32 -17
- package/lib/plugins/PageKitePlugin.d.ts +10 -8
- package/lib/plugins/PageKitePlugin.js +36 -20
- package/lib/plugins/ProxmoxPlugin.d.ts +8 -5
- package/lib/plugins/ProxmoxPlugin.js +25 -9
- package/lib/plugins/RedisPlugin.d.ts +4 -6
- package/lib/plugins/RedisPlugin.js +19 -8
- package/lib/plugins/index.d.ts +0 -2
- package/lib/plugins/index.js +0 -2
- package/lib/services/AppConfigService.d.ts +7 -17
- package/lib/services/AppConfigService.js +44 -114
- package/lib/services/AppEventsService.d.ts +1 -2
- package/lib/services/AppEventsService.js +11 -2
- package/lib/services/DockerService.d.ts +9 -39
- package/lib/services/DockerService.js +122 -4
- package/lib/services/LogService.d.ts +3 -5
- package/lib/services/LogService.js +19 -4
- package/lib/services/PluginService.d.ts +11 -9
- package/lib/services/PluginService.js +100 -8
- package/lib/services/PresetService.d.ts +4 -5
- package/lib/services/PresetService.js +26 -5
- package/lib/services/ProjectService.d.ts +9 -6
- package/lib/services/ProjectService.js +72 -37
- package/lib/utils/exec.d.ts +4 -1
- package/lib/utils/exec.js +16 -31
- package/lib/utils/followProgress.js +49 -45
- package/lib/utils/index.d.ts +0 -7
- package/lib/utils/index.js +0 -7
- package/lib/utils/spawn.d.ts +1 -1
- package/lib/utils/spawn.js +20 -12
- package/package.json +5 -7
- package/presets/node/config.json +1 -1
- package/presets/php-apache/Dockerfile +1 -1
- package/presets/php-apache/config.json +2 -1
- package/presets/php-fpm/Dockerfile +1 -1
- package/lib/App.d.ts +0 -16
- package/lib/App.js +0 -107
- package/lib/decorators/Inject.d.ts +0 -1
- package/lib/decorators/Inject.js +0 -8
- package/lib/decorators/Injectable.d.ts +0 -4
- package/lib/decorators/Injectable.js +0 -17
- package/lib/decorators/index.d.ts +0 -1
- package/lib/decorators/index.js +0 -17
- package/lib/index.d.ts +0 -6
- package/lib/index.js +0 -33
- package/lib/makes/Controller.d.ts +0 -5
- package/lib/makes/Controller.js +0 -8
- package/lib/makes/DI.d.ts +0 -7
- package/lib/makes/DI.js +0 -27
- package/lib/makes/Docker.d.ts +0 -58
- package/lib/makes/Docker.js +0 -320
- package/lib/makes/Plugin.d.ts +0 -13
- package/lib/makes/Project.d.ts +0 -45
- package/lib/makes/Project.js +0 -127
- package/lib/makes/Repository.d.ts +0 -11
- package/lib/makes/Repository.js +0 -22
- package/lib/plugins/PostgresPlugin.d.ts +0 -16
- package/lib/plugins/PostgresPlugin.js +0 -121
- package/lib/types/Config.d.ts +0 -12
- package/lib/types/Config.js +0 -2
- package/lib/types/EnvConfig.d.ts +0 -3
- package/lib/types/EnvConfig.js +0 -2
- package/lib/types/index.d.ts +0 -2
- package/lib/types/index.js +0 -18
- package/lib/utils/buildOptions.d.ts +0 -1
- package/lib/utils/buildOptions.js +0 -9
- package/lib/utils/demuxOutput.d.ts +0 -2
- package/lib/utils/demuxOutput.js +0 -19
- package/lib/utils/fetch.d.ts +0 -5
- package/lib/utils/fetch.js +0 -52
- package/lib/utils/get-config.d.ts +0 -2
- package/lib/utils/get-config.js +0 -17
- package/lib/utils/image-build.d.ts +0 -13
- package/lib/utils/image-build.js +0 -46
- package/lib/utils/set-config.d.ts +0 -2
- package/lib/utils/set-config.js +0 -15
- package/lib/utils/tty.d.ts +0 -2
- package/lib/utils/tty.js +0 -6
package/lib/makes/Project.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import "reflect-metadata";
|
|
2
|
-
import { DI } from "../makes/DI";
|
|
3
|
-
import { EnvConfig } from "../types";
|
|
4
|
-
type SearchOptions = {
|
|
5
|
-
id: string;
|
|
6
|
-
name: string;
|
|
7
|
-
path: string;
|
|
8
|
-
};
|
|
9
|
-
declare class Project {
|
|
10
|
-
id: string;
|
|
11
|
-
name: string;
|
|
12
|
-
type: string;
|
|
13
|
-
path: string;
|
|
14
|
-
preset?: string;
|
|
15
|
-
imageName?: string;
|
|
16
|
-
dockerfile?: string;
|
|
17
|
-
scripts?: string[];
|
|
18
|
-
buildArgs?: EnvConfig;
|
|
19
|
-
env: EnvConfig;
|
|
20
|
-
ports?: string[];
|
|
21
|
-
volumes?: string[];
|
|
22
|
-
metadata?: EnvConfig;
|
|
23
|
-
constructor(data: any);
|
|
24
|
-
get containerName(): string;
|
|
25
|
-
hasEnv(name: string): boolean;
|
|
26
|
-
getEnv(name: string, defaultValue?: string): string | undefined;
|
|
27
|
-
setEnv(name: string, value: string | boolean): void;
|
|
28
|
-
unsetEnv(name: string): void;
|
|
29
|
-
hasMeta(name: string): boolean;
|
|
30
|
-
getMeta<D = string | undefined>(name: string, defaultValue?: D): D;
|
|
31
|
-
setMeta(name: string, value: string | boolean): void;
|
|
32
|
-
unsetMeta(name: string): void;
|
|
33
|
-
volumeMount(...volumes: string[]): void;
|
|
34
|
-
getVolumeBySource(source: string): string | undefined;
|
|
35
|
-
getVolumeByDestination(destination: string): string | undefined;
|
|
36
|
-
volumeUnmount(...volumes: string[]): void;
|
|
37
|
-
save(): Promise<void>;
|
|
38
|
-
static install(di: DI): void;
|
|
39
|
-
static fromObject(data: any): Project;
|
|
40
|
-
static search(params?: Partial<SearchOptions>): Promise<Project[]>;
|
|
41
|
-
static searchOne(params: Partial<SearchOptions>): Promise<Project | null>;
|
|
42
|
-
}
|
|
43
|
-
export { Project };
|
|
44
|
-
export declare const PROJECT_TYPE_DOCKERFILE = "dockerfile";
|
|
45
|
-
export declare const PROJECT_TYPE_IMAGE = "image";
|
package/lib/makes/Project.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PROJECT_TYPE_IMAGE = exports.PROJECT_TYPE_DOCKERFILE = exports.Project = void 0;
|
|
4
|
-
require("reflect-metadata");
|
|
5
|
-
const ProjectService_1 = require("../services/ProjectService");
|
|
6
|
-
const volumeParse_1 = require("../utils/volumeParse");
|
|
7
|
-
let projectService;
|
|
8
|
-
class Project {
|
|
9
|
-
constructor(data) {
|
|
10
|
-
this.id = data.id;
|
|
11
|
-
this.name = data.name;
|
|
12
|
-
this.type = data.type;
|
|
13
|
-
this.path = data.path;
|
|
14
|
-
this.preset = data.preset;
|
|
15
|
-
this.dockerfile = data.dockerfile;
|
|
16
|
-
this.imageName = data.imageName;
|
|
17
|
-
this.scripts = data.scripts;
|
|
18
|
-
this.buildArgs = data.buildArgs;
|
|
19
|
-
this.env = data.env || {};
|
|
20
|
-
this.ports = data.ports;
|
|
21
|
-
this.volumes = data.volumes;
|
|
22
|
-
this.metadata = data.metadata;
|
|
23
|
-
}
|
|
24
|
-
get containerName() {
|
|
25
|
-
return `${this.name}.workspace`;
|
|
26
|
-
}
|
|
27
|
-
hasEnv(name) {
|
|
28
|
-
if (!this.env) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
return this.env.hasOwnProperty(name);
|
|
32
|
-
}
|
|
33
|
-
getEnv(name, defaultValue) {
|
|
34
|
-
const { [name]: value = defaultValue } = this.env;
|
|
35
|
-
return value;
|
|
36
|
-
}
|
|
37
|
-
setEnv(name, value) {
|
|
38
|
-
this.env = {
|
|
39
|
-
...this.env,
|
|
40
|
-
[name]: typeof value === "boolean"
|
|
41
|
-
? (value ? "true" : "false")
|
|
42
|
-
: value
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
unsetEnv(name) {
|
|
46
|
-
if (name in this.env) {
|
|
47
|
-
delete this.env[name];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
hasMeta(name) {
|
|
51
|
-
return !!this.metadata && this.metadata.hasOwnProperty(name);
|
|
52
|
-
}
|
|
53
|
-
getMeta(name, defaultValue) {
|
|
54
|
-
const { [name]: value = defaultValue } = this.metadata || {};
|
|
55
|
-
return value;
|
|
56
|
-
}
|
|
57
|
-
setMeta(name, value) {
|
|
58
|
-
if (!this.metadata) {
|
|
59
|
-
this.metadata = {};
|
|
60
|
-
}
|
|
61
|
-
this.metadata[name] = typeof value === "boolean"
|
|
62
|
-
? (value ? "true" : "false")
|
|
63
|
-
: value;
|
|
64
|
-
}
|
|
65
|
-
unsetMeta(name) {
|
|
66
|
-
if (this.metadata && name in this.metadata) {
|
|
67
|
-
delete this.metadata[name];
|
|
68
|
-
}
|
|
69
|
-
if (this.metadata && Object.keys(this.metadata).length === 0) {
|
|
70
|
-
delete this.metadata;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
volumeMount(...volumes) {
|
|
74
|
-
if (volumes.length === 0) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const [volume, ...restVolumes] = volumes;
|
|
78
|
-
const { destination } = (0, volumeParse_1.volumeParse)(volume);
|
|
79
|
-
this.volumes = [
|
|
80
|
-
...(this.volumes || []).filter((v) => {
|
|
81
|
-
return v !== this.getVolumeByDestination(destination);
|
|
82
|
-
}),
|
|
83
|
-
volume
|
|
84
|
-
];
|
|
85
|
-
this.volumeMount(...restVolumes);
|
|
86
|
-
}
|
|
87
|
-
getVolumeBySource(source) {
|
|
88
|
-
return (this.volumes || []).find((volume) => {
|
|
89
|
-
return (0, volumeParse_1.volumeParse)(volume).source === source;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
getVolumeByDestination(destination) {
|
|
93
|
-
return (this.volumes || []).find((volume) => {
|
|
94
|
-
return (0, volumeParse_1.volumeParse)(volume).destination === destination;
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
volumeUnmount(...volumes) {
|
|
98
|
-
this.volumes = (this.volumes || []).filter((mounted) => {
|
|
99
|
-
return !volumes.includes(mounted);
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
async save() {
|
|
103
|
-
if (!projectService) {
|
|
104
|
-
throw new Error("Dependency is missing");
|
|
105
|
-
}
|
|
106
|
-
await projectService.save(this);
|
|
107
|
-
}
|
|
108
|
-
static install(di) {
|
|
109
|
-
projectService = di.resolveService(ProjectService_1.ProjectService);
|
|
110
|
-
}
|
|
111
|
-
static fromObject(data) {
|
|
112
|
-
return new Project(data);
|
|
113
|
-
}
|
|
114
|
-
static async search(params = {}) {
|
|
115
|
-
if (!projectService) {
|
|
116
|
-
throw new Error("Dependency is missing");
|
|
117
|
-
}
|
|
118
|
-
return projectService.search(params);
|
|
119
|
-
}
|
|
120
|
-
static async searchOne(params) {
|
|
121
|
-
const [project] = await Project.search(params);
|
|
122
|
-
return project || null;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
exports.Project = Project;
|
|
126
|
-
exports.PROJECT_TYPE_DOCKERFILE = "dockerfile";
|
|
127
|
-
exports.PROJECT_TYPE_IMAGE = "image";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type Entity = {
|
|
2
|
-
id: number | string;
|
|
3
|
-
};
|
|
4
|
-
export declare class Repository<E extends Entity> {
|
|
5
|
-
create(data: Partial<E>): Promise<E>;
|
|
6
|
-
update(id: E["id"], record: Partial<E>): Promise<E>;
|
|
7
|
-
byId(id: E["id"]): Promise<E>;
|
|
8
|
-
search(params?: any): Promise<E[]>;
|
|
9
|
-
searchOne(params?: any): Promise<E>;
|
|
10
|
-
}
|
|
11
|
-
export {};
|
package/lib/makes/Repository.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Repository = void 0;
|
|
4
|
-
class Repository {
|
|
5
|
-
async create(data) {
|
|
6
|
-
return null;
|
|
7
|
-
}
|
|
8
|
-
async update(id, record) {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
async byId(id) {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
async search(params) {
|
|
15
|
-
return [];
|
|
16
|
-
}
|
|
17
|
-
async searchOne(params) {
|
|
18
|
-
const [item] = await this.search(params);
|
|
19
|
-
return item;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.Repository = Repository;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Cli } from "@kearisp/cli";
|
|
2
|
-
import { Plugin } from "../makes";
|
|
3
|
-
declare class PostgresPlugin extends Plugin {
|
|
4
|
-
protected container: string;
|
|
5
|
-
protected adminContainer: string;
|
|
6
|
-
constructor();
|
|
7
|
-
install(cli: Cli): void;
|
|
8
|
-
start(): Promise<void>;
|
|
9
|
-
protected startDB(): Promise<void>;
|
|
10
|
-
protected startAdmin(): Promise<void>;
|
|
11
|
-
stop(): Promise<void>;
|
|
12
|
-
protected stopDB(): Promise<void>;
|
|
13
|
-
protected stopAdmin(): Promise<void>;
|
|
14
|
-
restart(): Promise<void>;
|
|
15
|
-
}
|
|
16
|
-
export { PostgresPlugin };
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.PostgresPlugin = void 0;
|
|
27
|
-
const Path = __importStar(require("path"));
|
|
28
|
-
const env_1 = require("../env");
|
|
29
|
-
const makes_1 = require("../makes");
|
|
30
|
-
class PostgresPlugin extends makes_1.Plugin {
|
|
31
|
-
constructor() {
|
|
32
|
-
super("postgres");
|
|
33
|
-
this.container = "postgres.workspace";
|
|
34
|
-
this.adminContainer = "dbadmin-postgres.workspace";
|
|
35
|
-
this.dataDir = Path.join(env_1.DATA_DIR, "db/postgres");
|
|
36
|
-
}
|
|
37
|
-
install(cli) {
|
|
38
|
-
super.install(cli);
|
|
39
|
-
cli.command("postgres:start")
|
|
40
|
-
.action(() => this.start());
|
|
41
|
-
cli.command("postgres:stop")
|
|
42
|
-
.action(() => this.stop());
|
|
43
|
-
cli.command("postgres:restart")
|
|
44
|
-
.action(() => this.restart());
|
|
45
|
-
}
|
|
46
|
-
async start() {
|
|
47
|
-
await this.startDB();
|
|
48
|
-
await this.startAdmin();
|
|
49
|
-
}
|
|
50
|
-
async startDB() {
|
|
51
|
-
console.log("Postgres starting...");
|
|
52
|
-
await makes_1.Docker.pullImage("postgres:latest");
|
|
53
|
-
const container = await makes_1.Docker.createContainer({
|
|
54
|
-
name: this.container,
|
|
55
|
-
restart: "always",
|
|
56
|
-
image: "postgres:latest",
|
|
57
|
-
volumes: [
|
|
58
|
-
`${this.dataPath()}:/var/lib/postgresql/data`
|
|
59
|
-
],
|
|
60
|
-
ports: ["5432:5432"],
|
|
61
|
-
env: {
|
|
62
|
-
POSTGRES_USER: "root",
|
|
63
|
-
POSTGRES_PASSWORD: "toor"
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
await container.start();
|
|
67
|
-
}
|
|
68
|
-
async startAdmin() {
|
|
69
|
-
console.log("Postgres Admin starting...");
|
|
70
|
-
await makes_1.Docker.pullImage("dpage/pgadmin4:latest");
|
|
71
|
-
const container = await makes_1.Docker.createContainer({
|
|
72
|
-
name: this.adminContainer,
|
|
73
|
-
restart: "always",
|
|
74
|
-
links: [
|
|
75
|
-
`${this.container}:postgres`
|
|
76
|
-
],
|
|
77
|
-
env: {
|
|
78
|
-
PGADMIN_DEFAULT_EMAIL: "postgres@workspace.com.ua",
|
|
79
|
-
PGADMIN_DEFAULT_PASSWORD: "toor",
|
|
80
|
-
VIRTUAL_HOST: this.adminContainer
|
|
81
|
-
},
|
|
82
|
-
image: "dpage/pgadmin4:latest"
|
|
83
|
-
});
|
|
84
|
-
await container.start();
|
|
85
|
-
}
|
|
86
|
-
async stop() {
|
|
87
|
-
await this.stopDB();
|
|
88
|
-
await this.stopAdmin();
|
|
89
|
-
}
|
|
90
|
-
async stopDB() {
|
|
91
|
-
console.log("Postgres stopping...");
|
|
92
|
-
const container = await makes_1.Docker.getContainer(this.container);
|
|
93
|
-
if (container) {
|
|
94
|
-
try {
|
|
95
|
-
await container.stop();
|
|
96
|
-
await container.remove();
|
|
97
|
-
}
|
|
98
|
-
catch (err) {
|
|
99
|
-
makes_1.Logger.error(err.message);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
async stopAdmin() {
|
|
104
|
-
console.log("Stopping postgres admin...");
|
|
105
|
-
const container = await makes_1.Docker.getContainer(this.adminContainer);
|
|
106
|
-
if (container) {
|
|
107
|
-
try {
|
|
108
|
-
await container.stop();
|
|
109
|
-
await container.remove();
|
|
110
|
-
}
|
|
111
|
-
catch (err) {
|
|
112
|
-
makes_1.Logger.error(err.message);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
async restart() {
|
|
117
|
-
await this.stop();
|
|
118
|
-
await this.start();
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
exports.PostgresPlugin = PostgresPlugin;
|
package/lib/types/Config.d.ts
DELETED
package/lib/types/Config.js
DELETED
package/lib/types/EnvConfig.d.ts
DELETED
package/lib/types/EnvConfig.js
DELETED
package/lib/types/index.d.ts
DELETED
package/lib/types/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Config"), exports);
|
|
18
|
-
__exportStar(require("./EnvConfig"), exports);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const buildOptions: (name: string, options: any) => string;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildOptions = void 0;
|
|
4
|
-
const buildOptions = (name, options) => {
|
|
5
|
-
return Object.keys(options).map((key) => {
|
|
6
|
-
return `--${name} ${key}=${options[key]}`;
|
|
7
|
-
}).join(" ");
|
|
8
|
-
};
|
|
9
|
-
exports.buildOptions = buildOptions;
|
package/lib/utils/demuxOutput.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.demuxOutput = void 0;
|
|
4
|
-
const demuxOutput = (buffer) => {
|
|
5
|
-
let nextDataLength = null, output = Buffer.from([]);
|
|
6
|
-
while (buffer.length > 0) {
|
|
7
|
-
const header = bufferSlice(8);
|
|
8
|
-
nextDataLength = header.readUInt32BE(4);
|
|
9
|
-
const content = bufferSlice(nextDataLength);
|
|
10
|
-
output = Buffer.concat([output, content]);
|
|
11
|
-
}
|
|
12
|
-
function bufferSlice(end) {
|
|
13
|
-
const out = buffer.slice(0, end);
|
|
14
|
-
buffer = Buffer.from(buffer.slice(end, buffer.length));
|
|
15
|
-
return out;
|
|
16
|
-
}
|
|
17
|
-
return output;
|
|
18
|
-
};
|
|
19
|
-
exports.demuxOutput = demuxOutput;
|
package/lib/utils/fetch.d.ts
DELETED
package/lib/utils/fetch.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.fetch = void 0;
|
|
27
|
-
const https = __importStar(require("https"));
|
|
28
|
-
const fetch = async (url, options) => {
|
|
29
|
-
const { method = "GET" } = options || {};
|
|
30
|
-
const target = new URL(url);
|
|
31
|
-
const params = {
|
|
32
|
-
method,
|
|
33
|
-
protocol: target.protocol,
|
|
34
|
-
hostname: target.hostname,
|
|
35
|
-
port: target.port,
|
|
36
|
-
path: target.pathname
|
|
37
|
-
};
|
|
38
|
-
return new Promise((resolve, reject) => {
|
|
39
|
-
const req = https.request(params, (res) => {
|
|
40
|
-
let body = "";
|
|
41
|
-
res.on("data", (data) => {
|
|
42
|
-
body += data;
|
|
43
|
-
});
|
|
44
|
-
res.on("end", () => {
|
|
45
|
-
resolve(body);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
req.on("error", reject);
|
|
49
|
-
req.end();
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
exports.fetch = fetch;
|
package/lib/utils/get-config.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getConfig = void 0;
|
|
4
|
-
const env_1 = require("../env");
|
|
5
|
-
const FS_1 = require("../makes/FS");
|
|
6
|
-
const getConfig = async () => {
|
|
7
|
-
return FS_1.FS.readJSON(env_1.MAP_PATH).catch((err) => {
|
|
8
|
-
if (err.code === "ENOENT") {
|
|
9
|
-
return Promise.resolve({
|
|
10
|
-
env: {},
|
|
11
|
-
projects: []
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
throw err;
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
exports.getConfig = getConfig;
|
package/lib/utils/image-build.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.imageBuild = void 0;
|
|
27
|
-
const Path = __importStar(require("path"));
|
|
28
|
-
const exec_1 = require("./exec");
|
|
29
|
-
const imageBuild = async (options) => {
|
|
30
|
-
const { tag, buildArgs = {}, labels = {}, context, src } = options;
|
|
31
|
-
const buildArgsString = Object.keys(buildArgs).map((key) => {
|
|
32
|
-
return `--build-arg ${key}=${buildArgs[key]}`;
|
|
33
|
-
}).join(" ");
|
|
34
|
-
const labelsString = Object.keys(labels).map((key) => {
|
|
35
|
-
return `--label ${key}=${labels[key]}`;
|
|
36
|
-
}).join(" ");
|
|
37
|
-
await (0, exec_1.exec)(`
|
|
38
|
-
docker build \
|
|
39
|
-
--tag "${tag}" \
|
|
40
|
-
${buildArgsString} \
|
|
41
|
-
${labelsString} \
|
|
42
|
-
--file ${Path.join(context, src)} \
|
|
43
|
-
${context}
|
|
44
|
-
`);
|
|
45
|
-
};
|
|
46
|
-
exports.imageBuild = imageBuild;
|
package/lib/utils/set-config.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setConfig = void 0;
|
|
4
|
-
const env_1 = require("../env");
|
|
5
|
-
const FS_1 = require("../makes/FS");
|
|
6
|
-
const get_config_1 = require("./get-config");
|
|
7
|
-
const setConfig = async (data) => {
|
|
8
|
-
const config = {
|
|
9
|
-
...await (0, get_config_1.getConfig)(),
|
|
10
|
-
...data
|
|
11
|
-
};
|
|
12
|
-
await FS_1.FS.writeJSON(env_1.MAP_PATH, config);
|
|
13
|
-
return config;
|
|
14
|
-
};
|
|
15
|
-
exports.setConfig = setConfig;
|
package/lib/utils/tty.d.ts
DELETED