mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-28 02:53:15 -04:00
5
.changeset/mean-trainers-burn.md
Normal file
5
.changeset/mean-trainers-burn.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/package-bins": patch
|
||||
---
|
||||
|
||||
Allow the \$ sign to be a command name.
|
||||
@@ -48,7 +48,7 @@ function commandsFromBin (bin: PackageBin, pkgName: string, pkgPath: string) {
|
||||
]
|
||||
}
|
||||
return Object.keys(bin)
|
||||
.filter((commandName) => encodeURIComponent(commandName) === commandName)
|
||||
.filter((commandName) => encodeURIComponent(commandName) === commandName || commandName === '$')
|
||||
.map((commandName) => ({
|
||||
name: commandName,
|
||||
path: path.join(pkgPath, bin[commandName]),
|
||||
|
||||
@@ -15,6 +15,22 @@ test('getBinsFromPkg()', async () => {
|
||||
)
|
||||
})
|
||||
|
||||
test('getBinsFromPkg() should allow $ as command name', async () => {
|
||||
expect(
|
||||
await getBinsFromPkg({
|
||||
bin: {
|
||||
$: './undollar.js',
|
||||
},
|
||||
name: 'undollar',
|
||||
version: '1.0.0',
|
||||
}, process.cwd())).toStrictEqual(
|
||||
[{
|
||||
name: '$',
|
||||
path: path.resolve('undollar.js'),
|
||||
}]
|
||||
)
|
||||
})
|
||||
|
||||
test('find all the bin files from a bin directory', async () => {
|
||||
const fixtures = path.join(__dirname, 'fixtures')
|
||||
expect(
|
||||
|
||||
Reference in New Issue
Block a user