Skip to content

v60: plan for splitting app/main.js (docs only) - #61

Merged
BPMData merged 1 commit into
mainfrom
plan-app-main-split
Nov 28, 2026
Merged

BPMData merged 1 commit into
mainfrom
plan-app-main-split

Conversation

@BPMData

@BPMData BPMData commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Adds docs/plans/APP_MAIN_SPLIT.md: a step-by-step plan for Codex 6.1 Terra to split app/main.js (1,829 lines) into 12 smaller files in app/, without changing anything a teacher sees or does. This PR doesn't change any app code. The refactor itself will be a separate PR.

How the plan works

  • Phase 0: small setter functions for the handful of shared variables (doc, ink data, language, save state, chapters). Once the code is in separate files, other files can't assign those variables directly.
  • Phase 1: every piece of start-up code (creating the viewer, menus, timer and settings, and adding every event listener) goes into an initX() function. main.js calls these in today's order, so listeners and shortcuts are still set up in the same order.
  • Phases 2–8: cut-and-paste moves into state.js, core.js, saving.js, open.js, start-screen.js, page-view.js, menus.js, tools.js, settings.js, toolbar.js, notebook-ui.js and exporting.js. Each phase lists the exact line ranges, the import lines and the exports. Until a file exists, its names are imported from ./main.js for the time being.
  • Phase 9: docs (ARCHITECTURE module list, ROADMAP item removed) and final checks.

A checkpoint after every phase runs Prettier, tools/build.py / --check, a grep for leftover top-level start-up code, and npx playwright test. The plan stops if app/main.js has changed since 0603cec, since its line numbers would be out of date.

Nothing moves into or out of shared/, and the overlay is untouched. The app is still plain ES modules with no build step; tools/build.py picks up the new files for the version stamp and the offline copy.

Also: version v60, a changelog line, and python3 tools/build.py.

🤖 Generated with Claude Code

docs/plans/APP_MAIN_SPLIT.md is a step-by-step plan (for Codex to follow
exactly) that splits the PDF app's app/main.js into 12 smaller files
without changing anything the app does. No app code changes in this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BPMData
BPMData merged commit ef2246c into main Nov 28, 2026
1 check passed
@BPMData
BPMData deleted the plan-app-main-split branch November 28, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant