gts icon indicating copy to clipboard operation
gts copied to clipboard

Add support for Yarn PNP

Open 0az opened this issue 5 years ago • 7 comments

There's a couple spots that need patches:

  • Generated configs (extends: ./node_modules/gts, etc)
  • execa calls to node ./node_modules/*

Implementation thoughts:

  • Check for .yarn? Hacky.
  • ESLint API? Probably a better idea. More work.

0az avatar Sep 25 '20 00:09 0az

This would be really nice, probably the only thing preventing me from using yarn pnp.

hqnna avatar Jan 15 '21 20:01 hqnna

made a very hacky bash script to setup a new project using gts and yarn pnp https://gist.github.com/xpyxel/69adecbf2661eca104cdd49fd8ba1af1

you can setup a new project with curl -sL https://git.io/JtIw7 | bash -s <editor sdk here>

most things seem to be working except for eslint-plugin-node from what it looks like

hqnna avatar Jan 18 '21 07:01 hqnna

After doing some more research on the matter I'm going to attempt to get eslint-plugin-node working with the script, no promises that it will work, but if it does, gts will be "fully working" in a sense.

hqnna avatar Jan 19 '21 06:01 hqnna

So the issue with the eslint plugins and other things is that due to how yarn's pnp works, they have to be under dependencies of the root project, i.e the project you're making that depends on gts, otherwise since your extending their configuration(s), it won't be able to access them currently.

hqnna avatar Jan 19 '21 06:01 hqnna

Decided to go all out and made a template repo that sets up mostly everything for you, just need to run a few commands and you have a fully setup yarn + gts env. https://github.com/xpyxel/gts-pnp

hqnna avatar Jan 19 '21 08:01 hqnna

was this issue ever resolved? trying to set up gts in my pnp project and getting the following error:

1 $ yarn lint
version: 16
/Users/jaismith/Developer/doc/trailhead/.pnp.cjs:33932
    throw firstError;
    ^

Error: Qualified path resolution failed - none of those files can be found on the disk.

Source path: /Users/jaismith/Developer/doc/trailhead/node_modules/eslint/bin/eslint
Not found: /Users/jaismith/Developer/doc/trailhead/node_modules/eslint/bin/eslint
Not found: /Users/jaismith/Developer/doc/trailhead/node_modules/eslint/bin/eslint.js
Not found: /Users/jaismith/Developer/doc/trailhead/node_modules/eslint/bin/eslint.json
Not found: /Users/jaismith/Developer/doc/trailhead/node_modules/eslint/bin/eslint.node

    at Function.external_module_.Module._resolveFilename (/Users/jaismith/Developer/doc/trailhead/.pnp.cjs:33931:55)
    at Function.external_module_.Module._load (/Users/jaismith/Developer/doc/trailhead/.pnp.cjs:33730:48)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
    at node:internal/main/run_main_module:17:47

jaismith avatar Oct 27 '21 19:10 jaismith

@jaismith i ended up just making my own thing similar: https://github.com/stacknine/ts-pnp

hqnna avatar Oct 27 '21 20:10 hqnna