How to determine if the current project is specific framework based?

Answered

I'm building a plugin for a specific framework on nodejs.

How can I determine if this project is based on that framework?

For example, this framework's module name is ‘@swf’; if the user installs it, it will appear under the `node_modules` folder with the name `@swf`.

Should I check if the `@swf` folder exists under `node_modules` folder?

Thanks for any advices.

 

0
1 comment

You can code like:

  val swfFound: Boolean = PackageJsonFileManager.getInstance(project).validPackageJsonFiles.asSequence().map {
    PackageJsonData.getOrCreate(it)
  }.any {
    it.containsDependencyWithScope("@swf")
  }
0

Please sign in to leave a comment.