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

feat: update JIT plugins to version specified in package.json #564

Merged
merged 2 commits into from
Mar 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ export default class Plugins {
await this.add({type: 'link', name: c.name, root: c.root})
// if the plugin has typescript in devDeps, we will also compile it
if (c.pjson.devDependencies?.typescript) {
await this.yarn.exec(['run', 'tsc', '-p', '.', '--incremental', '--skipLibCheck'], {cwd: path.resolve(p), verbose: this.verbose})
try {
await this.yarn.exec(['run', 'tsc', '-p', '.', '--incremental', '--skipLibCheck'], {cwd: path.resolve(p), verbose: this.verbose})
} catch {
this.debug('typescript compilation failed')
}
}
}

Expand Down Expand Up @@ -223,9 +227,14 @@ export default class Plugins {
}

const npmPlugins = plugins.filter(p => !p.url)
const jitPlugins = this.config.pjson.oclif.jitPlugins ?? {}

if (npmPlugins.length > 0) {
await this.yarn.exec(
['add', ...npmPlugins.map(p => `${p.name}@${p.tag}`)],
['add', ...npmPlugins.map(p => {
const tag = jitPlugins[p.name] ?? p.tag
return `${p.name}@${tag}`
})],
{cwd: this.config.dataDir, verbose: this.verbose},
)
}
Expand Down Expand Up @@ -314,10 +323,6 @@ export default class Plugins {
return path.join(this.config.dataDir, 'package.json')
}

private get npmRegistry(): string {
return this.config.npmRegistry || 'https://registry.npmjs.org'
}

private async npmHasPackage(name: string): Promise<boolean> {
return new Promise((resolve, reject) => {
exec(
Expand Down