@wocker/core
Advanced tools
Comparing version 1.0.11 to 1.0.12
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import * as fs from "fs"; | ||
@@ -3,0 +2,0 @@ type ReaddirOptions = fs.ObjectEncodingOptions & { |
@@ -1,5 +0,1 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { Abortable } from "node:events"; | ||
@@ -6,0 +2,0 @@ import { PathLike, PathOrFileDescriptor, WriteFileOptions, RmOptions, MakeDirectoryOptions } from "fs"; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import fs, { createReadStream, MakeDirectoryOptions, RmOptions } from "fs"; | ||
@@ -3,0 +2,0 @@ import { FileSystem } from "./FileSystem"; |
import { PickProperties, EnvConfig } from "../types"; | ||
export type ProjectProperties = Omit<PickProperties<Project>, "containerName">; | ||
export type ProjectProperties = Omit<PickProperties<Project>, "containerName" | "domains">; | ||
export declare abstract class Project { | ||
@@ -19,2 +19,9 @@ id: string; | ||
get containerName(): string; | ||
get domains(): string[]; | ||
hasDomain(domain: string): boolean; | ||
addDomain(addDomain: string): void; | ||
removeDomain(removeDomain: string): void; | ||
clearDomains(): void; | ||
linkPort(hostPort: number, containerPort: number): void; | ||
unlinkPort(hostPort: number, containerPort: number): void; | ||
hasEnv(name: string): boolean; | ||
@@ -37,1 +44,2 @@ getEnv(name: string, defaultValue?: string): string | undefined; | ||
export declare const PROJECT_TYPE_IMAGE = "image"; | ||
export declare const PROJECT_TYPE_PRESET = "preset"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PROJECT_TYPE_IMAGE = exports.PROJECT_TYPE_DOCKERFILE = exports.Project = void 0; | ||
exports.PROJECT_TYPE_PRESET = exports.PROJECT_TYPE_IMAGE = exports.PROJECT_TYPE_DOCKERFILE = exports.Project = void 0; | ||
const volumeParse_1 = require("../utils/volumeParse"); | ||
@@ -25,2 +25,55 @@ class Project { | ||
} | ||
get domains() { | ||
const host = this.getEnv("VIRTUAL_HOST"); | ||
if (!host) { | ||
return []; | ||
} | ||
return host.split(","); | ||
} | ||
hasDomain(domain) { | ||
return this.domains.includes(domain); | ||
} | ||
addDomain(addDomain) { | ||
let domains = [ | ||
...this.domains.filter((domain) => { | ||
return domain !== addDomain; | ||
}), | ||
addDomain | ||
]; | ||
this.setEnv("VIRTUAL_HOST", domains.join(",")); | ||
} | ||
removeDomain(removeDomain) { | ||
if (!this.hasDomain(removeDomain)) { | ||
return; | ||
} | ||
let domains = this.domains.filter((domain) => { | ||
return domain !== removeDomain; | ||
}); | ||
this.setEnv("VIRTUAL_HOST", domains.join(",")); | ||
} | ||
clearDomains() { | ||
this.unsetEnv("VIRTUAL_HOST"); | ||
} | ||
linkPort(hostPort, containerPort) { | ||
if (!this.ports) { | ||
this.ports = []; | ||
} | ||
this.ports = [ | ||
...this.ports.filter((link) => { | ||
return link !== `${hostPort}:${containerPort}`; | ||
}), | ||
`${hostPort}:${containerPort}` | ||
]; | ||
} | ||
unlinkPort(hostPort, containerPort) { | ||
if (!this.ports) { | ||
return; | ||
} | ||
this.ports = this.ports.filter((link) => { | ||
return link !== `${hostPort}:${containerPort}`; | ||
}); | ||
if (this.ports.length === 0) { | ||
delete this.ports; | ||
} | ||
} | ||
hasEnv(name) { | ||
@@ -131,1 +184,2 @@ if (!this.env) { | ||
exports.PROJECT_TYPE_IMAGE = "image"; | ||
exports.PROJECT_TYPE_PRESET = "preset"; |
@@ -1,3 +0,1 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { Container, ImageInfo } from "dockerode"; | ||
@@ -58,3 +56,3 @@ import { Duplex } from "node:stream"; | ||
abstract pullImage(tag: string): Promise<void>; | ||
abstract attach(name: string): Promise<void>; | ||
abstract attach(name: string | Container): Promise<NodeJS.ReadWriteStream>; | ||
abstract attachStream(stream: NodeJS.ReadWriteStream): Promise<void>; | ||
@@ -61,0 +59,0 @@ abstract exec(name: string, command?: string[], tty?: boolean): Promise<Duplex>; |
@@ -8,1 +8,2 @@ export * from "./AppConfigService"; | ||
export * from "./ProjectService"; | ||
export * from "./ProxyService"; |
@@ -24,1 +24,2 @@ "use strict"; | ||
__exportStar(require("./ProjectService"), exports); | ||
__exportStar(require("./ProxyService"), exports); |
@@ -1,3 +0,1 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { WriteFileOptions, MakeDirectoryOptions, RmOptions } from "fs"; | ||
@@ -4,0 +2,0 @@ export declare class PluginConfigService { |
{ | ||
"name": "@wocker/core", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"author": "Kris Papercut <krispcut@gmail.com>", | ||
@@ -31,3 +31,3 @@ "description": "Core of wocker", | ||
"path": "^0.12.7", | ||
"reflect-metadata": "^0.2.1" | ||
"reflect-metadata": "^0.2.2" | ||
}, | ||
@@ -39,6 +39,6 @@ "devDependencies": { | ||
"jest": "^29.7.0", | ||
"ts-jest": "^29.1.2", | ||
"ts-jest": "^29.2.4", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.4.5" | ||
"typescript": "^5.5.4" | ||
} | ||
} |
89302
95
2222
Updatedreflect-metadata@^0.2.2