diff --git a/.changeset/tasty-kiwis-change.md b/.changeset/tasty-kiwis-change.md new file mode 100644 index 00000000000..a945646ab17 --- /dev/null +++ b/.changeset/tasty-kiwis-change.md @@ -0,0 +1,6 @@ +--- +"@pnpm/config": patch +"pnpm": patch +--- + +Normalize current working directory on Windows [#6524](https://github.com/pnpm/pnpm/issues/6524). diff --git a/config/config/package.json b/config/config/package.json index 7da587899a4..fa143ff7c76 100644 --- a/config/config/package.json +++ b/config/config/package.json @@ -41,6 +41,7 @@ "@pnpm/pnpmfile": "workspace:*", "@pnpm/read-project-manifest": "workspace:*", "@pnpm/types": "workspace:*", + "better-path-resolve": "1.0.0", "camelcase": "^6.3.0", "camelcase-keys": "^6.2.2", "can-write-to-dir": "^1.1.1", diff --git a/config/config/src/index.ts b/config/config/src/index.ts index 5f45f03a89a..da57ac343a5 100644 --- a/config/config/src/index.ts +++ b/config/config/src/index.ts @@ -8,6 +8,7 @@ import { requireHooks } from '@pnpm/pnpmfile' import { safeReadProjectManifestOnly } from '@pnpm/read-project-manifest' import { getCurrentBranch } from '@pnpm/git-utils' import { createMatcher } from '@pnpm/matcher' +import betterPathResolve from 'better-path-resolve' import camelcase from 'camelcase' import isWindows from 'is-windows' import normalizeRegistryUrl from 'normalize-registry-url' @@ -267,7 +268,7 @@ export async function getConfig ( ...rcOptions.map((configKey) => [camelcase(configKey), npmConfig.get(configKey)]) as any, // eslint-disable-line ...Object.entries(cliOptions).filter(([name, value]) => typeof value !== 'undefined').map(([name, value]) => [camelcase(name), value]), ]) as unknown as ConfigWithDeprecatedSettings - const cwd = (cliOptions.dir && path.resolve(cliOptions.dir)) ?? npmConfig.localPrefix + const cwd = betterPathResolve(cliOptions.dir ?? npmConfig.localPrefix) pnpmConfig.maxSockets = npmConfig.maxsockets // @ts-expect-error diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9f3c4a21796..54050b1bb1f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -565,6 +565,9 @@ importers: '@pnpm/types': specifier: workspace:* version: link:../../packages/types + better-path-resolve: + specifier: 1.0.0 + version: 1.0.0 camelcase: specifier: ^6.3.0 version: 6.3.0 @@ -8878,7 +8881,7 @@ packages: /@types/byline@4.2.33: resolution: {integrity: sha512-LJYez7wrWcJQQDknqZtrZuExMGP0IXmPl1rOOGDqLbu+H7UNNRfKNuSxCBcQMLH1EfjeWidLedC/hCc5dDfBog==} dependencies: - '@types/node': 20.0.0 + '@types/node': 14.18.44 dev: true /@types/cacheable-request@6.0.3: @@ -8886,7 +8889,7 @@ packages: dependencies: '@types/http-cache-semantics': 4.0.1 '@types/keyv': 3.1.4 - '@types/node': 20.0.0 + '@types/node': 14.18.44 '@types/responselike': 1.0.0 /@types/concat-stream@2.0.0: @@ -8914,7 +8917,7 @@ packages: resolution: {integrity: sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w==} dependencies: '@types/minimatch': 5.1.2 - '@types/node': 20.0.0 + '@types/node': 14.18.44 dev: true /@types/graceful-fs@4.1.6: @@ -8988,7 +8991,7 @@ packages: /@types/keyv@3.1.4: resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==} dependencies: - '@types/node': 20.0.0 + '@types/node': 14.18.44 /@types/lodash@4.14.181: resolution: {integrity: sha512-n3tyKthHJbkiWhDZs3DkhkCzt2MexYHXlX0td5iMplyfwketaOeKboEVBqzceH7juqvEg3q5oUoBFxSLu7zFag==} @@ -9031,7 +9034,6 @@ packages: /@types/node@14.18.44: resolution: {integrity: sha512-Sg79dXC3jrRlG0QOLrK5eq2hRzpU4pkD7xBiYNYJ6r9OitJMxkpTpWf6m3qa2AWzb76uMHx+6x5T1Y/WAiS3nw==} - dev: true /@types/node@18.16.4: resolution: {integrity: sha512-LUhvPmAKAbgm+p/K11IWszLZVoZDlMF4NRmqbhEzDz/CnCuehPkZXwZbBCKGJsgjnuVejotBwM7B3Scrq4EqDw==} @@ -9071,7 +9073,7 @@ packages: /@types/responselike@1.0.0: resolution: {integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==} dependencies: - '@types/node': 20.0.0 + '@types/node': 14.18.44 /@types/retry@0.12.2: resolution: {integrity: sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==} @@ -13624,7 +13626,7 @@ packages: jws: 3.2.2 lodash: 4.17.21 ms: 2.1.3 - semver: 7.3.8 + semver: 7.5.0 /jsprim@1.4.2: resolution: {integrity: sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==}