Skip to content

Yarn configuration file variables aren't supported completely #1609

@richard-underwood

Description

@richard-underwood

npm-check-updates supports loading authentication tokens from .yarnrc.yml files. It also supports simple variables such as ${VAR} but does not support variables with fallback ${VAR-fallback} and ${VAR:-fallback}.

This is needed as a different authentication token is needed for publishing and supplied on the command line.

Steps to Reproduce

Set up a .yarnrc.yml using a variable for the authentication token for a scope:

npmScopes:
  xxxxxx:
    npmAlwaysAuth: true
    npmAuthToken: ${YARN_NPM_AUTH_TOKEN:-ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxx}
    npmRegistryServer: 'https://npm.pkg.github.com'

Current Behaviour

The variable isn't interpreted correctly, and authentication fails:

Using yarn
Checking /zzz/package.json
[====================] 47/47 100%
 @xxxxxx/package-name  unauthenticated: User cannot be authenticated with the token provided. 

Expected Behaviour

The variable is parsed correctly and authentication succeeds using the fallback value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions