nyron fix
Validate and repair your Nyron setup
nyron fix
Validate and repair inconsistencies in your Nyron setup by checking configuration, metadata, and package files.
Usage
npx @nyron/cli fix
This command scans your entire Nyron setup and automatically fixes most issues, prompting you only when manual intervention is needed.
What It Does
The fix
command performs a comprehensive validation of your Nyron setup in four phases:
Phase 1: Detection
Scans for issues across your setup:
- Path validation - Checks if project directories exist
- package.json validation - Verifies all projects have valid package.json with required
version
field - Orphaned packages - Finds packages in
meta.json
orversions.json
that aren't in your config - Missing packages - Finds packages in config that aren't in metadata files
- Version mismatches - Detects when package.json versions differ from meta.json versions
- Latest release tag - Checks if the Nyron release tag in meta.json matches the latest tag in git
Phase 2: Auto-fix
Automatically fixes issues without prompting:
- Removes orphaned packages from
meta.json
andversions.json
(config is source of truth) - Adds missing packages to
meta.json
andversions.json
with their current versions - Syncs version mismatches from
package.json
tometa.json
(package.json is source of truth) - Updates latest Nyron release tag in
meta.json
from git tags (keeps track of your latest release)
Phase 3: Prompt for Path Issues
Asks for your input on filesystem issues:
- Missing directories - Prompts to create missing project directories with package.json
- Missing package.json - Prompts to create package.json with version 0.0.0
- Invalid package.json - Prompts to add missing
version
field
Phase 4: Report
Shows a comprehensive summary of all fixes applied.
When to Use
Run nyron fix
when:
- You've manually edited
nyron.config.ts
and added/removed projects - You suspect inconsistencies between your config and metadata files
- You're getting errors from other Nyron commands
- You've manually modified package versions
- You're setting up an existing project with Nyron
Example Output
$ npx @nyron/cli fix
🔍 Scanning Nyron setup for issues...
🔧 Auto-fixing issues...
⚠️ Path "packages/new-package" for project "new-package" doesn't exist.
Create directory with package.json? (y/n): y
============================================================
📋 Fix Summary
============================================================
Applied fixes:
1. Removed orphaned package "old-api" from meta.json
2. Removed orphaned package "old-api" from versions.json
3. Added missing package "new-package" to meta.json with version 0.0.0
4. Added missing package "new-package" to versions.json with version 0.0.0
5. Synced version for "cli": 1.0.0 → 1.1.0
6. Updated latest Nyron release tag: (not set) → nyron-release@2024-10-13@12-30-45.678
7. Created directory and package.json for "new-package" at packages/new-package
✅ Total: 7 fix(es) applied.
No Issues Found
If everything is in good shape, you'll see:
🔍 Scanning Nyron setup for issues...
✅ No issues found! Your Nyron setup is in good shape.
Configuration as Source of Truth
The fix
command treats your nyron.config.ts
as the single source of truth:
- If a package exists in config → it's added to metadata files
- If a package doesn't exist in config → it's removed from metadata files
For version conflicts, package.json
is the source of truth and metadata is synced to match it.
Nyron Release Tag Sync
The fix
command automatically checks and updates the latest Nyron release tag in meta.json
to match your git repository. This happens every time you run fix
, even if there are no other issues.
What it does:
- Fetches the latest
nyron-release@
tag from your git repository - Compares it with the tag stored in
meta.json
- Updates
meta.json
if they don't match (or if no tag is set) - Shows
(not set)
in the output if this is the first time setting the tag
This tag is used internally to track releases and generate changelogs between versions. The tag follows the format nyron-release@YYYY-MM-DD@HH-MM-SS.mmm
and is created when you use nyron push-tag
.
Best Practices
- Run after config changes - Always run
fix
after editingnyron.config.ts
- Commit metadata changes - After fixing, commit the updated
.nyron/
files - Review before accepting - Read the fix summary to understand what changed
- Safe to run anytime - The command is non-destructive and prompts before creating files
Related Commands
nyron init
- Initialize Nyron in your projectnyron bump
- Bump project versions