refactor(project): refactor project modules
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import type { Config } from "../../core/config";
|
||||
import { Target } from "./target";
|
||||
|
||||
export type PackerFactory = new (config: Config) => Packer;
|
||||
|
||||
export class Packer extends Target {
|
||||
static factory: Record<string, Record<string, PackerFactory>> = {};
|
||||
|
||||
call() {
|
||||
throw "Not Implemented";
|
||||
}
|
||||
|
||||
static register(platform: string, name: string, packer: PackerFactory) {
|
||||
if (!Packer.factory[platform]) Packer.factory[platform] = {};
|
||||
Packer.factory[platform][name] = packer;
|
||||
}
|
||||
|
||||
static new(config: Config, platform: string, name: string): Packer {
|
||||
return new Packer.factory[platform][name](config);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user