Skip to content
Open
Show file tree
Hide file tree
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
16 changes: 16 additions & 0 deletions lib/integration/Plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ export default class Plugin {
*/
async getType () {
if (this._type) return this._type
const pathType = this.getTypeFromProjectPath()
if (pathType) return (this._type = pathType)
const info = await this.getInfo()
if (!info) return null
const foundAttributeType = PLUGIN_TYPES.find(type => info[type])
Expand All @@ -347,6 +349,20 @@ export default class Plugin {
return (this._type = foundAttributeType || foundKeywordType || PLUGIN_DEFAULT_TYPE)
}

/**
* Infer plugin type from the installed project path.
* e.g. src/menu/adapt-contrib-boxMenu → 'menu'
* @returns {string|null}
*/
getTypeFromProjectPath () {
Copy link
Copy Markdown
Member

@oliverfoster oliverfoster Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this not make the rest of the getType code redundant?

if (!this.projectPath) return null
const folderToType = Object.fromEntries(
Object.entries(PLUGIN_TYPE_FOLDERS).map(([type, folder]) => [folder, type])
)
const parentFolder = path.basename(path.dirname(this.projectPath))
return folderToType[parentFolder] || null
}

async getTypeFolder () {
const type = await this.getType()
return PLUGIN_TYPE_FOLDERS[type]
Expand Down
6 changes: 6 additions & 0 deletions lib/integration/PluginManagement/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ async function loadPluginData ({ logger, project, targets }) {
percentage => logger?.logProgress?.(`${chalk.bold.cyan('<info>')} Getting plugin info ${percentage}% complete`)
)
logger?.log(`${chalk.bold.cyan('<info>')} Getting plugin info 100% complete`)
await eachOfLimitProgress(
targets,
target => target.fetchProjectInfo(),
percentage => logger?.logProgress?.(`${chalk.bold.cyan('<info>')} Checking installed plugins ${percentage}% complete`)
)
logger?.log(`${chalk.bold.cyan('<info>')} Checking installed plugins 100% complete`)
await eachOfLimitProgress(
targets,
target => target.findCompatibleVersion(frameworkVersion),
Expand Down
1 change: 1 addition & 0 deletions lib/integration/Target.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export default class Target extends Plugin {

markInstallable () {
if (!this.isApplyLatestCompatibleVersion && !(this.isLocalSource && this.latestSourceVersion)) return
if (this.projectVersion === this.matchedVersion) return
this.versionToApply = this.matchedVersion
}

Expand Down
Loading