25 lines
790 B
TypeScript
25 lines
790 B
TypeScript
import fs from "fs";
|
|
import path from "path";
|
|
import template from "../../../common/template";
|
|
import type { Config } from "../../../core/config";
|
|
import { Platform } from "../../../core/type";
|
|
import { Packer } from "../../core/packer";
|
|
|
|
export class FlashHTMLPacker extends Packer {
|
|
static NAME = "html";
|
|
|
|
constructor(config: Config) {
|
|
super(config, Platform.FLASH);
|
|
}
|
|
|
|
call() {
|
|
const target = this.targetPath;
|
|
const index = template.render("flash/index.html", this.config);
|
|
fs.writeFileSync(path.resolve(target, "index.html"), index);
|
|
fs.copyFileSync(path.resolve(import.meta.dirname, "..", "template/flash/swf.js"), path.resolve(target, "swf.js"));
|
|
return Promise.resolve();
|
|
}
|
|
}
|
|
|
|
Packer.register(Platform.FLASH, FlashHTMLPacker.NAME, FlashHTMLPacker);
|