Skip to content

Replace npm/npx usage with pnpm to stop npm warnings - #4973

Merged
Timothee Guerin (timotheeguerin) merged 4 commits into
Azure:mainfrom
timotheeguerin:cleanup-npm-leftover
Jul 21, 2026
Merged

Timothee Guerin (timotheeguerin) merged 4 commits into
Azure:mainfrom
timotheeguerin:cleanup-npm-leftover

Conversation

@timotheeguerin

Copy link
Copy Markdown
Member

Problem

Running pnpm install or various package scripts printed noisy warnings:

npm warn Unknown env config "catalog". This will stop working in the next major version of npm.
npm warn Unknown env config "verify-deps-before-run". ...
npm warn Unknown env config "auto-install-peers". ...

Root cause

pnpm exports all of its settings (.npmrc + pnpm-workspace.yaml catalog, verify-deps-before-run, minimum-release-age, etc.) into the environment as npm_config_* variables when it runs a script/lifecycle. Whenever npm or npx is invoked from inside that pnpm environment, npm reads those env vars, doesn't recognize the pnpm-specific keys, and warns.

The two sources were:

  • The root preinstall: "npx only-allow pnpm" → ran on every pnpm install (install-time warnings).
  • package.json scripts using npm run ... / npx ... (script-time warnings).

Changes

  • Remove the root preinstall: "npx only-allow pnpm" line. pnpm usage stays enforced via packageManager + manage-package-manager-versions + engine-strict.
  • Convert npm run / npx / npm pack → pnpm / pnpm exec / pnpm dlx / pnpm pack in internal package.json scripts (typespec-autorest, -azure-resource-manager, -client-generator-core, -azure-portal-core, -autorest-canonical, -azure-playground-website, -java, -ts), the typespec-go .scripts helpers, GitHub Actions, and ADO pipelines.
  • Update hand-authored docs (root README, CONTRIBUTING, samples/playground READMEs, a couple of howtos) to pnpm.
  • Update the typespec-ts scenario-suite generator header and regenerate the suite files; recompile the doc-update gh-aw lock file.

Intentionally left as npm

  • core/ submodule (upstream microsoft/typespec).
  • tspd-generated package ## Install sections (the generator lives in core/).
  • Standalone npm sub-projects not in the pnpm workspace (typespec-java/emitter-tests, generator test package).
  • Docs describing external npm-based repos (azure-rest-api-specs) and tools that shell out to npm internally (tsp-client).
  • Generated customer-facing SDK templates that intentionally emit npm.
  • pnpm bootstrap (npm install -g pnpm) and nightly-e2e.yml building core packages with npm.

Verification

  • pnpm install → 0 npm warn messages.
  • pnpm exec tsp-spector --help resolves cleanly.
  • pnpm turbo run build --filter @azure-tools/typespec-azure-portal-core succeeds (nested pnpm chain works), 0 warnings.
  • pnpm chronus verify passes.

pnpm exports its settings (catalog, verify-deps-before-run, etc.) as
npm_config_* env vars, so any npm/npx invoked inside pnpm's environment
printed 'npm warn Unknown env config'. This removes those invocations:

- Remove root preinstall 'npx only-allow pnpm' (source of install-time
  warnings); pnpm stays enforced via packageManager + engine-strict.
- Convert 'npm run'/'npx'/'npm pack' to pnpm equivalents in internal
  package.json scripts, helper scripts, CI and ADO pipelines.
- Update user-facing docs and regenerate typespec-ts scenario-suite
  headers and the doc-update gh-aw lock file.

Excludes core submodule, tspd-generated package READMEs, standalone npm
subprojects (typespec-java emitter-tests), tsp-client/azure-rest-api-specs
docs, and generated customer-facing SDK templates.
@microsoft-github-policy-service microsoft-github-policy-service Bot added eng lib:azure-resource-manager Issues for @azure-tools/typespec-azure-core library emitter:autorest Issues for @azure-tools/typespec-autorest emitter emitter:go Issues for @azure-tools/typespec-go emitter emitter:typescript Issues for @azure-tools/typespec-ts emitter emitter:java Issues for @azure-tools/typespec-java emitter lib:tcgc Issues for @azure-tools/typespec-client-generator-core library meta:website TypeSpec.io updates labels Jul 20, 2026
This CI step runs as a standalone shell (not inside pnpm's env) so it
never produced the npm warn messages; autorest is a global external CLI
and eng/scripts is a standalone non-workspace npm package. pnpm add -g
autorest failed because the pnpm global bin dir isn't on PATH.
@azure-sdk-automation

Copy link
Copy Markdown
Contributor

You can try these changes here

🛝 Playground 🌐 Website

@pkg-pr-new

pkg-pr-new Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@azure-tools/typespec-autorest

npm i https://pkg.pr.new/Azure/typespec-azure/@azure-tools/typespec-autorest@4973

@azure-tools/typespec-autorest-canonical

npm i https://pkg.pr.new/Azure/typespec-azure/@azure-tools/typespec-autorest-canonical@4973

@azure-tools/typespec-azure-portal-core

npm i https://pkg.pr.new/Azure/typespec-azure/@azure-tools/typespec-azure-portal-core@4973

@azure-tools/typespec-azure-resource-manager

npm i https://pkg.pr.new/Azure/typespec-azure/@azure-tools/typespec-azure-resource-manager@4973

@azure-tools/typespec-client-generator-core

npm i https://pkg.pr.new/Azure/typespec-azure/@azure-tools/typespec-client-generator-core@4973

@azure-tools/typespec-go

npm i https://pkg.pr.new/Azure/typespec-azure/@azure-tools/typespec-go@4973

@azure-tools/typespec-java

npm i https://pkg.pr.new/Azure/typespec-azure/@azure-tools/typespec-java@4973

@azure-tools/typespec-ts

npm i https://pkg.pr.new/Azure/typespec-azure/@azure-tools/typespec-ts@4973

commit: 2df5cbd

…rsions

- start-test-server.js spawned 'npx tsp-spector' inside pnpm's env, which
  re-emitted the npm warn Unknown env config warnings -> use 'pnpm exec'.
- Revert all standalone CI/pipeline npx->pnpm conversions: they run outside
  pnpm's env (so they don't cause the warnings) and several ADO jobs lack
  pnpm on PATH (pnpm: command not found in the PR commenter job).
@azure-sdk-automation

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • ✅ @azure-tools/typespec-autorest-canonical
  • ✅ @azure-tools/typespec-autorest
  • ✅ @azure-tools/typespec-azure-portal-core
  • ✅ @azure-tools/typespec-azure-resource-manager
  • ✅ @azure-tools/typespec-client-generator-core
  • ✅ @azure-tools/typespec-go
  • ✅ @azure-tools/typespec-java
  • ✅ @azure-tools/typespec-ts
Show changes

@azure-tools/typespec-autorest - internal ✏️

Replace npm/npx usage in build and test scripts with pnpm equivalents to stop npm warn Unknown env config warnings when running inside the pnpm workspace.

@azure-tools/typespec-autorest-canonical - internal ✏️

Replace npm/npx usage in build and test scripts with pnpm equivalents to stop npm warn Unknown env config warnings when running inside the pnpm workspace.

@azure-tools/typespec-azure-portal-core - internal ✏️

Replace npm/npx usage in build and test scripts with pnpm equivalents to stop npm warn Unknown env config warnings when running inside the pnpm workspace.

@azure-tools/typespec-azure-resource-manager - internal ✏️

Replace npm/npx usage in build and test scripts with pnpm equivalents to stop npm warn Unknown env config warnings when running inside the pnpm workspace.

@azure-tools/typespec-client-generator-core - internal ✏️

Replace npm/npx usage in build and test scripts with pnpm equivalents to stop npm warn Unknown env config warnings when running inside the pnpm workspace.

@azure-tools/typespec-go - internal ✏️

Replace npm/npx usage in build and test scripts with pnpm equivalents to stop npm warn Unknown env config warnings when running inside the pnpm workspace.

@azure-tools/typespec-java - internal ✏️

Replace npm/npx usage in build and test scripts with pnpm equivalents to stop npm warn Unknown env config warnings when running inside the pnpm workspace.

@azure-tools/typespec-ts - internal ✏️

Replace npm/npx usage in build and test scripts with pnpm equivalents to stop npm warn Unknown env config warnings when running inside the pnpm workspace.

pnpm forwards '--' literally to the script, so 'pnpm stop-test-server -- -p 3002'
resolved to 'tsp-spector server stop -- -p 3002'; yargs then treated '-p 3002' as
positional args after '--' and used the default port 3000, causing ECONNREFUSED
against the real server on 3002. Bake the port into the stop-test-server script
and drop the fragile '--' arg forwarding.

Verified locally: starting the server on 3002 then 'pnpm stop-test-server' now
prints 'Stopped server running at port 3002.' and exits 0.
Merged via the queue into Azure:main with commit 4293708 Jul 21, 2026
36 of 38 checks passed
@timotheeguerin
Timothee Guerin (timotheeguerin) deleted the cleanup-npm-leftover branch July 21, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:autorest Issues for @azure-tools/typespec-autorest emitter emitter:go Issues for @azure-tools/typespec-go emitter emitter:java Issues for @azure-tools/typespec-java emitter emitter:typescript Issues for @azure-tools/typespec-ts emitter eng lib:azure-resource-manager Issues for @azure-tools/typespec-azure-core library lib:tcgc Issues for @azure-tools/typespec-client-generator-core library meta:website TypeSpec.io updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants