Skip to main content

Normalize Artifacts

Normalize files, bin, man, directories, private, and publishConfig fields in workspace package.json files.

Summary

The normalize-artifacts recipe ensures that publish and artifact-related fields in each workspace's package.json match the conventions defined by the workspace role and policy.

It handles file inclusion lists, binary entry points, man pages, directory mappings, private flags, and publish configuration.

Why Use This Command?

  1. Keeps publish artifacts consistent with each workspace's role and distribution policy.
  2. Normalizes equivalent manifest shapes so downstream package tools see predictable values.
  3. Removes inapplicable publishing fields before they can misrepresent a private workspace.

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>.normalize-artifacts in nova.config.json.
  • Workspace manifest — The configured workspace must contain a readable package.json file.

Behavior

For each eligible workspace, the recipe inspects artifact and publish fields and applies the following rules. See Workspace Rules for how tags are determined.

  • files (Conditional) — Removed if the workspace role is not package or tool. If the role allows it but the array is empty, the field is also removed.
  • bin (Conditional) — Removed if the workspace role is not package or tool. If the role allows it and the value is a string, it is normalized into an object using the unscoped package name as the key (e.g., "./cli.js" becomes { "my-tool": "./cli.js" }). If empty, the field is removed.
  • man (Conditional) — Removed if the workspace role is not package or tool. If the role allows it and the value is a string, it is normalized into a single-element array. If empty, the field is removed.
  • directories (Conditional) — Removed if the workspace role is not package or tool. If the role allows it but the object is empty, the field is removed.
  • private (Required) — Set to false when the workspace policy is distributable, and true for all other policies. Non-boolean values and mismatches are corrected.
  • publishConfig (Conditional) — Removed if the workspace policy is not distributable. If the policy is distributable but the object is empty, the field is also removed.

Usage

Options

FlagDescription
-d, --dry-runRun without writing any files.
-r, --replace-fileOverwrite the original file instead of creating a .nova-backup copy.