Compare commits

...
4 Commits
Author SHA1 Message Date
shmyga 7615dbfc48 ci(version): 2.0.4
release / release (push) Failing after 5m38s
test / test (push) Failing after 5m44s
2026-11-01 21:22:45 +03:00
shmyga d079cbaac5 fix(haxe): replace old broken haxelib when haxe preparing
test / test (push) Failing after 5m43s
2026-11-01 18:28:46 +03:00
shmyga b3d1aee9ed fix: replace unzip-stream with unzipper
test / test (push) Failing after 5m35s
2026-11-01 17:26:56 +03:00
shmyga 769127d6f0 fix(template): fix project.hxml template
test / test (push) Failing after 5m38s
2026-11-01 16:19:02 +03:00
6 changed files with 127 additions and 1350 deletions
+88 -1327
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -1,7 +1,7 @@
{ {
"name": "gulp-haxetool", "name": "gulp-haxetool",
"type": "module", "type": "module",
"version": "2.0.3", "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",
+4 -4
View File
@@ -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);
} }
+1
View File
@@ -7,6 +7,7 @@ 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
View File
@@ -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;
+9 -4
View File
@@ -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%>