Fix JSR bug + Major simplification (v0.3.0)#10
Merged
Conversation
- Fix critical bug: JSR installations now generate valid hook paths (fixes #9) * Detect JSR installations and use .href instead of .pathname * Preserves full jsr:@scope/package@version/path format - Add comprehensive version management with deno task version command * Display current version * Bump patch/minor/major versions automatically * Create and push release tags * Built-in help and validation - Improve integration test path validation * Extract and validate exact path format * Reject invalid paths like /@scope/package/...
- Add 'deno task tag-dev' to create timestamped dev pre-releases - Add 'deno task tag' to create stable releases with tests - Add 'deno task test-all' combining unit and integration tests - Update GitHub Actions to publish dev tags (v*.*.*-dev.*) - Remove duplicate 'install' task from deno.json - Dev versions use format: 0.2.1-dev.1734197345 (version-dev.timestamp) - deno.json remains at stable version (no modifications for dev releases)
- Changed from 'deno add' which modifies local config - Now uses 'deno run -A jsr:@Package@version' for non-invasive testing - Updated PR description with correct test command
- Dev tags were publishing as stable releases (0.2.1 instead of 0.2.1-dev.*) - Extract version from git tag and pass to deno publish --set-version - Only apply --set-version for dev releases (contains '-dev.') - Stable releases continue using version from deno.json This fixes the issue where 0.2.1-dev.1765777443 was published as 0.2.1
- Upgrade denoland/setup-deno from v1 to v2 - Change deno-version from v1.x to v2.x - Deno 2.x supports --set-version flag for dev pre-releases - Allows publishing dev versions without modifying deno.json
- Change from timestamp-based (x.x.x-dev.timestamp) to incremental (x.x.x-dev.1, x.x.x-dev.2, etc.) - Update deno.json with dev version before creating tag (JSR requirement) - Commit version change automatically as part of dev release process - Push both commit and tag together This fixes the JSR publish error where version in config must match publish version.
- Add 'deno task version reset' to revert from dev to stable version - Display warning when running 'deno task version' on dev version - Prevent creating stable release tag when on dev version - Auto-commit and push version reset changes - Update help text with reset command and workflow examples
- Query git tags to find highest existing dev number - Automatically increment to next available dev version - Remove tag existence check (no longer needed with auto-increment) - Example: If v0.2.1-dev.1 exists, automatically create v0.2.1-dev.2 This allows running 'deno task tag-dev' multiple times without manual cleanup.
- Remove git tag querying logic - Only look at version in deno.json to determine next dev number - If collision occurs, user will get an error (their responsibility) - Simpler and more predictable behavior
- Changed from 'git commit -am' to 'git add deno.json && git commit -m' - The -a flag was staging ALL modified files, bypassing hooks on unstaged changes - Now only commits the specific file that was modified (deno.json) - This ensures pre-commit hooks run on all committed code
- Delete src/run.ts (no longer need runtime execution) - Delete src/executor.ts (no more built-in hooks) - Delete src/files.ts (no more file filtering logic) - Delete src/hook.ts (no more complex type definitions) Part of major architectural simplification to self-contained hooks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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
This PR includes:
Part 1: Bug Fix (Issue #9)
Changes
import.meta.url.startsWith("jsr:").hrefto preserve fulljsr:@scope/package@version/pathformat.pathnamefor absolute filesystem path/@theswanfactory/deno-hooks/0.2.0/src/run.tsjsr:@theswanfactory/deno-hooks@0.2.0/src/run.tsTest Improvements
Part 2: Version Management
New Features
Added comprehensive version management script (scripts/version.ts)
deno task version- Display current versiondeno task version patch/minor/major- Bump version automaticallydeno task version tag- Create and push release tagdeno task version dev- Create dev pre-release tagDev pre-release workflow for testing JSR installations
deno task tag-dev- Runs tests and creates timestamped dev tagdeno task tag- Runs tests and creates stable release tag0.3.0-dev.1734197345Part 3: Major Architectural Simplification (v0.3.0)
Breaking Changes
Simplified Configuration Format
Before (v0.2.x):
After (v0.3.0):
Self-Contained Hook Scripts
Generated hooks are now standalone bash scripts with no dependencies on deno-hooks:
What Was Removed
deno-fmt,deno-lint,deno-test) - usedeno taskinsteadpass_filenameslogicWhat Was Added
set -eBenefits
Files Modified
Core implementation:
Files removed:
Documentation:
Examples:
Tests:
Migration Guide
For Existing Users (v0.2.x → v0.3.0)
Update your configuration file (deno-hooks.yml or deno.json):
deno-fmt) withdeno task fmtglob,pass_filenames, etc.Define tasks in deno.json:
{ "tasks": { "fmt": "deno fmt --check", "lint": "deno lint", "test": "deno test -A" } }Run
deno task hooksto reinstall with new formatTest Results
All tests passing:
Closes
Fixes #9
🤖 Generated with Claude Code