Cleanup
Remove unsupported keys and reorder remaining keys in workspace package.json files.
Summary
The cleanup recipe finalizes each workspace's package.json by removing keys that are not in the known set of npm, Node.js, Corepack, ecosystem, or bundler fields and reordering remaining keys to a canonical order.
Behavior is controlled per-workspace via recipe settings in nova.config.json.
Why Use This Command?
- Removes unsupported manifest keys so stale or misspelled metadata cannot linger unnoticed.
- Applies one canonical key order so package diffs focus on values instead of layout.
- Lets each workspace opt out of removal or reordering when a real exception is needed.
Requirements
- Node.js runtime — Use a supported Node.js LTS release with the Nova CLI available.
- Project config — Register the workspace and enable
recipes.package-json.<workspace>.cleanupinnova.config.json. - Workspace manifest — The configured workspace must contain a readable
package.jsonfile.
Behavior
For each eligible workspace, the recipe applies up to two operations in order:
- Remove unknown keys — Every key in
package.jsonis checked against a combined allowlist of npm, Node.js, Corepack, ecosystem, and bundler fields. Keys not in the allowlist are logged as a warning and then deleted. Disable per-workspace by settingremoveUnknownKeystofalse. - Reorder keys — All remaining keys are reordered to a canonical sort order. Known keys are placed first in the defined order. Unknown keys (when
removeUnknownKeysisfalse) are appended after known keys in their original relative order. If the key order already matches, no changes are made. Disable per-workspace by settingreorderKeystofalse.
Settings
| Setting | Default | Description |
|---|---|---|
removeUnknownKeys | true | Remove keys not recognized by npm, Node.js, Corepack, ecosystem, or bundlers. |
reorderKeys | true | Reorder keys to a canonical sort order. |
Usage
Options
| Flag | Description |
|---|---|
-d, --dry-run | Run without writing any files. |
-r, --replace-file | Overwrite the original file instead of creating a .nova-backup copy. |
Unsupported Keys
During cleanup, this recipe removes any package.json keys that are not in the known set of npm, Node.js, Corepack, ecosystem, or bundler fields.
Disable this behavior per-workspace by setting removeUnknownKeys to false in the recipe settings.