From a204163f1785b41ac3f719dfd0c4a6faf1bbd992 Mon Sep 17 00:00:00 2001 From: Snorre Eskeland Brekke Date: Wed, 15 Jun 2022 22:29:04 +0200 Subject: [PATCH] fix: changed recommended link command to work with npm --- README.md | 2 +- src/actions/link-watch.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index defc8d09..a566944b 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,7 @@ This will publish the plugin to a local [yalc](https://github.com/wclr/yalc) reg In another shell, in your test Sanity Studio directory, run: ```sh -npx yalc add --link && yarn install +npx yalc add && npx yalc add --link && npm install ``` You can now change your plugin code, which will: diff --git a/src/actions/link-watch.ts b/src/actions/link-watch.ts index d3b9b89a..19b980b9 100644 --- a/src/actions/link-watch.ts +++ b/src/actions/link-watch.ts @@ -24,6 +24,7 @@ import fs from 'fs' import path from 'path' import log from '../util/log' import {getPackage} from '../npm/package' +import outdent from 'outdent' interface YalcWatchConfig { folder?: string @@ -58,9 +59,14 @@ export async function linkWatch({basePath}: {basePath: string}) { nodemon .on('start', function () { - log.info(`Watching ${watch.folder} for changes to files with extensions: ${watch.extensions}`) - log.info(`\nTo test this package in another repository directory run:`) - log.success(`yalc add --link \n${pkg.name} && yarn install`) + log.info( + outdent` + Watching ${watch.folder} for changes to files with extensions: ${watch.extensions} + + To test this package in another repository directory run: + ${chalk.greenBright(`npx yalc add ${pkg.name} && npx yalc link ${pkg.name} && npm install`)} + `.trimStart() + ) }) .on('quit', function () { process.exit()