qed
qed

Reputation: 23094

Declare js dependencies in sbt

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:[email protected]:jducoeur/bootstrap-datepicker-scalajs.git",
    Some("scm:git:[email protected]: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?

Upvotes: 0

Views: 761

Answers (1)

ochrons
ochrons

Reputation: 691

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.

Upvotes: 2

Related Questions