Skip to content

Commit

Permalink
feat: add hasPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Aug 19, 2019
1 parent 517eaa7 commit 5a7680d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/@nodepack/app-migrator/src/lib/MigrationAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
/** @typedef {import('./Migrator')} Migrator */
/** @typedef {import('./MigratorPlugin')} MigratorPlugin */

const { hasPlugin } = require('../util/plugins')

module.exports = class MigrationAPI {
/**
* @param {MigratorPlugin} plugin
Expand Down Expand Up @@ -32,4 +34,12 @@ module.exports = class MigrationAPI {
onComplete (cb) {
this.migrator.completeCbs.push(cb)
}

/**
* Check if the project has a plugin installed
* @param {string} id Plugin id
*/
hasPlugin (id) {
return hasPlugin(id, this.migrator.plugins, this.migrator.pkg)
}
}

0 comments on commit 5a7680d

Please sign in to comment.