Skip to content

use npm directly - #4086

Merged
Garrett Campbell (gcampbell-msft) merged 4 commits into
mainfrom
dev/gcampbell/UseNpmDirectly
Oct 9, 2024
Merged

Garrett Campbell (gcampbell-msft) merged 4 commits into
mainfrom
dev/gcampbell/UseNpmDirectly

Conversation

@gcampbell-msft

Copy link
Copy Markdown
Collaborator

See title.

@bobbrow

Bob Brown (bobbrow) commented Sep 19, 2024 •

Copy link
Copy Markdown
Contributor

Was there a problem with the tasks? We use Npm@0 for our extension too and wondering what this is for.

@snehara99
snehara99 self-requested a review October 9, 2024 17:34
@gcampbell-msft
Garrett Campbell (gcampbell-msft) deleted the dev/gcampbell/UseNpmDirectly branch October 9, 2024 19:15
Hannia Valera (hanniavalera) added a commit that referenced this pull request Jun 15, 2026
The prior commit a3316fa deleted the user .npmrc and left always-auth=true
in the project .npmrc, but neither was the cause of the E401. The actual cause:
the azure-public/cpp_PublicPackages CFS feed under CFSClean network isolation
only serves package versions that have already been saved to the feed - it
does not transparently pull from upstream npmjs. Requests for [email protected]
return 401 because that tarball is not in the feed; [email protected] IS in the
feed and IS pre-installed on the 1ESPT-Windows2025 image. The npm error
'authentication token seems to be invalid' is just how npm formats any 401
with a WWW-Authenticate: Bearer header.

This change adopts the working microsoft/vscode-cpptools and
microsoft/vscode-makefile-tools loc pipeline pattern:
- Use pre-installed Yarn 1.22.22 (no npm install -g yarn).
- Use @vscode/vsce from devDependencies via 'yarn run vsce' (no npm install
  -g @vscode/vsce) in pipelines that check out the repo.
- Drop always-auth=true from .npmrc. It is a no-op for anonymous CFS reads
  in both clients: npm 10 ignores it entirely (removed in v7.11.1, will
  warn/error in npm 11/12), and Yarn 1 gates the Authorization header
  behind 'if (authorization)' so it has no effect without a configured
  credential. Mirrors microsoft/vscode-cpptools#13377.
- Bump the packageManager field to [email protected] to match the pre-installed
  Yarn the signing pipelines now rely on.
- Keep the del %USERPROFILE%\.npmrc cleanup step and the npm_config_registry
  env on yarn/vsce steps as defense-in-depth. Both are no-ops on the current
  1ESPT-Windows2025 image and yarn.lock pinning, but guard against future
  image changes that inject a scoped .npmrc or a tool that reads
  npm_config_registry directly.

The release.yml / prerelease.yml release jobs do not check out the repo, so
they cannot use the devDependency. They keep 'npm install -g @vscode/vsce'
but pin to @3.1.0 - the same version the build pipelines resolve via
yarn.lock, verified saved in the CFS feed. Without a pin, npm would resolve
'latest' to 3.9.2, which is NOT saved in the feed and 401s; a3316fa
inherited this latent bug from #4086. Pinning to 3.1.0 keeps the package,
sign, and publish steps on a single vsce version.

Long-term, the cleaner fix is to bundle vsce into the vsix artifact so
release jobs never hit the feed for tooling.
Hannia Valera (hanniavalera) added a commit that referenced this pull request Jun 16, 2026
The prior commit a3316fa deleted the user .npmrc and left always-auth=true
in the project .npmrc, but neither was the cause of the E401. The actual cause:
the azure-public/cpp_PublicPackages CFS feed under CFSClean network isolation
only serves package versions that have already been saved to the feed - it
does not transparently pull from upstream npmjs. Requests for [email protected]
return 401 because that tarball is not in the feed; [email protected] IS in the
feed and IS pre-installed on the 1ESPT-Windows2025 image. The npm error
'authentication token seems to be invalid' is just how npm formats any 401
with a WWW-Authenticate: Bearer header.

