From f4ded5a8b21a6f9a4a18534740b7ac28b29366f3 Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Mon, 9 Oct 2023 10:08:16 -0700 Subject: [PATCH] feat: allow --no-install on plugins link (#679) --- src/commands/plugins/link.ts | 7 ++++++- src/plugins.ts | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/commands/plugins/link.ts b/src/commands/plugins/link.ts index 82a15b4b..79b391e4 100644 --- a/src/commands/plugins/link.ts +++ b/src/commands/plugins/link.ts @@ -21,6 +21,11 @@ e.g. If you have a user-installed or core plugin that has a 'hello' command, ins static flags = { help: Flags.help({char: 'h'}), verbose: Flags.boolean({char: 'v'}), + install: Flags.boolean({ + default: true, + allowNo: true, + description: 'Install dependencies after linking the plugin.', + }), } plugins = new Plugins(this.config) @@ -29,7 +34,7 @@ e.g. If you have a user-installed or core plugin that has a 'hello' command, ins const {flags, args} = await this.parse(PluginsLink) this.plugins.verbose = flags.verbose ux.action.start(`Linking plugin ${chalk.cyan(args.path)}`) - await this.plugins.link(args.path) + await this.plugins.link(args.path, {install: flags.install}) ux.action.stop() } } diff --git a/src/plugins.ts b/src/plugins.ts index ffe06eac..4cea3c25 100644 --- a/src/plugins.ts +++ b/src/plugins.ts @@ -178,13 +178,13 @@ export default class Plugins { })) } - async link(p: string): Promise { + async link(p: string, {install}: {install: boolean}): Promise { const c = await Config.load(path.resolve(p)) ux.action.start(`${this.config.name}: linking plugin ${c.name}`) this.isValidPlugin(c) // refresh will cause yarn.lock to install dependencies, including devDeps - await this.refresh({prod: false, all: false}, c.root) + if (install) await this.refresh({prod: false, all: false}, c.root) await this.add({type: 'link', name: c.name, root: c.root}) }