mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-25 16:18:06 -05:00
fix: command suggestion to apply patch on Windows (#8851)
close #7546 --------- Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
6
.changeset/lemon-ants-knock.md
Normal file
6
.changeset/lemon-ants-knock.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-patching": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Use double quotes in the command suggestion by `pnpm patch` on Windows [#7546](https://github.com/pnpm/pnpm/issues/7546).
|
||||
@@ -37,6 +37,7 @@
|
||||
"@pnpm/registry-mock": "catalog:",
|
||||
"@pnpm/test-fixtures": "workspace:*",
|
||||
"@pnpm/workspace.filter-packages-from-dir": "workspace:*",
|
||||
"@types/is-windows": "catalog:",
|
||||
"@types/normalize-path": "catalog:",
|
||||
"@types/ramda": "catalog:",
|
||||
"@types/semver": "catalog:",
|
||||
@@ -64,6 +65,7 @@
|
||||
"enquirer": "catalog:",
|
||||
"escape-string-regexp": "catalog:",
|
||||
"fast-glob": "catalog:",
|
||||
"is-windows": "catalog:",
|
||||
"make-empty-dir": "catalog:",
|
||||
"normalize-path": "catalog:",
|
||||
"ramda": "catalog:",
|
||||
|
||||
@@ -18,6 +18,7 @@ import { getEditDirPath } from './getEditDirPath'
|
||||
import { getPatchedDependency } from './getPatchedDependency'
|
||||
import { writeEditDirState } from './stateFile'
|
||||
import { tryReadProjectManifest } from '@pnpm/read-project-manifest'
|
||||
import isWindows from 'is-windows'
|
||||
|
||||
export function rcOptionsTypes (): Record<string, unknown> {
|
||||
return pick([], allTypes)
|
||||
@@ -122,13 +123,16 @@ export async function handler (opts: PatchCommandOptions, params: string[]): Pro
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const quote = isWindows() ? '"' : "'"
|
||||
|
||||
return `Patch: You can now edit the package at:
|
||||
|
||||
${terminalLink(chalk.blue(editDir), 'file://' + editDir)}
|
||||
|
||||
To commit your changes, run:
|
||||
|
||||
${chalk.green(`pnpm patch-commit '${editDir}'`)}
|
||||
${chalk.green(`pnpm patch-commit ${quote}${editDir}${quote}`)}
|
||||
|
||||
`
|
||||
}
|
||||
|
||||
@@ -1327,7 +1327,7 @@ describe('patch-remove', () => {
|
||||
})
|
||||
|
||||
function getPatchDirFromPatchOutput (output: string): string {
|
||||
const match = output.match(/'([^']+)'/)
|
||||
const match = output.match(/['"]([^'"]+)['"]/)
|
||||
if (match?.[1] == null) throw new Error('No path in output')
|
||||
return match[1]
|
||||
}
|
||||
|
||||
6
pnpm-lock.yaml
generated
6
pnpm-lock.yaml
generated
@@ -4096,6 +4096,9 @@ importers:
|
||||
fast-glob:
|
||||
specifier: 'catalog:'
|
||||
version: 3.3.2
|
||||
is-windows:
|
||||
specifier: 'catalog:'
|
||||
version: 1.0.2
|
||||
make-empty-dir:
|
||||
specifier: 'catalog:'
|
||||
version: 3.0.2
|
||||
@@ -4142,6 +4145,9 @@ importers:
|
||||
'@pnpm/workspace.filter-packages-from-dir':
|
||||
specifier: workspace:*
|
||||
version: link:../../workspace/filter-packages-from-dir
|
||||
'@types/is-windows':
|
||||
specifier: 'catalog:'
|
||||
version: 1.0.2
|
||||
'@types/normalize-path':
|
||||
specifier: 'catalog:'
|
||||
version: 3.0.2
|
||||
|
||||
Reference in New Issue
Block a user