refactor: fix typescript errors
This commit is contained in:
Generated
+665
-369
File diff suppressed because it is too large
Load Diff
+6
-3
@@ -42,9 +42,8 @@
|
||||
"gulp-debian": "^0.1.9",
|
||||
"gulp-gzip": "^1.4.2",
|
||||
"gulp-rename": "^2.1.0",
|
||||
"gulp-spawn": "^0.4.0",
|
||||
"gulp-tar": "^3.0.0",
|
||||
"gulp-zip": "^5.0.0",
|
||||
"gulp-tar": "^5.0.0",
|
||||
"gulp-zip": "^6.1.0",
|
||||
"lodash.defaults": "^4.2.0",
|
||||
"lodash.template": "^4.4.0",
|
||||
"plugin-error": "^1.0.1",
|
||||
@@ -60,10 +59,14 @@
|
||||
"devDependencies": {
|
||||
"@types/async": "^3.2.26",
|
||||
"@types/cli-progress": "^3.11.6",
|
||||
"@types/dateformat": "^5.0.3",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/gulp": "^4.0.18",
|
||||
"@types/gulp-connect": "^5.0.10",
|
||||
"@types/gulp-gzip": "^0.0.36",
|
||||
"@types/gulp-rename": "^2.0.7",
|
||||
"@types/gulp-tar": "^4.0.1",
|
||||
"@types/gulp-zip": "^4.0.4",
|
||||
"@types/lodash.template": "^4.5.3",
|
||||
"@types/node": "^26.6.5",
|
||||
"@types/tail": "^2.2.3",
|
||||
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
declare module "gulp-clean" {
|
||||
import type { WritableStream } from "stream";
|
||||
|
||||
export interface Options {
|
||||
force?: boolean;
|
||||
}
|
||||
|
||||
export default (options?: Options) => WritableStream;
|
||||
}
|
||||
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
declare module "gulp-debian" {
|
||||
import type { WritableStream } from "stream";
|
||||
|
||||
export interface Options {
|
||||
package: string;
|
||||
version: string;
|
||||
section: string;
|
||||
priority: string;
|
||||
architecture: string;
|
||||
maintainer?: string;
|
||||
description?: string;
|
||||
preinst?: string[];
|
||||
postinst?: string[];
|
||||
prerm?: string[];
|
||||
postrm?: string[];
|
||||
conffiles?: string;
|
||||
changelog?: {
|
||||
version: string;
|
||||
distribution: string;
|
||||
urgency: string;
|
||||
date: Date;
|
||||
changes: string[];
|
||||
}[];
|
||||
_target?: string;
|
||||
_out?: string;
|
||||
_copyright?: string;
|
||||
_clean?: boolean;
|
||||
_verbose?: boolean;
|
||||
}
|
||||
|
||||
export default (options: Options) => WritableStream;
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import fse from "fs-extra";
|
||||
import got from "got";
|
||||
import path from "path";
|
||||
import ps from "promise-streams";
|
||||
import type Stream from "stream";
|
||||
import type { Stream, Writable } from "stream";
|
||||
import * as tar from "tar";
|
||||
import unzip from "unzip-stream";
|
||||
|
||||
@@ -75,7 +75,7 @@ export class Downloader {
|
||||
}
|
||||
});
|
||||
} else if (url.endsWith("tar.gz")) {
|
||||
stream = stream.pipe(tar.x({ C: dest, strip }));
|
||||
stream = stream.pipe(tar.x({ C: dest, strip }) as unknown as Writable);
|
||||
} else {
|
||||
stream = stream.pipe(fs.createWriteStream(path.join(dest, url.split("/").pop()!)));
|
||||
}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
import { Downloader } from "../common/download";
|
||||
import { Log } from "../common/log";
|
||||
import { Downloader } from "./download";
|
||||
|
||||
export class Sdk {
|
||||
static _dir: string;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// @ts-nocheck
|
||||
import fs from "fs";
|
||||
import gulp from "gulp";
|
||||
import through from "through2";
|
||||
|
||||
+1
-1
@@ -2,11 +2,11 @@ import fs from "fs";
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
import through from "through2";
|
||||
import { Downloader } from "../common/download";
|
||||
import { Env } from "../common/env";
|
||||
import exec from "../common/exec";
|
||||
import { System } from "../common/system";
|
||||
import { HandlerWriter } from "../common/tail";
|
||||
import { Downloader } from "../core/download";
|
||||
import { Sdk } from "../core/sdk";
|
||||
import { Command } from "../run/command";
|
||||
|
||||
|
||||
@@ -59,7 +59,6 @@ export class FlashPlayer extends Sdk {
|
||||
|
||||
get flashPlayerBin(): string {
|
||||
if (System.isWindows) {
|
||||
const v = this.version.split(".");
|
||||
const playerName = `flashplayer_${this.version}_sa${this.debug ? "_debug" : ""}.exe`;
|
||||
return path.join(this.path, playerName);
|
||||
} else if (System.isLinux) {
|
||||
@@ -73,7 +72,7 @@ export class FlashPlayer extends Sdk {
|
||||
|
||||
static get flashPlayerDir(): string {
|
||||
if (os.type() === "Windows_NT") {
|
||||
return path.join(process.env.APPDATA, "Macromedia", "Flash Player");
|
||||
return path.join(process.env.APPDATA!, "Macromedia", "Flash Player");
|
||||
} else if (os.type() === "Linux") {
|
||||
return path.join(os.homedir(), ".macromedia", "Flash_Player");
|
||||
} else {
|
||||
@@ -89,7 +88,7 @@ export class FlashPlayer extends Sdk {
|
||||
const filename = path.join(os.homedir(), "mm.cfg");
|
||||
const value = "TraceOutputFileEnable=1";
|
||||
if (fs.existsSync(filename)) {
|
||||
const data = fs.readFileSync(filename);
|
||||
const data = fs.readFileSync(filename, "utf8");
|
||||
if (data.indexOf(value) === -1) {
|
||||
fs.appendFileSync(filename, `${value}\n`);
|
||||
}
|
||||
@@ -103,7 +102,7 @@ export class FlashPlayer extends Sdk {
|
||||
static trust(value: string) {
|
||||
const filename = path.join(this.flashPlayerDir, "#Security", "FlashPlayerTrust", "gulp.cfg");
|
||||
if (fs.existsSync(filename)) {
|
||||
const data = fs.readFileSync(filename);
|
||||
const data = fs.readFileSync(filename, "utf8");
|
||||
if (data.indexOf(value) === -1) {
|
||||
fs.appendFileSync(filename, `${value}\n`);
|
||||
}
|
||||
|
||||
+7
-3
@@ -115,7 +115,9 @@ export class Haxe extends Sdk {
|
||||
const buildDir = this.resolveBuildDir(config);
|
||||
fse.ensureDirSync(buildDir);
|
||||
|
||||
const projectTemplate = template(fs.readFileSync(path.resolve(import.meta.dirname, "..", "template/project.xml")));
|
||||
const projectTemplate = template(
|
||||
fs.readFileSync(path.resolve(import.meta.dirname, "..", "template/project.xml"), "utf8"),
|
||||
);
|
||||
const project = projectTemplate({ ...config, buildDir: buildDir });
|
||||
fs.writeFileSync(path.resolve(buildDir, "project.xml"), project);
|
||||
|
||||
@@ -145,7 +147,9 @@ export class Haxe extends Sdk {
|
||||
const buildDir = this.resolveBuildDir(config);
|
||||
fse.ensureDirSync(buildDir);
|
||||
|
||||
const projectTemplate = template(fs.readFileSync(path.resolve(import.meta.dirname, "..", "template/project.hxml")));
|
||||
const projectTemplate = template(
|
||||
fs.readFileSync(path.resolve(import.meta.dirname, "..", "template/project.hxml"), "utf8"),
|
||||
);
|
||||
|
||||
const ext =
|
||||
{
|
||||
@@ -180,7 +184,7 @@ export class Haxe extends Sdk {
|
||||
return this.haxe(args).then(() => {
|
||||
let r = vfs.src(`${target}/${result}`, { encoding: false });
|
||||
if (platform === "cpp") {
|
||||
r = r.pipe(rename(config.meta.filename));
|
||||
r = r.pipe(rename(config.meta.filename!));
|
||||
}
|
||||
return r;
|
||||
});
|
||||
|
||||
@@ -43,7 +43,9 @@ export class InnoSetup extends Sdk {
|
||||
|
||||
pack(config: Config, source: string, output: string) {
|
||||
const buildDir = path.join(os.tmpdir(), "build", config.name, "innosetup");
|
||||
const appTemplate = template(fs.readFileSync(path.resolve(import.meta.dirname, "..", "template/windows/app.iss"), "utf8"));
|
||||
const appTemplate = template(
|
||||
fs.readFileSync(path.resolve(import.meta.dirname, "..", "template/windows/app.iss"), "utf8"),
|
||||
);
|
||||
const app = appTemplate({ ...config, buildDir: buildDir, output: output });
|
||||
|
||||
fse.ensureDirSync(buildDir);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
export * from "./common/system";
|
||||
export * from "./core/config";
|
||||
export * from "./core/download";
|
||||
export * from "./common/download";
|
||||
export * from "./core/sdk";
|
||||
export * from "./core/type";
|
||||
export * from "./impl/android";
|
||||
|
||||
@@ -15,7 +15,7 @@ export class FlashHTMLPacker extends Packer {
|
||||
call() {
|
||||
const target = this.targetPath;
|
||||
const indexTemplate = template(
|
||||
fs.readFileSync(path.resolve(import.meta.dirname, "..", "template/flash/index.html")),
|
||||
fs.readFileSync(path.resolve(import.meta.dirname, "..", "template/flash/index.html"), "utf8"),
|
||||
);
|
||||
const index = indexTemplate(this.config);
|
||||
fs.writeFileSync(path.resolve(target, "index.html"), index);
|
||||
|
||||
@@ -2,7 +2,7 @@ import fs from "fs";
|
||||
import fse from "fs-extra";
|
||||
import gulp from "gulp";
|
||||
import deb from "gulp-debian";
|
||||
import template from "lodash.template";
|
||||
import { template } from "lodash";
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
import { Config } from "../../../../core/config";
|
||||
@@ -21,7 +21,7 @@ export class LinuxDEBPacker extends Packer {
|
||||
const buildDir = path.join(os.tmpdir(), "build", this.config.name, "debian");
|
||||
const iconfile = `${this.config.meta.filename}${path.extname(this.config.meta.icon!)}`;
|
||||
const desktopTemplate = template(
|
||||
fs.readFileSync(path.resolve(import.meta.dirname, "..", "template/linux/app.desktop")),
|
||||
fs.readFileSync(path.resolve(import.meta.dirname, "..", "template/linux/app.desktop"), "utf8"),
|
||||
);
|
||||
const desktop = desktopTemplate(Object.assign({ iconfile: iconfile }, this.config));
|
||||
fse.ensureDirSync(`${buildDir}/usr/share/applications`);
|
||||
@@ -30,8 +30,8 @@ export class LinuxDEBPacker extends Packer {
|
||||
fse.copySync(this.config.meta.icon!, `${buildDir}/usr/share/${this.config.meta.filename}/${iconfile}`);
|
||||
return gulp.src(`${buildDir}/*`).pipe(
|
||||
deb({
|
||||
package: this.config.meta.filename,
|
||||
version: this.config.meta.version,
|
||||
package: this.config.meta.filename!,
|
||||
version: this.config.meta.version!,
|
||||
section: "base",
|
||||
priority: "optional",
|
||||
architecture: "all",
|
||||
|
||||
+2
-1
@@ -14,7 +14,8 @@
|
||||
"esModuleInterop": true,
|
||||
"isolatedModules": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"skipLibCheck": true
|
||||
"skipLibCheck": true,
|
||||
"noImplicitThis": false,
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user