Skip to content

Commit

Permalink
fix: show correct yalc command for both npm and yarn
Browse files Browse the repository at this point in the history
Thanks to @davydog187 for this fix!
  • Loading branch information
snorrees committed Nov 15, 2022
1 parent b97d73d commit 47ac2a0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,26 @@ npx @sanity/plugin-kit init sanity-plugin-testing-it-out
cd sanity-plugin-testing-it-out
npm run link-watch

# In another shell, link the plugin to your Sanity studio using the command indicated by link-watch
# In another shell
cd /path/to/my-studio
# now link the plugin to your Sanity studio using the command indicated by link-watch output (see below)
```

Run **ONE** of the below commands, **based on the package manager** used in your studio:

```bash
# studio uses yarn
cd /path/to/my-studio
yalc add --link sanity-plugin-testing-it-out && yarn install
```

```bash
# studio uses npm
cd /path/to/my-studio
npx yalc add sanity-plugin-testing-it-out && npx yalc link sanity-plugin-testing-it-out && npm install
```

# Use this command if your studio uses yarn
npx yalc add sanity-plugin-testing-it-out && npx yalc link sanity-plugin-testing-it-out && npm install

```
Expand Down
10 changes: 9 additions & 1 deletion src/actions/link-watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,15 @@ export async function linkWatch({basePath}: {basePath: string}) {
outdent`
Watching ${watch.folder} for changes to files with extensions: ${watch.extensions}
To test this package in another repository directory run:
To test this package in Sanity Studio or another package, in a separate shell run:
cd /path/to/sanity/studio-or-package
Then, run one of the below commands, based on the package manager used in studio-or-package:
## yarn
${chalk.greenBright(`yalc add --link ${pkg.name} && yarn install`)}
## npm
${chalk.greenBright(`npx yalc add ${pkg.name} && npx yalc link ${pkg.name} && npm install`)}
`.trimStart()
)
Expand Down

0 comments on commit 47ac2a0

Please sign in to comment.