Comments (9)
Lots of debugging but I got closer. Because I'm using prettier and its plugins via a require()
, I have install them in the project folder, which in this case is /home/runner/work/react-wordle/react-wordle/
. Reference: https://docs.npmjs.com/cli/v8/configuring-npm/folders/ (Install it locally if you're going to require() it.
).
But for some reason (and I can't figure out why), everything that is installed locally gets installed to /home/runner/work/_actions/creyD/prettier_action/v4.2/
.
npm prefix
yields /home/runner/work/_actions/creyD/prettier_action/v4.2/
so clearly npm believes that is the 'local' folder. A pwd
yields /home/runner/work/react-wordle/react-wordle/
so I don't understand why the difference.
And it's this discrepancy between the 2 directories that makes prettier unable to find the plugin module.
I solved this by amending my lint.yml
Github actions file to run a npm install
first (I have prettier and the plugins in my package.json
too). This works for me, but for people who don't have the library entries in a package.json
this won't work and I still believe there must a be more elegant solution.
from prettier_action.
It should be possible to do it like this: prettier_plugins: '@trivago/prettier-plugin-sort-imports prettier-plugin-tailwindcss --global'
from prettier_action.
Maybe we would need to install the plugins globally to be used with a config?
from prettier_action.
@creyD Is there anything I can do from my side to check that?
from prettier_action.
No, that unfortunately doesn't work.
Looks like the @trivago/prettier-plugin-sort-imports prettier-plugin-tailwindcss --global
is implicitly parsed as 3 separate strings.
from prettier_action.
I can try submit a PR to add a new option to install prettier and/or its plugins globally, but how does one test GitHub actions locally?
from prettier_action.
@igitur That's very generous of you to offer, thanks a lot! I myself didn't find a way yet, at least not with the way this action is built (I think docker based actions are more easily tested). What I always do is to create a separate test repo with just one js file in it and the action configured to creyd/prettier_action@latest (you would need to replace the username with your own name to test against your own action and you could exchange latest with any version statement or a branch etc). Hope this helps!
from prettier_action.
How would you advise to go forward? @igitur Should we mark this issue as solved or are you still working on a fix?
from prettier_action.
Happy to close this.
from prettier_action.
Related Issues (20)
- [BUG] Problem running prettier in workflow HOT 5
- [BUG] Doesn't fail on infer parser failed HOT 4
- [BUG] Shouldn't delete node_modules HOT 8
- [BUG] Actions Fails to install/use modules - Cannot find module '@prettier/plugin-php'
- [BUG] Cannot find module 'prettier-plugin-tailwindcss' HOT 11
- [BUG] `prettier` not installed correctly HOT 9
- [BUG] prettier: command not found HOT 3
- [BUG] Problem --writer HOT 4
- [BUG] Process completed with exit code 1 HOT 5
- [BUG] Example not working. HOT 4
- IDEA: Add push_options parameter HOT 3
- [BUG] Error: Process completed with exit code 1 when using prettier-php HOT 12
- [BUG] Code style issues found, can't reproduce locally HOT 2
- [FEATURE] Format only changed lines not the whole file HOT 1
- [BUG] Should work when package-lock.json is not versioned HOT 3
- [FEATURE] Don't log unchanged files
- [BUG] Dry run fails in spite of the fact that a line length does not exceed 80 chars. HOT 2
- What is status code 128? HOT 5
- Readme out of date
- [FEATURE] Print the `prettier` command to be executed before executing it
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prettier_action.