@wocker/core
Advanced tools
Comparing version 1.0.21-beta.2 to 1.0.21-beta.3
@@ -34,2 +34,3 @@ import { EnvConfig, PickProperties } from "../types"; | ||
unregisterPreset(name: string): void; | ||
hasMeta(name: string): boolean; | ||
getMeta(name: string): string | undefined; | ||
@@ -36,0 +37,0 @@ getMeta(name: string, defaultValue: string): string; |
@@ -102,2 +102,8 @@ "use strict"; | ||
} | ||
hasMeta(name) { | ||
if (!this.meta) { | ||
return false; | ||
} | ||
return name in this.meta; | ||
} | ||
getMeta(name, defaultValue) { | ||
@@ -104,0 +110,0 @@ if (!this.meta || !(name in this.meta)) { |
@@ -1,2 +0,2 @@ | ||
import fs, { RmOptions, Stats, WriteFileOptions } from "fs"; | ||
import fs, { RmOptions, Stats, WriteFileOptions, MakeDirectoryOptions } from "fs"; | ||
type ReaddirOptions = fs.ObjectEncodingOptions & { | ||
@@ -12,10 +12,10 @@ recursive?: boolean | undefined; | ||
stat(...parts: string[]): Stats; | ||
mkdir(path?: string, options?: fs.MakeDirectoryOptions): void; | ||
mkdir(path?: string, options?: MakeDirectoryOptions): void; | ||
readdir(...parts: string[]): Promise<string[]>; | ||
readdirFiles(path?: string, options?: ReaddirOptions): Promise<string[]>; | ||
readFile(path: string): Buffer<ArrayBufferLike>; | ||
readFile(path: string): Buffer; | ||
readJSON(...paths: string[]): any; | ||
writeFile(path: string, data: string | Buffer | NodeJS.ArrayBufferView, options?: fs.WriteFileOptions): Promise<void>; | ||
writeJSON(path: string, data: any, options?: WriteFileOptions): void; | ||
rm(path: string, options?: RmOptions): Promise<void>; | ||
rm(path: string, options?: RmOptions): void; | ||
createWriteStream(path: string, options?: BufferEncoding): fs.WriteStream; | ||
@@ -22,0 +22,0 @@ createReadStream(path: string, options?: BufferEncoding): fs.ReadStream; |
@@ -139,20 +139,4 @@ "use strict"; | ||
rm(path, options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const fullPath = this.path(path); | ||
return new Promise((resolve, reject) => { | ||
const callback = (err) => { | ||
if (err) { | ||
reject(err); | ||
return; | ||
} | ||
resolve(undefined); | ||
}; | ||
if (options) { | ||
fs_1.default.rm(fullPath, options, callback); | ||
} | ||
else { | ||
fs_1.default.rm(fullPath, callback); | ||
} | ||
}); | ||
}); | ||
const fullPath = this.path(path); | ||
fs_1.default.rmdirSync(fullPath, options); | ||
} | ||
@@ -159,0 +143,0 @@ createWriteStream(path, options) { |
@@ -7,2 +7,5 @@ import { Abortable } from "node:events"; | ||
}; | ||
/** | ||
* @deprecated | ||
*/ | ||
export declare class FS { | ||
@@ -9,0 +12,0 @@ static mkdir(path: PathLike, options?: MakeDirectoryOptions): Promise<unknown>; |
@@ -51,2 +51,5 @@ "use strict"; | ||
const Path = __importStar(require("path")); | ||
/** | ||
* @deprecated | ||
*/ | ||
class FS { | ||
@@ -53,0 +56,0 @@ static mkdir(path, options) { |
@@ -1,12 +0,9 @@ | ||
import fs, { createReadStream, MakeDirectoryOptions, RmOptions } from "fs"; | ||
import { FileSystem } from "./FileSystem"; | ||
export declare class FSManager { | ||
readonly source: FileSystem; | ||
readonly destination: FileSystem; | ||
constructor(source: string, destination: string); | ||
import fs, { createReadStream, RmOptions } from "fs"; | ||
import { FileSystemManager } from "./FileSystemManager"; | ||
/** | ||
* @deprecated | ||
*/ | ||
export declare class FSManager extends FileSystemManager { | ||
path(...parts: string[]): string; | ||
mkdir(path: string, options?: MakeDirectoryOptions): Promise<unknown>; | ||
readdir(path: string): Promise<string[]>; | ||
exists(path: string): boolean; | ||
copy(path: string): Promise<void>; | ||
readJSON(path: string): Promise<any>; | ||
@@ -13,0 +10,0 @@ writeJSON(path: string, data: any): Promise<void>; |
@@ -47,25 +47,10 @@ "use strict"; | ||
const fs_1 = __importStar(require("fs")); | ||
const FileSystem_1 = require("./FileSystem"); | ||
class FSManager { | ||
constructor(source, destination) { | ||
this.source = new FileSystem_1.FileSystem(source); | ||
this.destination = new FileSystem_1.FileSystem(destination); | ||
} | ||
const FileSystemManager_1 = require("./FileSystemManager"); | ||
/** | ||
* @deprecated | ||
*/ | ||
class FSManager extends FileSystemManager_1.FileSystemManager { | ||
path(...parts) { | ||
return this.destination.path(...parts); | ||
} | ||
mkdir(path_1) { | ||
return __awaiter(this, arguments, void 0, function* (path, options = {}) { | ||
const fullPath = this.path(path); | ||
return new Promise((resolve, reject) => { | ||
(0, fs_1.mkdir)(fullPath, options, (err) => { | ||
if (err) { | ||
reject(err); | ||
return; | ||
} | ||
resolve(undefined); | ||
}); | ||
}); | ||
}); | ||
} | ||
readdir(path) { | ||
@@ -85,21 +70,2 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
exists(path) { | ||
const fullPath = this.path(path); | ||
return (0, fs_1.existsSync)(fullPath); | ||
} | ||
copy(path) { | ||
const destination = this.path(path); | ||
if ((0, fs_1.existsSync)(destination)) { | ||
return Promise.resolve(); | ||
} | ||
return new Promise((resolve, reject) => { | ||
(0, fs_1.copyFile)(this.source.path(path), destination, (err) => { | ||
if (err) { | ||
reject(err); | ||
return; | ||
} | ||
resolve(undefined); | ||
}); | ||
}); | ||
} | ||
readJSON(path) { | ||
@@ -106,0 +72,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -5,2 +5,3 @@ export * from "./AppConfig"; | ||
export * from "./FileSystem"; | ||
export * from "./FileSystemManager"; | ||
export * from "./FS"; | ||
@@ -7,0 +8,0 @@ export * from "./FSManager"; |
@@ -21,2 +21,3 @@ "use strict"; | ||
__exportStar(require("./FileSystem"), exports); | ||
__exportStar(require("./FileSystemManager"), exports); | ||
__exportStar(require("./FS"), exports); | ||
@@ -23,0 +24,0 @@ __exportStar(require("./FSManager"), exports); |
@@ -12,2 +12,4 @@ import { Container, ImageInfo, VolumeCreateResponse } from "dockerode"; | ||
tty?: boolean; | ||
memory?: number; | ||
memorySwap?: number; | ||
ulimits?: { | ||
@@ -14,0 +16,0 @@ [key: string]: { |
import { WriteFileOptions, MakeDirectoryOptions, RmOptions, WriteStream, ReadStream } from "fs"; | ||
import { AppConfigService } from "./AppConfigService"; | ||
import { FileSystem } from "../makes"; | ||
export declare class PluginConfigService { | ||
protected readonly appConfigService: AppConfigService; | ||
protected readonly pluginDir: string; | ||
protected _fs?: FileSystem; | ||
constructor(pluginDir: string); | ||
constructor(appConfigService: AppConfigService, pluginDir: string); | ||
get fs(): FileSystem; | ||
isVersionGTE(version: string): boolean; | ||
/** @deprecated */ | ||
@@ -9,0 +12,0 @@ dataPath(...parts: string[]): string; |
@@ -25,2 +25,3 @@ "use strict"; | ||
exports.PluginConfigService = void 0; | ||
const AppConfigService_1 = require("./AppConfigService"); | ||
const makes_1 = require("../makes"); | ||
@@ -30,3 +31,4 @@ const decorators_1 = require("../decorators"); | ||
let PluginConfigService = class PluginConfigService { | ||
constructor(pluginDir) { | ||
constructor(appConfigService, pluginDir) { | ||
this.appConfigService = appConfigService; | ||
this.pluginDir = pluginDir; | ||
@@ -46,2 +48,8 @@ } | ||
} | ||
isVersionGTE(version) { | ||
if (!this.appConfigService.isVersionGTE) { | ||
return false; | ||
} | ||
return this.appConfigService.isVersionGTE(version); | ||
} | ||
/** @deprecated */ | ||
@@ -97,4 +105,4 @@ dataPath(...parts) { | ||
(0, decorators_1.Injectable)(), | ||
__param(0, (0, decorators_1.Inject)(env_1.PLUGIN_DIR_KEY)), | ||
__metadata("design:paramtypes", [String]) | ||
__param(1, (0, decorators_1.Inject)(env_1.PLUGIN_DIR_KEY)), | ||
__metadata("design:paramtypes", [AppConfigService_1.AppConfigService, String]) | ||
], PluginConfigService); |
{ | ||
"name": "@wocker/core", | ||
"version": "1.0.21-beta.2", | ||
"version": "1.0.21-beta.3", | ||
"author": "Kris Papercut <krispcut@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "Core of the Wocker", |
106074
2693
4