0

Here is a build.sbt file from https://github.com/jducoeur/bootstrap-datepicker-scalajs :

import SonatypeKeys._

sonatypeSettings

lazy val root = project.in(file(".")).
  enablePlugins(ScalaJSPlugin)

name := "Scala.js facade for bootstrap-datepicker"

normalizedName := "bootstrap-datepicker-facade"

version := "0.3"

organization := "org.querki"

scalaVersion := "2.11.6"

crossScalaVersions := Seq("2.10.4", "2.11.5")

libraryDependencies ++= Seq(
  "org.querki" %%% "querki-jsext" % "0.5",
  "org.scala-js" %%% "scalajs-dom" % "0.8.0",
  "org.querki" %%% "jquery-facade" % "0.6"
)

jsDependencies += "org.webjars" % "bootstrap" % "3.3.4" / "bootstrap.js" minified "bootstrap.min.js" dependsOn "jquery.js"

jsDependencies += "org.webjars" % "bootstrap-datepicker" % "1.4.0" / "bootstrap-datepicker.js" minified "bootstrap-datepicker.min.js" dependsOn "bootstrap.js"

jsDependencies in Test += RuntimeDOM

homepage := Some(url("http://www.querki.net/"))

licenses += ("MIT License", url("http://www.opensource.org/licenses/mit-license.php"))

scmInfo := Some(ScmInfo(
    url("https://github.com/jducoeur/bootstrap-datepicker-scalajs"),
    "scm:git:git@github.com:jducoeur/bootstrap-datepicker-scalajs.git",
    Some("scm:git:git@github.com:jducoeur/bootstrap-datepicker-scalajs.git")))

publishMavenStyle := true

publishTo := {
  val nexus = "https://oss.sonatype.org/"
  if (isSnapshot.value)
    Some("snapshots" at nexus + "content/repositories/snapshots")
  else
    Some("releases" at nexus + "service/local/staging/deploy/maven2")
}

pomExtra := (
  <developers>
    <developer>
      <id>jducoeur</id>
      <name>Mark Waks</name>
      <url>https://github.com/jducoeur/</url>
    </developer>
  </developers>
)

pomIncludeRepository := { _ => false }

It declared two js dependencies: bootstrap and bootstrap-datepicker. Since bootstrap-datepicker already depends on bootstrap, can we not just declare bootstrap-datepicker alone?

qed
  • 22,298
  • 21
  • 125
  • 196

1 Answers1

2

There are different dependencies here. One is dependencies between WebJars, which just makes sure the relevant packages are downloaded.

Then there are dependencies between JS packages, which is used to make sure they are loaded in correct order into the jsdeps.js file. This dependency does not automatically include the other library into the final output.

So you need to define all JS libs you need in your application and use dependsOn to make sure they are in the correct order.

ochrons
  • 691
  • 5
  • 10
  • Just one additional note: Scala.js libraries may include additional jsDependencies. In the above, you'll note that the jsDependency for Bootstrap dependsOn jquery.js. That's referring to the jsDependency for jquery.js, which is picked up from the jquery-facade libraryDependency. It's common for facades to publish the jsDependencies they need. – Justin du Coeur Nov 03 '15 at 14:32