-
-
Save mermshaus/db827721edcf22e80083f0b5f4c179f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Now using node v20.5.1 (npm v9.8.0) | |
changed 8 packages in 491ms | |
3 packages are looking for funding | |
run `npm fund` for details | |
/home/marc/.nvm/versions/node/v20.5.1/lib | |
├── @prettier/plugin-php@0.20.1 | |
├── corepack@0.19.0 | |
├── npm@9.8.0 | |
└── prettier@3.0.2 | |
/home/marc/.nvm/versions/node/v20.5.1/bin/prettier | |
[debug] normalized argv: {"":["test.php"],"cache":false,"color":true,"editorconfig":true,"logLevel":"debug","plugins":["/home/marc/.nvm/versions/node/v20.5.1/lib/node_modules/@prettier/plugin-php/src/index.js"],"parser":"php","configPrecedence":"cli-override","debugRepeat":0,"ignorePath":[".gitignore",".prettierignore"],"_":["test.php"],"__raw":{"_":["test.php"],"cache":false,"color":true,"editorconfig":true,"log-level":"debug","plugin":"/home/marc/.nvm/versions/node/v20.5.1/lib/node_modules/@prettier/plugin-php/src/index.js","parser":"php","config-precedence":"cli-override","debug-repeat":0,"ignore-path":[".gitignore",".prettierignore"]}} | |
[debug] resolve config from '/home/marc/tmp/prettier-plugin-php/test.php' | |
[debug] loaded options `null` | |
[debug] applied config-precedence (cli-override): {"parser":"php","plugins":["/home/marc/.nvm/versions/node/v20.5.1/lib/node_modules/@prettier/plugin-php/src/index.js"]} | |
<?php | |
if (1) { | |
echo 2; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eu | |
node_version="20" | |
source ~/.nvm/nvm.sh | |
nvm use "${node_version}" | |
nvm_node_version="$(nvm current)" | |
plugin_php_entrypoint=~/.nvm/versions/node/${nvm_node_version}/lib/node_modules/@prettier/plugin-php/src/index.js | |
npm install --global prettier @prettier/plugin-php | |
npm list --global | |
if [[ ! -f "${plugin_php_entrypoint}" ]] | |
then | |
echo "Entrypoint for plugin-php doesn't exist at \"${plugin_php_entrypoint}\"." | |
exit 1 | |
fi | |
cat << EOF > test.php | |
<?php | |
if(1 ){ echo 2; } | |
?> | |
EOF | |
command -v prettier | |
prettier --log-level debug \ | |
--plugin "${plugin_php_entrypoint}" \ | |
--parser php \ | |
test.php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment