Repository navigation
Replace npm/npx usage with pnpm to stop npm warnings - #4973
Timothee Guerin (timotheeguerin) merged 4 commits into
Conversation
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.
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.
|
You can try these changes here
|
@azure-tools/typespec-autorest
@azure-tools/typespec-autorest-canonical
@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
commit: |
…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).
|
All changed packages have been documented.
Show changes
|
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.
Problem
Running
pnpm installor various package scripts printed noisy warnings:Root cause
pnpm exports all of its settings (
.npmrc+pnpm-workspace.yamlcatalog,verify-deps-before-run,minimum-release-age, etc.) into the environment asnpm_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:
preinstall: "npx only-allow pnpm"→ ran on everypnpm install(install-time warnings).scriptsusingnpm run .../npx ...(script-time warnings).Changes
preinstall: "npx only-allow pnpm"line. pnpm usage stays enforced viapackageManager+manage-package-manager-versions+engine-strict.npm run/npx/npm pack→pnpm/pnpm exec/pnpm dlx/pnpm packin 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.scriptshelpers, GitHub Actions, and ADO pipelines.doc-updategh-aw lock file.Intentionally left as npm
core/submodule (upstream microsoft/typespec).## Installsections (the generator lives incore/).typespec-java/emitter-tests, generator test package).azure-rest-api-specs) and tools that shell out to npm internally (tsp-client).npm install -g pnpm) andnightly-e2e.ymlbuilding core packages with npm.Verification
pnpm install→ 0npm warnmessages.pnpm exec tsp-spector --helpresolves cleanly.pnpm turbo run build --filter @azure-tools/typespec-azure-portal-coresucceeds (nestedpnpmchain works), 0 warnings.pnpm chronus verifypasses.