fix: rename hook files to .cjs for ES module compatibility#800
Open
ethan-hurst wants to merge 1 commit intogsd-build:mainfrom
Open
fix: rename hook files to .cjs for ES module compatibility#800ethan-hurst wants to merge 1 commit intogsd-build:mainfrom
ethan-hurst wants to merge 1 commit intogsd-build:mainfrom
Conversation
…#125) Projects with "type": "module" in package.json treat .js files as ES modules, breaking hooks that use CommonJS require(). Renaming to .cjs forces Node.js to always treat them as CommonJS regardless of project module type. - Rename gsd-check-update.js → .cjs - Rename gsd-statusline.js → .cjs - Rename gsd-context-monitor.js → .cjs - Add old .js filenames to orphan cleanup for upgrades - Update statusline migration to target .cjs - Update build script and docs
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.
Summary
ReferenceError: require is not definedin projects with"type": "module"inpackage.json.jsto.cjsso Node.js always treats them as CommonJS regardless of project module type.jsfilenames to orphan cleanup lists so upgrades remove stale hooks and settings referencesChanges
hooks/gsd-check-update.js→hooks/gsd-check-update.cjshooks/gsd-statusline.js→hooks/gsd-statusline.cjshooks/gsd-context-monitor.js→hooks/gsd-context-monitor.cjsbin/install.js— updated hook paths, orphan cleanup, file templating, statusline migrationscripts/build-hooks.js— updated copy listdocs/context-monitor.mdandget-shit-done/workflows/update.md— updated referencesTest plan
npm run build:hookscopies.cjsfiles correctly"type": "module"— verify norequire is not definederror on startup.jshooks are cleaned up