validate
Before a package can be published, there are many requirements that should be checked and validated.
Does the package have a valid entry point? Does it have a license? Is the package.json configured
correctly? So on and so forth.
The validate command does just that and can be used to validate an array of options as a thorough
pre-publish step. It accomplishes this by inspecting the package's package.json and
build artifacts.
{
"scripts": {
"validate": "packemon validate"
}
}
Any errors found within the validation process will cause a non-zero exit code, while warnings only, or no warnings or errors would cause a zero exit code.
Options
Validate supports the following command line options.
--deps- Check thatdependencies,peerDependencies, anddevDependenciesare valid by:- Requiring peer deps to have version satisfying dev deps.
- Disallowing peer and prod deps of the same package.
- Disallowing
file:andlink:versions.
--engines- Check that the currentnode,npm, andyarnruntimes (on your host machine) satisfy the configuredenginesconstraint.--entries- Check themain,module,browser,types,typings,bin, andmanentry points are valid by:- Requiring either
mainorexportsto be configured. - Verifying the relative path exists on the file system.
- Requiring either
--license- Check thatlicenseis a valid SPDX license and aLICENSE(orLICENSE.md) file exists.--links- Check thathomepageandbugslinks are valid URLs.--meta- Check thatname,version,description, andkeywordsare valid.--people- Check thatauthorandcontributorscontain a name and optional but valid URL.--repo- Check thatrepositoryexists and is a valid URL.--skipPrivate- Skipprivatepackages from being packed.
By default all options are enabled, so you'd need to negate them with --no-* to disable each one
(this is not suggested).
packemon validate --no-people