added more detailed version info (#937)
* renamed configuration parameter * updated version info build * added default version info and expose in engine * replaced version in menu updated form link to include version * use the current branch name as directory
This commit is contained in:
parent
6f688eea73
commit
1ebc33481e
|
@ -1,7 +1,7 @@
|
|||
module.exports = {
|
||||
source: 'src/web',
|
||||
target: 'build/web',
|
||||
version: 'lib/hakuneko/version.html',
|
||||
version: 'mjs/VersionInfo.mjs',
|
||||
polymer: {
|
||||
entrypoint: 'index.html',
|
||||
shell: '',
|
||||
|
|
70
build-web.js
70
build-web.js
|
@ -8,11 +8,6 @@ const config = require('./build-web.config');
|
|||
config.source = config.source || 'src';
|
||||
config.target = config.target || 'build';
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} command
|
||||
* @param {bool} silent
|
||||
*/
|
||||
function execute(command, silent) {
|
||||
if(!silent) {
|
||||
console.log('>', command);
|
||||
|
@ -32,31 +27,12 @@ function execute(command, silent) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
async function gitHead() {
|
||||
let rev = (await execute(`git log -1 --format="%H"`)).trim();
|
||||
return {
|
||||
revision: rev,
|
||||
version: rev.slice(0, 6)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} identifier
|
||||
*/
|
||||
async function gitStashPush(identifier) {
|
||||
identifier = identifier || 'DEPLOY#' + Date.now().toString(16).toUpperCase();
|
||||
await execute(`git stash push -u -m '${identifier}'`);
|
||||
return identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} identifier
|
||||
*/
|
||||
async function gitStashPop(identifier) {
|
||||
let out = await execute(`git stash list`);
|
||||
if(out.includes(identifier)) {
|
||||
|
@ -64,11 +40,6 @@ async function gitStashPop(identifier) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {NodeJS.ReadableStream} streamReader
|
||||
* @param {NodeJS.WritableStream} streamWriter
|
||||
*/
|
||||
function pipe(streamReader, streamWriter) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let stream = streamReader.pipe(streamWriter);
|
||||
|
@ -77,9 +48,6 @@ function pipe(streamReader, streamWriter) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
async function polymerBuild(settings) {
|
||||
let target = path.resolve(config.target);
|
||||
let cwd = process.cwd();
|
||||
|
@ -95,40 +63,32 @@ async function polymerBuild(settings) {
|
|||
process.chdir(cwd);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} revision
|
||||
* @param {string} version
|
||||
*/
|
||||
async function createVersion(file, revision, version) {
|
||||
async function createVersionInfo(file) {
|
||||
let branch = (await execute(`git rev-parse --abbrev-ref HEAD`)).trim();
|
||||
let revision = (await execute(`git rev-parse HEAD`)).trim();
|
||||
let content = [
|
||||
`<script>`,
|
||||
` var revision = {`,
|
||||
` id: '${version}',`,
|
||||
` url: 'https://github.com/manga-download/hakuneko/commits/${revision}'`,
|
||||
` };`,
|
||||
`</script>`
|
||||
`export default {`,
|
||||
` branch: {`,
|
||||
` label: '${branch}',`,
|
||||
` link: 'https://github.com/manga-download/hakuneko/commits/${branch}',`,
|
||||
` },`,
|
||||
` revision: {`,
|
||||
` label: '${revision.slice(0, 6)}',`,
|
||||
` link: 'https://github.com/manga-download/hakuneko/commits/${revision}',`,
|
||||
` }`,
|
||||
`};`
|
||||
].join('\n');
|
||||
await fs.writeFile(file, content);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
async function main() {
|
||||
let head = await gitHead();
|
||||
let stashID = await gitStashPush();
|
||||
await fs.remove(config.target);
|
||||
await polymerBuild(config.polymer);
|
||||
// overwrite the polymer minified/obfuscated js files with the original minified/obfuscated js files (e.g. prevent breaking hls.light.min.js when minified by polymer)
|
||||
//cp -f ./js/*.min.js $DIR/js/
|
||||
// polymer will break files that are already obfuscated, so use the original obfuscated files => otherwise leads to blank/white screen + out-of-memory error in electron
|
||||
//cp -f ./lib/hakuneko/engine/base/connectors/mangago.html $DIR/lib/hakuneko/engine/base/connectors/mangago.html
|
||||
//cp -f ./lib/hakuneko/engine/base/connectors/tencentcomic.html $DIR/lib/hakuneko/engine/base/connectors/tencentcomic.html
|
||||
await createVersion(path.join(config.target, config.version), head.revision, head.version);
|
||||
await createVersionInfo(path.join(config.target, config.version));
|
||||
await gitStashPop(stashID);
|
||||
}
|
||||
|
||||
// exit application as soon as any uncaught exception is thrown
|
||||
process.on('unhandledRejection', error => { throw error });
|
||||
process.on('unhandledRejection', error => { throw error; });
|
||||
main();
|
|
@ -10,5 +10,5 @@ module.exports = {
|
|||
* 'https://manga-download.gihub.io/hakuneko/master/latest'
|
||||
* 'https://manga-download.gihub.io/hakuneko/6.1.7/latest'
|
||||
*/
|
||||
deploy: './master' // Use 'process.env.GITHUB_REF' ???
|
||||
directory: './' + process.env.GITHUB_REF // current branch
|
||||
}
|
|
@ -83,8 +83,8 @@ async function gitCommit() {
|
|||
let user = process.env.GITHUB_ACTOR;
|
||||
let mail = user + '@users.noreply.github.com';
|
||||
let auth = Buffer.from('x-access-token:' + process.env.GITHUB_TOKEN).toString('base64');
|
||||
await execute(`git add ${config.deploy}/*`);
|
||||
await execute(`git -c user.name="${user}" -c user.email="${mail}" commit -m 'Deployed Release: ${config.deploy}'`);
|
||||
await execute(`git add ${config.directory}/*`);
|
||||
await execute(`git -c user.name="${user}" -c user.email="${mail}" commit -m 'Deployed Release: ${config.directory}'`);
|
||||
await execute(`git -c http.extraheader="AUTHORIZATION: Basic ${auth}" push origin HEAD:${config.branch}`);
|
||||
}
|
||||
|
||||
|
@ -96,10 +96,10 @@ async function main() {
|
|||
let meta = 'latest';
|
||||
let archive = Date.now().toString(36).toUpperCase() + '.zip';
|
||||
await sslPack(archive, meta);
|
||||
await fs.remove(config.deploy);
|
||||
await fs.mkdir(config.deploy);
|
||||
await fs.move(path.resolve(config.build, meta), path.resolve(config.deploy, meta));
|
||||
await fs.move(path.resolve(config.build, archive), path.resolve(config.deploy, archive));
|
||||
await fs.remove(config.directory);
|
||||
await fs.mkdir(config.directory);
|
||||
await fs.move(path.resolve(config.build, meta), path.resolve(config.directory, meta));
|
||||
await fs.move(path.resolve(config.build, archive), path.resolve(config.directory, archive));
|
||||
let stashID = await gitStashPush();
|
||||
await execute(`git checkout ${config.branch} || git checkout -b ${config.branch}`);
|
||||
await execute(`git rm -r ${config.deploy} || true`);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<link rel="import" href="../version.html">
|
||||
<link rel="import" href="../../polymer/polymer-element.html">
|
||||
<link rel="import" href="../../polymer/lib/elements/dom-if.html">
|
||||
<link rel="import" href="../../polymer/lib/elements/dom-repeat.html">
|
||||
|
@ -127,7 +126,17 @@
|
|||
<div class="info">
|
||||
<div>A simple and easy Manga Downloader…</div>
|
||||
<div class="credits">
|
||||
<div>© [[ year ]] <a href="https://github.com/manga-download/hakuneko" target="_blank">HakuNeko</a> rev.<a href$="[[ revision.url ]]" target="_blank">[[ revision.id ]]</a><hr></div>
|
||||
<div>
|
||||
© [[ year ]]
|
||||
<a href="https://github.com/manga-download/hakuneko" target="_blank">
|
||||
HakuNeko
|
||||
</a>
|
||||
|
|
||||
<a href$="[[ version.revision.link ]]" target="_blank">
|
||||
[[ version.branch.label ]]@[[ version.revision.label ]]
|
||||
</a>
|
||||
<hr>
|
||||
</div>
|
||||
<div><a href="https://github.com/ronny1982" target="_blank">Ronny Wegener</a> (Application)</div>
|
||||
<div><a href="https://sourceforge.net/u/medmig/profile/" target="_blank">Neogeek</a> (Connectors)</div>
|
||||
<div><a href="http://hakuneko3kune.deviantart.com/" target="_blank">HakuNeko3Kune</a> (Artwork)</div>
|
||||
|
@ -136,7 +145,7 @@
|
|||
<i class="fas fa-fw fa-book button" on-click="openWindow" title="Read User Documentation (GitHub Wiki)" data-href="https://github.com/manga-download/hakuneko/wiki"></i>
|
||||
<i class="fas fa-fw fa-exclamation-circle button" on-click="openWindow" title="Show Troubleshooting (GitHub Wiki)" data-href="https://github.com/manga-download/hakuneko/wiki/Troubleshooting"></i>
|
||||
<i class="fas fa-fw fa-comment button" on-click="openWindow" title="Support Channel (Discord)" data-href="https://discord.gg/FdgZ7Mr"></i>
|
||||
<i class="fas fa-fw fa-bug button" on-click="openWindow" title="Report Problem (GitHub Issues)" data-href="https://docs.google.com/forms/d/e/1FAIpQLSfHUn92wqncQUKbJAqY-NUYdshOoyyRYGcxHjGGUaqYuyBqCw/viewform?hl=en&usp=pp_url&entry.535298315=HakuNeko+User"></i>
|
||||
<i class="fas fa-fw fa-bug button" on-click="openWindow" title="Report Problem (GitHub Issues)" data-href$="https://docs.google.com/forms/d/e/1FAIpQLSfHUn92wqncQUKbJAqY-NUYdshOoyyRYGcxHjGGUaqYuyBqCw/viewform?usp=pp_url&entry.535298315=HakuNeko+User&entry.1990156964=[[ version.branch.label ]]@[[ version.revision.label ]]"></i>
|
||||
<i class="fas fa-fw fa-network-wired button" on-click="openWindow" title="IP Geolocation Lookup" data-href="https://ipinfo.io/json"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -192,7 +201,7 @@
|
|||
ready() {
|
||||
super.ready();
|
||||
this.year = (new Date()).getFullYear();
|
||||
this.revision = revision;
|
||||
this.version = Engine.Version;
|
||||
this.popupVisibility = false;
|
||||
this.settingCategories = Engine.Settings.getCategorizedSettings();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<link rel="import" href="../version.html">
|
||||
<link rel="import" href="../../polymer/polymer-element.html">
|
||||
<link rel="import" href="../../polymer/lib/elements/dom-if.html">
|
||||
<link rel="import" href="../../polymer/lib/elements/dom-repeat.html">
|
||||
|
@ -127,7 +126,17 @@
|
|||
<div class="info">
|
||||
<div>A simple and easy Manga Downloader…</div>
|
||||
<div class="credits">
|
||||
<div>© [[ year ]] <a href="https://github.com/manga-download/hakuneko" target="_blank">HakuNeko</a> rev.<a href$="[[ revision.url ]]" target="_blank">[[ revision.id ]]</a><hr></div>
|
||||
<div>
|
||||
© [[ year ]]
|
||||
<a href="https://github.com/manga-download/hakuneko" target="_blank">
|
||||
HakuNeko
|
||||
</a>
|
||||
|
|
||||
<a href$="[[ version.revision.link ]]" target="_blank">
|
||||
[[ version.branch.label ]]@[[ version.revision.label ]]
|
||||
</a>
|
||||
<hr>
|
||||
</div>
|
||||
<div><a href="https://github.com/ronny1982" target="_blank">Ronny Wegener</a> (Application)</div>
|
||||
<div><a href="https://sourceforge.net/u/medmig/profile/" target="_blank">Neogeek</a> (Connectors)</div>
|
||||
<div><a href="http://hakuneko3kune.deviantart.com/" target="_blank">HakuNeko3Kune</a> (Artwork)</div>
|
||||
|
@ -136,7 +145,7 @@
|
|||
<i class="fas fa-fw fa-book button" on-click="openWindow" title="Read User Documentation (GitHub Wiki)" data-href="https://github.com/manga-download/hakuneko/wiki"></i>
|
||||
<i class="fas fa-fw fa-exclamation-circle button" on-click="openWindow" title="Show Troubleshooting (GitHub Wiki)" data-href="https://github.com/manga-download/hakuneko/wiki/Troubleshooting"></i>
|
||||
<i class="fas fa-fw fa-comment button" on-click="openWindow" title="Support Channel (Discord)" data-href="https://discord.gg/FdgZ7Mr"></i>
|
||||
<i class="fas fa-fw fa-bug button" on-click="openWindow" title="Report Problem (GitHub Issues)" data-href="https://docs.google.com/forms/d/e/1FAIpQLSfHUn92wqncQUKbJAqY-NUYdshOoyyRYGcxHjGGUaqYuyBqCw/viewform?hl=en&usp=pp_url&entry.535298315=HakuNeko+User"></i>
|
||||
<i class="fas fa-fw fa-bug button" on-click="openWindow" title="Report Problem (GitHub Issues)" data-href$="https://docs.google.com/forms/d/e/1FAIpQLSfHUn92wqncQUKbJAqY-NUYdshOoyyRYGcxHjGGUaqYuyBqCw/viewform?usp=pp_url&entry.535298315=HakuNeko+User&entry.1990156964=[[ version.branch.label ]]@[[ version.revision.label ]]"></i>
|
||||
<i class="fas fa-fw fa-network-wired button" on-click="openWindow" title="IP Geolocation Lookup" data-href="https://ipinfo.io/json"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -192,7 +201,7 @@
|
|||
ready() {
|
||||
super.ready();
|
||||
this.year = (new Date()).getFullYear();
|
||||
this.revision = revision;
|
||||
this.version = Engine.Version;
|
||||
this.popupVisibility = false;
|
||||
this.settingCategories = Engine.Settings.getCategorizedSettings();
|
||||
}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<script>
|
||||
var revision = {
|
||||
id: 'master',
|
||||
url: 'https://github.com/manga-download/hakuneko/commits/master'
|
||||
};
|
||||
</script>
|
|
@ -11,6 +11,7 @@ import DownloadManager from './engine/DownloadManager.mjs';
|
|||
import Request from './engine/Request.mjs';
|
||||
import Settings from './engine/Settings.mjs';
|
||||
import Storage from './engine/Storage.mjs';
|
||||
import Version from './VersionInfo.mjs';
|
||||
|
||||
export default class HakuNeko {
|
||||
|
||||
|
@ -18,6 +19,7 @@ export default class HakuNeko {
|
|||
// set global first, beause some of the engine classes access them during instantiation
|
||||
this._initializeGlobals(context);
|
||||
|
||||
this._version = Version;
|
||||
this._enums = Enums;
|
||||
|
||||
this._blacklist = new Blacklist();
|
||||
|
@ -84,4 +86,8 @@ export default class HakuNeko {
|
|||
get Storage() {
|
||||
return this._storage;
|
||||
}
|
||||
|
||||
get Version() {
|
||||
return this._version;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
export default {
|
||||
branch: {
|
||||
label: 'master',
|
||||
link: 'https://github.com/manga-download/hakuneko/commits/master',
|
||||
},
|
||||
revision: {
|
||||
label: 'HEAD',
|
||||
link: 'https://github.com/manga-download/hakuneko/commits/HEAD',
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue