Compare commits
3
Commits
1.2.0
...
e58d63f260
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e58d63f260 | ||
|
|
f45effe571 | ||
|
|
bf9ac8a8bf |
@@ -1,3 +1,4 @@
|
||||
node_modules/
|
||||
target/
|
||||
dist/
|
||||
build/
|
||||
@@ -1,71 +0,0 @@
|
||||
const gulp = require('gulp');
|
||||
const gulpClean = require('gulp-clean');
|
||||
const packageInfo = require('./package.json');
|
||||
const {System, Sdk, Haxe, Project} = require('gulp-haxetool');
|
||||
|
||||
//Sdk.dir = '/opt/sdk';
|
||||
|
||||
exports.clean = function clean() {
|
||||
return gulp.src('target/*', {read: false}).pipe(gulpClean());
|
||||
};
|
||||
|
||||
exports.install = function install() {
|
||||
const haxe = new Haxe();
|
||||
return haxe.prepare().then(() => haxe.install(packageInfo.haxeDependencies));
|
||||
};
|
||||
|
||||
const config = new Project.Config({
|
||||
meta: {
|
||||
title: 'Application',
|
||||
filename: 'app',
|
||||
icon: './resources/icon.jpg',
|
||||
pack: 'com.example',
|
||||
author: 'Anonim <anonim@anonim.com>',
|
||||
company: 'Any company',
|
||||
version: packageInfo.version,
|
||||
},
|
||||
name: 'app',
|
||||
libs: packageInfo.haxeDependencies,
|
||||
sources: ['src'],
|
||||
assets: ['resources'],
|
||||
main: 'Main',
|
||||
});
|
||||
|
||||
const project = new Project(
|
||||
Project.BuildSystem.OPENFL,
|
||||
[
|
||||
Project.Platform.FLASH,
|
||||
Project.Platform.HTML5,
|
||||
Project.Platform.LINUX,
|
||||
Project.Platform.WINDOWS,
|
||||
],
|
||||
config
|
||||
).bind(module);
|
||||
|
||||
|
||||
const defaultSeries = [
|
||||
exports.clean,
|
||||
module.exports['app:flash:build'],
|
||||
module.exports['app:flash:html'],
|
||||
module.exports['app:html5:build'],
|
||||
];
|
||||
|
||||
if (System.isLinux) {
|
||||
defaultSeries.push(
|
||||
module.exports['app:linux:build'],
|
||||
module.exports['app:linux:archive'],
|
||||
module.exports['app:linux:deb'],
|
||||
|
||||
module.exports['app:android:build'],
|
||||
);
|
||||
}
|
||||
|
||||
if (System.isWindows) {
|
||||
defaultSeries.push(
|
||||
module.exports['app:windows:build'],
|
||||
module.exports['app:windows:archive'],
|
||||
module.exports['app:windows:installer'],
|
||||
);
|
||||
}
|
||||
|
||||
module.exports.default = gulp.series(defaultSeries);
|
||||
@@ -0,0 +1,7 @@
|
||||
import gulp from "gulp";
|
||||
import { Preset } from "gulp-haxetool";
|
||||
import presetData from "./haxetool.json" with { type: "json" };
|
||||
import packageInfo from "./package.json" with { type: "json" };
|
||||
|
||||
const preset = new Preset(presetData, null, packageInfo);
|
||||
export default preset.register(gulp);
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"app": {
|
||||
"buildSystem": "openfl",
|
||||
"platforms": ["flash", "html5", "linux", "windows", "android"],
|
||||
"config": {
|
||||
"meta": {
|
||||
"title": "Example",
|
||||
"filename": "example",
|
||||
"icon": "./resources/icon.jpg",
|
||||
"pack": "com.example",
|
||||
"author": "Anonim <anonim@anonim.com>",
|
||||
"company": "Any company",
|
||||
"version": "<%=package.version%>"
|
||||
},
|
||||
"sources": ["src"],
|
||||
"main": "Main"
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+7098
File diff suppressed because it is too large
Load Diff
+17
-12
@@ -1,14 +1,19 @@
|
||||
{
|
||||
"name": "app",
|
||||
"version": "0.0.1",
|
||||
"devDependencies": {
|
||||
"gulp": "^4.0.0",
|
||||
"gulp-clean": "^0.4.0",
|
||||
"gulp-haxetool": "^0.1.0"
|
||||
},
|
||||
"haxeDependencies": {
|
||||
"lime": "7.6.0",
|
||||
"openfl": "8.9.2",
|
||||
"hxcpp": "4.0.19"
|
||||
}
|
||||
"name": "example",
|
||||
"type": "module",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"build": "gulp",
|
||||
"dev": "gulp app:flash:test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp-cli": "^3.1.0",
|
||||
"gulp-haxetool": "^1.2.0"
|
||||
},
|
||||
"haxeDependencies": {
|
||||
"lime": "8.0.0",
|
||||
"openfl": "9.2.0",
|
||||
"hxcpp": "4.2.1"
|
||||
},
|
||||
"haxe": "4.2.5"
|
||||
}
|
||||
|
||||
Generated
+846
-797
File diff suppressed because it is too large
Load Diff
+6
-13
@@ -29,24 +29,21 @@
|
||||
"license": "MIT",
|
||||
"homepage": "https://git.shmyga.ru/InfernalGames/gulp-haxetool#readme",
|
||||
"dependencies": {
|
||||
"ansi-colors": "^1.1.0",
|
||||
"async": "^2.6.0",
|
||||
"ansi-colors": "^4.1.3",
|
||||
"async": "^3.2.6",
|
||||
"cli-progress": "^3.12.0",
|
||||
"dateformat": "^5.0.4",
|
||||
"fancy-log": "^1.3.2",
|
||||
"fs-extra": "^5.0.0",
|
||||
"dateformat": "^5.0.5",
|
||||
"eta": "^4.6.0",
|
||||
"fs-extra": "^11.4.1",
|
||||
"got": "^16.1.0",
|
||||
"gulp": "^5.0.1",
|
||||
"gulp-clean": "^0.4.0",
|
||||
"gulp-connect": "^5.7.0",
|
||||
"gulp-debian": "^0.1.9",
|
||||
"gulp-debian": "^0.3.2",
|
||||
"gulp-gzip": "^1.4.2",
|
||||
"gulp-rename": "^2.1.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",
|
||||
"promise-streams": "^2.1.1",
|
||||
"tail": "^2.2.6",
|
||||
"tar": "^7.5.22",
|
||||
@@ -67,7 +64,6 @@
|
||||
"@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",
|
||||
"@types/tar": "^7.0.87",
|
||||
@@ -77,8 +73,5 @@
|
||||
"prettier": "^3.9.10",
|
||||
"tsdown": "0.22.14",
|
||||
"typescript": "^7.0.2"
|
||||
},
|
||||
"inlinedDependencies": {
|
||||
"lodash": "4.18.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Eta } from "eta";
|
||||
import path from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
export default new Eta({
|
||||
autoFilter: true,
|
||||
filterFunction: (val: unknown): string => (val === null ? "" : String(val)),
|
||||
useWith: true,
|
||||
views: path.join(__dirname, "..", "template"),
|
||||
});
|
||||
+9
-10
@@ -1,13 +1,13 @@
|
||||
import fs from "fs";
|
||||
import fse from "fs-extra";
|
||||
import rename from "gulp-rename";
|
||||
import template from "lodash.template";
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
import vfs from "vinyl-fs";
|
||||
import { Env } from "../common/env";
|
||||
import exec from "../common/exec";
|
||||
import { System } from "../common/system";
|
||||
import template from "../common/template";
|
||||
import type { Config, LibDef } from "../core/config";
|
||||
import { Sdk } from "../core/sdk";
|
||||
import { Neko } from "./neko";
|
||||
@@ -115,10 +115,7 @@ 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"), "utf8"),
|
||||
);
|
||||
const project = projectTemplate({ ...config, buildDir: buildDir });
|
||||
const project = template.render("project.xml", { ...config, buildDir: buildDir });
|
||||
fs.writeFileSync(path.resolve(buildDir, "project.xml"), project);
|
||||
|
||||
const args = ["-cwd", buildDir, "run", "openfl", command, platform];
|
||||
@@ -147,10 +144,6 @@ 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"), "utf8"),
|
||||
);
|
||||
|
||||
const ext =
|
||||
{
|
||||
flash: ".swf",
|
||||
@@ -162,7 +155,13 @@ export class Haxe extends Sdk {
|
||||
flash: "swf",
|
||||
}[platform] || platform;
|
||||
|
||||
const project = projectTemplate({ ...config, buildDir: buildDir, platform: platform, ext: ext, out: out });
|
||||
const project = template.render("project.hxml", {
|
||||
...config,
|
||||
buildDir: buildDir,
|
||||
platform: platform,
|
||||
ext: ext,
|
||||
out: out,
|
||||
});
|
||||
const projectHXML = path.resolve(buildDir, "project.hxml");
|
||||
fs.writeFileSync(projectHXML, project);
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import fs from "fs";
|
||||
import fse from "fs-extra";
|
||||
import template from "lodash.template";
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
import exec from "../common/exec";
|
||||
import template from "../common/template";
|
||||
import type { Config } from "../core/config";
|
||||
import { Sdk } from "../core/sdk";
|
||||
|
||||
@@ -43,10 +43,7 @@ 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 app = appTemplate({ ...config, buildDir: buildDir, output: output });
|
||||
const app = template.render("windows/app.iss", { ...config, buildDir: buildDir, output: output });
|
||||
|
||||
fse.ensureDirSync(buildDir);
|
||||
fse.copySync(`${source}`, `${buildDir}`);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import fs from "fs";
|
||||
import template from "lodash.template";
|
||||
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";
|
||||
@@ -14,10 +14,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"), "utf8"),
|
||||
);
|
||||
const index = indexTemplate(this.config);
|
||||
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();
|
||||
|
||||
@@ -2,9 +2,9 @@ import fs from "fs";
|
||||
import fse from "fs-extra";
|
||||
import gulp from "gulp";
|
||||
import deb from "gulp-debian";
|
||||
import { template } from "lodash";
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
import template from "../../../../common/template";
|
||||
import { Config } from "../../../../core/config";
|
||||
import { Platform } from "../../../../core/type";
|
||||
import { Packer } from "../../../core/packer";
|
||||
@@ -20,10 +20,7 @@ export class LinuxDEBPacker extends Packer {
|
||||
const target = this.targetPath;
|
||||
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"), "utf8"),
|
||||
);
|
||||
const desktop = desktopTemplate(Object.assign({ iconfile: iconfile }, this.config));
|
||||
const desktop = template.render("linux/app.desktop", Object.assign({ iconfile: iconfile }, this.config));
|
||||
fse.ensureDirSync(`${buildDir}/usr/share/applications`);
|
||||
fs.writeFileSync(`${buildDir}/usr/share/applications/${this.config.meta.filename}.desktop`, desktop);
|
||||
fse.copySync(`${target}`, `${buildDir}/usr/share/${this.config.meta.filename}/`);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import dateformat from "dateformat";
|
||||
import gulp from "gulp";
|
||||
import gulpClean from "gulp-clean";
|
||||
import template from "lodash.template";
|
||||
import os from "os";
|
||||
import type { Task } from "undertaker";
|
||||
import { Builder, Project } from ".";
|
||||
import { System } from "../common/system";
|
||||
import { Config, type ConfigParams } from "../core/config";
|
||||
import template from "../common/template";
|
||||
import { Config, type ConfigParams, type SignKey } from "../core/config";
|
||||
import { Sdk } from "../core/sdk";
|
||||
import { Platform } from "../core/type";
|
||||
import { Haxe } from "../impl/haxe";
|
||||
@@ -16,7 +16,7 @@ export interface PresetConfig {
|
||||
BuildDir?: string;
|
||||
Develop?: boolean;
|
||||
UseRuffle?: boolean;
|
||||
Key?: any;
|
||||
Key?: SignKey;
|
||||
}
|
||||
|
||||
export const DEFAULT_CONFIG: PresetConfig = {
|
||||
@@ -44,9 +44,13 @@ export class Preset {
|
||||
}
|
||||
|
||||
private fillPreset(preset: ProjectPreset): ProjectPreset {
|
||||
const configTemplate = template(JSON.stringify(preset));
|
||||
return JSON.parse(
|
||||
configTemplate({ config: this.config, package: this.packageInfo, env: process.env, dateformat: dateformat }),
|
||||
template.renderString(JSON.stringify(preset), {
|
||||
config: this.config,
|
||||
package: this.packageInfo,
|
||||
env: process.env,
|
||||
dateformat: dateformat,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
import colors from "ansi-colors";
|
||||
import cp from "child_process";
|
||||
import { defaults, template } from "lodash";
|
||||
import path from "path";
|
||||
import stream from "stream";
|
||||
import util from "util";
|
||||
import Vinyl from "vinyl";
|
||||
import template from "../common/template";
|
||||
|
||||
export class Command {
|
||||
private command: string;
|
||||
@@ -14,7 +14,7 @@ export class Command {
|
||||
constructor(command: string, options?: any) {
|
||||
this.command = command;
|
||||
this.isWindows = process.platform.lastIndexOf("win") === 0;
|
||||
this.options = defaults(options || {}, {
|
||||
this.options = Object.assign(options || {}, {
|
||||
cwd: process.cwd(),
|
||||
env: process.env,
|
||||
verbosity: options && options.silent ? 1 : 2,
|
||||
@@ -69,7 +69,7 @@ export class Command {
|
||||
// execute the command.
|
||||
// we spawn the command in a subshell, so things like i/o redirection
|
||||
// just work. e.g. `echo hello world >> ./hello.txt` works as expected.
|
||||
const command = template(this.command)({
|
||||
const command = template.renderString(this.command, {
|
||||
file: stdin,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user