This change adopts the working microsoft/vscode-cpptools and
microsoft/vscode-makefile-tools loc pipeline pattern:
- Use pre-installed Yarn 1.22.22 (no npm install -g yarn).
- Use @vscode/vsce from devDependencies via 'yarn run vsce' (no npm install
  -g @vscode/vsce) in pipelines that check out the repo.
- Drop always-auth=true from .npmrc. It is a no-op for anonymous CFS reads
  in both clients: npm 10 ignores it entirely (removed in v7.11.1, will
  warn/error in npm 11/12), and Yarn 1 gates the Authorization header
  behind 'if (authorization)' so it has no effect without a configured
  credential. Mirrors microsoft/vscode-cpptools#13377.
- Bump the packageManager field to [email protected] to match the pre-installed
  Yarn the signing pipelines now rely on.
- Keep the del %USERPROFILE%\.npmrc cleanup step and the npm_config_registry
  env on yarn/vsce steps as defense-in-depth. Both are no-ops on the current
  1ESPT-Windows2025 image and yarn.lock pinning, but guard against future
  image changes that inject a scoped .npmrc or a tool that reads
  npm_config_registry directly.

The release.yml / prerelease.yml release jobs do not check out the repo, so
they cannot use the devDependency. They keep 'npm install -g @vscode/vsce'
but pin to @3.1.0 - the same version the build pipelines resolve via
yarn.lock, verified saved in the CFS feed. Without a pin, npm would resolve
'latest' to 3.9.2, which is NOT saved in the feed and 401s; a3316fa
inherited this latent bug from #4086. Pinning to 3.1.0 keeps the package,
sign, and publish steps on a single vsce version.

Long-term, the cleaner fix is to bundle vsce into the vsix artifact so
release jobs never hit the feed for tooling.
Hannia Valera (hanniavalera) added a commit that referenced this pull request Jun 16, 2026
…401 (#4976)

The prior commit a3316fa deleted the user .npmrc and left always-auth=true
in the project .npmrc, but neither was the cause of the E401. The actual cause:
the azure-public/cpp_PublicPackages CFS feed under CFSClean network isolation
only serves package versions that have already been saved to the feed - it
does not transparently pull from upstream npmjs. Requests for [email protected]
return 401 because that tarball is not in the feed; [email protected] IS in the
feed and IS pre-installed on the 1ESPT-Windows2025 image. The npm error
'authentication token seems to be invalid' is just how npm formats any 401
with a WWW-Authenticate: Bearer header.

This change adopts the working microsoft/vscode-cpptools and
microsoft/vscode-makefile-tools loc pipeline pattern:
- Use pre-installed Yarn 1.22.22 (no npm install -g yarn).
- Use @vscode/vsce from devDependencies via 'yarn run vsce' (no npm install
  -g @vscode/vsce) in pipelines that check out the repo.
- Drop always-auth=true from .npmrc. It is a no-op for anonymous CFS reads
  in both clients: npm 10 ignores it entirely (removed in v7.11.1, will
  warn/error in npm 11/12), and Yarn 1 gates the Authorization header
  behind 'if (authorization)' so it has no effect without a configured
  credential. Mirrors microsoft/vscode-cpptools#13377.
- Bump the packageManager field to [email protected] to match the pre-installed
  Yarn the signing pipelines now rely on.
- Keep the del %USERPROFILE%\.npmrc cleanup step and the npm_config_registry
  env on yarn/vsce steps as defense-in-depth. Both are no-ops on the current
  1ESPT-Windows2025 image and yarn.lock pinning, but guard against future
  image changes that inject a scoped .npmrc or a tool that reads
  npm_config_registry directly.

The release.yml / prerelease.yml release jobs do not check out the repo, so
they cannot use the devDependency. They keep 'npm install -g @vscode/vsce'
but pin to @3.1.0 - the same version the build pipelines resolve via
yarn.lock, verified saved in the CFS feed. Without a pin, npm would resolve
'latest' to 3.9.2, which is NOT saved in the feed and 401s; a3316fa
inherited this latent bug from #4086. Pinning to 3.1.0 keeps the package,
sign, and publish steps on a single vsce version.

Long-term, the cleaner fix is to bundle vsce into the vsix artifact so
release jobs never hit the feed for tooling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants