Skip to content

feat: Add IIFE bundle for script-tag installs#1

Merged
Artem-Okladov merged 3 commits into
mainfrom
feat/iife
Jun 8, 2026
Merged

feat: Add IIFE bundle for script-tag installs#1
Artem-Okladov merged 3 commits into
mainfrom
feat/iife

Conversation

@Artem-Okladov

Copy link
Copy Markdown
Collaborator

Summary

Re-introduces the IIFE distribution path that v1.1 had removed. Host apps that
don't use npm or a bundler (PHP, Python, Java, ASP.NET, Ruby, classic HTML) can
now load the connector via a single <script> tag served from jsDelivr.

The runtime API is unchanged. LearnosityWProofreader.init({...}) from a
<script> tag is identical to the ESM call site.

What changed

  • package.json: version bumped to 1.2.0; added esbuild ^0.23.0 as a dev
    dependency; added a build script that produces dist/wproofreader-learnosity.min.js
    via esbuild (IIFE, minified, ~5 KB); added a prepack hook so the bundle is
    regenerated automatically at publish time; added dist/ to files.
  • .gitignore: added dist/. The bundle is a build artefact, not committed
    source. It ships in the npm tarball, not in the repo.
  • .github/workflows/ci.yml: added a build step after the existing test
    step, plus a soft bundle-size check that emits a GitHub Actions warning when
    the bundle exceeds 10 KB. Does not fail the build.
  • README.md: split the "Install" section into "Via npm (Node host apps)"
    and "Via <script> tag (non-Node host apps)" subsections. The second
    subsection documents the pinned jsDelivr URL for v1.2.0 and notes the bundle
    is about 5 KB minified with no runtime dependencies.
  • CHANGELOG.md: added v1.2.0 entry under Features.

How to verify

npm install
npm run build
ls -lh dist/wproofreader-learnosity.min.js   # ~5 KB

@Artem-Okladov Artem-Okladov merged commit a9fde8e into main Jun 8, 2026
3 checks passed
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