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
, anddevDependencies
are 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
, andyarn
runtimes (on your host machine) satisfy the configuredengines
constraint.--entries
- Check themain
,module
,browser
,types
,typings
,bin
, andman
entry points are valid by:- Requiring either
main
orexports
to be configured. - Verifying the relative path exists on the file system.
- Requiring either
--license
- Check thatlicense
is a valid SPDX license and aLICENSE
(orLICENSE.md
) file exists.--links
- Check thathomepage
andbugs
links are valid URLs.--meta
- Check thatname
,version
,description
, andkeywords
are valid.--people
- Check thatauthor
andcontributors
contain a name and optional but valid URL.--repo
- Check thatrepository
exists and is a valid URL.--skipPrivate
- Skipprivate
packages 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