Opened 6 months ago
Closed 5 months ago
#63912 closed enhancement (fixed)
Make Composer available via npm run on host machine
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.9 | Priority: | normal |
| Severity: | trivial | Version: | |
| Component: | Build/Test Tools | Keywords: | has-patch |
| Focuses: | Cc: |
Description
Context
Working on a ticket on my wordpress-develop cloned instance, I wanted to lint and format my code but :
- I couldn't find the command in composer.json in order to do so;
- I didn't want to install composer nor phpcs on my host machine because those tools are already available in the container spawned.
Solutions
To lint my code I used this command : node ./tools/local-env/scripts/docker.js run -T --rm php composer lint [my_file]
@SirLouen suggested to create a new custom script in package.json enabling developers to directly invoke the composer instance of the wordpressdevelop/php container from their host machine. Implementing this will simplifies future call to composer specific scripts from host machine (linting, formating etc ...).
You will find the modified package.json in the attached .diff and the PR related to this ticket.
Attachments (2)
Change History (9)
#1
follow-up:
↓ 4
@
6 months ago
- Milestone Awaiting Review deleted
- Version trunk deleted
Hey @paulbonneau
Why not using a similar format as the current env:cli command like:
node ./tools/local-env/scripts/docker.js exec php composer
This ticket was mentioned in PR #9713 on WordPress/wordpress-develop by @paulbonneau.
6 months ago
#3
## Context
Working on a ticket on my wordpress-develop cloned instance, I wanted to lint and format my code but :
- I couldn't find the command in
composer.jsonin order to do so; - I didn't want to install
composernorphpcson my host machine because those tools are already available in the container spawned.
##Solutions
To lint my code I used this command : node ./tools/local-env/scripts/docker.js run -T --rm php composer lint [my_file]
@SirLouen suggested to create a new custom script in package.json enabling developers to directly invoke the composer instance of the wordpressdevelop/php container from their host machine. Implementing this will simplifies future call to composer specific scripts from host machine (linting, formating etc ...).
Trac ticket: (https://core.trac.wordpress.org/ticket/63912)
#4
in reply to:
↑ 1
;
follow-up:
↓ 5
@
6 months ago
Replying to SirLouen:
Hey @paulbonneau
Why not using a similar format as the currentenv:clicommand like:
node ./tools/local-env/scripts/docker.js exec php composer
Hello @SirLouen !
I kept docker run over docker exec because it enables the container to be spawned specifically at the command runtime meaning that you can for example, lint your code, even if wordpressdevelop/php container is off.
Thank for your review !
#5
in reply to:
↑ 4
@
6 months ago
Replying to paulbonneau:
I kept
docker runoverdocker execbecause it enables the container to be spawned specifically at the command runtime meaning that you can for example, lint your code, even ifwordpressdevelop/phpcontainer is off.
Good idea. I think this is good to go.
63912