Skip to content

Conversation

mho22
Copy link
Collaborator

@mho22 mho22 commented Jul 29, 2025

Motivation for the change, related issues

Currently, when NPM installs @php-wasm/cli, it creates a binary named cli in the node_modules/.bin. However, if there is an already existing cli binary in the node_modules/.bin directory, the action is ignored.

That is what is happening when trying to install both @php-wasm/cli and @wp-playground/cli in the same project.

This pull request aims to rename these generic binaries into :

  • cli > php-wasm-cli
  • cli > wp-playground-cli

Implementation details

@php-wasm/cli/package.json

- "bin": "php-wasm.js"
+ "bin": {
+	"php-wasm-cli": "php-wasm.js"
+ },

@wp-playground-cli/package.json

- "bin": "wp-playground.js"
+ "bin": {
+	"wp-playground-cli": "wp-playground.js"
+ },

Testing Instructions (or ideally a Blueprint)

Run npm install in a empty directory :

npm install @php-wasm/cli @wp-playground/cli

Before

> ls -1A node_modules/.bin

cli
crc32
mime
semver
sha.js
xdebug-bridge

After

> ls -1A node_modules/.bin

crc32
mime
php-wasm-cli
semver
sha.js
wp-playground-cli
xdebug-bridge

@mho22 mho22 marked this pull request as ready for review August 4, 2025 08:11
@adamziel
Copy link
Collaborator

adamziel commented Aug 4, 2025

I have a vague recollection I had some troubles with getting the right global binary names using this approach, but let's give it a shot and see what happens.

@adamziel adamziel merged commit 8a2b490 into trunk Aug 4, 2025
46 of 50 checks passed
@adamziel adamziel deleted the rename-cli-binaries branch August 4, 2025 15:28
@brandonpayton
Copy link
Member

Nice change!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants