-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Add deno-jsr-check built-in hook to validate JSR package metadata and structure before publishing, catching common issues early.
Motivation
Publishing to JSR requires:
- Specific
deno.jsonstructure - Valid exports configuration
- Proper versioning
- README and documentation
- License information
Catching these issues in a pre-push hook saves time and prevents publishing failures.
Proposed Solution
hooks:
pre-push:
- id: jsr-validate
run: deno-jsr-check
config:
checkExports: true
checkVersion: true
checkReadme: true
checkLicense: true
checkDocs: trueImplementation
Built-in hook that validates:
- Exports field: Ensure
deno.jsonhas valid exports
// Check that all export paths exist
const config = JSON.parse(await Deno.readTextFile("deno.json"));
for (const [name, path] of Object.entries(config.exports)) {
if (!await exists(path)) {
violations.push(`Export "${name}" points to non-existent ${path}`);
}
}- Version format: Validate semver in package.json/deno.json
const version = config.version;
if (!version.match(/^\d+\.\d+\.\d+$/)) {
violations.push(`Invalid version format: ${version}`);
}- README: Ensure README.md exists and has content
- License: Check for LICENSE file
- Documentation: Verify JSDoc on public exports
- Package name: Validate format (
@scope/name)
Configuration Options
checkExports: Validate exports field (default: true)checkVersion: Validate version format (default: true)checkReadme: Require README.md (default: true)checkLicense: Require LICENSE file (default: true)checkDocs: Validate JSDoc comments (default: false)minReadmeLength: Minimum README length in chars (default: 100)
Example Validations
Missing export:
❌ JSR validation failed:
- Export "./install" points to non-existent src/install.ts
Invalid version:
❌ JSR validation failed:
- Invalid version format: "1.0" (expected semver like "1.0.0")
Missing README:
❌ JSR validation failed:
- README.md not found (required for JSR publishing)
Benefits
- ✅ Catch publishing issues before push
- ✅ Ensure JSR package quality
- ✅ Ecosystem play - Help grow JSR adoption
- ✅ Unique to Deno - JSR-specific validation
- ✅ Save time vs failed publishes
Use Cases
Library authors:
hooks:
pre-push:
- id: jsr-ready
run: deno-jsr-check
config:
checkExports: true
checkVersion: true
checkReadme: true
checkLicense: true
checkDocs: true # Ensure public APIs documentedQuick projects:
hooks:
pre-push:
- id: jsr-basic
run: deno-jsr-check
config:
checkExports: true
checkVersion: trueFiles to Modify
src/executor.ts- AdddenoJsrCheckbuilt-in hook- Create
src/jsr-validator.ts- JSR validation logic
Priority
LOW - High marketing value for JSR ecosystem, but niche use case. Good for "Phase 2" features.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request