Skip to content

Migrate to Manifest V3; modernize build (fixes #33)#34

Open
JoshuaKimsey wants to merge 4 commits into
CSS-Tricks:masterfrom
JoshuaKimsey:master
Open

Migrate to Manifest V3; modernize build (fixes #33)#34
JoshuaKimsey wants to merge 4 commits into
CSS-Tricks:masterfrom
JoshuaKimsey:master

Conversation

@JoshuaKimsey

Copy link
Copy Markdown

Summary

Migrates The Printliminator from Manifest V2 to V3 so it loads in modern Chrome again. The current Web Store listing installs a broken extension.

See #33 for the full context.

Changes

Manifest V3 (src/chrome/manifest.json)

  • manifest_version 2 → 3; version 4.0.5 → 5.0.0
  • browser_actionaction
  • Added scripting permission
  • web_accessible_resources: string array → object form with matches: ["<all_urls>"]

API migration (src/chrome/popup.js)

  • chrome.tabs.executeScriptchrome.scripting.executeScript
  • chrome.tabs.insertCSSchrome.scripting.insertCSS
  • code: string injection → func: arrow functions
  • file:files: arrays
  • Result reads updated from result[0]result[0].result (affects the print ready-state polling loop)
  • Implicit active-tab targeting (null tabId) → explicit target: { tabId } from the already-queried tabArray[0].id
  • matchAboutBlank dropped (no MV3 equivalent — Yahoo Mail print-popup edge case deferred; documented in the README)

Build modernization

  • Replaced the 2015 Grunt 0.4 + grunt-preprocess pipeline with a zero-dependency build.js (Node)
  • Single dev dependency: sass (Dart Sass ^1.77.0) for SCSS compilation
  • npm run build / npm run clean scripts; outputs dist/chrome/
  • Replicates the original @echo / @if MODE / {version} preprocessing semantics exactly
  • Chrome extension output only; bookmarklet build path untouched (unaffected by MV3)

Other

  • README: added v5.0.0 changelog entry, building-from-source section, fork notice
  • Manifest contributors field added crediting original authors + MV3 migration
  • homepage_url pointed to the active fork
  • Build now includes all 5 locales (de, en, fr, pt_BR, sr); previous committed dist/ only shipped en and fr

Verification

  • npm run build produces a loadable dist/chrome/ (14 files + 5 locale folders)
  • Manifest validated as MV3 JSON
  • No leftover chrome.tabs.executeScript/insertCSS calls in output
  • No unprocessed @echo/@if/{version} directives in output
  • printliminator.js diff vs old committed dist: only the version string changed
  • popup.html diff vs old committed dist: byte-identical
  • Tested in Chrome: loads as unpacked extension, all four popup buttons (Undo, Stylize, Remove Graphics, Print) work, keyboard commands work (arrows, Enter, Backspace, +/-, Esc, Alt+click, Shift+click). Functionally identical to v4.0.5.

Notes

  • I'm also publishing this as a separate Web Store listing under my account, since the original listing is under CSS-Tricks' account and this PR may not be reviewed. If this PR is merged, I'm happy to coordinate on the Web Store listing (e.g., transfer ownership or redirect users).
  • The matchAboutBlank edge case (Yahoo Mail print popups) is deferred — documented in the README limitations section. Core functionality on normal pages is unaffected.
  • Tagged as v5.0.0 on my fork.

MV3 changes (src/chrome/manifest.json):
- manifest_version 2 -> 3, version 4.0.5 -> 4.1.0
- browser_action -> action
- Add 'scripting' permission
- web_accessible_resources: string array -> object form with matches

API migration (src/chrome/popup.js):
- chrome.tabs.executeScript -> chrome.scripting.executeScript
- chrome.tabs.insertCSS -> chrome.scripting.insertCSS
- code: string -> func: arrow function
- file: -> files: array
- result[0] -> result[0].result (ready-state polling)
- null tabId -> explicit target { tabId } from tabArray[0].id
- matchAboutBlank dropped (no MV3 equivalent; Yahoo Mail popup deferred)

Build modernization:
- Replace Grunt 0.4 + grunt-preprocess with build.js (Node, zero deps)
- Single devDependency: sass (Dart Sass ^1.77.0)
- npm run build / npm run clean scripts
- Replicates @echo / @if MODE / {version} preprocessing semantics
- Chrome extension output only; bookmarklet path untouched

Verified working in Chrome MV3.
- Major version bump (4.0.5 -> 5.0.0) for the breaking MV3 platform change
- README: add v5.0.0 changelog entry, building-from-source section,
  fork notice, and update limitations (dead Google Code link removed)
- Rebuild dist/ with 5.0.0 version strings
- Keep Chris Coyier as author (original creator)
- Add contributors: Devon Govett, Rob Garrison (original),
  Joshua Kimsey (MV3 migration)
- Point homepage_url to the active fork
- build.js: add --package flag that builds then zips dist/chrome/
  contents (manifest.json at zip root) into dist/printliminator-vX.Y.Z.zip
  using a zero-dependency zip writer
- package.json: add 'npm run package' script
- PRIVACY.md: Web Store-required privacy policy (extension collects no data)
- PUBLISHING.md: pre-written copy for every Chrome Web Store dashboard field
- .gitignore: exclude dist/*.zip build artifacts
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