Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change guidance to use yarn install #43

Closed
wants to merge 1 commit into from

Conversation

davydog187
Copy link

When following the development instructions for testing a package with yalc, npm install will fail with a message like the following:

$ npm install
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "link:": link:.yalc/sanity-plugin-table

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/davidlucia/.npm/_logs/2022-11-09T14_07_27_183Z-debug-0.log

This is because npm does not support link: syntax in packages. I tested this on Node 16x and 18x. yarn install does work

Signed-off-by: Dave Lucia davelucianyc@gmail.com

When following the development instructions for testing a package with yalc, `npm install` will fail with a message like the following:

```bash
$ npm install
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "link:": link:.yalc/sanity-plugin-table

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/davidlucia/.npm/_logs/2022-11-09T14_07_27_183Z-debug-0.log
```

This is because npm does not support `link:` syntax in packages. I tested this on Node 16x and 18x. `yarn install` does work

Signed-off-by: Dave Lucia <davelucianyc@gmail.com>
@snorrees
Copy link
Contributor

I realize that plugin-kit docs are written for an environment where you use npm in both the plugin package and in the test-studio.

This change will make it work in a studio that uses yarn, but then it would break for studios that use npm.

I also think (gotta recheck this) that studios that use yarn ideally should run
yalc add --link sanity-plugin-testing-it-out && yarn install,
cause I seem to remember that using file:// with yarn+Vite stopped hot-reload from working.

So, what I think we should do is output one command for yarn and one command for npm.

Do you mind if I piggyback on this PR to introduce that @davydog187?

@davydog187
Copy link
Author

Fine by me @snorrees. From my perspective, I do not use yarn, but I couldn't quickly find a way to fix using npm. Having both sounds like the right path

@snorrees
Copy link
Contributor

snorrees commented Nov 15, 2022

Fine by me @snorrees. From my perspective, I do not use yarn, but I couldn't quickly find a way to fix using npm. Having both sounds like the right path

Sorry for the confusion; accidentally left an amalgamation of yarn+npm command in the README 🤦 .
The command logged by link-watch is correct for npm though:
npx yalc add ${pkg.name} && npx yalc link ${pkg.name} && npm install.
(this also will have the correct package name so it is a copypasta job)

Yalc use different protocol (file: vs link: as you saw) between yalc link and yalc add --link which leads to the error.

I will capture this in a fix shortly with explicit command for both yarn and npm.
Thanks for reporting btw!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants