Release / release (push) Waiting to run
The releases carried the wheel and the sdist; the only zip was GitHub's source archive of the whole repository (tests, CI, tools). A Windows user just wants to extract a folder and double-click start.bat. - scripts/build_release_zip.py builds simtrace-analyser-<version>.zip with a single top-level directory: the two Python packages, the PWA runtime files (frontend/tests and package.json stay out), the four launchers, the udev rule, the READMEs and the screenshot. The .bat entries are written with CRLF line endings (cmd.exe mishandles bare-LF labels/goto), the .sh files keep their executable bit; LICENSE is included automatically once the repo has one. - tests/test_release_zip.py pins the archive shape, the exclusions, the sw.js PRECACHE drift (every precached asset must travel), the CRLF/LF line endings and start.sh's mode. - the release workflow builds the zip, checks it carries start.bat and the PWA, uploads it with the run and attaches it to the release. - READMEs (EN/RU) and the release-notes template offer the zip as the Windows-friendly option; version 2.7.12, PWA cache v94. Verified: the built zip (34 entries, 658 KB compressed) extracted and started on Linux serves the same index.html; 553 Python + 80 Node tests.
49 lines
1.4 KiB
JavaScript
49 lines
1.4 KiB
JavaScript
const CACHE = 'simtrace-analyser-v94';
|
|
|
|
const PRECACHE = [
|
|
'index.html',
|
|
'manifest.json',
|
|
'icon-192.png',
|
|
'icon-512.png',
|
|
'favicon.png',
|
|
'sim-analyser.svg',
|
|
'sim-analyser-light.svg',
|
|
];
|
|
|
|
self.addEventListener('install', e => {
|
|
self.skipWaiting();
|
|
e.waitUntil(
|
|
caches.open(CACHE)
|
|
.then(cache => cache.addAll(PRECACHE))
|
|
.then(() => console.log('SW: precache done'))
|
|
.catch(err => console.error('SW: precache failed', err))
|
|
);
|
|
});
|
|
|
|
self.addEventListener('activate', e => {
|
|
e.waitUntil(
|
|
caches.keys()
|
|
.then(keys => Promise.all(
|
|
keys.filter(k => k !== CACHE).map(k => caches.delete(k))
|
|
))
|
|
.then(() => self.clients.claim())
|
|
.then(() => console.log('SW: activated, controlling clients'))
|
|
);
|
|
});
|
|
|
|
self.addEventListener('fetch', e => {
|
|
// Network-first: the local server is always up, so always serve fresh
|
|
// content and fall back to cache only when offline.
|
|
if (!e.request.url.startsWith('http')) return;
|
|
if (e.request.method !== 'GET') return;
|
|
e.respondWith(
|
|
fetch(e.request)
|
|
.then(r => {
|
|
const clone = r.clone();
|
|
caches.open(CACHE).then(c => c.put(e.request, clone)).catch(() => {});
|
|
return r;
|
|
})
|
|
.catch(() => caches.match(e.request))
|
|
);
|
|
});
|