diff --git a/REFACTOR_PLAN.md b/REFACTOR_PLAN.md index 28c9d30..8cbf6f2 100644 --- a/REFACTOR_PLAN.md +++ b/REFACTOR_PLAN.md @@ -115,6 +115,7 @@ This is a gradual destination, not a requirement to move everything at once. IPC - [x] Route the snooze action's message-label hook through the productivity feature API (`snooze-ui.js`, `productivity.js`). - [x] Encapsulate productivity implementation state and helpers in a local module scope, preserving the explicit productivity feature API (`productivity.js`). - [x] Encapsulate DAV helpers in a local module scope while preserving `window.epMailFeatures.dav` (`dav-ui.js`). +- [x] Encapsulate core renderer implementation behind `window.epMailShell` (`app.js`). - [x] Migrate additional mail-related consumers to unique local aliases to avoid classic-script lexical redeclarations. - [x] Add a combined-script parse test to prevent duplicate top-level lexical declarations from stopping later UI scripts. - [ ] Migrate remaining mail-related consumers and remove transitional global dependencies. @@ -143,7 +144,7 @@ This is a gradual destination, not a requirement to move everything at once. IPC - Electron Builder and the desktop Actions artifact name derive from `package.json`. - Android `versionName` derives from the same package version. Its current `versionCode` mapping is `major * 10000 + minor * 100 + patch`; keep minor and patch below 100, and revise the mapping before reaching that boundary to avoid collisions. - `scripts/build-all.ps1` uses the package version for APK naming. Before a release, bump once with `npm run bump:build`, verify the lockfile and computed Android version code, and build every target without another bump. -- Latest version check: `package.json` and both lockfile version fields are `0.4.26`; Android derives `versionName 0.4.26` and `versionCode 426`. The user confirms the previous artifact works; this bump is for the next build. +- Latest version check: `package.json` and both lockfile version fields are `0.4.27`; Android derives `versionName 0.4.27` and `versionCode 427`. The user confirms the previous artifact works; this bump is for the next build. ## Progress log @@ -172,5 +173,6 @@ This is a gradual destination, not a requirement to move everything at once. IPC - Step 6 at version `0.4.24` removes the snooze-to-productivity label action's implicit global call; account and snooze feature API checks are covered by the renderer tests. - Step 6 at version `0.4.25` wraps productivity internals in a local scope; Calendar, Contacts, labels, and profile behavior remain published through the productivity feature API. - Step 6 at version `0.4.26` wraps DAV UI internals in a local scope while preserving the public DAV feature API. +- Step 6 at version `0.4.27` scopes core renderer functions and state in `app.js`; other scripts continue through the explicit `epMailShell` interface. - The current IPC/DAV validation changes pass the full suite: 108 tests. - While work continued, `package.json` and `package-lock.json` reflected a version bump to `0.4.6`; those changes were preserved. diff --git a/app.js b/app.js index 8c99203..a0762b7 100644 --- a/app.js +++ b/app.js @@ -1,3 +1,4 @@ +(() => { if('serviceWorker'in navigator)window.addEventListener('load',()=>navigator.serviceWorker.register('./service-worker.js').catch(()=>{})); const state = window.epMailState; const $=s=>document.querySelector(s), $$=s=>[...document.querySelectorAll(s)]; @@ -53,3 +54,4 @@ window.epMailShell = Object.freeze({ wrapOpenMessage(decorator) { openMessage = decorator(openMessage); }, wrapShowCompose(decorator) { showCompose = decorator(showCompose); } }); +})(); diff --git a/package-lock.json b/package-lock.json index 60d5184..115cc89 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ep-mail", - "version": "0.4.26", + "version": "0.4.27", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ep-mail", - "version": "0.4.26", + "version": "0.4.27", "dependencies": { "@capacitor/android": "^8.5.2", "@capacitor/core": "^8.5.2", diff --git a/package.json b/package.json index 32ad7f6..9e2e649 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ep-mail", - "version": "0.4.26", + "version": "0.4.27", "private": true, "description": "Eternity Project mail client", "homepage": "https://git.eternityproject.fi/thuttu/ep-mail-client", diff --git a/tests/renderer-bootstrap.test.cjs b/tests/renderer-bootstrap.test.cjs index 6b3ce30..9a5fd45 100644 --- a/tests/renderer-bootstrap.test.cjs +++ b/tests/renderer-bootstrap.test.cjs @@ -24,6 +24,8 @@ test('renderer bootstrap loads shared state and mail security before the applica test('core app shell uses the namespaced renderer state', () => { const app = read('app.js'); + assert.match(app, /^\(\(\) => \{/); + assert.match(app, /window\.epMailShell = Object\.freeze/); assert.match(app, /const state = window\.epMailState/); assert.doesNotMatch(app, /^\s*(?:const|let|var)\s+(?:messages|contacts|activeMessage|activeFolder|activeView|query|toastTimer|selectedIds)\b/m); }); diff --git a/www/app.js b/www/app.js index 8c99203..a0762b7 100644 --- a/www/app.js +++ b/www/app.js @@ -1,3 +1,4 @@ +(() => { if('serviceWorker'in navigator)window.addEventListener('load',()=>navigator.serviceWorker.register('./service-worker.js').catch(()=>{})); const state = window.epMailState; const $=s=>document.querySelector(s), $$=s=>[...document.querySelectorAll(s)]; @@ -53,3 +54,4 @@ window.epMailShell = Object.freeze({ wrapOpenMessage(decorator) { openMessage = decorator(openMessage); }, wrapShowCompose(decorator) { showCompose = decorator(showCompose); } }); +})();