2 Commits
Author SHA1 Message Date
shmyga 9e67513897 build(npm): update gulp-haxetool 2026-05-20 00:05:30 +03:00
shmyga e41d461ba6 feat(app): update nginx image source 2026-05-20 00:03:52 +03:00
17 changed files with 13844 additions and 13667 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
PROJECT=puzzlez PROJECT=puzzlez
#VERSION=$(grep -m 1 'version' ./package.json | grep -oP '"version"\s*:\s*"\K\d+\.\d+.\d+') VERSION=$(grep -m 1 'version' ./package.json | grep -oP '"version"\s*:\s*"\K\d+\.\d+.\d+')
SDK_PATH=$HOME/sdk SDK_PATH=$HOME/sdk
PUBLISH_PATH=$HOME/public/$PROJECT PUBLISH_PATH=$HOME/public/$PROJECT
BUILD_PATH=./build BUILD_PATH=./build
@@ -8,7 +8,7 @@ KEY_STORE=<keystore.jks>
KEY_PASS=<passphrase> KEY_PASS=<passphrase>
# publish # publish
PUBLISH_REPO=https://git.shmyga.ru/api/packages/InfernalGames REPO=https://git.shmyga.ru/api/packages/InfernalGames
PUBLISH_USER=<username> PUBLISH_USER=<username>
PUBLISH_PASSWORD=<passphrase> PUBLISH_PASSWORD=<passphrase>
+5 -5
View File
@@ -1,4 +1,4 @@
build/ /build/
target/ target/
src-gen/ src-gen/
out/ out/
@@ -10,8 +10,8 @@ out/
.idea/ .idea/
.ideaDataSources/ .ideaDataSources/
config.json config.json
node_modules /node_modules
log /log
ansible/*.retry /ansible/*.retry
.npmrc .npmrc
.env .env
-23
View File
@@ -1,23 +0,0 @@
modules = ["."]
[presets.docker]
variables.docker_target = "web"
variables.docker_name = "{{ project_name }}-web"
[presets.docker.tasks.build.compose]
priority = 1
variables.sdk_path = "{{ 'SDK_PATH' | env('$HOME/sdk') }}"
variables.publish_path = "{{ 'PUBLISH_PATH' | env('$HOME/public/' + project_name) }}"
variables.build_path = "{{ 'BUILD_PATH' | env('./build') }}"
variables.target_path = "{{ 'TARGET_PATH' | env('./target') }}"
commands = [
"mkdir -p \"{{ sdk_path }}\" \"{{ publish_path }}\" \"{{ build_path }}\" \"{{ target_path }}\" \"src-gen\"",
"docker compose run --rm --user $(id -u):$(id -g) --build --remove-orphans builder",
]
[presets.gitea]
variables.publish_artefacts.debian = "target/app/debian/{{ project_name }}_{{ project_version }}_all.deb"
variables.publish_artefacts.android = "target/app/android/{{ project_name }}_{{ project_version }}.apk"
variables.publish_artefacts.archive_linux = "target/app/archive/{{ project_name }}_{{ project_version }}_linux.tar.gz"
variables.publish_artefacts.archive_win = "target/app/archive/{{ project_name }}_{{ project_version }}_win.zip"
variables.publish_artefacts.installer = "target/app/installer/{{ project_name }}_{{ project_version }}.exe"
+10 -11
View File
@@ -1,10 +1,10 @@
FROM ubuntu:noble AS base FROM ubuntu:noble AS base
RUN apt update && apt install -y \ RUN apt update && apt install -y \
nodejs \ nodejs \
npm \ npm \
openjdk-11-jre \ openjdk-11-jre \
protobuf-compiler \ protobuf-compiler \
jq jq
RUN node -v RUN node -v
RUN npm -v RUN npm -v
@@ -12,17 +12,16 @@ FROM base AS builder
ENV GRADLE_USER_HOME=/sdk/gradle ENV GRADLE_USER_HOME=/sdk/gradle
WORKDIR /app WORKDIR /app
COPY package.json package-lock.json ./ COPY package.json package-lock.json ./
RUN --mount=type=cache,target=/root/.npm \ RUN npm ci
npm ci
COPY gulpfile.js protohx.json ./ COPY gulpfile.js protohx.json ./
COPY tasks ./tasks COPY tasks ./tasks
COPY config.example.json ./config.example.json COPY config.example.json ./config.example.json
RUN --mount=type=secret,id=KEY_STORE \ RUN --mount=type=secret,id=KEY_STORE \
cat /run/secrets/KEY_STORE > ./key.jks cat /run/secrets/KEY_STORE > ./key.jks
RUN --mount=type=secret,id=KEY_PASS,env=KEY_PASS \ RUN --mount=type=secret,id=KEY_PASS,env=KEY_PASS \
jq --arg key_pass "$KEY_PASS" \ jq --arg key_pass "$KEY_PASS" \
'.SdkDir = "/sdk" | .PublishDir = "/app/publish" | .Key.store = "key.jks" | .Key.pass = $key_pass' \ '.SdkDir = "/sdk" | .PublishDir = "/app/publish" | .Key.store = "key.jks" | .Key.pass = $key_pass' \
config.example.json > config.json config.example.json > config.json
COPY src ./src COPY src ./src
COPY dependencies ./dependencies COPY dependencies ./dependencies
VOLUME ["/sdk", "/app/build", "/app/target", "/app/publish", "/app/src-gen"] VOLUME ["/sdk", "/app/build", "/app/target", "/app/publish", "/app/src-gen"]
+11
View File
@@ -0,0 +1,11 @@
[defaults]
hash_behaviour = merge
host_key_checking = False
#callback_whitelist = profile_tasks
display_skipped_hosts = False
stdout_callback = yaml
bin_ansible_callbacks = True
[ssh_connection]
pipelining = True
ssh_args = -o ForwardAgent=yes
+11
View File
@@ -0,0 +1,11 @@
---
- hosts: all
vars:
ansible_user: "{{ deploy_user }}"
roles:
- ansible-deploy
- build
post_tasks:
- include_role:
name: ansible-deploy
tasks_from: complete.yml
+2
View File
@@ -0,0 +1,2 @@
all:
hosts: localhost
+9
View File
@@ -0,0 +1,9 @@
---
project_name: puzzlez
project_user: holop
deploy_user: "{{ project_user }}"
deploy_project: "{{ project_name }}"
deploy_repo_url: "git@bitbucket.org:infernalgames/{{ project_name }}.git"
deploy_repo_version: master
deploy_npm: yes
+4
View File
@@ -0,0 +1,4 @@
all:
hosts: shmyga.ru
vars:
config_src: "/home/holop/puzzlez/config.json"
+5
View File
@@ -0,0 +1,5 @@
---
- name: ansible-deploy
src: git@bitbucket.org:shmyga/ansible-deploy.git
version: master
scm: git
+2
View File
@@ -0,0 +1,2 @@
config_src: "{{ deploy_release_dir }}/config.{{ inventory_hostname }}.json"
config_dest: "{{ deploy_release_dir }}/config.json"
+11
View File
@@ -0,0 +1,11 @@
---
- name: "Copy config"
copy:
src: "{{ config_src }}"
dest: "{{ config_dest }}"
remote_src: true
- name: "Gulp build"
command: "{{ deploy_release_dir }}/node_modules/.bin/gulp default"
args:
chdir: "{{ deploy_release_dir }}"
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"SdkDir": "$HOME/sdk", "SdkDir": "C:\\sdk",
"BuildDir": null, "BuildDir": null,
"PublishDir": "$HOME/public/puzzlez", "PublishDir": "",
"PublishUrl": "https://shmyga.ru/repo/puzzlez", "PublishUrl": "https://shmyga.ru/repo/puzzlez",
"Develop": false, "Develop": false,
"Key": { "Key": {
+12 -5
View File
@@ -4,21 +4,21 @@ const Config = require("./config.json");
const packageInfo = require("./package.json"); const packageInfo = require("./package.json");
const { System, Sdk, Haxe, Project } = require("gulp-haxetool"); const { System, Sdk, Haxe, Project } = require("gulp-haxetool");
const dateformat = require("dateformat"); const dateformat = require("dateformat");
const argv = require("yargs").argv;
const publish = require("./tasks/gulp-publish"); const publish = require("./tasks/gulp-publish");
const os = require("os");
const resolvePath = (path) => path.replace("$HOME", os.homedir()); Project.useRuffle();
if (packageInfo.haxe) { if (packageInfo.haxe) {
Haxe.VERSION = packageInfo.haxe; Haxe.VERSION = packageInfo.haxe;
} }
if (Config.SdkDir) { if (Config.SdkDir) {
Sdk.dir = resolvePath(Config.SdkDir); Sdk.dir = Config.SdkDir;
} }
if (Config.BuildDir) { if (Config.BuildDir) {
Haxe.buildDir = resolvePath(Config.BuildDir); Haxe.buildDir = Config.BuildDir;
} }
exports.clean = function clean() { exports.clean = function clean() {
@@ -66,6 +66,9 @@ const config = new Project.Config({
flags: ["proto_debug"], flags: ["proto_debug"],
}); });
const host = argv.host || "localhost";
const port = argv.port || 5000;
const app = new Project( const app = new Project(
Project.BuildSystem.OPENFL, Project.BuildSystem.OPENFL,
[ [
@@ -90,6 +93,10 @@ const app = new Project(
width: 1280, width: 1280,
height: 768, height: 768,
}, },
macros: [
`CompilationOption.set('host','${host}')`,
`CompilationOption.set('port',${port})`,
],
flags: ["app"], flags: ["app"],
}), }),
).bind(module, gulp); ).bind(module, gulp);
@@ -107,7 +114,7 @@ const server = new Project(
module.exports.publish = publish( module.exports.publish = publish(
packageInfo.name, packageInfo.name,
packageInfo.version, packageInfo.version,
resolvePath(Config.PublishDir), Config.PublishDir,
Config.PublishUrl, Config.PublishUrl,
); );
+13731 -13594
View File
File diff suppressed because it is too large Load Diff
+2 -5
View File
@@ -1,10 +1,7 @@
{ {
"name": "puzzlez", "name": "puzzlez",
"version": "0.6.1", "version": "0.6.1",
"scripts": { "private": true,
"build": "gulp",
"dev": "gulp app:flash:test"
},
"devDependencies": { "devDependencies": {
"dateformat": "^3.0.3", "dateformat": "^3.0.3",
"fs-extra": "^10.0.0", "fs-extra": "^10.0.0",
@@ -12,7 +9,7 @@
"gulp-add": "0.0.2", "gulp-add": "0.0.2",
"gulp-clean": "^0.4.0", "gulp-clean": "^0.4.0",
"gulp-cli": "^2.2.0", "gulp-cli": "^2.2.0",
"gulp-haxetool": "^0.1.9", "gulp-haxetool": "^0.2.1",
"yargs": "^13.2.4" "yargs": "^13.2.4"
}, },
"haxeDependencies": { "haxeDependencies": {
@@ -25,6 +25,7 @@ class NginxImageSource implements ImageSource {
public var id(default, never):String = "nginx"; public var id(default, never):String = "nginx";
private var baseUrl:String; private var baseUrl:String;
private var cache:Map<String, Promise<NginxResponse>> = new Map();
public function new(baseUrl:String) { public function new(baseUrl:String) {
this.baseUrl = baseUrl; this.baseUrl = baseUrl;
@@ -36,31 +37,35 @@ class NginxImageSource implements ImageSource {
public function getPage(page:Page):Promise<DataPage<ImageId>> { public function getPage(page:Page):Promise<DataPage<ImageId>> {
var category = page.filter.get("category"); var category = page.filter.get("category");
return new JsonLoader<NginxResponse>().GET(category != null ? this.baseUrl + category + "/" : this.baseUrl) var url = category != null ? this.baseUrl + category + "/" : this.baseUrl;
.then((response:NginxResponse) -> { if (!this.cache.exists(url)) {
var data:Array<ImageId> = []; this.cache.set(url, new JsonLoader<NginxResponse>().GET(url));
for (item in response) { }
if (item.type == NginxResponseItemType.FILE) { return this.cache.get(url).then((response:NginxResponse) -> {
var itemId = category != null ? category + "@" + item.name : item.name; var data:Array<ImageId> = [];
data.push(new ImageId().setSource(id).setId(itemId)); for (item in response) {
} if (item.type == NginxResponseItemType.FILE) {
var itemId = category != null ? category + "@" + item.name : item.name;
data.push(new ImageId().setSource(id).setId(itemId));
} }
return { }
page: page, data = data.slice(page.index * page.count, (page.index + 1) * page.count);
data: data, return {
total: response.length, page: page,
} data: data,
}); total: response.length,
}
});
} }
public function load(id:String, thumb:Bool = false):Promise<ImageValue> { public function load(id:String, thumb:Bool = false):Promise<ImageValue> {
var url = this.baseUrl + StringTools.replace(id, "@", "/"); var url = this.baseUrl + StringTools.replace(id, "@", "/");
if (thumb) { // TODO: default size by screen width?
var parts = url.split("."); var width = thumb ? 360 : 1920;
var index = parts.length - 2; var parts = url.split(".");
parts[index] = parts[index] + "-thumbnail"; var index = parts.length - 2;
url = parts.join("."); parts[index] = parts[index] + '-w${width}';
} url = parts.join(".");
return Promise.promise(ImageValue.URL(url)); return Promise.promise(ImageValue.URL(url));
} }