Skip to content

Comments

Breaking: Extract AdaptFrameworkUtils into individual utility files (fixes #153)#154

Open
taylortom wants to merge 5 commits intomasterfrom
issue/153
Open

Breaking: Extract AdaptFrameworkUtils into individual utility files (fixes #153)#154
taylortom wants to merge 5 commits intomasterfrom
issue/153

Conversation

@taylortom
Copy link
Contributor

Summary

  • Extracts pure utility functions from AdaptFrameworkUtils static class into individual files under lib/utils/
  • Replaces local readJson, writeJson, toBoolean, ensureDir implementations with core imports
  • Replaces Utils.spawn() in AdaptFrameworkImport with named spawn import from core
  • Fixes inferBuildAction bug where URLs without a trailing slash (e.g. /import) had the last character truncated
  • Adds tests/utils.spec.js with 14 tests for the extracted functions

New files

File Description
lib/utils/inferBuildAction.js Infer framework action from request URL
lib/utils/getPluginUpdateStatus.js Semver-based plugin update status code
lib/utils/getImportContentCounts.js Count content items by _type
lib/utils.js Barrel re-export

Changed files

File Change
lib/AdaptFrameworkUtils.js Class methods delegate to extracted/core functions, marked @deprecated
lib/AdaptFrameworkBuild.js Import ensureDir from core, remove local method
lib/AdaptFrameworkImport.js Replace Utils with spawn named import
package.json Point adapt-authoring-core at issue/91 branch

Test plan

  • All 127 tests pass (14 new + 113 existing)
  • Extracted functions tested directly via tests/utils.spec.js
  • Backward-compatible class delegation verified via existing AdaptFrameworkUtils.spec.js
  • inferBuildAction bug fix verified (URLs without trailing slash)

Resolves #153

🤖 Generated with Claude Code

taylortom and others added 3 commits February 21, 2026 14:26
 #153)

- Extract pure utility functions to lib/utils/: inferBuildAction,
  getPluginUpdateStatus, getImportContentCounts
- Replace local readJson/writeJson/toBoolean with core imports
- Replace local ensureDir in AdaptFrameworkBuild with core import
- Replace Utils.spawn with named spawn import from core
- Fix inferBuildAction bug with URLs lacking trailing slash
- Add tests for all extracted utility functions
- Bump adapt-authoring-core dependency to issue/91 branch

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace git branch reference with semver range now that core PR #92
has been merged and released as 2.0.0.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Follow the convention from UTILS.md: one test file per extracted
utility, prefixed with utils-.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@taylortom taylortom changed the title Update: Extract AdaptFrameworkUtils into individual utility files (fixes #153) Breaking: Extract AdaptFrameworkUtils into individual utility files (fixes #153) Feb 21, 2026
taylortom and others added 2 commits February 21, 2026 15:18
Remove readJson, writeJson, inferBuildAction, toBoolean,
getPluginUpdateStatus, getImportContentCounts from the class.
All internal callers now use direct imports from core or ./utils.js.

External consumers (e.g. multilang) that use AdaptFrameworkUtils for
non-deprecated methods (copyFrameworkSource, etc.) are unaffected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Update: Extract AdaptFrameworkUtils into individual utility files

1 participant