Compare commits
10
Commits
87fe852f99
..
2.0.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7615dbfc48 | ||
|
|
d079cbaac5 | ||
|
|
b3d1aee9ed | ||
|
|
769127d6f0 | ||
|
|
57f7e88fab | ||
|
|
7f62df2364 | ||
|
|
6622d53167 | ||
|
|
561dd99cba | ||
|
|
bc77380aba | ||
|
|
a20e98d730 |
Generated
+88
-1327
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "gulp-haxetool",
|
"name": "gulp-haxetool",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "2.0.0",
|
"version": "2.0.4",
|
||||||
"description": "HaXe Tool with Gulp",
|
"description": "HaXe Tool with Gulp",
|
||||||
"exports": {
|
"exports": {
|
||||||
"./bin/cli": "./dist/bin/cli.mjs",
|
"./bin/cli": "./dist/bin/cli.mjs",
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
"tar": "^7.5.22",
|
"tar": "^7.5.22",
|
||||||
"through2": "^5.0.12",
|
"through2": "^5.0.12",
|
||||||
"tmp-file": "^2.0.1",
|
"tmp-file": "^2.0.1",
|
||||||
"unzip-stream": "^0.3.4",
|
"unzipper": "^0.12.5",
|
||||||
"vinyl": "^3.0.1",
|
"vinyl": "^3.0.1",
|
||||||
"vinyl-fs": "^4.0.2"
|
"vinyl-fs": "^4.0.2"
|
||||||
},
|
},
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
"@types/tail": "^2.2.3",
|
"@types/tail": "^2.2.3",
|
||||||
"@types/tar": "^7.0.87",
|
"@types/tar": "^7.0.87",
|
||||||
"@types/through2": "^5.0.0",
|
"@types/through2": "^5.0.0",
|
||||||
"@types/unzip-stream": "^0.3.4",
|
"@types/unzipper": "^0.10.11",
|
||||||
"eslint": "^10.13.0",
|
"eslint": "^10.13.0",
|
||||||
"prettier": "^3.9.10",
|
"prettier": "^3.9.10",
|
||||||
"tsdown": "0.22.14",
|
"tsdown": "0.22.14",
|
||||||
|
|||||||
+1
-1
@@ -5,5 +5,5 @@ const __filename = fileURLToPath(import.meta.url);
|
|||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
export default (name: string): string => {
|
export default (name: string): string => {
|
||||||
return path.join(__dirname, "..", "assets", name);
|
return path.join(__dirname, "assets", name);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import fse from "fs-extra";
|
|||||||
import got, { type Progress, type Request } from "got";
|
import got, { type Progress, type Request } from "got";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import ps from "promise-streams";
|
import ps from "promise-streams";
|
||||||
import type { Stream, Writable } from "stream";
|
import { type Stream, type Writable } from "stream";
|
||||||
import { x as tarX } from "tar";
|
import { x as tarX } from "tar";
|
||||||
import unzip from "unzip-stream";
|
import unzipper from "unzipper";
|
||||||
|
|
||||||
export interface DownloadOptions {
|
export interface DownloadOptions {
|
||||||
progress?: boolean;
|
progress?: boolean;
|
||||||
@@ -19,7 +19,7 @@ const DEFAULT_OPTIONS: DownloadOptions = { progress: true, strip: 1, executable:
|
|||||||
type Extractor = (stream: Request, dest: string, options: DownloadOptions) => Stream;
|
type Extractor = (stream: Request, dest: string, options: DownloadOptions) => Stream;
|
||||||
|
|
||||||
const ZIP_EXTRACTOR: Extractor = (stream: Request, dest: string, options: DownloadOptions): Stream => {
|
const ZIP_EXTRACTOR: Extractor = (stream: Request, dest: string, options: DownloadOptions): Stream => {
|
||||||
return stream.pipe(unzip.Parse()).on("entry", (entry: any) => {
|
return stream.pipe(unzipper.Parse()).on("entry", (entry: unzipper.Entry) => {
|
||||||
const filePath = entry.path.split("/").slice(options.strip).join(path.sep);
|
const filePath = entry.path.split("/").slice(options.strip).join(path.sep);
|
||||||
if (filePath.length > 0) {
|
if (filePath.length > 0) {
|
||||||
if (entry.type === "Directory") {
|
if (entry.type === "Directory") {
|
||||||
@@ -94,7 +94,7 @@ const progressBar = new ProgressBar();
|
|||||||
export const download = async (url: string, dest: string, options?: DownloadOptions): Promise<void> => {
|
export const download = async (url: string, dest: string, options?: DownloadOptions): Promise<void> => {
|
||||||
options = { ...DEFAULT_OPTIONS, ...options };
|
options = { ...DEFAULT_OPTIONS, ...options };
|
||||||
fse.ensureDirSync(dest);
|
fse.ensureDirSync(dest);
|
||||||
let stream: Request = got.stream(url);
|
let stream: Request = got.stream(url, { decompress: false });
|
||||||
if (options.progress) {
|
if (options.progress) {
|
||||||
stream = progressBar.handle(stream);
|
stream = progressBar.handle(stream);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ const __dirname = path.dirname(__filename);
|
|||||||
|
|
||||||
export default new Eta({
|
export default new Eta({
|
||||||
autoFilter: true,
|
autoFilter: true,
|
||||||
|
escapeFunction: (val: unknown): string => String(val),
|
||||||
filterFunction: (val: unknown): string => (val === null || val === undefined ? "" : String(val)),
|
filterFunction: (val: unknown): string => (val === null || val === undefined ? "" : String(val)),
|
||||||
useWith: true,
|
useWith: true,
|
||||||
views: path.join(__dirname, "..", "template"),
|
views: path.join(__dirname, "template"),
|
||||||
});
|
});
|
||||||
|
|||||||
+22
-12
@@ -78,26 +78,36 @@ export class Haxe extends Sdk {
|
|||||||
env.addPath(this.path, "LD_LIBRARY_PATH");
|
env.addPath(this.path, "LD_LIBRARY_PATH");
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare() {
|
async replaceHaxelib(version: string): Promise<any> {
|
||||||
return Promise.all([this.neko.prepare(), super.prepare()]).then(() => {
|
const haxe = new Haxe(version);
|
||||||
fs.copyFileSync(
|
await haxe.prepare();
|
||||||
path.resolve(import.meta.dirname, "..", "template/haxe/activate"),
|
fs.copyFileSync(haxe.haxelibBin, this.haxelibBin);
|
||||||
path.resolve(this.path, "activate"),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get link(): string {
|
async prepare(): Promise<any> {
|
||||||
|
await Promise.all([this.neko.prepare(), super.prepare()]);
|
||||||
|
fs.copyFileSync(path.resolve(import.meta.dirname, "template/haxe/activate"), path.resolve(this.path, "activate"));
|
||||||
|
// TODO: old haxelib fail with EOF
|
||||||
|
if (this.intVersion < 430) {
|
||||||
|
await this.replaceHaxelib(Haxe.VERSION_4_3_7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static buildLink(version: string): string {
|
||||||
if (System.isWindows) {
|
if (System.isWindows) {
|
||||||
return `https://github.com/HaxeFoundation/haxe/releases/download/${this.version}/haxe-${this.version}-win.zip`;
|
return `https://github.com/HaxeFoundation/haxe/releases/download/${version}/haxe-${version}-win.zip`;
|
||||||
} else if (System.isLinux) {
|
} else if (System.isLinux) {
|
||||||
let arch = System.archInt;
|
let arch = System.archInt;
|
||||||
return `https://github.com/HaxeFoundation/haxe/releases/download/${this.version}/haxe-${this.version}-linux${arch}.tar.gz`;
|
return `https://github.com/HaxeFoundation/haxe/releases/download/${version}/haxe-${version}-linux${arch}.tar.gz`;
|
||||||
} else {
|
} else {
|
||||||
throw `Unsupported os: ${System.os}`;
|
throw `Unsupported os: ${System.os}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get link(): string {
|
||||||
|
return Haxe.buildLink(this.version);
|
||||||
|
}
|
||||||
|
|
||||||
haxe(args: any) {
|
haxe(args: any) {
|
||||||
this.activate();
|
this.activate();
|
||||||
return exec(".", [this.haxeBin].concat(args).join(" "));
|
return exec(".", [this.haxeBin].concat(args).join(" "));
|
||||||
@@ -179,7 +189,7 @@ export class Haxe extends Sdk {
|
|||||||
args.push("-debug");
|
args.push("-debug");
|
||||||
}
|
}
|
||||||
const target = path.resolve(buildDir, platform, "bin");
|
const target = path.resolve(buildDir, platform, "bin");
|
||||||
if (platform !== "cpp") {
|
if (platform !== Platform.CPP) {
|
||||||
fse.emptyDirSync(target);
|
fse.emptyDirSync(target);
|
||||||
}
|
}
|
||||||
for (const asset of config.assets) {
|
for (const asset of config.assets) {
|
||||||
@@ -193,7 +203,7 @@ export class Haxe extends Sdk {
|
|||||||
)[platform] || "**/*";
|
)[platform] || "**/*";
|
||||||
return this.haxe(args).then(() => {
|
return this.haxe(args).then(() => {
|
||||||
let r = vfs.src(`${target}/${result}`, { encoding: false });
|
let r = vfs.src(`${target}/${result}`, { encoding: false });
|
||||||
if (platform === "cpp") {
|
if (platform === Platform.CPP) {
|
||||||
r = r.pipe(rename(config.meta.filename!));
|
r = r.pipe(rename(config.meta.filename!));
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
+1
-1
@@ -73,7 +73,7 @@ export class Neko extends Sdk {
|
|||||||
prepare() {
|
prepare() {
|
||||||
return Promise.all([super.prepare()]).then(() => {
|
return Promise.all([super.prepare()]).then(() => {
|
||||||
fs.copyFileSync(
|
fs.copyFileSync(
|
||||||
path.resolve(import.meta.dirname, "..", "template/neko/activate"),
|
path.resolve(import.meta.dirname, "template/neko/activate"),
|
||||||
path.resolve(this.path, "activate"),
|
path.resolve(this.path, "activate"),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export class FlashHTMLPacker extends Packer {
|
|||||||
const target = this.targetPath;
|
const target = this.targetPath;
|
||||||
const index = template.render("flash/index.html", this.config);
|
const index = template.render("flash/index.html", this.config);
|
||||||
fs.writeFileSync(path.resolve(target, "index.html"), index);
|
fs.writeFileSync(path.resolve(target, "index.html"), index);
|
||||||
fs.copyFileSync(path.resolve(import.meta.dirname, "..", "template/flash/swf.js"), path.resolve(target, "swf.js"));
|
fs.copyFileSync(path.resolve(import.meta.dirname, "template/flash/swf.js"), path.resolve(target, "swf.js"));
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
<% sources.forEach(function(item) { %>
|
<% sources.forEach(function(item) { %>
|
||||||
-cp "<%=item%>"<% }); %>
|
-cp "<%=item%>"
|
||||||
|
<% }); %>
|
||||||
<% libs.forEach(function(item) { %>
|
<% libs.forEach(function(item) { %>
|
||||||
-lib <%=item.name%>:<%=item.version.split('@').shift()%><% }); %>
|
-lib <%=item.name%>:<%=item.version.split('@').shift()%>
|
||||||
|
|
||||||
|
<% }); %>
|
||||||
<% macros.forEach(function(item) { %>
|
<% macros.forEach(function(item) { %>
|
||||||
--macro "<%=item%>"<% }); %>
|
--macro "<%=item%>"
|
||||||
|
<% }); %>
|
||||||
<% flags.forEach(function(item) { %>
|
<% flags.forEach(function(item) { %>
|
||||||
-D <%=item%><% }); %>
|
-D <%=item%>
|
||||||
|
<% }); %>
|
||||||
|
|
||||||
-main <%=main%>
|
-main <%=main%>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user