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.

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-runPreview changes without modifying files.
-r, --replace-fileOverwrite the original file instead of creating a .nova-backup copy.