mirror of
https://github.com/pnpm/pnpm.git
synced 2026-01-08 15:08:27 -05:00
fix(patch): improve printing of the pnpm patch command (#8239)
* style(patch): improve printin of the `pnpm patch` command * fix: add missing dep * test: fix --------- Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
committed by
GitHub
parent
497fea8de5
commit
fd884c1915
6
.changeset/cold-trees-rush.md
Normal file
6
.changeset/cold-trees-rush.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-completion": patch
|
||||
"@pnpm/build-modules": patch
|
||||
---
|
||||
|
||||
Improve output of the `pnpm patch` command.
|
||||
@@ -58,6 +58,7 @@
|
||||
"@pnpm/read-package-json": "workspace:*",
|
||||
"@pnpm/read-project-manifest": "workspace:*",
|
||||
"@pnpm/store-connection-manager": "workspace:*",
|
||||
"chalk": "catalog:",
|
||||
"enquirer": "catalog:",
|
||||
"escape-string-regexp": "catalog:",
|
||||
"fast-glob": "catalog:",
|
||||
@@ -67,7 +68,8 @@
|
||||
"render-help": "catalog:",
|
||||
"safe-execa": "catalog:",
|
||||
"semver": "catalog:",
|
||||
"tempy": "catalog:"
|
||||
"tempy": "catalog:",
|
||||
"terminal-link": "catalog:"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@pnpm/logger": "^5.0.0"
|
||||
|
||||
@@ -9,6 +9,8 @@ import {
|
||||
} from '@pnpm/store-connection-manager'
|
||||
import pick from 'ramda/src/pick'
|
||||
import renderHelp from 'render-help'
|
||||
import chalk from 'chalk'
|
||||
import terminalLink from 'terminal-link'
|
||||
import tempy from 'tempy'
|
||||
import { PnpmError } from '@pnpm/error'
|
||||
import { type ParseWantedDependencyResult } from '@pnpm/parse-wanted-dependency'
|
||||
@@ -101,9 +103,15 @@ export async function handler (opts: PatchCommandOptions, params: string[]): Pro
|
||||
})
|
||||
}
|
||||
}
|
||||
return `You can now edit the following folder: ${editDir}
|
||||
return `Patch: You can now edit the package at:
|
||||
|
||||
Once you're done with your changes, run "pnpm patch-commit '${editDir}'"`
|
||||
${terminalLink(chalk.blue(editDir), 'file://' + editDir)}
|
||||
|
||||
To commit your changes, run:
|
||||
|
||||
${chalk.green(`pnpm patch-commit '${editDir}'`)}
|
||||
|
||||
`
|
||||
}
|
||||
|
||||
function tryPatchWithExistingPatchFile (
|
||||
|
||||
@@ -928,7 +928,8 @@ describe('patch-remove', () => {
|
||||
})
|
||||
})
|
||||
|
||||
function getPatchDirFromPatchOutput (output: string) {
|
||||
const [firstLine] = output.split('\n')
|
||||
return firstLine.substring(firstLine.indexOf(':') + 1).trim()
|
||||
function getPatchDirFromPatchOutput (output: string): string {
|
||||
const match = output.match(/'([^']+)'/)
|
||||
if (match?.[1] == null) throw new Error('No path in output')
|
||||
return match[1]
|
||||
}
|
||||
|
||||
27
pnpm-lock.yaml
generated
27
pnpm-lock.yaml
generated
@@ -603,6 +603,9 @@ catalogs:
|
||||
tempy:
|
||||
specifier: ^1.0.1
|
||||
version: 1.0.1
|
||||
terminal-link:
|
||||
specifier: ^2.1.1
|
||||
version: 2.1.1
|
||||
touch:
|
||||
specifier: 3.1.0
|
||||
version: 3.1.0
|
||||
@@ -3651,6 +3654,9 @@ importers:
|
||||
'@pnpm/store-connection-manager':
|
||||
specifier: workspace:*
|
||||
version: link:../../store/store-connection-manager
|
||||
chalk:
|
||||
specifier: 'catalog:'
|
||||
version: 4.1.2
|
||||
enquirer:
|
||||
specifier: 'catalog:'
|
||||
version: 2.4.1
|
||||
@@ -3681,6 +3687,9 @@ importers:
|
||||
tempy:
|
||||
specifier: 'catalog:'
|
||||
version: 1.0.1
|
||||
terminal-link:
|
||||
specifier: 'catalog:'
|
||||
version: 2.1.1
|
||||
devDependencies:
|
||||
'@pnpm/plugin-commands-patching':
|
||||
specifier: workspace:*
|
||||
@@ -13056,6 +13065,10 @@ packages:
|
||||
resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
supports-hyperlinks@2.3.0:
|
||||
resolution: {integrity: sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
supports-preserve-symlinks-flag@1.0.0:
|
||||
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
|
||||
engines: {node: '>= 0.4'}
|
||||
@@ -13092,6 +13105,10 @@ packages:
|
||||
resolution: {integrity: sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
terminal-link@2.1.1:
|
||||
resolution: {integrity: sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
test-exclude@6.0.0:
|
||||
resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -20594,6 +20611,11 @@ snapshots:
|
||||
dependencies:
|
||||
has-flag: 4.0.0
|
||||
|
||||
supports-hyperlinks@2.3.0:
|
||||
dependencies:
|
||||
has-flag: 4.0.0
|
||||
supports-color: 7.2.0
|
||||
|
||||
supports-preserve-symlinks-flag@1.0.0: {}
|
||||
|
||||
symlink-dir@6.0.0:
|
||||
@@ -20645,6 +20667,11 @@ snapshots:
|
||||
|
||||
term-size@2.2.1: {}
|
||||
|
||||
terminal-link@2.1.1:
|
||||
dependencies:
|
||||
ansi-escapes: 4.3.2
|
||||
supports-hyperlinks: 2.3.0
|
||||
|
||||
test-exclude@6.0.0:
|
||||
dependencies:
|
||||
'@istanbuljs/schema': 0.1.3
|
||||
|
||||
@@ -234,6 +234,7 @@ catalog:
|
||||
tar-stream: ^2.2.0
|
||||
tar: ^6.2.1
|
||||
tempy: ^1.0.1
|
||||
terminal-link: ^2.1.1
|
||||
touch: 3.1.0
|
||||
tree-kill: ^1.2.2
|
||||
uuid: ^9.0.1
|
||||
|
||||
Reference in New Issue
Block a user