NPM

kind: npm

sourceconditiontarget

source

The NPM "source" retrieves the latest version of a npm package matching a specific version filter.

condition

The NPM "condition" test that a specific version is published on a NPM registry.

target

The NPM "target" is not supported as we couldn’t think about a useful usecase. Feel free to open an issue suggesting one.

Parameter

NameTypeDescriptionRequired
namestringDefines the specific npm package name
npmrcpathstringNpmrcPath defines the path to the .npmrc file
registrytokenstringRegistryToken defines the token to use when connection to the registry
urlstringURL defines the registry url (defaults to https://registry.npmjs.org/)
versionstringDefines a specific package version
versionfilterobjectVersionFilter provides parameters to specify version pattern and its type like regex, semver, or just latest.
    kindstringspecifies the version kind such as semver, regex, or latest
    patternstringspecifies the version pattern according the version kind
    strictbooleanstrict enforce strict versioning rule. Only used for semantic versioning at this time

Example

# updatecli.yaml
name: NPM resource example
sources:
  axios: 
    name: Get latest axios version from npm registry
    kind: npm
    spec: 
      name: axios
  yaml:
    name: get latest yaml version matching ~0
    kind: npm
    spec: 
      name: yaml
      versionfilter: 
        kind: semver
        pattern: ~0
conditions:
  axios: 
    name: Test that axios version 1.0.0 exists on the NPM registry
    kind: npm
    disablesourceinput: true
    spec: 
      name: axios
      version: 1.0.0
  yaml:
    name: Test that that YAML version matching ~0 exist on registry
    kind: npm
    sourceid: yaml
    spec: 
      name: yaml
targets:
  # Targets are not supported
Top