Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
fix: do not load oclif.devPlugins in production (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
RasPhilCo authored Apr 14, 2020
1 parent 1cd07ff commit c850bbe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,15 @@ function channelFromVersion(version: string) {
return (m && m[1]) || 'stable'
}

function hasManifest(p: string): boolean {
try {
require(p)
return true
} catch {
return false
}
}

export class Config implements IConfig {
_base = `${_pjson.name}@${_pjson.version}`

Expand Down Expand Up @@ -265,6 +274,8 @@ export class Config implements IConfig {

async loadDevPlugins() {
if (this.options.devPlugins !== false) {
// do not load oclif.devPlugins in production
if (hasManifest(path.join(this.root, 'oclif.manifest.json'))) return
try {
const devPlugins = this.pjson.oclif.devPlugins
if (devPlugins) await this.loadPlugins(this.root, 'dev', devPlugins)
Expand Down

0 comments on commit c850bbe

Please sign in to comment.