Coder Social home page Coder Social logo

Comments (4)

azz avatar azz commented on September 27, 2024

Interesting. pretty-quick only has a peerDependency on prettier and your version 1.10.2 matches it. pretty-quick does have a devDependency of 1.18.2 on prettier here which does match what you're seeing.

Could you change the console log you inserted to show require.resolve('prettier') instead, to confirm the path that prettier is being loaded from?

from pretty-quick.

gillchristian avatar gillchristian commented on September 27, 2024

It gets resolved to this: node_modules/prettier/index.js, which is indeed version 1.18.2.

$ cat node_modules/prettier/index.js | grep version | head -n 1
var version$1 = "1.18.2";

And then I checked what version the scripts are using:

$ cat $(yarn bin)/prettier | grep version | head -n 1
var version$1 = "1.10.2";

It seems more of yarn/npm problem, in the way dependencies are resolved.

The only solution that occurs to me is to use execa to run prettier on pretty-quick side . Instead of using it as a library. But personally I don't like the idea, the library is handier to use.

~/p/cw-buyer master*
$ cat with-execa.js
const execa = require('execa')

console.log(execa.sync('prettier', ['--version']).stdout)

~/p/cw-buyer master*
$ node with-execa.js
1.10.2

If you think this is something that shouldn't be solved from pretty-quick side then let's close the issue, that would be totally fine πŸ˜… (I should be using an updated version of prettier anyway.)

But if you do want to solve it from pretty-quick side I'm open to collaborate on implementation.

from pretty-quick.

azz avatar azz commented on September 27, 2024

Where does ls -l $(yarn bin)/prettier link to then?

Don't want to switch to sub-processes in the interest of being quick πŸ˜‰, so I will close this issue, but still interested to see where your prettier is actually being resolved from!

from pretty-quick.

gillchristian avatar gillchristian commented on September 27, 2024

Makes sense.

It didn't occur to me to check were prettier was linked to.

We have it installed as a dependency of a toolbox ("cw-sdk-js") so it comes from there.

~/projects/cw-buyer/node_modules/.bin/prettier -> ../cw-sdk-js/node_modules/prettier/bin-prettier.js

from pretty-quick.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.