It would be convenient if it were possible to determine if an sbt Project is a Scala.js project.
Perhaps something like this (which I have for now in user-land):
import sbt._
import sbt.Keys._
object IsScalaJsProjectAutoPlugin extends AutoPlugin {
override def requires = plugins.JvmPlugin
override def trigger = allRequirements
object autoImport {
val isScalaJsProject = settingKey[Boolean]("Determines if a project is a Scala.js project")
}
import autoImport._
override def globalSettings: Seq[Setting[_]] = Seq(isScalaJsProject := false)
override def projectSettings: Seq[Setting[_]] = Seq(
isScalaJsProject := libraryDependencies.value.exists(_.name == "scalajs-library")
)
}
Example output:
> show isScalaJsProject
[info] str/*:isScalaJsProject
[info] false
[info] strJs/*:isScalaJsProject
[info] true
[info] strRoot/*:isScalaJsProject
[info] false
Was this removed in 1.0? Is there an alternative we can use?
It was superseded by crossProjectPlatform.value == JSPlatform, offered by sbt-crossproject.
Most helpful comment
It was superseded by
crossProjectPlatform.value == JSPlatform, offered by sbt-crossproject.