Add build version
This commit is contained in:
parent
4eaff4e6b9
commit
c980abfc63
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ node_modules/
|
|||||||
test-results/
|
test-results/
|
||||||
var/
|
var/
|
||||||
.npmrc
|
.npmrc
|
||||||
|
src/version.txt
|
7
Makefile
7
Makefile
@ -3,10 +3,13 @@ all: format build
|
|||||||
restart-server:
|
restart-server:
|
||||||
docker-compose restart
|
docker-compose restart
|
||||||
|
|
||||||
build:
|
write-version:
|
||||||
|
@echo $(shell date +'%Y%m%d-%H.%M.%S') > ./src/version.txt
|
||||||
|
|
||||||
|
build: write-version
|
||||||
tools/npm run-script build:dev
|
tools/npm run-script build:dev
|
||||||
|
|
||||||
build-min:
|
build-min: write-version
|
||||||
tools/npm run-script build
|
tools/npm run-script build
|
||||||
|
|
||||||
format:
|
format:
|
||||||
|
@ -7,9 +7,11 @@ import { Command } from './Common';
|
|||||||
import TaskQueueRenderer from './TaskQueueRenderer';
|
import TaskQueueRenderer from './TaskQueueRenderer';
|
||||||
|
|
||||||
export default class Dashboard {
|
export default class Dashboard {
|
||||||
|
private readonly version: string;
|
||||||
private scheduler: Scheduler;
|
private scheduler: Scheduler;
|
||||||
|
|
||||||
constructor(scheduler: Scheduler) {
|
constructor(version: string, scheduler: Scheduler) {
|
||||||
|
this.version = version;
|
||||||
this.scheduler = scheduler;
|
this.scheduler = scheduler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,7 +21,7 @@ export default class Dashboard {
|
|||||||
|
|
||||||
await sleepShort();
|
await sleepShort();
|
||||||
|
|
||||||
markPage('Dashboard');
|
markPage('Dashboard', this.version);
|
||||||
new TaskQueueRenderer().render(this.scheduler.taskState());
|
new TaskQueueRenderer().render(this.scheduler.taskState());
|
||||||
|
|
||||||
if (p.pathname === '/build.php') {
|
if (p.pathname === '/build.php') {
|
||||||
|
@ -9,17 +9,19 @@ import { Args, Command } from './Common';
|
|||||||
import TaskQueueRenderer from './TaskQueueRenderer';
|
import TaskQueueRenderer from './TaskQueueRenderer';
|
||||||
|
|
||||||
export default class Scheduler {
|
export default class Scheduler {
|
||||||
|
private readonly version: string;
|
||||||
private taskQueue: TaskQueue;
|
private taskQueue: TaskQueue;
|
||||||
private actionQueue: ActionQueue;
|
private actionQueue: ActionQueue;
|
||||||
|
|
||||||
constructor() {
|
constructor(version: string) {
|
||||||
|
this.version = version;
|
||||||
this.taskQueue = new TaskQueue();
|
this.taskQueue = new TaskQueue();
|
||||||
this.actionQueue = new ActionQueue();
|
this.actionQueue = new ActionQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
async run() {
|
async run() {
|
||||||
await sleepShort();
|
await sleepShort();
|
||||||
markPage('Executor');
|
markPage('Executor', this.version);
|
||||||
new TaskQueueRenderer().render(this.taskQueue.state());
|
new TaskQueueRenderer().render(this.taskQueue.state());
|
||||||
while (true) {
|
while (true) {
|
||||||
await sleepLong();
|
await sleepLong();
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import ModeDetector from './ModeDetector';
|
import ModeDetector from './ModeDetector';
|
||||||
import Scheduler from './Scheduler';
|
import Scheduler from './Scheduler';
|
||||||
import Dashboard from './Dashboard';
|
import Dashboard from './Dashboard';
|
||||||
|
import TxtVersion from '!!raw-loader!./version.txt';
|
||||||
|
|
||||||
const md = new ModeDetector();
|
const md = new ModeDetector();
|
||||||
if (md.isAuto()) {
|
if (md.isAuto()) {
|
||||||
md.setAuto();
|
md.setAuto();
|
||||||
console.log('AUTO MANAGEMENT ON');
|
console.log('AUTO MANAGEMENT ON');
|
||||||
const scheduler = new Scheduler();
|
const scheduler = new Scheduler(TxtVersion);
|
||||||
scheduler.run();
|
scheduler.run();
|
||||||
} else {
|
} else {
|
||||||
console.log('NORMAL MODE');
|
console.log('NORMAL MODE');
|
||||||
const dashboard = new Dashboard(new Scheduler());
|
const dashboard = new Dashboard(TxtVersion, new Scheduler());
|
||||||
dashboard.run();
|
dashboard.run();
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ export async function sleepLong() {
|
|||||||
return await sleep(ms);
|
return await sleep(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function markPage(text: string) {
|
export function markPage(text: string, version: string) {
|
||||||
jQuery('body').append(
|
jQuery('body').append(
|
||||||
'<div style="' +
|
'<div style="' +
|
||||||
'position: absolute; ' +
|
'position: absolute; ' +
|
||||||
@ -25,6 +25,8 @@ export function markPage(text: string) {
|
|||||||
'padding: 8px 6px; ' +
|
'padding: 8px 6px; ' +
|
||||||
'color: black">' +
|
'color: black">' +
|
||||||
text +
|
text +
|
||||||
|
' ' +
|
||||||
|
version +
|
||||||
'</div>'
|
'</div>'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ const path = require('path');
|
|||||||
|
|
||||||
module.exports = (env = {}) => ({
|
module.exports = (env = {}) => ({
|
||||||
mode: env.production ? 'production' : 'development',
|
mode: env.production ? 'production' : 'development',
|
||||||
entry: path.resolve(__dirname, 'src/index.ts'),
|
entry: path.resolve(__dirname, 'src/index.js'),
|
||||||
output: {
|
output: {
|
||||||
filename: env.production ? 'travian.min.js' : 'travian.js',
|
filename: env.production ? 'travian.min.js' : 'travian.js',
|
||||||
path: path.resolve(__dirname, 'dist'),
|
path: path.resolve(__dirname, 'dist'),
|
||||||
|
Loading…
Reference in New Issue
Block a user