Skip to content

Commit

Permalink
feat: allow --no-install on plugins link (#679)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley authored Oct 9, 2023
1 parent fcfbd4a commit f4ded5a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/commands/plugins/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
}
}
4 changes: 2 additions & 2 deletions src/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@ export default class Plugins {
}))
}

async link(p: string): Promise<void> {
async link(p: string, {install}: {install: boolean}): Promise<void> {
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})
}

Expand Down

0 comments on commit f4ded5a

Please sign in to comment.