Specifier Types
Specifier types categorise the different formats a version specifier can have in package.json files.
They can be used in version groups and other configuration to apply specific rules to dependencies based on how their versions are specified, to ban unsupported
versions or check for updates for only exact
versions for example.
All Values
Section titled “All Values”A dependency that uses npm's alias syntax to reference a package under a different name.
Example: npm:@preact/compat
A dependency with a precise version number, including potential pre-release identifiers.
Examples: 1.2.3
, 1.2.3-alpha
, 1.2.3-rc.1
A dependency referencing a local file path on the filesystem.
Example: file:./path/to/package
A dependency directly referencing a Git repository.
Example: git+https://github.com/user/repo.git
latest
Section titled “latest”A dependency that resolves to the latest available version. Includes wildcard patterns.
Examples: latest
, *
A dependency specifier that only indicates the major version number.
Example: 1
A dependency specifier that includes both major and minor version numbers.
Example: 1.2
missing
Section titled “missing”A local package.json with a missing version
field
A dependency that uses standard semver range syntax with a complete version number.
Examples: ^1.2.3
, ^1.2.3-alpha
, ^1.2.3-rc.1
range-complex
Section titled “range-complex”A dependency that uses multiple ranges combined with logical operators.
Example: ^1.2.3-alpha || ~1.2.3-rc.1
range-major
Section titled “range-major”A dependency that uses a range operator with only a major version.
Example: ^1
range-minor
Section titled “range-minor”A dependency that uses a range operator with major and minor versions.
Example: ^1.2
A dependency referencing an npm distribution tag rather than a version.
Example: alpha
unsupported
Section titled “unsupported”A dependency with a version specifier that syncpack cannot parse or handle.
Example: wtf|#|broken
A dependency referencing a URL to a package distribution.
Example: https://example.com/package
workspace-protocol
Section titled “workspace-protocol”A dependency that uses the workspace protocol for monorepo local references.
Example: workspace:*
Using Specifier Types
Section titled “Using Specifier Types”Specifier types can be used in various contexts within syncpack:
Command Line Filtering
Section titled “Command Line Filtering”Use the --specifier-types
option to target dependencies with specific version formats:
# Only check dependencies with exact versionssyncpack lint --specifier-types exact
# Find dependencies using any kind of rangesyncpack list --specifier-types range,range-major,range-minor
# Check everything except URL dependenciessyncpack lint --specifier-types '!url'
Configuration
Section titled “Configuration”Specifier types can be used to target and filter Version Groups, to apply specific rules to dependencies based on their version format.