diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3275e52180..d7d0de54ef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,13 +28,16 @@ jobs: gcc -I. -c -o lookup2.o lookup2.c g++ -std=c++11 -o ldid lookup2.o ldid.cpp -I. -lcrypto -lplist -lxml2 sudo mv ldid /usr/local/bin - - name: install pnpm and npm + - name: install pnpm run: | - curl -L https://get.pnpm.io/v6.16.js | node - add --global pnpm@next-8 npm@7 + corepack enable + corepack prepare pnpm@next-8 --activate - name: pnpm install run: pnpm install - name: Publish Packages env: + # setting the "npm_config_//registry.npmjs.org/:_authToken" env variable directly doesn't work. + # probably "pnpm release" doesn't pass auth tokens to child processes NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: | npm config set "//registry.npmjs.org/:_authToken" "${NPM_TOKEN}" # pnpm config set is broken diff --git a/.gitignore b/.gitignore index 681c8b0ea0..f85815d290 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,5 @@ RELEASE.md ## custom modules-dir fixture __fixtures__/custom-modules-dir/**/fake_modules/ +__fixtures__/custom-modules-dir/cache/ +__fixtures__/custom-modules-dir/patches/ diff --git a/.meta-updater/CHANGELOG.md b/.meta-updater/CHANGELOG.md index a55fe09ad3..7511bcbab3 100644 --- a/.meta-updater/CHANGELOG.md +++ b/.meta-updater/CHANGELOG.md @@ -1,5 +1,12 @@ # @pnpm-private/updater +## 0.4.10 + +### Patch Changes + +- Updated dependencies [787c43dcc] + - @pnpm/lockfile-file@7.0.6 + ## 0.4.9 ### Patch Changes diff --git a/.meta-updater/package.json b/.meta-updater/package.json index 9f789600f3..8a72ecb9f6 100644 --- a/.meta-updater/package.json +++ b/.meta-updater/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm-private/updater", - "version": "0.4.9", + "version": "0.4.10", "private": true, "type": "module", "scripts": { diff --git a/README.md b/README.md index 8590f63629..0c391a7894 100644 --- a/README.md +++ b/README.md @@ -84,17 +84,6 @@ To quote the [Rush](https://rushjs.io/) team: - - - - - - - - - - - diff --git a/__fixtures__/multiple-scripts-error-exit/dev-bar.js b/__fixtures__/multiple-scripts-error-exit/dev-bar.js new file mode 100644 index 0000000000..3485ba0679 --- /dev/null +++ b/__fixtures__/multiple-scripts-error-exit/dev-bar.js @@ -0,0 +1,11 @@ +import { createServer } from 'http' +const server = createServer() +server.listen(9999, (err) => { + if (err) { + console.log(`[bar] dev error:`, err) + } + console.log(`[bar] server listen on 9999`) + setTimeout(() => { + throw new Error('[bar] server error, Oops') + }, 2000) +}) diff --git a/__fixtures__/multiple-scripts-error-exit/dev-foo.js b/__fixtures__/multiple-scripts-error-exit/dev-foo.js new file mode 100644 index 0000000000..37daa2c9cf --- /dev/null +++ b/__fixtures__/multiple-scripts-error-exit/dev-foo.js @@ -0,0 +1,2 @@ +import { spawn } from 'child_process' +spawn('node', ['./process-foo.js'], { stdio: 'inherit' }) diff --git a/__fixtures__/multiple-scripts-error-exit/package.json b/__fixtures__/multiple-scripts-error-exit/package.json new file mode 100644 index 0000000000..b8f0fbaab7 --- /dev/null +++ b/__fixtures__/multiple-scripts-error-exit/package.json @@ -0,0 +1,10 @@ +{ + "name": "multiple-scripts-error-exit", + "private": true, + "version": "1.0.0", + "type": "module", + "scripts": { + "dev:foo": "node ./dev-foo.js", + "dev:bar": "node ./dev-bar.js" + } +} diff --git a/__fixtures__/multiple-scripts-error-exit/process-foo.js b/__fixtures__/multiple-scripts-error-exit/process-foo.js new file mode 100644 index 0000000000..373d0fb788 --- /dev/null +++ b/__fixtures__/multiple-scripts-error-exit/process-foo.js @@ -0,0 +1,8 @@ +import { createServer } from 'http' +const server = createServer() +server.listen(9990, (err) => { + if (err) { + console.log(`[foo] dev error:`, err) + } + console.log(`[foo] server listen on 9990`) +}) diff --git a/__utils__/assert-project/CHANGELOG.md b/__utils__/assert-project/CHANGELOG.md index 26aaf88edb..986897ac84 100644 --- a/__utils__/assert-project/CHANGELOG.md +++ b/__utils__/assert-project/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/assert-project +## 2.3.21 + +### Patch Changes + +- @pnpm/assert-store@1.0.58 + ## 2.3.20 ### Patch Changes diff --git a/__utils__/assert-project/package.json b/__utils__/assert-project/package.json index 1b7fdb2c9a..f7c33bc391 100644 --- a/__utils__/assert-project/package.json +++ b/__utils__/assert-project/package.json @@ -1,7 +1,7 @@ { "name": "@pnpm/assert-project", "description": "Utils for testing projects that use pnpm", - "version": "2.3.20", + "version": "2.3.21", "author": { "name": "Zoltan Kochan", "email": "z@kochan.io", diff --git a/__utils__/assert-store/CHANGELOG.md b/__utils__/assert-store/CHANGELOG.md index 5bde913e8b..56a2b8efac 100644 --- a/__utils__/assert-store/CHANGELOG.md +++ b/__utils__/assert-store/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/assert-store +## 1.0.58 + +### Patch Changes + +- @pnpm/cafs@6.0.2 + ## 1.0.57 ### Patch Changes diff --git a/__utils__/assert-store/package.json b/__utils__/assert-store/package.json index 712685dad3..38b8e121eb 100644 --- a/__utils__/assert-store/package.json +++ b/__utils__/assert-store/package.json @@ -1,7 +1,7 @@ { "name": "@pnpm/assert-store", "description": "Utils for testing pnpm store", - "version": "1.0.57", + "version": "1.0.58", "author": { "name": "Zoltan Kochan", "email": "z@kochan.io", diff --git a/__utils__/get-release-text/src/main.ts b/__utils__/get-release-text/src/main.ts index 8ba5c3e3c5..3010dac4d2 100644 --- a/__utils__/get-release-text/src/main.ts +++ b/__utils__/get-release-text/src/main.ts @@ -126,17 +126,6 @@ function getChangelogEntry (changelog: string, version: string) { - - - - - - - - - - - diff --git a/__utils__/prepare/CHANGELOG.md b/__utils__/prepare/CHANGELOG.md index 17f6d66086..ee98755d26 100644 --- a/__utils__/prepare/CHANGELOG.md +++ b/__utils__/prepare/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/prepare +## 0.0.64 + +### Patch Changes + +- @pnpm/assert-project@2.3.21 + ## 0.0.63 ### Patch Changes diff --git a/__utils__/prepare/package.json b/__utils__/prepare/package.json index 56e21a90d7..f186ff3d31 100644 --- a/__utils__/prepare/package.json +++ b/__utils__/prepare/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/prepare", - "version": "0.0.63", + "version": "0.0.64", "main": "lib/index.js", "types": "lib/index.d.ts", "dependencies": { diff --git a/__utils__/test-fixtures/CHANGELOG.md b/__utils__/test-fixtures/CHANGELOG.md index 8804b77bdc..8001e4e712 100644 --- a/__utils__/test-fixtures/CHANGELOG.md +++ b/__utils__/test-fixtures/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/test-fixtures +## 0.0.33 + +### Patch Changes + +- @pnpm/prepare@0.0.64 + ## 0.0.32 ### Patch Changes diff --git a/__utils__/test-fixtures/package.json b/__utils__/test-fixtures/package.json index 6fd94d4e17..8c930fa74e 100644 --- a/__utils__/test-fixtures/package.json +++ b/__utils__/test-fixtures/package.json @@ -1,7 +1,7 @@ { "name": "@pnpm/test-fixtures", "description": "Test fixtures", - "version": "0.0.32", + "version": "0.0.33", "author": { "name": "Zoltan Kochan", "email": "z@kochan.io", diff --git a/cli/cli-utils/CHANGELOG.md b/cli/cli-utils/CHANGELOG.md index 295d7f50b8..7057628059 100644 --- a/cli/cli-utils/CHANGELOG.md +++ b/cli/cli-utils/CHANGELOG.md @@ -1,5 +1,14 @@ # @pnpm/cli-utils +## 1.1.5 + +### Patch Changes + +- Updated dependencies [e505b58e3] + - @pnpm/config@17.0.0 + - @pnpm/read-project-manifest@4.1.4 + - @pnpm/default-reporter@11.0.40 + ## 1.1.4 ### Patch Changes diff --git a/cli/cli-utils/package.json b/cli/cli-utils/package.json index 68a6893a18..81a6c699d3 100644 --- a/cli/cli-utils/package.json +++ b/cli/cli-utils/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/cli-utils", - "version": "1.1.4", + "version": "1.1.5", "description": "Utils for pnpm commands", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/cli/default-reporter/CHANGELOG.md b/cli/default-reporter/CHANGELOG.md index 8a3f6a8e5a..f5a89557e8 100644 --- a/cli/default-reporter/CHANGELOG.md +++ b/cli/default-reporter/CHANGELOG.md @@ -1,5 +1,12 @@ # @pnpm/default-reporter +## 11.0.40 + +### Patch Changes + +- Updated dependencies [e505b58e3] + - @pnpm/config@17.0.0 + ## 11.0.39 ### Patch Changes diff --git a/cli/default-reporter/package.json b/cli/default-reporter/package.json index ee0dce13bd..59ea5a36a7 100644 --- a/cli/default-reporter/package.json +++ b/cli/default-reporter/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/default-reporter", - "version": "11.0.39", + "version": "11.0.40", "description": "The default reporter of pnpm", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/config/config/CHANGELOG.md b/config/config/CHANGELOG.md index 22731e625d..5d0fb45626 100644 --- a/config/config/CHANGELOG.md +++ b/config/config/CHANGELOG.md @@ -1,5 +1,16 @@ # @pnpm/config +## 17.0.0 + +### Major Changes + +- e505b58e3: Don't extend NODE_PATH in command shims [#5176](https://github.com/pnpm/pnpm/issues/5176). + +### Patch Changes + +- @pnpm/read-project-manifest@4.1.4 +- @pnpm/pnpmfile@4.0.38 + ## 16.7.2 ### Patch Changes diff --git a/config/config/package.json b/config/config/package.json index bd3f26e015..cc82ece8ee 100644 --- a/config/config/package.json +++ b/config/config/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/config", - "version": "16.7.2", + "version": "17.0.0", "description": "Gets configuration options for pnpm", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/config/config/src/index.ts b/config/config/src/index.ts index 8c0a3ab727..a8900f0ede 100644 --- a/config/config/src/index.ts +++ b/config/config/src/index.ts @@ -188,7 +188,7 @@ export async function getConfig ( 'deploy-all-files': false, 'dedupe-peer-dependents': true, 'enable-modules-dir': true, - 'extend-node-path': true, + 'extend-node-path': false, 'fetch-retries': 2, 'fetch-retry-factor': 10, 'fetch-retry-maxtimeout': 60000, diff --git a/config/plugin-commands-config/CHANGELOG.md b/config/plugin-commands-config/CHANGELOG.md index bfb9b3cc7f..261cb404cd 100644 --- a/config/plugin-commands-config/CHANGELOG.md +++ b/config/plugin-commands-config/CHANGELOG.md @@ -1,5 +1,19 @@ # @pnpm/plugin-commands-config +## 1.0.23 + +### Patch Changes + +- Updated dependencies [e505b58e3] + - @pnpm/config@17.0.0 + - @pnpm/cli-utils@1.1.5 + +## 1.0.22 + +### Patch Changes + +- 6314a47b8: Settings related to authorization should be set/deleted by npm CLI [#6181](https://github.com/pnpm/pnpm/issues/6181). + ## 1.0.21 ### Patch Changes diff --git a/config/plugin-commands-config/package.json b/config/plugin-commands-config/package.json index 4fa9fcee35..14d0e8475d 100644 --- a/config/plugin-commands-config/package.json +++ b/config/plugin-commands-config/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/plugin-commands-config", - "version": "1.0.21", + "version": "1.0.23", "description": "Commands for reading and writing settings to/from config files", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -33,6 +33,7 @@ "@pnpm/cli-utils": "workspace:*", "@pnpm/config": "workspace:*", "@pnpm/error": "workspace:*", + "@pnpm/run-npm": "workspace:*", "ini": "3.0.1", "read-ini-file": "4.0.0", "render-help": "^1.0.3", diff --git a/config/plugin-commands-config/src/ConfigCommandOptions.ts b/config/plugin-commands-config/src/ConfigCommandOptions.ts index b8dd210c3e..bd0be3fe54 100644 --- a/config/plugin-commands-config/src/ConfigCommandOptions.ts +++ b/config/plugin-commands-config/src/ConfigCommandOptions.ts @@ -5,6 +5,7 @@ export type ConfigCommandOptions = Pick & { json?: boolean diff --git a/config/plugin-commands-config/src/configSet.ts b/config/plugin-commands-config/src/configSet.ts index c38ec13376..29de5ae048 100644 --- a/config/plugin-commands-config/src/configSet.ts +++ b/config/plugin-commands-config/src/configSet.ts @@ -1,10 +1,20 @@ import path from 'path' +import { runNpm } from '@pnpm/run-npm' import { readIniFile } from 'read-ini-file' import { writeIniFile } from 'write-ini-file' import { ConfigCommandOptions } from './ConfigCommandOptions' export async function configSet (opts: ConfigCommandOptions, key: string, value: string | null) { const configPath = opts.global ? path.join(opts.configDir, 'rc') : path.join(opts.dir, '.npmrc') + if (opts.global && settingShouldFallBackToNpm(key)) { + const _runNpm = runNpm.bind(null, opts.npmPath) + if (value == null) { + _runNpm(['config', 'delete', key]) + } else { + _runNpm(['config', 'set', `${key}=${value}`]) + } + return + } const settings = await safeReadIniFile(configPath) if (value == null) { if (settings[key] == null) return @@ -15,6 +25,14 @@ export async function configSet (opts: ConfigCommandOptions, key: string, value: await writeIniFile(configPath, settings) } +function settingShouldFallBackToNpm (key: string): boolean { + return ( + ['registry', '_auth', '_authToken', 'username', '_password'].includes(key) || + key[0] === '@' || + key.startsWith('//') + ) +} + async function safeReadIniFile (configPath: string): Promise> { try { return await readIniFile(configPath) as Record diff --git a/config/plugin-commands-config/test/managingAuthSettings.test.ts b/config/plugin-commands-config/test/managingAuthSettings.test.ts new file mode 100644 index 0000000000..d8b9b49c3a --- /dev/null +++ b/config/plugin-commands-config/test/managingAuthSettings.test.ts @@ -0,0 +1,33 @@ +import { config } from '@pnpm/plugin-commands-config' +import { runNpm } from '@pnpm/run-npm' + +jest.mock('@pnpm/run-npm', () => ({ + runNpm: jest.fn(), +})) + +describe.each( + [ + '_auth', + '_authToken', + '_password', + 'username', + 'registry', + '@foo:registry', + '//registry.npmjs.org/:_authToken', + ] +)('settings related to auth are handled by npm CLI', (key) => { + const configOpts = { + dir: process.cwd(), + cliOptions: {}, + configDir: __dirname, // this doesn't matter, it won't be used + rawConfig: {}, + } + it(`should set ${key}`, async () => { + await config.handler(configOpts, ['set', `${key}=123`]) + expect(runNpm).toHaveBeenCalledWith(undefined, ['config', 'set', `${key}=123`]) + }) + it(`should delete ${key}`, async () => { + await config.handler(configOpts, ['delete', key]) + expect(runNpm).toHaveBeenCalledWith(undefined, ['config', 'delete', key]) + }) +}) diff --git a/config/plugin-commands-config/tsconfig.json b/config/plugin-commands-config/tsconfig.json index dfb3722d8a..dad5fead95 100644 --- a/config/plugin-commands-config/tsconfig.json +++ b/config/plugin-commands-config/tsconfig.json @@ -15,6 +15,9 @@ { "path": "../../cli/cli-utils" }, + { + "path": "../../exec/run-npm" + }, { "path": "../../packages/error" }, diff --git a/env/node.fetcher/CHANGELOG.md b/env/node.fetcher/CHANGELOG.md index c95339f42e..4346729b48 100644 --- a/env/node.fetcher/CHANGELOG.md +++ b/env/node.fetcher/CHANGELOG.md @@ -1,5 +1,12 @@ # @pnpm/node.fetcher +## 2.0.14 + +### Patch Changes + +- @pnpm/tarball-fetcher@14.1.4 +- @pnpm/create-cafs-store@3.1.6 + ## 2.0.13 ### Patch Changes diff --git a/env/node.fetcher/package.json b/env/node.fetcher/package.json index 780b0f1067..62423f14fd 100644 --- a/env/node.fetcher/package.json +++ b/env/node.fetcher/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/node.fetcher", - "version": "2.0.13", + "version": "2.0.14", "description": "Node.js artifacts fetcher", "funding": "https://opencollective.com/pnpm", "main": "lib/index.js", diff --git a/env/node.resolver/CHANGELOG.md b/env/node.resolver/CHANGELOG.md index f0529084c0..de0080f3d6 100644 --- a/env/node.resolver/CHANGELOG.md +++ b/env/node.resolver/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/node.resolver +## 1.1.11 + +### Patch Changes + +- @pnpm/node.fetcher@2.0.14 + ## 1.1.10 ### Patch Changes diff --git a/env/node.resolver/package.json b/env/node.resolver/package.json index 831d776866..52f94f03de 100644 --- a/env/node.resolver/package.json +++ b/env/node.resolver/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/node.resolver", - "version": "1.1.10", + "version": "1.1.11", "description": "Resolves a Node.js version specifier to an exact Node.js version", "funding": "https://opencollective.com/pnpm", "main": "lib/index.js", diff --git a/env/plugin-commands-env/CHANGELOG.md b/env/plugin-commands-env/CHANGELOG.md index eff94475f6..176d93a1d6 100644 --- a/env/plugin-commands-env/CHANGELOG.md +++ b/env/plugin-commands-env/CHANGELOG.md @@ -1,5 +1,15 @@ # @pnpm/plugin-commands-env +## 3.1.34 + +### Patch Changes + +- Updated dependencies [e505b58e3] + - @pnpm/config@17.0.0 + - @pnpm/cli-utils@1.1.5 + - @pnpm/node.fetcher@2.0.14 + - @pnpm/node.resolver@1.1.11 + ## 3.1.33 ### Patch Changes diff --git a/env/plugin-commands-env/package.json b/env/plugin-commands-env/package.json index 0cc6a45dad..5afdaa841c 100644 --- a/env/plugin-commands-env/package.json +++ b/env/plugin-commands-env/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/plugin-commands-env", - "version": "3.1.33", + "version": "3.1.34", "description": "pnpm commands for managing Node.js", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/exec/build-modules/CHANGELOG.md b/exec/build-modules/CHANGELOG.md index 4c2725e3fc..6412585053 100644 --- a/exec/build-modules/CHANGELOG.md +++ b/exec/build-modules/CHANGELOG.md @@ -1,5 +1,13 @@ # @pnpm/build-modules +## 10.1.7 + +### Patch Changes + +- @pnpm/link-bins@8.0.9 +- @pnpm/lifecycle@14.1.7 +- @pnpm/fs.hard-link-dir@1.0.3 + ## 10.1.6 ### Patch Changes diff --git a/exec/build-modules/package.json b/exec/build-modules/package.json index 421269cb9b..0a6cf782e3 100644 --- a/exec/build-modules/package.json +++ b/exec/build-modules/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/build-modules", - "version": "10.1.6", + "version": "10.1.7", "description": "Build packages in node_modules", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/exec/lifecycle/CHANGELOG.md b/exec/lifecycle/CHANGELOG.md index 9312ed16e7..dc1d31f826 100644 --- a/exec/lifecycle/CHANGELOG.md +++ b/exec/lifecycle/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/lifecycle +## 14.1.7 + +### Patch Changes + +- @pnpm/directory-fetcher@5.1.6 + ## 14.1.6 ### Patch Changes diff --git a/exec/lifecycle/package.json b/exec/lifecycle/package.json index ca68eb1a20..aff503011d 100644 --- a/exec/lifecycle/package.json +++ b/exec/lifecycle/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/lifecycle", - "version": "14.1.6", + "version": "14.1.7", "description": "Package lifecycle hook runner", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/exec/plugin-commands-rebuild/CHANGELOG.md b/exec/plugin-commands-rebuild/CHANGELOG.md index 24e0b9af85..323520ceb5 100644 --- a/exec/plugin-commands-rebuild/CHANGELOG.md +++ b/exec/plugin-commands-rebuild/CHANGELOG.md @@ -1,5 +1,19 @@ # @pnpm/plugin-commands-rebuild +## 7.1.5 + +### Patch Changes + +- Updated dependencies [e505b58e3] + - @pnpm/config@17.0.0 + - @pnpm/get-context@8.2.4 + - @pnpm/cli-utils@1.1.5 + - @pnpm/store-connection-manager@5.2.18 + - @pnpm/link-bins@8.0.9 + - @pnpm/find-workspace-packages@5.0.40 + - @pnpm/lifecycle@14.1.7 + - @pnpm/fs.hard-link-dir@1.0.3 + ## 7.1.4 ### Patch Changes diff --git a/exec/plugin-commands-rebuild/package.json b/exec/plugin-commands-rebuild/package.json index d0bad60734..72a9394391 100644 --- a/exec/plugin-commands-rebuild/package.json +++ b/exec/plugin-commands-rebuild/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/plugin-commands-rebuild", - "version": "7.1.4", + "version": "7.1.5", "description": "Commands for rebuilding dependencies", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/exec/plugin-commands-script-runners/CHANGELOG.md b/exec/plugin-commands-script-runners/CHANGELOG.md index 37b320f0a8..eddf70481c 100644 --- a/exec/plugin-commands-script-runners/CHANGELOG.md +++ b/exec/plugin-commands-script-runners/CHANGELOG.md @@ -1,5 +1,16 @@ # @pnpm/plugin-commands-script-runners +## 6.5.5 + +### Patch Changes + +- Updated dependencies [e505b58e3] + - @pnpm/config@17.0.0 + - @pnpm/plugin-commands-installation@11.5.5 + - @pnpm/read-project-manifest@4.1.4 + - @pnpm/cli-utils@1.1.5 + - @pnpm/lifecycle@14.1.7 + ## 6.5.4 ### Patch Changes diff --git a/exec/plugin-commands-script-runners/package.json b/exec/plugin-commands-script-runners/package.json index c7ecd43125..44c9eb1ec7 100644 --- a/exec/plugin-commands-script-runners/package.json +++ b/exec/plugin-commands-script-runners/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/plugin-commands-script-runners", - "version": "6.5.4", + "version": "6.5.5", "description": "Commands for running scripts", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/exec/prepare-package/CHANGELOG.md b/exec/prepare-package/CHANGELOG.md index 2fa1b600eb..760792d0c5 100644 --- a/exec/prepare-package/CHANGELOG.md +++ b/exec/prepare-package/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/prepare-package +## 4.1.2 + +### Patch Changes + +- @pnpm/lifecycle@14.1.7 + ## 4.1.1 ### Patch Changes diff --git a/exec/prepare-package/package.json b/exec/prepare-package/package.json index ba14fb2997..4fdd1c1dc9 100644 --- a/exec/prepare-package/package.json +++ b/exec/prepare-package/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/prepare-package", - "version": "4.1.1", + "version": "4.1.2", "description": "Prepares a Git-hosted package", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/fetching/directory-fetcher/CHANGELOG.md b/fetching/directory-fetcher/CHANGELOG.md index f122218067..d178181401 100644 --- a/fetching/directory-fetcher/CHANGELOG.md +++ b/fetching/directory-fetcher/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/directory-fetcher +## 5.1.6 + +### Patch Changes + +- @pnpm/read-project-manifest@4.1.4 + ## 5.1.5 ### Patch Changes diff --git a/fetching/directory-fetcher/package.json b/fetching/directory-fetcher/package.json index 3ea906bd2a..ed1a632156 100644 --- a/fetching/directory-fetcher/package.json +++ b/fetching/directory-fetcher/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/directory-fetcher", - "version": "5.1.5", + "version": "5.1.6", "description": "A fetcher for local directory packages", "funding": "https://opencollective.com/pnpm", "main": "lib/index.js", diff --git a/fetching/git-fetcher/CHANGELOG.md b/fetching/git-fetcher/CHANGELOG.md index 19b497914e..f25583a898 100644 --- a/fetching/git-fetcher/CHANGELOG.md +++ b/fetching/git-fetcher/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/git-fetcher +## 8.0.2 + +### Patch Changes + +- @pnpm/prepare-package@4.1.2 + ## 8.0.1 ### Patch Changes diff --git a/fetching/git-fetcher/package.json b/fetching/git-fetcher/package.json index afb7a2f549..ce86d3c868 100644 --- a/fetching/git-fetcher/package.json +++ b/fetching/git-fetcher/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/git-fetcher", - "version": "8.0.1", + "version": "8.0.2", "description": "A fetcher for git-hosted packages", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/fetching/tarball-fetcher/CHANGELOG.md b/fetching/tarball-fetcher/CHANGELOG.md index 4160c18b86..88b742f389 100644 --- a/fetching/tarball-fetcher/CHANGELOG.md +++ b/fetching/tarball-fetcher/CHANGELOG.md @@ -1,5 +1,13 @@ # @pnpm/tarball-fetcher +## 14.1.4 + +### Patch Changes + +- Updated dependencies [955874422] + - @pnpm/graceful-fs@2.1.0 + - @pnpm/prepare-package@4.1.2 + ## 14.1.3 ### Patch Changes diff --git a/fetching/tarball-fetcher/package.json b/fetching/tarball-fetcher/package.json index 2ce6c7897b..d875ee362e 100644 --- a/fetching/tarball-fetcher/package.json +++ b/fetching/tarball-fetcher/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/tarball-fetcher", - "version": "14.1.3", + "version": "14.1.4", "description": "Fetcher for packages hosted as tarballs", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/fs/find-packages/CHANGELOG.md b/fs/find-packages/CHANGELOG.md index 45114365a3..d62e345ec1 100644 --- a/fs/find-packages/CHANGELOG.md +++ b/fs/find-packages/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/fs.find-packages +## 1.0.3 + +### Patch Changes + +- @pnpm/read-project-manifest@4.1.4 + ## 1.0.2 ### Patch Changes diff --git a/fs/find-packages/package.json b/fs/find-packages/package.json index 7000da8f2c..f672f23bbb 100644 --- a/fs/find-packages/package.json +++ b/fs/find-packages/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/fs.find-packages", - "version": "1.0.2", + "version": "1.0.3", "description": "Find all packages inside a directory", "main": "lib/index.js", "files": [ diff --git a/fs/graceful-fs/CHANGELOG.md b/fs/graceful-fs/CHANGELOG.md index 1e78d1b6ad..b6e2428abb 100644 --- a/fs/graceful-fs/CHANGELOG.md +++ b/fs/graceful-fs/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/graceful-fs +## 2.1.0 + +### Minor Changes + +- 955874422: Add copyFile, link, stat. + ## 2.0.0 ### Major Changes diff --git a/fs/graceful-fs/package.json b/fs/graceful-fs/package.json index da7aa11254..dd69a3a55c 100644 --- a/fs/graceful-fs/package.json +++ b/fs/graceful-fs/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/graceful-fs", - "version": "2.0.0", + "version": "2.1.0", "description": "Promisified graceful-fs", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/fs/graceful-fs/src/index.ts b/fs/graceful-fs/src/index.ts index 85d207b094..a5e4aad193 100644 --- a/fs/graceful-fs/src/index.ts +++ b/fs/graceful-fs/src/index.ts @@ -2,7 +2,10 @@ import { promisify } from 'util' import gfs from 'graceful-fs' export default { // eslint-disable-line + copyFile: promisify(gfs.copyFile), createReadStream: gfs.createReadStream, + link: promisify(gfs.link), readFile: promisify(gfs.readFile), + stat: promisify(gfs.stat), writeFile: promisify(gfs.writeFile), } diff --git a/fs/indexed-pkg-importer/CHANGELOG.md b/fs/indexed-pkg-importer/CHANGELOG.md index a1efcc852e..f4624c4cd8 100644 --- a/fs/indexed-pkg-importer/CHANGELOG.md +++ b/fs/indexed-pkg-importer/CHANGELOG.md @@ -1,5 +1,13 @@ # @pnpm/fs.indexed-pkg-importer +## 2.1.4 + +### Patch Changes + +- 955874422: Retry copying file on EBUSY error [#6201](https://github.com/pnpm/pnpm/issues/6201). +- Updated dependencies [955874422] + - @pnpm/graceful-fs@2.1.0 + ## 2.1.3 ### Patch Changes diff --git a/fs/indexed-pkg-importer/package.json b/fs/indexed-pkg-importer/package.json index f422af1358..0bfb1c104c 100644 --- a/fs/indexed-pkg-importer/package.json +++ b/fs/indexed-pkg-importer/package.json @@ -1,7 +1,7 @@ { "name": "@pnpm/fs.indexed-pkg-importer", "description": "Replicates indexed directories using hard links, copies, or cloning", - "version": "2.1.3", + "version": "2.1.4", "bugs": { "url": "https://github.com/pnpm/pnpm/issues" }, @@ -16,6 +16,7 @@ }, "dependencies": { "@pnpm/core-loggers": "workspace:*", + "@pnpm/graceful-fs": "workspace:*", "@pnpm/store-controller-types": "workspace:*", "@zkochan/rimraf": "^2.1.2", "fs-extra": "^11.1.0", diff --git a/fs/indexed-pkg-importer/src/index.ts b/fs/indexed-pkg-importer/src/index.ts index c84950762a..5fd67162b2 100644 --- a/fs/indexed-pkg-importer/src/index.ts +++ b/fs/indexed-pkg-importer/src/index.ts @@ -1,4 +1,5 @@ -import { constants, promises as fs, Stats } from 'fs' +import { constants, Stats } from 'fs' +import fs from '@pnpm/graceful-fs' import path from 'path' import { globalInfo, globalWarn } from '@pnpm/logger' import { packageImportMethodLogger } from '@pnpm/core-loggers' diff --git a/fs/indexed-pkg-importer/test/createImportPackage.test.ts b/fs/indexed-pkg-importer/test/createImportPackage.test.ts index 69258be812..2afc56a897 100644 --- a/fs/indexed-pkg-importer/test/createImportPackage.test.ts +++ b/fs/indexed-pkg-importer/test/createImportPackage.test.ts @@ -1,31 +1,43 @@ +import fs from 'fs' import path from 'path' +import { createIndexedPkgImporter } from '@pnpm/fs.indexed-pkg-importer' +import gfs from '@pnpm/graceful-fs' +import { globalInfo } from '@pnpm/logger' -const fsMock = { promises: {} as any } as any // eslint-disable-line -jest.mock('fs', () => { - const { access, constants, promises } = jest.requireActual('fs') - fsMock.constants = constants - fsMock.promises.mkdir = promises.mkdir - fsMock.promises.readdir = promises.readdir - fsMock.access = access - return fsMock +jest.mock('@pnpm/graceful-fs', () => { + const { access, promises } = jest.requireActual('fs') + const fsMock = { + mkdir: promises.mkdir, + readdir: promises.readdir, + access, + copyFile: jest.fn(), + link: jest.fn(), + stat: jest.fn(), + } + return { + __esModule: true, + default: fsMock, + } }) jest.mock('path-temp', () => (dir: string) => path.join(dir, '_tmp')) jest.mock('rename-overwrite', () => jest.fn()) jest.mock('fs-extra', () => ({ copy: jest.fn(), })) -const globalInfo = jest.fn() -const globalWarn = jest.fn() -const logger = jest.fn(() => ({ debug: jest.fn() })) -jest.mock('@pnpm/logger', () => ({ logger, globalWarn, globalInfo })) +jest.mock('@pnpm/logger', () => ({ + logger: jest.fn(() => ({ debug: jest.fn() })), + globalWarn: jest.fn(), + globalInfo: jest.fn(), +})) -// eslint-disable-next-line -import { createIndexedPkgImporter } from '@pnpm/fs.indexed-pkg-importer' +beforeEach(() => { + ;(gfs.copyFile as jest.Mock).mockClear() + ;(gfs.link as jest.Mock).mockClear() + ;(globalInfo as jest.Mock).mockReset() +}) test('packageImportMethod=auto: clone files by default', async () => { const importPackage = createIndexedPkgImporter('auto') - fsMock.promises.copyFile = jest.fn() - fsMock.promises.rename = jest.fn() expect(await importPackage('project/package', { filesMap: { 'index.js': 'hash2', @@ -34,25 +46,23 @@ test('packageImportMethod=auto: clone files by default', async () => { force: false, fromStore: false, })).toBe('clone') - expect(fsMock.promises.copyFile).toBeCalledWith( + expect(gfs.copyFile).toBeCalledWith( path.join('hash1'), path.join('project', '_tmp', 'package.json'), - fsMock.constants.COPYFILE_FICLONE_FORCE + fs.constants.COPYFILE_FICLONE_FORCE ) - expect(fsMock.promises.copyFile).toBeCalledWith( + expect(gfs.copyFile).toBeCalledWith( path.join('hash2'), path.join('project', '_tmp', 'index.js'), - fsMock.constants.COPYFILE_FICLONE_FORCE + fs.constants.COPYFILE_FICLONE_FORCE ) }) test('packageImportMethod=auto: link files if cloning fails', async () => { const importPackage = createIndexedPkgImporter('auto') - fsMock.promises.copyFile = jest.fn(() => { + ;(gfs.copyFile as jest.Mock).mockImplementation(async () => { throw new Error('This file system does not support cloning') }) - fsMock.promises.link = jest.fn() - fsMock.promises.rename = jest.fn() expect(await importPackage('project/package', { filesMap: { 'index.js': 'hash2', @@ -61,10 +71,10 @@ test('packageImportMethod=auto: link files if cloning fails', async () => { force: false, fromStore: false, })).toBe('hardlink') - expect(fsMock.promises.link).toBeCalledWith(path.join('hash1'), path.join('project', '_tmp', 'package.json')) - expect(fsMock.promises.link).toBeCalledWith(path.join('hash2'), path.join('project', '_tmp', 'index.js')) - expect(fsMock.promises.copyFile).toBeCalled() - fsMock.promises.copyFile.mockClear() + expect(gfs.link).toBeCalledWith(path.join('hash1'), path.join('project', '_tmp', 'package.json')) + expect(gfs.link).toBeCalledWith(path.join('hash2'), path.join('project', '_tmp', 'index.js')) + expect(gfs.copyFile).toBeCalled() + ;(gfs.copyFile as jest.Mock).mockClear() // The copy function will not be called again expect(await importPackage('project2/package', { @@ -75,24 +85,23 @@ test('packageImportMethod=auto: link files if cloning fails', async () => { force: false, fromStore: false, })).toBe('hardlink') - expect(fsMock.promises.copyFile).not.toBeCalled() - expect(fsMock.promises.link).toBeCalledWith(path.join('hash1'), path.join('project2', '_tmp', 'package.json')) - expect(fsMock.promises.link).toBeCalledWith(path.join('hash2'), path.join('project2', '_tmp', 'index.js')) + expect(gfs.copyFile).not.toBeCalled() + expect(gfs.link).toBeCalledWith(path.join('hash1'), path.join('project2', '_tmp', 'package.json')) + expect(gfs.link).toBeCalledWith(path.join('hash2'), path.join('project2', '_tmp', 'index.js')) }) test('packageImportMethod=auto: link files if cloning fails and even hard linking fails but not with EXDEV error', async () => { const importPackage = createIndexedPkgImporter('auto') - fsMock.promises.copyFile = jest.fn(() => { + ;(gfs.copyFile as jest.Mock).mockImplementation(async () => { throw new Error('This file system does not support cloning') }) let linkFirstCall = true - fsMock.promises.link = jest.fn(() => { + ;(gfs.link as jest.Mock).mockImplementation(async () => { if (linkFirstCall) { linkFirstCall = false throw new Error() } }) - fsMock.promises.rename = jest.fn() expect(await importPackage('project/package', { filesMap: { 'index.js': 'hash2', @@ -100,22 +109,21 @@ test('packageImportMethod=auto: link files if cloning fails and even hard linkin force: false, fromStore: false, })).toBe('hardlink') - expect(fsMock.promises.link).toBeCalledWith(path.join('hash2'), path.join('project', '_tmp', 'index.js')) - expect(fsMock.promises.link).toBeCalledTimes(2) - expect(fsMock.promises.copyFile).toBeCalledTimes(1) + expect(gfs.link).toBeCalledWith(path.join('hash2'), path.join('project', '_tmp', 'index.js')) + expect(gfs.link).toBeCalledTimes(2) + expect(gfs.copyFile).toBeCalledTimes(1) }) test('packageImportMethod=auto: chooses copying if cloning and hard linking is not possible', async () => { const importPackage = createIndexedPkgImporter('auto') - fsMock.promises.copyFile = jest.fn((src: string, dest: string, flags?: number) => { - if (flags === fsMock.constants.COPYFILE_FICLONE_FORCE) { + ;(gfs.copyFile as jest.Mock).mockImplementation(async (src: string, dest: string, flags?: number) => { + if (flags === fs.constants.COPYFILE_FICLONE_FORCE) { throw new Error('This file system does not support cloning') } }) - fsMock.promises.link = jest.fn(() => { + ;(gfs.link as jest.Mock).mockImplementation(() => { throw new Error('EXDEV: cross-device link not permitted') }) - fsMock.promises.rename = jest.fn() expect(await importPackage('project/package', { filesMap: { 'index.js': 'hash2', @@ -123,19 +131,18 @@ test('packageImportMethod=auto: chooses copying if cloning and hard linking is n force: false, fromStore: false, })).toBe('copy') - expect(fsMock.promises.copyFile).toBeCalledWith(path.join('hash2'), path.join('project', '_tmp', 'index.js')) - expect(fsMock.promises.copyFile).toBeCalledTimes(2) + expect(gfs.copyFile).toBeCalledWith(path.join('hash2'), path.join('project', '_tmp', 'index.js')) + expect(gfs.copyFile).toBeCalledTimes(2) }) test('packageImportMethod=hardlink: fall back to copying if hardlinking fails', async () => { const importPackage = createIndexedPkgImporter('hardlink') - fsMock.promises.link = jest.fn((src: string, dest: string) => { + ;(gfs.link as jest.Mock).mockImplementation(async (src: string, dest: string) => { if (dest.endsWith('license')) { throw Object.assign(new Error(''), { code: 'EEXIST' }) } throw new Error('This file system does not support hard linking') }) - fsMock.promises.copyFile = jest.fn() expect(await importPackage('project/package', { filesMap: { 'index.js': 'hash2', @@ -145,17 +152,15 @@ test('packageImportMethod=hardlink: fall back to copying if hardlinking fails', force: false, fromStore: false, })).toBe('hardlink') - expect(fsMock.promises.link).toBeCalledTimes(3) - expect(fsMock.promises.copyFile).toBeCalledTimes(2) // One time the target already exists, so it won't be copied - expect(fsMock.promises.copyFile).toBeCalledWith(path.join('hash1'), path.join('project', '_tmp', 'package.json')) - expect(fsMock.promises.copyFile).toBeCalledWith(path.join('hash2'), path.join('project', '_tmp', 'index.js')) + expect(gfs.link).toBeCalledTimes(3) + expect(gfs.copyFile).toBeCalledTimes(2) // One time the target already exists, so it won't be copied + expect(gfs.copyFile).toBeCalledWith(path.join('hash1'), path.join('project', '_tmp', 'package.json')) + expect(gfs.copyFile).toBeCalledWith(path.join('hash2'), path.join('project', '_tmp', 'index.js')) }) test('packageImportMethod=hardlink does not relink package from store if package.json is linked from the store', async () => { const importPackage = createIndexedPkgImporter('hardlink') - fsMock.promises.copyFile = jest.fn() - fsMock.promises.rename = jest.fn() - fsMock.promises.stat = jest.fn(() => ({ ino: 1 })) + ;(gfs.stat as jest.Mock).mockReturnValue(Promise.resolve({ ino: 1 })) expect(await importPackage('project/package', { filesMap: { 'index.js': 'hash2', @@ -167,12 +172,9 @@ test('packageImportMethod=hardlink does not relink package from store if package }) test('packageImportMethod=hardlink relinks package from store if package.json is not linked from the store', async () => { - globalInfo.mockReset() const importPackage = createIndexedPkgImporter('hardlink') - fsMock.promises.copyFile = jest.fn() - fsMock.promises.rename = jest.fn() let ino = 0 - fsMock.promises.stat = jest.fn(() => ({ ino: ++ino })) + ;(gfs.stat as jest.Mock).mockImplementation(async () => ({ ino: ++ino })) expect(await importPackage('project/package', { filesMap: { 'index.js': 'hash2', @@ -186,9 +188,7 @@ test('packageImportMethod=hardlink relinks package from store if package.json is test('packageImportMethod=hardlink does not relink package from store if package.json is not present in the store', async () => { const importPackage = createIndexedPkgImporter('hardlink') - fsMock.promises.copyFile = jest.fn() - fsMock.promises.rename = jest.fn() - fsMock.promises.stat = jest.fn((file) => { + ;(gfs.stat as jest.Mock).mockImplementation(async (file) => { expect(typeof file).toBe('string') return { ino: 1 } }) @@ -202,11 +202,8 @@ test('packageImportMethod=hardlink does not relink package from store if package }) test('packageImportMethod=hardlink links packages when they are not found', async () => { - globalInfo.mockReset() const importPackage = createIndexedPkgImporter('hardlink') - fsMock.promises.copyFile = jest.fn() - fsMock.promises.rename = jest.fn() - fsMock.promises.stat = jest.fn((file) => { + ;(gfs.stat as jest.Mock).mockImplementation(async (file) => { if (file === path.join('project/package', 'package.json')) { throw Object.assign(new Error(), { code: 'ENOENT' }) } diff --git a/fs/indexed-pkg-importer/tsconfig.json b/fs/indexed-pkg-importer/tsconfig.json index bc6ba6bff7..49ca5028a2 100644 --- a/fs/indexed-pkg-importer/tsconfig.json +++ b/fs/indexed-pkg-importer/tsconfig.json @@ -17,6 +17,9 @@ }, { "path": "../../store/store-controller-types" + }, + { + "path": "../graceful-fs" } ], "composite": true diff --git a/hooks/pnpmfile/CHANGELOG.md b/hooks/pnpmfile/CHANGELOG.md index d41fd2b993..bcedd177aa 100644 --- a/hooks/pnpmfile/CHANGELOG.md +++ b/hooks/pnpmfile/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/pnpmfile +## 4.0.38 + +### Patch Changes + +- @pnpm/core@8.0.2 + ## 4.0.37 ### Patch Changes diff --git a/hooks/pnpmfile/package.json b/hooks/pnpmfile/package.json index a4a5db0755..7714bbbbe8 100644 --- a/hooks/pnpmfile/package.json +++ b/hooks/pnpmfile/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/pnpmfile", - "version": "4.0.37", + "version": "4.0.38", "description": "Reading a .pnpmfile.cjs", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/lockfile/audit/CHANGELOG.md b/lockfile/audit/CHANGELOG.md index 6479ed0daa..da14c37410 100644 --- a/lockfile/audit/CHANGELOG.md +++ b/lockfile/audit/CHANGELOG.md @@ -1,5 +1,14 @@ # @pnpm/audit +## 6.1.8 + +### Patch Changes + +- 185ab01ad: When patch package does not specify a version, use locally installed version by default [#6192](https://github.com/pnpm/pnpm/issues/6192). +- Updated dependencies [185ab01ad] + - @pnpm/list@8.2.2 + - @pnpm/read-project-manifest@4.1.4 + ## 6.1.7 ### Patch Changes diff --git a/lockfile/audit/package.json b/lockfile/audit/package.json index 2cbde89a1d..e435c54e76 100644 --- a/lockfile/audit/package.json +++ b/lockfile/audit/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/audit", - "version": "6.1.7", + "version": "6.1.8", "description": "Audit a lockfile", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/lockfile/audit/src/index.ts b/lockfile/audit/src/index.ts index e415a157fe..c96b2e5957 100644 --- a/lockfile/audit/src/index.ts +++ b/lockfile/audit/src/index.ts @@ -6,7 +6,7 @@ import { Lockfile } from '@pnpm/lockfile-types' import { DependenciesField } from '@pnpm/types' import { lockfileToAuditTree } from './lockfileToAuditTree' import { AuditReport } from './types' -import { searchForPackages, PackageNode } from '@pnpm/list' +import { searchForPackages, flattenSearchedPackages } from '@pnpm/list' export * from './types' @@ -95,28 +95,7 @@ async function searchPackagePaths ( pkg: string ) { const pkgs = await searchForPackages([pkg], projectDirs, searchOpts) - const paths: string[] = [] - - for (const pkg of pkgs) { - _walker([ - ...(pkg.optionalDependencies ?? []), - ...(pkg.dependencies ?? []), - ...(pkg.devDependencies ?? []), - ...(pkg.unsavedDependencies ?? []), - ], path.relative(searchOpts.lockfileDir, pkg.path) || '.') - } - return paths - - function _walker (packages: PackageNode[], depPath: string) { - for (const pkg of packages) { - const nextDepPath = `${depPath} > ${pkg.name}@${pkg.version}` - if (pkg.dependencies?.length) { - _walker(pkg.dependencies, nextDepPath) - } else { - paths.push(nextDepPath) - } - } - } + return flattenSearchedPackages(pkgs, { lockfileDir: searchOpts.lockfileDir }).map(({ depPath }) => depPath) } export class AuditEndpointNotExistsError extends PnpmError { diff --git a/lockfile/lockfile-file/CHANGELOG.md b/lockfile/lockfile-file/CHANGELOG.md index 8d73f15b6d..ce00caaa94 100644 --- a/lockfile/lockfile-file/CHANGELOG.md +++ b/lockfile/lockfile-file/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/lockfile-file +## 7.0.6 + +### Patch Changes + +- 787c43dcc: `patchedDependencies` are now sorted consistently in the lockfile [#6208](https://github.com/pnpm/pnpm/pull/6208). + ## 7.0.5 ### Patch Changes diff --git a/lockfile/lockfile-file/package.json b/lockfile/lockfile-file/package.json index c7560227b8..6f53a6e700 100644 --- a/lockfile/lockfile-file/package.json +++ b/lockfile/lockfile-file/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/lockfile-file", - "version": "7.0.5", + "version": "7.0.6", "description": "Read/write pnpm-lock.yaml files", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/lockfile/lockfile-file/src/sortLockfileKeys.ts b/lockfile/lockfile-file/src/sortLockfileKeys.ts index 06fadb4a64..03b34f0ed2 100644 --- a/lockfile/lockfile-file/src/sortLockfileKeys.ts +++ b/lockfile/lockfile-file/src/sortLockfileKeys.ts @@ -77,9 +77,9 @@ export function sortLockfileKeys (lockfile: LockfileFile) { }) } } - for (const key of ['specifiers', 'dependencies', 'devDependencies', 'optionalDependencies', 'time'] as const) { + for (const key of ['specifiers', 'dependencies', 'devDependencies', 'optionalDependencies', 'time', 'patchedDependencies'] as const) { if (!lockfile[key]) continue - lockfile[key] = sortKeys(lockfile[key]!) + lockfile[key] = sortKeys(lockfile[key]) // eslint-disable-line @typescript-eslint/no-explicit-any } return sortKeys(lockfile, { compare: compareRootKeys }) } diff --git a/lockfile/lockfile-file/test/sortLockfileKeys.test.ts b/lockfile/lockfile-file/test/sortLockfileKeys.test.ts index dce970ed9c..083e670b9a 100644 --- a/lockfile/lockfile-file/test/sortLockfileKeys.test.ts +++ b/lockfile/lockfile-file/test/sortLockfileKeys.test.ts @@ -26,6 +26,11 @@ test('sorts keys alphabetically', () => { }, }, }, + patchedDependencies: { + zzz: { path: 'foo', hash: 'bar' }, + bar: { path: 'foo', hash: 'bar' }, + aaa: { path: 'foo', hash: 'bar' }, + }, }) expect(normalizedLockfile).toStrictEqual({ @@ -52,9 +57,15 @@ test('sorts keys alphabetically', () => { }, }, }, + patchedDependencies: { + aaa: { path: 'foo', hash: 'bar' }, + bar: { path: 'foo', hash: 'bar' }, + zzz: { path: 'foo', hash: 'bar' }, + }, }) expect(Object.keys(normalizedLockfile.importers?.foo.dependencies ?? {})).toStrictEqual(['aaa', 'bar', 'zzz']) expect(Object.keys(normalizedLockfile.importers?.foo.specifiers ?? {})).toStrictEqual(['aaa', 'bar', 'zzz']) + expect(Object.keys(normalizedLockfile.patchedDependencies ?? {})).toStrictEqual(['aaa', 'bar', 'zzz']) }) test('sorting does not care about locale (e.g. Czech has "ch" as a single character after "h")', () => { diff --git a/lockfile/lockfile-to-pnp/CHANGELOG.md b/lockfile/lockfile-to-pnp/CHANGELOG.md index 2215993af9..647ce8c8fd 100644 --- a/lockfile/lockfile-to-pnp/CHANGELOG.md +++ b/lockfile/lockfile-to-pnp/CHANGELOG.md @@ -1,5 +1,12 @@ # @pnpm/lockfile-to-pnp +## 2.0.14 + +### Patch Changes + +- Updated dependencies [787c43dcc] + - @pnpm/lockfile-file@7.0.6 + ## 2.0.13 ### Patch Changes diff --git a/lockfile/lockfile-to-pnp/package.json b/lockfile/lockfile-to-pnp/package.json index 0f4d8f24f5..b4011a46a8 100644 --- a/lockfile/lockfile-to-pnp/package.json +++ b/lockfile/lockfile-to-pnp/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/lockfile-to-pnp", - "version": "2.0.13", + "version": "2.0.14", "description": "Creates a Plug'n'Play file from a pnpm-lock.yaml", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/lockfile/plugin-commands-audit/CHANGELOG.md b/lockfile/plugin-commands-audit/CHANGELOG.md index 2ff00eb7c6..a10e5bf237 100644 --- a/lockfile/plugin-commands-audit/CHANGELOG.md +++ b/lockfile/plugin-commands-audit/CHANGELOG.md @@ -1,5 +1,18 @@ # @pnpm/plugin-commands-audit +## 7.2.13 + +### Patch Changes + +- Updated dependencies [185ab01ad] +- Updated dependencies [787c43dcc] +- Updated dependencies [e505b58e3] + - @pnpm/audit@6.1.8 + - @pnpm/lockfile-file@7.0.6 + - @pnpm/config@17.0.0 + - @pnpm/read-project-manifest@4.1.4 + - @pnpm/cli-utils@1.1.5 + ## 7.2.12 ### Patch Changes diff --git a/lockfile/plugin-commands-audit/package.json b/lockfile/plugin-commands-audit/package.json index 0acb82cf9b..882ae8368d 100644 --- a/lockfile/plugin-commands-audit/package.json +++ b/lockfile/plugin-commands-audit/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/plugin-commands-audit", - "version": "7.2.12", + "version": "7.2.13", "description": "pnpm commands for dependencies audit", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/make-dedicated-lockfile/CHANGELOG.md b/packages/make-dedicated-lockfile/CHANGELOG.md index edf123cf07..81ed1f5808 100644 --- a/packages/make-dedicated-lockfile/CHANGELOG.md +++ b/packages/make-dedicated-lockfile/CHANGELOG.md @@ -1,5 +1,14 @@ # @pnpm/make-dedicated-lockfile +## 0.4.14 + +### Patch Changes + +- Updated dependencies [787c43dcc] + - @pnpm/lockfile-file@7.0.6 + - @pnpm/read-project-manifest@4.1.4 + - @pnpm/exportable-manifest@4.0.8 + ## 0.4.13 ### Patch Changes diff --git a/packages/make-dedicated-lockfile/package.json b/packages/make-dedicated-lockfile/package.json index 6e6a3e3f8c..127b9d9523 100644 --- a/packages/make-dedicated-lockfile/package.json +++ b/packages/make-dedicated-lockfile/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/make-dedicated-lockfile", - "version": "0.4.13", + "version": "0.4.14", "description": "Creates a dedicated lockfile for a subset of workspace projects", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/mount-modules/CHANGELOG.md b/packages/mount-modules/CHANGELOG.md index 3ea7bbb5b2..f679e3ca4c 100644 --- a/packages/mount-modules/CHANGELOG.md +++ b/packages/mount-modules/CHANGELOG.md @@ -1,5 +1,15 @@ # @pnpm/mount-modules +## 0.3.40 + +### Patch Changes + +- Updated dependencies [787c43dcc] +- Updated dependencies [e505b58e3] + - @pnpm/lockfile-file@7.0.6 + - @pnpm/config@17.0.0 + - @pnpm/cafs@6.0.2 + ## 0.3.39 ### Patch Changes diff --git a/packages/mount-modules/package.json b/packages/mount-modules/package.json index 9a1776d2d6..8c22a81f40 100644 --- a/packages/mount-modules/package.json +++ b/packages/mount-modules/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/mount-modules", - "version": "0.3.39", + "version": "0.3.40", "description": "Mounts a node_modules directory with FUSE", "main": "lib/index.js", "bin": "bin/mount-modules.js", diff --git a/packages/plugin-commands-doctor/CHANGELOG.md b/packages/plugin-commands-doctor/CHANGELOG.md index 9596ece602..65710ab764 100644 --- a/packages/plugin-commands-doctor/CHANGELOG.md +++ b/packages/plugin-commands-doctor/CHANGELOG.md @@ -1,5 +1,13 @@ # @pnpm/plugin-commands-doctor +## 1.0.38 + +### Patch Changes + +- Updated dependencies [e505b58e3] + - @pnpm/config@17.0.0 + - @pnpm/cli-utils@1.1.5 + ## 1.0.37 ### Patch Changes diff --git a/packages/plugin-commands-doctor/package.json b/packages/plugin-commands-doctor/package.json index 0a5349d623..8d63057adc 100644 --- a/packages/plugin-commands-doctor/package.json +++ b/packages/plugin-commands-doctor/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/plugin-commands-doctor", - "version": "1.0.37", + "version": "1.0.38", "description": "Commands for checks of known common issues ", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/plugin-commands-init/CHANGELOG.md b/packages/plugin-commands-init/CHANGELOG.md index b0085b7a1d..0d6827fbcd 100644 --- a/packages/plugin-commands-init/CHANGELOG.md +++ b/packages/plugin-commands-init/CHANGELOG.md @@ -1,5 +1,13 @@ # @pnpm/plugin-commands-init +## 2.0.40 + +### Patch Changes + +- Updated dependencies [e505b58e3] + - @pnpm/config@17.0.0 + - @pnpm/cli-utils@1.1.5 + ## 2.0.39 ### Patch Changes diff --git a/packages/plugin-commands-init/package.json b/packages/plugin-commands-init/package.json index c30ff818d3..e26ebdcab4 100644 --- a/packages/plugin-commands-init/package.json +++ b/packages/plugin-commands-init/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/plugin-commands-init", - "version": "2.0.39", + "version": "2.0.40", "description": "Create a package.json file", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/plugin-commands-setup/CHANGELOG.md b/packages/plugin-commands-setup/CHANGELOG.md index 9742f03d3d..b11a9858b9 100644 --- a/packages/plugin-commands-setup/CHANGELOG.md +++ b/packages/plugin-commands-setup/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/plugin-commands-setup +## 3.0.40 + +### Patch Changes + +- @pnpm/cli-utils@1.1.5 + ## 3.0.39 ### Patch Changes diff --git a/packages/plugin-commands-setup/package.json b/packages/plugin-commands-setup/package.json index ae26d5bd58..1557680547 100644 --- a/packages/plugin-commands-setup/package.json +++ b/packages/plugin-commands-setup/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/plugin-commands-setup", - "version": "3.0.39", + "version": "3.0.40", "description": "pnpm commands for setting up pnpm", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/patching/plugin-commands-patching/CHANGELOG.md b/patching/plugin-commands-patching/CHANGELOG.md index a130f85a8f..b95c2ad987 100644 --- a/patching/plugin-commands-patching/CHANGELOG.md +++ b/patching/plugin-commands-patching/CHANGELOG.md @@ -1,5 +1,19 @@ # @pnpm/plugin-commands-patching +## 2.1.14 + +### Patch Changes + +- 185ab01ad: When patch package does not specify a version, use locally installed version by default [#6192](https://github.com/pnpm/pnpm/issues/6192). +- Updated dependencies [787c43dcc] +- Updated dependencies [e505b58e3] + - @pnpm/lockfile-file@7.0.6 + - @pnpm/config@17.0.0 + - @pnpm/plugin-commands-installation@11.5.5 + - @pnpm/read-project-manifest@4.1.4 + - @pnpm/cli-utils@1.1.5 + - @pnpm/store-connection-manager@5.2.18 + ## 2.1.13 ### Patch Changes diff --git a/patching/plugin-commands-patching/package.json b/patching/plugin-commands-patching/package.json index a288d9602d..6e0ce3c751 100644 --- a/patching/plugin-commands-patching/package.json +++ b/patching/plugin-commands-patching/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/plugin-commands-patching", - "version": "2.1.13", + "version": "2.1.14", "description": "Commands for creating patches", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -37,13 +37,17 @@ "@pnpm/plugin-commands-patching": "workspace:*", "@pnpm/prepare": "workspace:*", "@pnpm/registry-mock": "3.5.0", + "@pnpm/test-fixtures": "workspace:*", "@types/ramda": "0.28.20", + "@types/semver": "7.3.13", "write-yaml-file": "^4.2.0" }, "dependencies": { "@pnpm/cli-utils": "workspace:*", "@pnpm/config": "workspace:*", + "@pnpm/constants": "workspace:*", "@pnpm/error": "workspace:*", + "@pnpm/modules-yaml": "workspace:*", "@pnpm/parse-wanted-dependency": "workspace:*", "@pnpm/patching.apply-patch": "workspace:*", "@pnpm/pick-registry-for-package": "workspace:*", @@ -51,10 +55,15 @@ "@pnpm/read-package-json": "workspace:*", "@pnpm/read-project-manifest": "workspace:*", "@pnpm/store-connection-manager": "workspace:*", + "@pnpm/lockfile-file": "workspace:*", + "@pnpm/lockfile-utils": "workspace:*", + "enquirer": "^2.3.6", "escape-string-regexp": "^4.0.0", "ramda": "npm:@pnpm/ramda@0.28.1", + "realpath-missing": "^1.1.0", "render-help": "^1.0.3", "safe-execa": "^0.1.3", + "semver": "^7.3.8", "tempy": "^1.0.1" }, "peerDependencies": { diff --git a/patching/plugin-commands-patching/src/getPatchedDependency.ts b/patching/plugin-commands-patching/src/getPatchedDependency.ts new file mode 100644 index 0000000000..e03d9e21d5 --- /dev/null +++ b/patching/plugin-commands-patching/src/getPatchedDependency.ts @@ -0,0 +1,72 @@ +import path from 'path' +import { parseWantedDependency, ParseWantedDependencyResult } from '@pnpm/parse-wanted-dependency' +import { prompt } from 'enquirer' +import { readCurrentLockfile } from '@pnpm/lockfile-file' +import { nameVerFromPkgSnapshot } from '@pnpm/lockfile-utils' +import { PnpmError } from '@pnpm/error' +import { WANTED_LOCKFILE } from '@pnpm/constants' +import { readModulesManifest } from '@pnpm/modules-yaml' +import realpathMissing from 'realpath-missing' +import semver from 'semver' +import { Config } from '@pnpm/config' + +type GetPatchedDependencyOptions = { + lockfileDir: string +} & Pick + +export async function getPatchedDependency (rawDependency: string, opts: GetPatchedDependencyOptions): Promise { + const dep = parseWantedDependency(rawDependency) + + const { versions, preferredVersions } = await getVersionsFromLockfile(dep, opts) + + if (!preferredVersions.length) { + throw new PnpmError( + 'PATCH_VERSION_NOT_FOUND', + `Can not find ${rawDependency} in project ${opts.lockfileDir}, ${versions.length ? `you can specify currently installed version: ${versions.join(', ')}.` : `did you forget to install ${rawDependency}?`}` + ) + } + + dep.alias = dep.alias ?? rawDependency + if (preferredVersions.length > 1) { + const { version } = await prompt<{ + version: string + }>({ + type: 'select', + name: 'version', + message: 'Choose which version to patch', + choices: versions, + }) + dep.pref = version + } else { + dep.pref = preferredVersions[0] + } + + return dep +} + +async function getVersionsFromLockfile (dep: ParseWantedDependencyResult, opts: GetPatchedDependencyOptions) { + const modulesDir = await realpathMissing(path.join(opts.lockfileDir, opts.modulesDir ?? 'node_modules')) + const modules = await readModulesManifest(modulesDir) + const lockfile = (modules?.virtualStoreDir && await readCurrentLockfile(modules.virtualStoreDir, { + ignoreIncompatible: true, + })) ?? null + + if (!lockfile) { + throw new PnpmError( + 'PATCH_NO_LOCKFILE', + `No ${WANTED_LOCKFILE} found: Cannot patch without a lockfile` + ) + } + + const pkgName = dep.alias && dep.pref ? dep.alias : (dep.pref ?? dep.alias) + + const versions = Object.entries(lockfile.packages ?? {}) + .map(([depPath, pkgSnapshot]) => nameVerFromPkgSnapshot(depPath, pkgSnapshot)) + .filter(({ name }) => name === pkgName) + .map(({ version }) => version) + + return { + versions, + preferredVersions: versions.filter(version => dep.alias && dep.pref ? semver.satisfies(version, dep.pref) : true), + } +} diff --git a/patching/plugin-commands-patching/src/patch.ts b/patching/plugin-commands-patching/src/patch.ts index c5f4c7d419..47d0f1ee06 100644 --- a/patching/plugin-commands-patching/src/patch.ts +++ b/patching/plugin-commands-patching/src/patch.ts @@ -11,7 +11,9 @@ import pick from 'ramda/src/pick' import renderHelp from 'render-help' import tempy from 'tempy' import { PnpmError } from '@pnpm/error' -import { writePackage, ParseWantedDependencyResult } from './writePackage' +import { ParseWantedDependencyResult } from '@pnpm/parse-wanted-dependency' +import { writePackage } from './writePackage' +import { getPatchedDependency } from './getPatchedDependency' export function rcOptionsTypes () { return pick([], allTypes) @@ -48,7 +50,16 @@ export function help () { }) } -export type PatchCommandOptions = Pick & CreateStoreControllerOptions & { +export type PatchCommandOptions = Pick & CreateStoreControllerOptions & { editDir?: string reporter?: (logObj: LogBase) => void ignoreExisting?: boolean @@ -58,14 +69,24 @@ export async function handler (opts: PatchCommandOptions, params: string[]) { if (opts.editDir && fs.existsSync(opts.editDir) && fs.readdirSync(opts.editDir).length > 0) { throw new PnpmError('PATCH_EDIT_DIR_EXISTS', `The target directory already exists: '${opts.editDir}'`) } + if (!params[0]) { + throw new PnpmError('MISSING_PACKAGE_NAME', '`pnpm patch` requires the package name') + } const editDir = opts.editDir ?? tempy.directory() - const patchedDep = await writePackage(params[0], editDir, opts) + const lockfileDir = opts.lockfileDir ?? opts.dir ?? process.cwd() + const patchedDep = await getPatchedDependency(params[0], { + lockfileDir, + modulesDir: opts.modulesDir, + virtualStoreDir: opts.virtualStoreDir, + }) + + await writePackage(patchedDep, editDir, opts) if (!opts.ignoreExisting && opts.rootProjectManifest?.pnpm?.patchedDependencies) { tryPatchWithExistingPatchFile({ patchedDep, patchedDir: editDir, patchedDependencies: opts.rootProjectManifest.pnpm.patchedDependencies, - lockfileDir: opts.lockfileDir ?? opts.dir ?? process.cwd(), + lockfileDir, }) } return `You can now edit the following folder: ${editDir} diff --git a/patching/plugin-commands-patching/src/patchCommit.ts b/patching/plugin-commands-patching/src/patchCommit.ts index e350f2f6d0..1c716aa6e1 100644 --- a/patching/plugin-commands-patching/src/patchCommit.ts +++ b/patching/plugin-commands-patching/src/patchCommit.ts @@ -11,6 +11,7 @@ import escapeStringRegexp from 'escape-string-regexp' import renderHelp from 'render-help' import tempy from 'tempy' import { writePackage } from './writePackage' +import { parseWantedDependency } from '@pnpm/parse-wanted-dependency' export const rcOptionsTypes = cliOptionsTypes @@ -37,7 +38,7 @@ export async function handler (opts: install.InstallCommandOptions & Pick -export async function writePackage (pkg: string, dest: string, opts: WritePackageOptions): Promise { - const dep = parseWantedDependency(pkg) +export async function writePackage (dep: ParseWantedDependencyResult, dest: string, opts: WritePackageOptions) { const store = await createOrConnectStoreController({ ...opts, packageImportMethod: 'clone-or-copy', @@ -28,5 +25,4 @@ export async function writePackage (pkg: string, dest: string, opts: WritePackag filesResponse, force: true, }) - return dep } diff --git a/patching/plugin-commands-patching/test/patch.test.ts b/patching/plugin-commands-patching/test/patch.test.ts index a4b8837c11..33591ae7e1 100644 --- a/patching/plugin-commands-patching/test/patch.test.ts +++ b/patching/plugin-commands-patching/test/patch.test.ts @@ -1,7 +1,7 @@ import fs from 'fs' import os from 'os' import path from 'path' -import { prepare, preparePackages } from '@pnpm/prepare' +import { prepare, preparePackages, tempDir } from '@pnpm/prepare' import { install } from '@pnpm/plugin-commands-installation' import { readProjects } from '@pnpm/filter-workspace-packages' import writeYamlFile from 'write-yaml-file' @@ -10,31 +10,50 @@ import { patch, patchCommit } from '@pnpm/plugin-commands-patching' import { readProjectManifest } from '@pnpm/read-project-manifest' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { DEFAULT_OPTS } from './utils/index' +import { fixtures } from '@pnpm/test-fixtures' +import * as enquirer from 'enquirer' + +jest.mock('enquirer', () => ({ prompt: jest.fn() })) + +// eslint-disable-next-line +const prompt = enquirer.prompt as any +const f = fixtures(__dirname) + +const basePatchOption = { + pnpmHomeDir: '', + rawConfig: { + registry: `http://localhost:${REGISTRY_MOCK_PORT}/`, + }, + registries: { default: `http://localhost:${REGISTRY_MOCK_PORT}/` }, + userConfig: {}, + virtualStoreDir: 'node_modules/.pnpm', +} describe('patch and commit', () => { let defaultPatchOption: patch.PatchCommandOptions - beforeEach(() => { + beforeEach(async () => { prepare({ dependencies: { 'is-positive': '1.0.0', }, }) - const cacheDir = path.resolve('cache') const storeDir = path.resolve('store') - defaultPatchOption = { + ...basePatchOption, cacheDir, dir: process.cwd(), - pnpmHomeDir: '', - rawConfig: { - registry: `http://localhost:${REGISTRY_MOCK_PORT}/`, - }, - registries: { default: `http://localhost:${REGISTRY_MOCK_PORT}/` }, storeDir, - userConfig: {}, } + + await install.handler({ + ...DEFAULT_OPTS, + cacheDir, + storeDir, + dir: process.cwd(), + saveLockfile: true, + }) }) test('patch and commit', async () => { @@ -55,6 +74,8 @@ describe('patch and commit', () => { await patchCommit.handler({ ...DEFAULT_OPTS, dir: process.cwd(), + frozenLockfile: false, + fixLockfile: true, }, [patchDir]) const { manifest } = await readProjectManifest(process.cwd()) @@ -84,6 +105,8 @@ describe('patch and commit', () => { await patchCommit.handler({ ...DEFAULT_OPTS, dir: process.cwd(), + frozenLockfile: false, + fixLockfile: true, }, [patchDir]) expect(fs.readFileSync('node_modules/is-positive/index.js', 'utf8')).toContain('// test patching') @@ -111,6 +134,8 @@ describe('patch and commit', () => { await patchCommit.handler({ ...DEFAULT_OPTS, dir: process.cwd(), + frozenLockfile: false, + fixLockfile: true, }, [patchDir]) expect(fs.readFileSync('node_modules/is-positive/index.js', 'utf8')).toContain('// test patching') @@ -126,6 +151,8 @@ describe('patch and commit', () => { await patchCommit.handler({ ...DEFAULT_OPTS, dir: process.cwd(), + frozenLockfile: false, + fixLockfile: true, }, [patchDir]) const { manifest } = await readProjectManifest(process.cwd()) @@ -171,6 +198,8 @@ describe('patch and commit', () => { await patchCommit.handler({ ...DEFAULT_OPTS, dir: process.cwd(), + frozenLockfile: false, + fixLockfile: true, }, [patchDir]) const { manifest } = await readProjectManifest(process.cwd()) @@ -187,12 +216,101 @@ describe('patch and commit', () => { expect(fs.existsSync(path.join(patchDir, 'license'))).toBe(true) expect(fs.readFileSync(path.join(patchDir, 'index.js'), 'utf8')).not.toContain('// test patching') }) + + test('patch throw an error if no package specified', async () => { + await expect(() => patch.handler({ ...defaultPatchOption }, [])) + .rejects.toThrow('`pnpm patch` requires the package name') + }) + + test('should throw an error if no installed versions found for patched package', async () => { + await expect(() => patch.handler(defaultPatchOption, ['chalk'])) + .rejects.toThrow(`Can not find chalk in project ${process.cwd()}, did you forget to install chalk?`) + }) + + test('should throw an error if no preferred versions found for patched package', async () => { + await expect(() => patch.handler(defaultPatchOption, ['is-positive@2.0.0'])) + .rejects.toThrow(`Can not find is-positive@2.0.0 in project ${process.cwd()}, you can specify currently installed version: 1.0.0.`) + }) + + test('patch package with installed version', async () => { + const output = await patch.handler(defaultPatchOption, ['is-positive@1']) + const patchDir = getPatchDirFromPatchOutput(output) + const tempDir = os.tmpdir() + expect(patchDir).toContain(tempDir) + expect(fs.existsSync(patchDir)).toBe(true) + expect(JSON.parse(fs.readFileSync(path.join(patchDir, 'package.json'), 'utf8')).version).toBe('1.0.0') + }) +}) + +describe('prompt to choose version', () => { + let defaultPatchOption: patch.PatchCommandOptions + let cacheDir: string + let storeDir: string + beforeEach(() => { + prepare({ + dependencies: { + ava: '5.2.0', + chalk: '4.1.2', + }, + }) + cacheDir = path.resolve('cache') + storeDir = path.resolve('store') + defaultPatchOption = { + ...basePatchOption, + cacheDir, + dir: process.cwd(), + storeDir, + } + }) + + test('prompt to choose version if multiple version founded for patched package', async () => { + await install.handler({ + ...DEFAULT_OPTS, + cacheDir, + storeDir, + dir: process.cwd(), + saveLockfile: true, + }) + prompt.mockResolvedValue({ + version: '5.2.0', + }) + + const output = await patch.handler(defaultPatchOption, ['chalk']) + + expect(prompt.mock.calls[0][0].choices).toEqual(expect.arrayContaining(['5.2.0', '4.1.2'])) + prompt.mockClear() + + const patchDir = getPatchDirFromPatchOutput(output) + const tempDir = os.tmpdir() + + expect(patchDir).toContain(tempDir) + expect(fs.existsSync(patchDir)).toBe(true) + expect(JSON.parse(fs.readFileSync(path.join(patchDir, 'package.json'), 'utf8')).version).toBe('5.2.0') + expect(fs.existsSync(path.join(patchDir, 'source/index.js'))).toBe(true) + + fs.appendFileSync(path.join(patchDir, 'source/index.js'), '// test patching', 'utf8') + await patchCommit.handler({ + ...DEFAULT_OPTS, + dir: process.cwd(), + frozenLockfile: false, + fixLockfile: true, + }, [patchDir]) + + const { manifest } = await readProjectManifest(process.cwd()) + expect(manifest.pnpm?.patchedDependencies).toStrictEqual({ + 'chalk@5.2.0': 'patches/chalk@5.2.0.patch', + }) + const patchContent = fs.readFileSync('patches/chalk@5.2.0.patch', 'utf8') + expect(patchContent).toContain('diff --git') + expect(patchContent).toContain('// test patching') + expect(fs.readFileSync('node_modules/.pnpm/ava@5.2.0/node_modules/chalk/source/index.js', 'utf8')).toContain('// test patching') + }) }) describe('patching should work when there is a no EOL in the patched file', () => { let defaultPatchOption: patch.PatchCommandOptions - beforeEach(() => { + beforeEach(async () => { prepare({ dependencies: { 'safe-execa': '0.1.2', @@ -203,16 +321,19 @@ describe('patching should work when there is a no EOL in the patched file', () = const storeDir = path.resolve('store') defaultPatchOption = { + ...basePatchOption, cacheDir, dir: process.cwd(), - pnpmHomeDir: '', - rawConfig: { - registry: `http://localhost:${REGISTRY_MOCK_PORT}/`, - }, - registries: { default: `http://localhost:${REGISTRY_MOCK_PORT}/` }, storeDir, - userConfig: {}, } + + await install.handler({ + ...DEFAULT_OPTS, + cacheDir, + storeDir, + dir: process.cwd(), + saveLockfile: true, + }) }) it('should work when adding content on a newline', async () => { const output = await patch.handler(defaultPatchOption, ['safe-execa@0.1.2']) @@ -228,6 +349,8 @@ describe('patching should work when there is a no EOL in the patched file', () = await patchCommit.handler({ ...DEFAULT_OPTS, dir: process.cwd(), + frozenLockfile: false, + fixLockfile: true, }, [userPatchDir]) const { manifest } = await readProjectManifest(process.cwd()) @@ -254,6 +377,8 @@ describe('patching should work when there is a no EOL in the patched file', () = await patchCommit.handler({ ...DEFAULT_OPTS, dir: process.cwd(), + frozenLockfile: false, + fixLockfile: true, }, [userPatchDir]) const { manifest } = await readProjectManifest(process.cwd()) @@ -300,15 +425,10 @@ describe('patch and commit in workspaces', () => { storeDir = path.resolve('store') defaultPatchOption = { + ...basePatchOption, cacheDir, dir: process.cwd(), - pnpmHomeDir: '', - rawConfig: { - registry: `http://localhost:${REGISTRY_MOCK_PORT}/`, - }, - registries: { default: `http://localhost:${REGISTRY_MOCK_PORT}/` }, storeDir, - userConfig: {}, } }) @@ -322,11 +442,11 @@ describe('patch and commit in workspaces', () => { allProjects, allProjectsGraph, dir: process.cwd(), + lockfileDir: process.cwd(), selectedProjectsGraph, workspaceDir: process.cwd(), saveLockfile: true, }) - const output = await patch.handler(defaultPatchOption, ['is-positive@1.0.0']) const patchDir = getPatchDirFromPatchOutput(output) const tempDir = os.tmpdir() @@ -350,6 +470,8 @@ describe('patch and commit in workspaces', () => { lockfileDir: process.cwd(), workspaceDir: process.cwd(), saveLockfile: true, + frozenLockfile: false, + fixLockfile: true, }, [patchDir]) const { manifest } = await readProjectManifest(process.cwd()) @@ -366,6 +488,68 @@ describe('patch and commit in workspaces', () => { }) }) +describe('patch with custom modules-dir and virtual-store-dir', () => { + const customModulesDirFixture = tempDir() + f.copy('custom-modules-dir', customModulesDirFixture) + const cacheDir = path.resolve(customModulesDirFixture, 'cache') + const storeDir = path.resolve(customModulesDirFixture, 'store') + const defaultPatchOption = { + ...basePatchOption, + cacheDir, + dir: customModulesDirFixture, + storeDir, + modulesDir: 'fake_modules', + virtualStoreDir: 'fake_modules/.fake_store', + } + + test('should work with custom modules-dir and virtual-store-dir', async () => { + const manifest = fs.readFileSync(path.join(customModulesDirFixture, 'package.json'), 'utf8') + const lockfileYaml = fs.readFileSync(path.join(customModulesDirFixture, 'pnpm-lock.yaml'), 'utf8') + const { allProjects, allProjectsGraph, selectedProjectsGraph } = await readProjects(customModulesDirFixture, []) + await install.handler({ + ...DEFAULT_OPTS, + cacheDir, + storeDir, + dir: customModulesDirFixture, + lockfileDir: customModulesDirFixture, + allProjects, + allProjectsGraph, + selectedProjectsGraph, + workspaceDir: customModulesDirFixture, + saveLockfile: true, + modulesDir: 'fake_modules', + virtualStoreDir: 'fake_modules/.fake_store', + }) + const output = await patch.handler(defaultPatchOption, ['is-positive@1']) + const patchDir = getPatchDirFromPatchOutput(output) + const tempDir = os.tmpdir() + expect(patchDir).toContain(tempDir) + expect(fs.existsSync(patchDir)).toBe(true) + expect(JSON.parse(fs.readFileSync(path.join(patchDir, 'package.json'), 'utf8')).version).toBe('1.0.0') + + fs.appendFileSync(path.join(patchDir, 'index.js'), '// test patching', 'utf8') + + await patchCommit.handler({ + ...DEFAULT_OPTS, + dir: customModulesDirFixture, + saveLockfile: true, + frozenLockfile: false, + fixLockfile: true, + allProjects, + allProjectsGraph, + selectedProjectsGraph, + modulesDir: 'fake_modules', + virtualStoreDir: 'fake_modules/.fake_store', + lockfileDir: customModulesDirFixture, + workspaceDir: customModulesDirFixture, + }, [patchDir]) + expect(fs.readFileSync(path.join(customModulesDirFixture, 'packages/bar/fake_modules/is-positive/index.js'), 'utf8')).toContain('// test patching') + // restore package.json and package-lock.yaml + fs.writeFileSync(path.join(customModulesDirFixture, 'package.json'), manifest, 'utf8') + fs.writeFileSync(path.join(customModulesDirFixture, 'pnpm-lock.yaml'), lockfileYaml, 'utf8') + }) +}) + function getPatchDirFromPatchOutput (output: string) { const [firstLine] = output.split('\n') return firstLine.substring(firstLine.indexOf(':') + 1).trim() diff --git a/patching/plugin-commands-patching/tsconfig.json b/patching/plugin-commands-patching/tsconfig.json index 3381d90c46..9fa50581f0 100644 --- a/patching/plugin-commands-patching/tsconfig.json +++ b/patching/plugin-commands-patching/tsconfig.json @@ -12,6 +12,9 @@ { "path": "../../__utils__/prepare" }, + { + "path": "../../__utils__/test-fixtures" + }, { "path": "../../cli/cli-utils" }, @@ -21,12 +24,24 @@ { "path": "../../config/pick-registry-for-package" }, + { + "path": "../../lockfile/lockfile-file" + }, + { + "path": "../../lockfile/lockfile-utils" + }, + { + "path": "../../packages/constants" + }, { "path": "../../packages/error" }, { "path": "../../packages/parse-wanted-dependency" }, + { + "path": "../../pkg-manager/modules-yaml" + }, { "path": "../../pkg-manager/plugin-commands-installation" }, diff --git a/pkg-manager/client/CHANGELOG.md b/pkg-manager/client/CHANGELOG.md index 6bd5a5aefa..e9541ce17d 100644 --- a/pkg-manager/client/CHANGELOG.md +++ b/pkg-manager/client/CHANGELOG.md @@ -1,5 +1,14 @@ # @pnpm/client +## 9.1.5 + +### Patch Changes + +- @pnpm/tarball-fetcher@14.1.4 +- @pnpm/directory-fetcher@5.1.6 +- @pnpm/default-resolver@17.0.11 +- @pnpm/git-fetcher@8.0.2 + ## 9.1.4 ### Patch Changes diff --git a/pkg-manager/client/package.json b/pkg-manager/client/package.json index 3c6a854510..92f446600a 100644 --- a/pkg-manager/client/package.json +++ b/pkg-manager/client/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/client", - "version": "9.1.4", + "version": "9.1.5", "description": "Creates the package resolve and fetch functions", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/pkg-manager/core/CHANGELOG.md b/pkg-manager/core/CHANGELOG.md index 9c3b296ca0..d2cd59ec4e 100644 --- a/pkg-manager/core/CHANGELOG.md +++ b/pkg-manager/core/CHANGELOG.md @@ -1,5 +1,24 @@ # @pnpm/core +## 8.0.2 + +### Patch Changes + +- Updated dependencies [787c43dcc] + - @pnpm/lockfile-file@7.0.6 + - @pnpm/package-requester@20.1.7 + - @pnpm/read-project-manifest@4.1.4 + - @pnpm/lockfile-to-pnp@2.0.14 + - @pnpm/get-context@8.2.4 + - @pnpm/headless@19.5.2 + - @pnpm/link-bins@8.0.9 + - @pnpm/resolve-dependencies@30.0.2 + - @pnpm/lifecycle@14.1.7 + - @pnpm/build-modules@10.1.7 + - @pnpm/hoist@7.0.16 + - @pnpm/symlink-dependency@6.0.3 + - @pnpm/crypto.base32-hash@1.0.1 + ## 8.0.1 ### Patch Changes diff --git a/pkg-manager/core/package.json b/pkg-manager/core/package.json index 5067d22b14..1fc2946f00 100644 --- a/pkg-manager/core/package.json +++ b/pkg-manager/core/package.json @@ -1,7 +1,7 @@ { "name": "@pnpm/core", "description": "Fast, disk space efficient installation engine", - "version": "8.0.1", + "version": "8.0.2", "bugs": { "url": "https://github.com/pnpm/pnpm/issues" }, diff --git a/pkg-manager/get-context/CHANGELOG.md b/pkg-manager/get-context/CHANGELOG.md index 56cfdd26d8..4c70aaf47a 100644 --- a/pkg-manager/get-context/CHANGELOG.md +++ b/pkg-manager/get-context/CHANGELOG.md @@ -1,5 +1,13 @@ # @pnpm/get-context +## 8.2.4 + +### Patch Changes + +- Updated dependencies [787c43dcc] + - @pnpm/lockfile-file@7.0.6 + - @pnpm/read-projects-context@7.0.12 + ## 8.2.3 ### Patch Changes diff --git a/pkg-manager/get-context/package.json b/pkg-manager/get-context/package.json index 2f7bf431de..dd37bc7449 100644 --- a/pkg-manager/get-context/package.json +++ b/pkg-manager/get-context/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/get-context", - "version": "8.2.3", + "version": "8.2.4", "description": "Gets context information about a project", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/pkg-manager/headless/CHANGELOG.md b/pkg-manager/headless/CHANGELOG.md index 8fc3cbf1ce..b64f37fd8e 100644 --- a/pkg-manager/headless/CHANGELOG.md +++ b/pkg-manager/headless/CHANGELOG.md @@ -1,5 +1,21 @@ # @pnpm/headless +## 19.5.2 + +### Patch Changes + +- Updated dependencies [787c43dcc] + - @pnpm/lockfile-file@7.0.6 + - @pnpm/package-requester@20.1.7 + - @pnpm/read-project-manifest@4.1.4 + - @pnpm/lockfile-to-pnp@2.0.14 + - @pnpm/real-hoist@1.1.6 + - @pnpm/link-bins@8.0.9 + - @pnpm/lifecycle@14.1.7 + - @pnpm/build-modules@10.1.7 + - @pnpm/hoist@7.0.16 + - @pnpm/symlink-dependency@6.0.3 + ## 19.5.1 ### Patch Changes diff --git a/pkg-manager/headless/package.json b/pkg-manager/headless/package.json index b0864c41c0..55cb11540d 100644 --- a/pkg-manager/headless/package.json +++ b/pkg-manager/headless/package.json @@ -1,7 +1,7 @@ { "name": "@pnpm/headless", "description": "Fast installation using only pnpm-lock.yaml", - "version": "19.5.1", + "version": "19.5.2", "bugs": { "url": "https://github.com/pnpm/pnpm/issues" }, diff --git a/pkg-manager/hoist/CHANGELOG.md b/pkg-manager/hoist/CHANGELOG.md index f73d056ba6..1347599523 100644 --- a/pkg-manager/hoist/CHANGELOG.md +++ b/pkg-manager/hoist/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/hoist +## 7.0.16 + +### Patch Changes + +- @pnpm/link-bins@8.0.9 + ## 7.0.15 ### Patch Changes diff --git a/pkg-manager/hoist/package.json b/pkg-manager/hoist/package.json index b5b2076e1e..9ecb81ebe8 100644 --- a/pkg-manager/hoist/package.json +++ b/pkg-manager/hoist/package.json @@ -1,7 +1,7 @@ { "name": "@pnpm/hoist", "description": "Hoists dependencies in a node_modules created by pnpm", - "version": "7.0.15", + "version": "7.0.16", "bugs": { "url": "https://github.com/pnpm/pnpm/issues" }, diff --git a/pkg-manager/link-bins/CHANGELOG.md b/pkg-manager/link-bins/CHANGELOG.md index e05ba9512a..bacfcba5ef 100644 --- a/pkg-manager/link-bins/CHANGELOG.md +++ b/pkg-manager/link-bins/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/link-bins +## 8.0.9 + +### Patch Changes + +- @pnpm/read-project-manifest@4.1.4 + ## 8.0.8 ### Patch Changes diff --git a/pkg-manager/link-bins/package.json b/pkg-manager/link-bins/package.json index 7bfa57d9cd..96b9660226 100644 --- a/pkg-manager/link-bins/package.json +++ b/pkg-manager/link-bins/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/link-bins", - "version": "8.0.8", + "version": "8.0.9", "description": "Link bins to node_modules/.bin", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/pkg-manager/package-requester/CHANGELOG.md b/pkg-manager/package-requester/CHANGELOG.md index c8f0f574e1..0500c94ac5 100644 --- a/pkg-manager/package-requester/CHANGELOG.md +++ b/pkg-manager/package-requester/CHANGELOG.md @@ -1,5 +1,13 @@ # @pnpm/package-requester +## 20.1.7 + +### Patch Changes + +- Updated dependencies [955874422] + - @pnpm/graceful-fs@2.1.0 + - @pnpm/cafs@6.0.2 + ## 20.1.6 ### Patch Changes diff --git a/pkg-manager/package-requester/package.json b/pkg-manager/package-requester/package.json index 4da67fd841..329f8356a0 100644 --- a/pkg-manager/package-requester/package.json +++ b/pkg-manager/package-requester/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/package-requester", - "version": "20.1.6", + "version": "20.1.7", "description": "Concurrent downloader of npm-compatible packages", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/pkg-manager/plugin-commands-installation/CHANGELOG.md b/pkg-manager/plugin-commands-installation/CHANGELOG.md index 9f8f43367b..2c37e26f93 100644 --- a/pkg-manager/plugin-commands-installation/CHANGELOG.md +++ b/pkg-manager/plugin-commands-installation/CHANGELOG.md @@ -1,5 +1,24 @@ # @pnpm/plugin-commands-installation +## 11.5.5 + +### Patch Changes + +- Updated dependencies [955874422] +- Updated dependencies [e505b58e3] + - @pnpm/graceful-fs@2.1.0 + - @pnpm/config@17.0.0 + - @pnpm/read-project-manifest@4.1.4 + - @pnpm/core@8.0.2 + - @pnpm/outdated@11.0.21 + - @pnpm/cli-utils@1.1.5 + - @pnpm/plugin-commands-rebuild@7.1.5 + - @pnpm/store-connection-manager@5.2.18 + - @pnpm/package-store@15.1.8 + - @pnpm/pnpmfile@4.0.38 + - @pnpm/find-workspace-packages@5.0.40 + - @pnpm/filter-workspace-packages@6.0.40 + ## 11.5.4 ### Patch Changes diff --git a/pkg-manager/plugin-commands-installation/package.json b/pkg-manager/plugin-commands-installation/package.json index e1b8fac9df..72651187ef 100644 --- a/pkg-manager/plugin-commands-installation/package.json +++ b/pkg-manager/plugin-commands-installation/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/plugin-commands-installation", - "version": "11.5.4", + "version": "11.5.5", "description": "Commands for installation", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/pkg-manager/read-projects-context/CHANGELOG.md b/pkg-manager/read-projects-context/CHANGELOG.md index f834c5c4ca..b414367e2f 100644 --- a/pkg-manager/read-projects-context/CHANGELOG.md +++ b/pkg-manager/read-projects-context/CHANGELOG.md @@ -1,5 +1,12 @@ # @pnpm/read-projects-context +## 7.0.12 + +### Patch Changes + +- Updated dependencies [787c43dcc] + - @pnpm/lockfile-file@7.0.6 + ## 7.0.11 ### Patch Changes diff --git a/pkg-manager/read-projects-context/package.json b/pkg-manager/read-projects-context/package.json index c470c05044..ceed22b5e7 100644 --- a/pkg-manager/read-projects-context/package.json +++ b/pkg-manager/read-projects-context/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/read-projects-context", - "version": "7.0.11", + "version": "7.0.12", "description": "Reads the current state of projects from modules manifest", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/pkg-manager/resolve-dependencies/CHANGELOG.md b/pkg-manager/resolve-dependencies/CHANGELOG.md index d41a6ebd60..8733db77c0 100644 --- a/pkg-manager/resolve-dependencies/CHANGELOG.md +++ b/pkg-manager/resolve-dependencies/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/resolve-dependencies +## 30.0.2 + +### Patch Changes + +- @pnpm/npm-resolver@15.0.9 + ## 30.0.1 ### Patch Changes diff --git a/pkg-manager/resolve-dependencies/package.json b/pkg-manager/resolve-dependencies/package.json index df743a988d..b8f3ddd5b5 100644 --- a/pkg-manager/resolve-dependencies/package.json +++ b/pkg-manager/resolve-dependencies/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/resolve-dependencies", - "version": "30.0.1", + "version": "30.0.2", "description": "Resolves dependency graph of a package", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/pkg-manifest/exportable-manifest/CHANGELOG.md b/pkg-manifest/exportable-manifest/CHANGELOG.md index 4b3840eb68..d9559f8525 100644 --- a/pkg-manifest/exportable-manifest/CHANGELOG.md +++ b/pkg-manifest/exportable-manifest/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/exportable-manifest +## 4.0.8 + +### Patch Changes + +- @pnpm/read-project-manifest@4.1.4 + ## 4.0.7 ### Patch Changes diff --git a/pkg-manifest/exportable-manifest/package.json b/pkg-manifest/exportable-manifest/package.json index f2418f6ace..c2cb147662 100644 --- a/pkg-manifest/exportable-manifest/package.json +++ b/pkg-manifest/exportable-manifest/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/exportable-manifest", - "version": "4.0.7", + "version": "4.0.8", "description": "Creates an exportable manifest", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/pkg-manifest/read-project-manifest/CHANGELOG.md b/pkg-manifest/read-project-manifest/CHANGELOG.md index 7259c5325e..b3ae9946a6 100644 --- a/pkg-manifest/read-project-manifest/CHANGELOG.md +++ b/pkg-manifest/read-project-manifest/CHANGELOG.md @@ -1,5 +1,12 @@ # @pnpm/read-project-manifest +## 4.1.4 + +### Patch Changes + +- Updated dependencies [955874422] + - @pnpm/graceful-fs@2.1.0 + ## 4.1.3 ### Patch Changes diff --git a/pkg-manifest/read-project-manifest/package.json b/pkg-manifest/read-project-manifest/package.json index f262e7bb00..a38324c90e 100644 --- a/pkg-manifest/read-project-manifest/package.json +++ b/pkg-manifest/read-project-manifest/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/read-project-manifest", - "version": "4.1.3", + "version": "4.1.4", "description": "Read a project manifest (called package.json in most cases)", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9eb1c9d97b..2e74c95f1c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -711,6 +711,9 @@ importers: '@pnpm/error': specifier: workspace:* version: link:../../packages/error + '@pnpm/run-npm': + specifier: workspace:* + version: link:../../exec/run-npm ini: specifier: 3.0.1 version: 3.0.1 @@ -1495,6 +1498,9 @@ importers: '@pnpm/core-loggers': specifier: workspace:* version: link:../../packages/core-loggers + '@pnpm/graceful-fs': + specifier: workspace:* + version: link:../graceful-fs '@pnpm/logger': specifier: ^5.0.0 version: 5.0.0 @@ -2480,12 +2486,24 @@ importers: '@pnpm/config': specifier: workspace:* version: link:../../config/config + '@pnpm/constants': + specifier: workspace:* + version: link:../../packages/constants '@pnpm/error': specifier: workspace:* version: link:../../packages/error + '@pnpm/lockfile-file': + specifier: workspace:* + version: link:../../lockfile/lockfile-file + '@pnpm/lockfile-utils': + specifier: workspace:* + version: link:../../lockfile/lockfile-utils '@pnpm/logger': specifier: ^5.0.0 version: 5.0.0 + '@pnpm/modules-yaml': + specifier: workspace:* + version: link:../../pkg-manager/modules-yaml '@pnpm/parse-wanted-dependency': specifier: workspace:* version: link:../../packages/parse-wanted-dependency @@ -2507,18 +2525,27 @@ importers: '@pnpm/store-connection-manager': specifier: workspace:* version: link:../../store/store-connection-manager + enquirer: + specifier: ^2.3.6 + version: 2.3.6 escape-string-regexp: specifier: ^4.0.0 version: 4.0.0 ramda: specifier: npm:@pnpm/ramda@0.28.1 version: /@pnpm/ramda@0.28.1 + realpath-missing: + specifier: ^1.1.0 + version: 1.1.0 render-help: specifier: ^1.0.3 version: 1.0.3 safe-execa: specifier: ^0.1.3 version: 0.1.3 + semver: + specifier: ^7.3.8 + version: 7.3.8 tempy: specifier: ^1.0.1 version: 1.0.1 @@ -2535,9 +2562,15 @@ importers: '@pnpm/registry-mock': specifier: 3.5.0 version: 3.5.0(typanion@3.12.1) + '@pnpm/test-fixtures': + specifier: workspace:* + version: link:../../__utils__/test-fixtures '@types/ramda': specifier: 0.28.20 version: 0.28.20 + '@types/semver': + specifier: 7.3.13 + version: 7.3.13 write-yaml-file: specifier: ^4.2.0 version: 4.2.0 @@ -4228,6 +4261,9 @@ importers: path-name: specifier: ^1.0.0 version: 1.0.0 + pidtree: + specifier: ^0.6.0 + version: 0.6.0 ps-list: specifier: ^7.2.0 version: 7.2.0 @@ -14846,6 +14882,12 @@ packages: hasBin: true dev: true + /pidtree@0.6.0: + resolution: {integrity: sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==} + engines: {node: '>=0.10'} + hasBin: true + dev: true + /pify@3.0.0: resolution: {integrity: sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==} engines: {node: '>=4'} @@ -17651,6 +17693,7 @@ time: /path-exists@4.0.0: '2019-04-04T03:29:16.887Z' /path-name@1.0.0: '2016-10-20T18:43:50.780Z' /path-temp@2.0.0: '2019-05-04T14:35:52.401Z' + /pidtree@0.6.0: '2022-06-05T18:35:44.206Z' /pkg-deb@1.1.2: '2020-10-26T14:13:54.373Z' /pkg-rpm@1.0.3: '2021-01-12T09:42:07.762Z' /preferred-pm@3.0.3: '2021-02-09T01:16:52.150Z' diff --git a/pnpm/CHANGELOG.md b/pnpm/CHANGELOG.md index 07b9df1cd2..d3b2a75781 100644 --- a/pnpm/CHANGELOG.md +++ b/pnpm/CHANGELOG.md @@ -17,6 +17,22 @@ - Direct dependencies are deduped. So if the same dependency is both in a project and in the workspace root, then it is only linked to the workspace root. - Create a lockfile even if the project has no dependencies at all. +## 7.29.2 + +### Patch Changes + +- Clean up child processes when process exited [#6162](https://github.com/pnpm/pnpm/issues/6162). +- When patch package does not specify a version, use locally installed version by default [#6192](https://github.com/pnpm/pnpm/issues/6192). +- `patchedDependencies` are now sorted consistently in the lockfile [#6208](https://github.com/pnpm/pnpm/pull/6208). +- Don't extend `NODE_PATH` in command shims [#5176](https://github.com/pnpm/pnpm/issues/5176). +- Retry copying file on EBUSY error [#6201](https://github.com/pnpm/pnpm/issues/6201). + +## 7.29.1 + +### Patch Changes + +- Settings related to authorization should be set/deleted by npm CLI [#6181](https://github.com/pnpm/pnpm/issues/6181). + ## 7.29.0 ### Minor Changes diff --git a/pnpm/README.md b/pnpm/README.md index a2f7df0cb0..41c15343c2 100644 --- a/pnpm/README.md +++ b/pnpm/README.md @@ -84,17 +84,6 @@ To quote the [Rush](https://rushjs.io/) team: - - - - - - - - - - - diff --git a/pnpm/package.json b/pnpm/package.json index d9edf1d140..c6e4bd7278 100644 --- a/pnpm/package.json +++ b/pnpm/package.json @@ -94,6 +94,7 @@ "p-defer": "^3.0.0", "path-exists": "^4.0.0", "path-name": "^1.0.0", + "pidtree": "^0.6.0", "ps-list": "^7.2.0", "ramda": "npm:@pnpm/ramda@0.28.1", "read-yaml-file": "^2.1.0", diff --git a/pnpm/src/errorHandler.ts b/pnpm/src/errorHandler.ts index f2bba4be1a..16faed5c90 100644 --- a/pnpm/src/errorHandler.ts +++ b/pnpm/src/errorHandler.ts @@ -1,7 +1,13 @@ +import { promisify } from 'util' import { logger } from '@pnpm/logger' +import pidTree from 'pidtree' import { REPORTER_INITIALIZED } from './main' -export function errorHandler (error: Error & { code?: string }) { +const getDescendentProcesses = promisify((pid: number, callback: (error: Error | undefined, result: number[]) => void) => { + pidTree(pid, { root: false }, callback) +}) + +export async function errorHandler (error: Error & { code?: string }) { if (error.name != null && error.name !== 'pnpm' && !error.name.startsWith('pnpm:')) { try { error.name = 'pnpm' @@ -32,5 +38,23 @@ export function errorHandler (error: Error & { code?: string }) { logger.error(error, error) // Deferring exit. Otherwise, the reporter wouldn't show the error - setTimeout(() => process.exit(1), 0) + setTimeout(async () => { + await killProcesses() + }, 0) +} + +async function killProcesses () { + try { + const descendentProcesses = await getDescendentProcesses(process.pid) + for (const pid of descendentProcesses) { + try { + process.kill(pid) + } catch (err) { + // ignore error here + } + } + } catch (err) { + // ignore error here + } + process.exit(1) } diff --git a/pnpm/src/main.ts b/pnpm/src/main.ts index e90ff56948..4e2427b0d7 100644 --- a/pnpm/src/main.ts +++ b/pnpm/src/main.ts @@ -168,7 +168,7 @@ export async function main (inputArgv: string[]) { } if ( - (cmd === 'install' || cmd === 'import' || cmd === 'dedupe' || cmd === 'patch-commit') && + (cmd === 'install' || cmd === 'import' || cmd === 'dedupe' || cmd === 'patch-commit' || cmd === 'patch') && typeof workspaceDir === 'string' ) { cliOptions['recursive'] = true diff --git a/pnpm/src/pnpm.ts b/pnpm/src/pnpm.ts index 329651631e..30d3e6204e 100644 --- a/pnpm/src/pnpm.ts +++ b/pnpm/src/pnpm.ts @@ -71,7 +71,7 @@ async function runPnpm () { const { main } = await import('./main') await main(argv) } catch (err: any) { // eslint-disable-line - errorHandler(err) + await errorHandler(err) } } diff --git a/pnpm/test/errorHandler.test.ts b/pnpm/test/errorHandler.test.ts index b913987ca2..146239201f 100644 --- a/pnpm/test/errorHandler.test.ts +++ b/pnpm/test/errorHandler.test.ts @@ -1,6 +1,11 @@ import { prepare, preparePackages } from '@pnpm/prepare' import writeYamlFile from 'write-yaml-file' import { execPnpmSync } from './utils' +import { fixtures } from '@pnpm/test-fixtures' +import { isPortInUse } from './utils/isPortInUse' + +const f = fixtures(__dirname) +const multipleScriptsErrorExit = f.find('multiple-scripts-error-exit') test('should print json format error when publish --json failed', async () => { prepare({ @@ -35,3 +40,10 @@ test('should print json format error when add dependency on workspace root', asy const { error } = JSON.parse(stdout.toString()) expect(error?.code).toBe('ERR_PNPM_ADDING_TO_ROOT') }) + +test('should clean up child processes when process exited', async () => { + process.chdir(multipleScriptsErrorExit) + execPnpmSync(['run', '/^dev:.*/'], { stdio: 'inherit', env: {} }) + expect(await isPortInUse(9990)).toBe(false) + expect(await isPortInUse(9999)).toBe(false) +}) diff --git a/pnpm/test/utils/execPnpm.ts b/pnpm/test/utils/execPnpm.ts index 2833b9b992..b3b3a08288 100644 --- a/pnpm/test/utils/execPnpm.ts +++ b/pnpm/test/utils/execPnpm.ts @@ -1,4 +1,4 @@ -import { ChildProcess as NodeChildProcess } from 'child_process' +import { ChildProcess as NodeChildProcess, StdioOptions } from 'child_process' import path from 'path' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import isWindows from 'is-windows' @@ -74,12 +74,13 @@ export interface ChildProcess { stderr: Object } -export function execPnpmSync (args: string[], opts?: { env: Object }): ChildProcess { +export function execPnpmSync (args: string[], opts?: { env: Object, stdio?: StdioOptions }): ChildProcess { return crossSpawn.sync(process.execPath, [pnpmBinLocation, ...args], { env: { ...createEnv(), ...opts?.env, } as NodeJS.ProcessEnv, + stdio: opts?.stdio, }) as ChildProcess } diff --git a/pnpm/test/utils/isPortInUse.ts b/pnpm/test/utils/isPortInUse.ts new file mode 100644 index 0000000000..e745b1857f --- /dev/null +++ b/pnpm/test/utils/isPortInUse.ts @@ -0,0 +1,18 @@ +import { createServer } from 'net' + +export const isPortInUse = (port: number) => new Promise((resolve, reject) => { + const server = createServer() + // eslint-disable-next-line @typescript-eslint/no-explicit-any + server.once('error', (err: any) => { + if (err?.code !== 'EADDRINUSE') { + reject(err); return + } + resolve(true) + }) + server.once('listening', () => { + server.once('close', () => { + resolve(false) + }).close() + }) + server.listen(port) +}) diff --git a/releasing/plugin-commands-deploy/CHANGELOG.md b/releasing/plugin-commands-deploy/CHANGELOG.md index 3bda170084..187a5750a5 100644 --- a/releasing/plugin-commands-deploy/CHANGELOG.md +++ b/releasing/plugin-commands-deploy/CHANGELOG.md @@ -1,5 +1,15 @@ # @pnpm/plugin-commands-deploy +## 2.0.40 + +### Patch Changes + +- Updated dependencies [955874422] + - @pnpm/fs.indexed-pkg-importer@2.1.4 + - @pnpm/plugin-commands-installation@11.5.5 + - @pnpm/cli-utils@1.1.5 + - @pnpm/directory-fetcher@5.1.6 + ## 2.0.39 ### Patch Changes diff --git a/releasing/plugin-commands-deploy/package.json b/releasing/plugin-commands-deploy/package.json index d6f242e8ea..f496c7c0e2 100644 --- a/releasing/plugin-commands-deploy/package.json +++ b/releasing/plugin-commands-deploy/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/plugin-commands-deploy", - "version": "2.0.39", + "version": "2.0.40", "description": "Commands for deploy", "funding": "https://opencollective.com/pnpm", "main": "lib/index.js", diff --git a/releasing/plugin-commands-publishing/CHANGELOG.md b/releasing/plugin-commands-publishing/CHANGELOG.md index 180635b273..eb942c8908 100644 --- a/releasing/plugin-commands-publishing/CHANGELOG.md +++ b/releasing/plugin-commands-publishing/CHANGELOG.md @@ -1,5 +1,16 @@ # @pnpm/plugin-commands-publishing +## 6.1.20 + +### Patch Changes + +- Updated dependencies [e505b58e3] + - @pnpm/config@17.0.0 + - @pnpm/cli-utils@1.1.5 + - @pnpm/client@9.1.5 + - @pnpm/exportable-manifest@4.0.8 + - @pnpm/lifecycle@14.1.7 + ## 6.1.19 ### Patch Changes diff --git a/releasing/plugin-commands-publishing/package.json b/releasing/plugin-commands-publishing/package.json index b1b5f0218d..0f40348887 100644 --- a/releasing/plugin-commands-publishing/package.json +++ b/releasing/plugin-commands-publishing/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/plugin-commands-publishing", - "version": "6.1.19", + "version": "6.1.20", "description": "The pack and publish commands of pnpm", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/resolving/default-resolver/CHANGELOG.md b/resolving/default-resolver/CHANGELOG.md index c10e119746..3e8599cc1c 100644 --- a/resolving/default-resolver/CHANGELOG.md +++ b/resolving/default-resolver/CHANGELOG.md @@ -1,5 +1,12 @@ # @pnpm/default-resolver +## 17.0.11 + +### Patch Changes + +- @pnpm/local-resolver@9.0.9 +- @pnpm/npm-resolver@15.0.9 + ## 17.0.10 ### Patch Changes diff --git a/resolving/default-resolver/package.json b/resolving/default-resolver/package.json index fdfe7b1079..72e25b9ba2 100644 --- a/resolving/default-resolver/package.json +++ b/resolving/default-resolver/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/default-resolver", - "version": "17.0.10", + "version": "17.0.11", "description": "pnpm's default package resolver", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/resolving/local-resolver/CHANGELOG.md b/resolving/local-resolver/CHANGELOG.md index 564819b129..0673ef10b4 100644 --- a/resolving/local-resolver/CHANGELOG.md +++ b/resolving/local-resolver/CHANGELOG.md @@ -1,5 +1,13 @@ # @pnpm/local-resolver +## 9.0.9 + +### Patch Changes + +- Updated dependencies [955874422] + - @pnpm/graceful-fs@2.1.0 + - @pnpm/read-project-manifest@4.1.4 + ## 9.0.8 ### Patch Changes diff --git a/resolving/local-resolver/package.json b/resolving/local-resolver/package.json index 7d39548ef9..23d9a8ac90 100644 --- a/resolving/local-resolver/package.json +++ b/resolving/local-resolver/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/local-resolver", - "version": "9.0.8", + "version": "9.0.9", "description": "Resolver for local packages", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/resolving/npm-resolver/CHANGELOG.md b/resolving/npm-resolver/CHANGELOG.md index 348409aec5..82d656ced2 100644 --- a/resolving/npm-resolver/CHANGELOG.md +++ b/resolving/npm-resolver/CHANGELOG.md @@ -1,5 +1,12 @@ # @pnpm/npm-resolver +## 15.0.9 + +### Patch Changes + +- Updated dependencies [955874422] + - @pnpm/graceful-fs@2.1.0 + ## 15.0.8 ### Patch Changes diff --git a/resolving/npm-resolver/package.json b/resolving/npm-resolver/package.json index 5ecf8aeda2..580185d9bf 100644 --- a/resolving/npm-resolver/package.json +++ b/resolving/npm-resolver/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/npm-resolver", - "version": "15.0.8", + "version": "15.0.9", "description": "Resolver for npm-hosted packages", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/reviewing/dependencies-hierarchy/CHANGELOG.md b/reviewing/dependencies-hierarchy/CHANGELOG.md index 3fd4413faf..9e69fc716a 100644 --- a/reviewing/dependencies-hierarchy/CHANGELOG.md +++ b/reviewing/dependencies-hierarchy/CHANGELOG.md @@ -1,5 +1,12 @@ # @pnpm/reviewing.dependencies-hierarchy +## 1.2.5 + +### Patch Changes + +- Updated dependencies [787c43dcc] + - @pnpm/lockfile-file@7.0.6 + ## 1.2.4 ### Patch Changes diff --git a/reviewing/dependencies-hierarchy/package.json b/reviewing/dependencies-hierarchy/package.json index 2278f34331..597379fee8 100644 --- a/reviewing/dependencies-hierarchy/package.json +++ b/reviewing/dependencies-hierarchy/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/reviewing.dependencies-hierarchy", - "version": "1.2.4", + "version": "1.2.5", "description": "Creates a dependencies hierarchy for a symlinked `node_modules`", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/reviewing/license-scanner/CHANGELOG.md b/reviewing/license-scanner/CHANGELOG.md index 16692048bb..68189047a2 100644 --- a/reviewing/license-scanner/CHANGELOG.md +++ b/reviewing/license-scanner/CHANGELOG.md @@ -1,5 +1,14 @@ # @pnpm/license-scanner +## 1.0.17 + +### Patch Changes + +- Updated dependencies [787c43dcc] + - @pnpm/lockfile-file@7.0.6 + - @pnpm/cafs@6.0.2 + - @pnpm/directory-fetcher@5.1.6 + ## 1.0.16 ### Patch Changes diff --git a/reviewing/license-scanner/package.json b/reviewing/license-scanner/package.json index 531d6e8434..a351e0ab02 100644 --- a/reviewing/license-scanner/package.json +++ b/reviewing/license-scanner/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/license-scanner", - "version": "1.0.16", + "version": "1.0.17", "description": "Check for licenses packages", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/reviewing/list/CHANGELOG.md b/reviewing/list/CHANGELOG.md index be7f16d9f3..c2a6d728dd 100644 --- a/reviewing/list/CHANGELOG.md +++ b/reviewing/list/CHANGELOG.md @@ -1,5 +1,13 @@ # @pnpm/list +## 8.2.2 + +### Patch Changes + +- 185ab01ad: When patch package does not specify a version, use locally installed version by default [#6192](https://github.com/pnpm/pnpm/issues/6192). + - @pnpm/read-project-manifest@4.1.4 + - @pnpm/reviewing.dependencies-hierarchy@1.2.5 + ## 8.2.1 ### Patch Changes diff --git a/reviewing/list/package.json b/reviewing/list/package.json index e20ace07ff..e103aef607 100644 --- a/reviewing/list/package.json +++ b/reviewing/list/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/list", - "version": "8.2.1", + "version": "8.2.2", "description": "List installed packages in a symlinked `node_modules`", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/reviewing/list/src/index.ts b/reviewing/list/src/index.ts index 01d7a75483..7183631c15 100644 --- a/reviewing/list/src/index.ts +++ b/reviewing/list/src/index.ts @@ -1,6 +1,7 @@ +import path from 'path' import { readProjectManifestOnly } from '@pnpm/read-project-manifest' import { DependenciesField, Registries } from '@pnpm/types' -import { buildDependenciesHierarchy } from '@pnpm/reviewing.dependencies-hierarchy' +import { PackageNode, buildDependenciesHierarchy } from '@pnpm/reviewing.dependencies-hierarchy' import { createPackagesSearcher } from './createPackagesSearcher' import { renderJson } from './renderJson' import { renderParseable } from './renderParseable' @@ -18,6 +19,36 @@ const DEFAULTS = { showExtraneous: true, } +export function flattenSearchedPackages (pkgs: PackageDependencyHierarchy[], opts: { + lockfileDir: string +}) { + const flattedPkgs: Array = [] + for (const pkg of pkgs) { + _walker([ + ...(pkg.optionalDependencies ?? []), + ...(pkg.dependencies ?? []), + ...(pkg.devDependencies ?? []), + ...(pkg.unsavedDependencies ?? []), + ], path.relative(opts.lockfileDir, pkg.path) || '.') + } + + return flattedPkgs + + function _walker (packages: PackageNode[], depPath: string) { + for (const pkg of packages) { + const nextDepPath = `${depPath} > ${pkg.name}@${pkg.version}` + if (pkg.dependencies?.length) { + _walker(pkg.dependencies, nextDepPath) + } else { + flattedPkgs.push({ + depPath: nextDepPath, + ...pkg, + }) + } + } + } +} + export async function searchForPackages ( packages: string[], projectPaths: string[], diff --git a/reviewing/outdated/CHANGELOG.md b/reviewing/outdated/CHANGELOG.md index a31a8e038f..980b781e77 100644 --- a/reviewing/outdated/CHANGELOG.md +++ b/reviewing/outdated/CHANGELOG.md @@ -1,5 +1,14 @@ # @pnpm/outdated +## 11.0.21 + +### Patch Changes + +- Updated dependencies [787c43dcc] + - @pnpm/lockfile-file@7.0.6 + - @pnpm/npm-resolver@15.0.9 + - @pnpm/client@9.1.5 + ## 11.0.20 ### Patch Changes diff --git a/reviewing/outdated/package.json b/reviewing/outdated/package.json index 58ec251f12..b1caf9e0da 100644 --- a/reviewing/outdated/package.json +++ b/reviewing/outdated/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/outdated", - "version": "11.0.20", + "version": "11.0.21", "description": "Check for outdated packages", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/reviewing/plugin-commands-licenses/CHANGELOG.md b/reviewing/plugin-commands-licenses/CHANGELOG.md index 0096905732..ee84852911 100644 --- a/reviewing/plugin-commands-licenses/CHANGELOG.md +++ b/reviewing/plugin-commands-licenses/CHANGELOG.md @@ -1,5 +1,16 @@ # @pnpm/plugin-commands-licenses +## 1.0.31 + +### Patch Changes + +- Updated dependencies [787c43dcc] +- Updated dependencies [e505b58e3] + - @pnpm/lockfile-file@7.0.6 + - @pnpm/config@17.0.0 + - @pnpm/license-scanner@1.0.17 + - @pnpm/cli-utils@1.1.5 + ## 1.0.30 ### Patch Changes diff --git a/reviewing/plugin-commands-licenses/package.json b/reviewing/plugin-commands-licenses/package.json index 1209e9fc56..9d492c3d4f 100644 --- a/reviewing/plugin-commands-licenses/package.json +++ b/reviewing/plugin-commands-licenses/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/plugin-commands-licenses", - "version": "1.0.30", + "version": "1.0.31", "description": "The licenses command of pnpm", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/reviewing/plugin-commands-listing/CHANGELOG.md b/reviewing/plugin-commands-listing/CHANGELOG.md index 9162d15d96..1090a3b587 100644 --- a/reviewing/plugin-commands-listing/CHANGELOG.md +++ b/reviewing/plugin-commands-listing/CHANGELOG.md @@ -1,5 +1,15 @@ # @pnpm/plugin-commands-listing +## 6.0.40 + +### Patch Changes + +- Updated dependencies [185ab01ad] +- Updated dependencies [e505b58e3] + - @pnpm/list@8.2.2 + - @pnpm/config@17.0.0 + - @pnpm/cli-utils@1.1.5 + ## 6.0.39 ### Patch Changes diff --git a/reviewing/plugin-commands-listing/package.json b/reviewing/plugin-commands-listing/package.json index 62f9d7e025..9662fb069d 100644 --- a/reviewing/plugin-commands-listing/package.json +++ b/reviewing/plugin-commands-listing/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/plugin-commands-listing", - "version": "6.0.39", + "version": "6.0.40", "description": "The list and why commands of pnpm", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/reviewing/plugin-commands-outdated/CHANGELOG.md b/reviewing/plugin-commands-outdated/CHANGELOG.md index 480c4bce1a..85ceef2875 100644 --- a/reviewing/plugin-commands-outdated/CHANGELOG.md +++ b/reviewing/plugin-commands-outdated/CHANGELOG.md @@ -1,5 +1,17 @@ # @pnpm/plugin-commands-outdated +## 8.0.35 + +### Patch Changes + +- Updated dependencies [787c43dcc] +- Updated dependencies [e505b58e3] + - @pnpm/lockfile-file@7.0.6 + - @pnpm/config@17.0.0 + - @pnpm/outdated@11.0.21 + - @pnpm/cli-utils@1.1.5 + - @pnpm/default-resolver@17.0.11 + ## 8.0.34 ### Patch Changes diff --git a/reviewing/plugin-commands-outdated/package.json b/reviewing/plugin-commands-outdated/package.json index 55ce5101db..760f253e45 100644 --- a/reviewing/plugin-commands-outdated/package.json +++ b/reviewing/plugin-commands-outdated/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/plugin-commands-outdated", - "version": "8.0.34", + "version": "8.0.35", "description": "The outdated command of pnpm", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/store/cafs/CHANGELOG.md b/store/cafs/CHANGELOG.md index 7d34ec8bd6..ae81af074e 100644 --- a/store/cafs/CHANGELOG.md +++ b/store/cafs/CHANGELOG.md @@ -1,5 +1,12 @@ # @pnpm/cafs +## 6.0.2 + +### Patch Changes + +- Updated dependencies [955874422] + - @pnpm/graceful-fs@2.1.0 + ## 6.0.1 ### Patch Changes diff --git a/store/cafs/package.json b/store/cafs/package.json index bdbbe86d88..158313f8d0 100644 --- a/store/cafs/package.json +++ b/store/cafs/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/cafs", - "version": "6.0.1", + "version": "6.0.2", "description": "A content-addressable filesystem for the packages storage", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/store/create-cafs-store/CHANGELOG.md b/store/create-cafs-store/CHANGELOG.md index be079853f5..8a5d9844d2 100644 --- a/store/create-cafs-store/CHANGELOG.md +++ b/store/create-cafs-store/CHANGELOG.md @@ -1,5 +1,13 @@ # @pnpm/create-cafs-store +## 3.1.6 + +### Patch Changes + +- Updated dependencies [955874422] + - @pnpm/fs.indexed-pkg-importer@2.1.4 + - @pnpm/cafs@6.0.2 + ## 3.1.5 ### Patch Changes diff --git a/store/create-cafs-store/package.json b/store/create-cafs-store/package.json index 468687ad51..80ad73a239 100644 --- a/store/create-cafs-store/package.json +++ b/store/create-cafs-store/package.json @@ -1,7 +1,7 @@ { "name": "@pnpm/create-cafs-store", "description": "Create a CAFS store controller", - "version": "3.1.5", + "version": "3.1.6", "bugs": { "url": "https://github.com/pnpm/pnpm/issues" }, diff --git a/store/package-store/CHANGELOG.md b/store/package-store/CHANGELOG.md index 1145327bc6..955904cfef 100644 --- a/store/package-store/CHANGELOG.md +++ b/store/package-store/CHANGELOG.md @@ -1,5 +1,13 @@ # @pnpm/package-store +## 15.1.8 + +### Patch Changes + +- @pnpm/package-requester@20.1.7 +- @pnpm/cafs@6.0.2 +- @pnpm/create-cafs-store@3.1.6 + ## 15.1.7 ### Patch Changes diff --git a/store/package-store/package.json b/store/package-store/package.json index cb1b756096..f47235c565 100644 --- a/store/package-store/package.json +++ b/store/package-store/package.json @@ -1,7 +1,7 @@ { "name": "@pnpm/package-store", "description": "A storage for packages", - "version": "15.1.7", + "version": "15.1.8", "bugs": { "url": "https://github.com/pnpm/pnpm/issues" }, diff --git a/store/plugin-commands-server/CHANGELOG.md b/store/plugin-commands-server/CHANGELOG.md index fb1a2ead6a..f255b0bc50 100644 --- a/store/plugin-commands-server/CHANGELOG.md +++ b/store/plugin-commands-server/CHANGELOG.md @@ -1,5 +1,15 @@ # @pnpm/plugin-commands-server +## 5.0.40 + +### Patch Changes + +- Updated dependencies [e505b58e3] + - @pnpm/config@17.0.0 + - @pnpm/cli-utils@1.1.5 + - @pnpm/store-connection-manager@5.2.18 + - @pnpm/server@14.1.2 + ## 5.0.39 ### Patch Changes diff --git a/store/plugin-commands-server/package.json b/store/plugin-commands-server/package.json index 70b0afbbc2..f0a4c4f109 100644 --- a/store/plugin-commands-server/package.json +++ b/store/plugin-commands-server/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/plugin-commands-server", - "version": "5.0.39", + "version": "5.0.40", "description": "Commands for controlling the store server", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/store/plugin-commands-store/CHANGELOG.md b/store/plugin-commands-store/CHANGELOG.md index b83cbeee7f..81342f63fb 100644 --- a/store/plugin-commands-store/CHANGELOG.md +++ b/store/plugin-commands-store/CHANGELOG.md @@ -1,5 +1,16 @@ # @pnpm/plugin-commands-store +## 6.0.40 + +### Patch Changes + +- Updated dependencies [e505b58e3] + - @pnpm/config@17.0.0 + - @pnpm/cafs@6.0.2 + - @pnpm/get-context@8.2.4 + - @pnpm/cli-utils@1.1.5 + - @pnpm/store-connection-manager@5.2.18 + ## 6.0.39 ### Patch Changes diff --git a/store/plugin-commands-store/package.json b/store/plugin-commands-store/package.json index 01f46307fa..4ea47373c8 100644 --- a/store/plugin-commands-store/package.json +++ b/store/plugin-commands-store/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/plugin-commands-store", - "version": "6.0.39", + "version": "6.0.40", "description": "Commands for controlling the store", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/store/store-connection-manager/CHANGELOG.md b/store/store-connection-manager/CHANGELOG.md index d7e4f306cf..d54dd09020 100644 --- a/store/store-connection-manager/CHANGELOG.md +++ b/store/store-connection-manager/CHANGELOG.md @@ -1,5 +1,15 @@ # @pnpm/store-connection-manager +## 5.2.18 + +### Patch Changes + +- Updated dependencies [e505b58e3] + - @pnpm/config@17.0.0 + - @pnpm/client@9.1.5 + - @pnpm/package-store@15.1.8 + - @pnpm/server@14.1.2 + ## 5.2.17 ### Patch Changes diff --git a/store/store-connection-manager/package.json b/store/store-connection-manager/package.json index 98816cc833..41a9993830 100644 --- a/store/store-connection-manager/package.json +++ b/store/store-connection-manager/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/store-connection-manager", - "version": "5.2.17", + "version": "5.2.18", "description": "Create a direct pnpm store controller or connect to a running store server", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/workspace/filter-workspace-packages/CHANGELOG.md b/workspace/filter-workspace-packages/CHANGELOG.md index e7d0e69c7f..a87e4ccfe3 100644 --- a/workspace/filter-workspace-packages/CHANGELOG.md +++ b/workspace/filter-workspace-packages/CHANGELOG.md @@ -1,5 +1,11 @@ # @pnpm/filter-workspace-packages +## 6.0.40 + +### Patch Changes + +- @pnpm/find-workspace-packages@5.0.40 + ## 6.0.39 ### Patch Changes diff --git a/workspace/filter-workspace-packages/package.json b/workspace/filter-workspace-packages/package.json index 255034bfb7..8b879164fb 100644 --- a/workspace/filter-workspace-packages/package.json +++ b/workspace/filter-workspace-packages/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/filter-workspace-packages", - "version": "6.0.39", + "version": "6.0.40", "description": "Filters packages in a workspace", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/workspace/find-workspace-packages/CHANGELOG.md b/workspace/find-workspace-packages/CHANGELOG.md index 1c23c4969e..44c527e83d 100644 --- a/workspace/find-workspace-packages/CHANGELOG.md +++ b/workspace/find-workspace-packages/CHANGELOG.md @@ -1,5 +1,12 @@ # @pnpm/find-workspace-packages +## 5.0.40 + +### Patch Changes + +- @pnpm/cli-utils@1.1.5 +- @pnpm/fs.find-packages@1.0.3 + ## 5.0.39 ### Patch Changes diff --git a/workspace/find-workspace-packages/package.json b/workspace/find-workspace-packages/package.json index cffff36d89..fb5d389061 100644 --- a/workspace/find-workspace-packages/package.json +++ b/workspace/find-workspace-packages/package.json @@ -1,6 +1,6 @@ { "name": "@pnpm/find-workspace-packages", - "version": "5.0.39", + "version": "5.0.40", "description": "Finds packages inside a workspace", "main": "lib/index.js", "types": "lib/index.d.ts",