refactor!: modernize codebase, switch to ES Modules, and replace Gulp with Microbundle#22
Open
cougrimes wants to merge 2 commits intoamorey:masterfrom
Open
refactor!: modernize codebase, switch to ES Modules, and replace Gulp with Microbundle#22cougrimes wants to merge 2 commits intoamorey:masterfrom
cougrimes wants to merge 2 commits intoamorey:masterfrom
Conversation
* **build:** replaced Gulp build system with Microbundle for zero-config, optimized builds. * **core:** refactored `src/sentinel.js` to a standard ES Module, removing the invalid top-level `return` statement. * **chore:** removed `bower.json` in favor of NPM and `unpkg` distribution. ### Features * **core:** refactored source to ES Modules (`export default`), enabling tree-shaking and direct import in modern tools. * **build:** implemented `microbundle` to auto-generate UMD, CJS, and ESM formats. * **docs:** added automated pipeline to generate a full documentation website from `examples/` using TypeDoc. * **legacy:** added explicit `window.sentinel` assignment and `sentinel-load` event dispatch for legacy script tag support. ### Bug Fixes * **core:** fixed issue where `off()` failed to clear callbacks when no specific callback function was provided. * **core:** corrected invalid syntax (top-level return) that prevented modern test runners from executing source code directly. ### Documentation * **readme:** modernized installation instructions, added ES Module usage, and updated CDN links to `unpkg`. * **readme:** updated Browser Support matrix to accurately reflect modern environment (IE11+ via UMD, dropping IE10/Android 4.4 claims). * **tsdoc:** added comprehensive TSDoc comments to all public API methods for IDE IntelliSense. * **examples:** integrated `examples/` directory as first-class documentation pages in the generated site. ### Build * **test:** migrated test suite to `@web/test-runner` for faster, browser-native testing. * **config:** updated `package.json` with correct `source`, `module`, `unpkg`, and `types` entry points. * **chore:** removed outdated dev dependencies (`gulp`, `del`, `jshint`) and legacy templates.
… and import sentinel) for backward compatability. This does generate a harmless "Consumers of your bundle will have to use `sentinel["default"]` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning". However, smart bundlers already know to look at default... by default.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
I have modernized the repository by migrating the source code to ES Modules, replacing the Gulp build system with Microbundle, and implementing an automated documentation pipeline using TypeDoc.
Why
The previous codebase contained invalid JavaScript (top-level
returnstatement) that prevented modern test runners and bundlers from processing the source directly. Additionally, the project relied on deprecated tooling (Bower, Gulp v3) and outdated documentation practices that made maintenance difficult and prevented tree-shaking for end users.How
src/sentinel.jsto a standard ES Module (export default), allowing it to be imported directly in modern tools while preserving the globalwindow.sentinelfor legacy browser support.umd-templates/with Microbundle, which automatically generates optimized UMD, CJS, and ESM formats.TypeDocand a custom script (scripts/build-docs-data.js) that automatically generates documentation pages from the raw HTML files inexamples/, ensuring the docs and code examples never drift apart.describe,it) and Chai for assertions (assert,expect), relying on global variables in a browser environment. This was migrated to@web/test-runner, enabling faster, browser-native testing without a build step.bower.jsonand updatedpackage.jsonentry points (source,module,unpkg) to align with modern standards.Testing
npm run testto verify the test suite passes in a headless browser via@web/test-runner.npm run buildand verified thatdist/contains validsentinel.umd.js(legacy) andsentinel.module.js(modern) files.npm run docs:buildand visually verified the generated site indocs/index.htmlcorrectly lists the API and renders the Examples sidebar.const/lettovar, ensuring syntax compatibility for IE11.Questions
animationstartevents (which these browsers do not support without prefixes). The code is technically syntax-compatible (ES5), but functionally incompatible without polyfills. Is this acceptable?