allow app.json version overrides to percolate through all loads
This commit is contained in:
parent
3e97bae8fa
commit
61bd454f85
5 changed files with 14 additions and 11 deletions
13
app.js
13
app.js
|
|
@ -30,6 +30,7 @@ let dversion;
|
|||
let lastmod;
|
||||
let logger;
|
||||
let debug;
|
||||
let over;
|
||||
let http;
|
||||
let util;
|
||||
let dir;
|
||||
|
|
@ -50,13 +51,14 @@ function init(mod) {
|
|||
lastmod = mod.util.lastmod;
|
||||
logger = mod.log;
|
||||
debug = mod.env.debug || mod.meta.debug;
|
||||
oversion = mod.env.over || mod.meta.over;
|
||||
http = mod.http;
|
||||
util = mod.util;
|
||||
dir = mod.dir;
|
||||
log = mod.log;
|
||||
|
||||
// dversion = debug ? `_${version}` : version;
|
||||
dversion = debug ? Date.now().toString(36) : version;
|
||||
dversion = debug ? `_${version}` : version;
|
||||
// dversion = debug ? Date.now().toString(36) : version;
|
||||
cacheDir = mod.util.datadir("cache");
|
||||
|
||||
const approot = "main/gapp";
|
||||
|
|
@ -306,7 +308,7 @@ function initModule(mod, file, dir) {
|
|||
script: script,
|
||||
moddir: dir,
|
||||
rootdir: mod.dir,
|
||||
version: version
|
||||
version: oversion || version
|
||||
},
|
||||
env: mod.env,
|
||||
pkg: {
|
||||
|
|
@ -608,11 +610,12 @@ function concatCode(array) {
|
|||
// scripts instead of serving a complete bundle
|
||||
if (debug) {
|
||||
const code = [
|
||||
oversion ? `self.debug_version='${oversion}';` : '',
|
||||
'self.debug=true;',
|
||||
'(function() { let load = [ '
|
||||
];
|
||||
direct.forEach(file => {
|
||||
const vers = cachever[file] || dversion || version;
|
||||
const vers = cachever[file] || oversion || dversion || version;
|
||||
code.push(`"/${file.replace(/\\/g,'/')}?${vers}",`);
|
||||
});
|
||||
code.push([
|
||||
|
|
@ -815,7 +818,7 @@ function rewriteHtmlVersion(req, res, next) {
|
|||
let real_write = res.write;
|
||||
let real_end = res.end;
|
||||
let mlen = '{{version}}'.length;
|
||||
let vstr = dversion || version;
|
||||
let vstr = oversion || dversion || version;
|
||||
if (vstr.length < mlen) {
|
||||
vstr = vstr.padStart(mlen,0);
|
||||
} else if (vstr.length > mlen) {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
const service_worker = navigator.serviceWorker;
|
||||
|
||||
async function start_service_worker() {
|
||||
const version = 65;
|
||||
const version = self.gapp.version;
|
||||
function debug() {
|
||||
console.log(`[${version}]`, ...arguments);
|
||||
}
|
||||
|
||||
// install service worker
|
||||
debug('service worker registration', { gapp: self.gapp.version });
|
||||
debug('service worker registration');
|
||||
|
||||
try {
|
||||
// const reg = await navigator.serviceWorker.register("/src/moto/service.js?013", { scope: "/" });
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
let terms = {
|
||||
COPYRIGHT: "Copyright (C) Stewart Allen <sa@grid.space> - All Rights Reserved",
|
||||
LICENSE: "See the license.md file included with the source distribution",
|
||||
VERSION: "3.5.D4"
|
||||
VERSION: this.debug_version || "3.5.D4"
|
||||
};
|
||||
|
||||
if (typeof(module) === 'object') {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const version = 65;
|
||||
const version = self.gapp.version;
|
||||
const stats = {
|
||||
hit: 0,
|
||||
miss: 0,
|
||||
|
|
@ -22,7 +22,7 @@ function report() {
|
|||
stats.hit = stats.miss = stats.fetch = stats.cache = stats.preload = 0;
|
||||
}
|
||||
|
||||
debug('sw entry point', { gapp: self.gapp.version });
|
||||
debug('sw entry point');
|
||||
|
||||
const addResourcesToCache = async (resources) => {
|
||||
// debug('cache resources', resources);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
<link rel="stylesheet" type="text/css" href="/kiri/index.css?{{version}}">
|
||||
<link href="/font/css/all.min.css" rel="stylesheet">
|
||||
<link href="/kiri/manifest.json" rel="manifest">
|
||||
<script src="/code/cache.js?65" defer></script>
|
||||
<script src="/code/cache.js?{{version}}" defer></script>
|
||||
<script src="/font/js/all.min.js" crossorigin="anonymous" defer></script>
|
||||
<script src="/code/kiri.js?{{version}}"></script>
|
||||
</head>
|
||||
|
|
|
|||
Loading…
Reference in a new issue