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

Commit

Permalink
fix: allow reading oclif manifest not as a dotfile
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed May 3, 2018
1 parent cc275a8 commit 7ee3007
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,23 @@ export class Plugin implements IPlugin {
}

protected async _manifest(ignoreManifest: boolean, errorOnManifestCreate: boolean = false): Promise<Manifest> {
const readManifest = async () => {
const readManifest = async (dotfile = false): Promise<Manifest | undefined> => {
try {
const p = path.join(this.root, '.oclif.manifest.json')
const p = path.join(this.root, `${dotfile ? '.' : '' }oclif.manifest.json`)
const manifest: Manifest = await loadJSON(p)
if (!process.env.OCLIF_NEXT_VERSION && manifest.version.split('-')[0] !== this.version.split('-')[0]) {
process.emitWarning(`Mismatched version in ${this.name} plugin manifest. Expected: ${this.version} Received: ${manifest.version}\nThis usually means you have an .oclif.manifest.json file that should be deleted in development. This file should be automatically generated when publishing.`)
process.emitWarning(`Mismatched version in ${this.name} plugin manifest. Expected: ${this.version} Received: ${manifest.version}\nThis usually means you have an oclif.manifest.json file that should be deleted in development. This file should be automatically generated when publishing.`)
} else {
this._debug('using manifest from', p)
return manifest
}
} catch (err) {
if (err.code !== 'ENOENT') this.warn(err, 'readManifest')
if (err.code === 'ENOENT') {
if (!dotfile) return readManifest(true)
} else {
this.warn(err, 'readManifest')
return
}
}
}
if (!ignoreManifest) {
Expand Down

0 comments on commit 7ee3007

Please sign in to comment.