Skip to content

Commit

Permalink
feat: update JIT plugins to version specified in package.json (#564)
Browse files Browse the repository at this point in the history
* feat: update JIT plugins to version specified in package.json

* fix: add try/catch to compilation step
  • Loading branch information
mdonnalley committed Mar 8, 2023
1 parent a640813 commit a05dabb
Showing 1 changed file with 11 additions and 6 deletions.
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

0 comments on commit a05dabb

Please sign in to comment.