Skip to content

Remove JS dependencies #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 3, 2018
Merged
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ before_script:

script:
- sbt ++$TRAVIS_SCALA_VERSION test
- sbt ++$TRAVIS_SCALA_VERSION +publishLocal
- sbt ++$TRAVIS_SCALA_VERSION publishLocal
- cd example && sbt ++$TRAVIS_SCALA_VERSION compile fullOptJS
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Static types for the jQuery API for [Scala.js](http://www.scala-js.org/) program

## Usage

Add the following to your SBT build:
Add the following dependency to your SBT build:

```scala
libraryDependencies += "io.udash" %%% "udash-jquery" % "1.1.0"
libraryDependencies += "io.udash" %%% "udash-jquery" % "2.0.0"
```

then import the jQuery package:
Expand All @@ -16,6 +16,21 @@ then import the jQuery package:
import io.udash.wrappers.jquery._
```

Since version `2.0.0` the wrapper does not force JS dependency on jQuery. You have to
add it manually by:
* explicit link in your `index.html`.
```html
<script src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
```
* or a [Scala.js dependency](http://www.scala-js.org/doc/project/dependencies.html).
```scala
jsDependencies +=
"org.webjars" % "jquery" % "3.3.1" / "3.3.1/jquery.js" minified "3.3.1/jquery.min.js"
```


## Examples

```scala
Expand Down
6 changes: 3 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.scalajs.jsenv.selenium.SeleniumJSEnv
name := "udash-jquery"

inThisBuild(Seq(
version := "1.2.0",
version := "2.0.0",
organization := "io.udash",
scalaVersion := "2.12.6",
crossScalaVersions := Seq("2.11.12", "2.12.6"),
Expand Down Expand Up @@ -58,13 +58,13 @@ val commonJSSettings = Seq(
)

libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "0.9.5",
"org.scala-js" %%% "scalajs-dom" % "0.9.6",
"org.scalatest" %%% "scalatest" % "3.0.5" % Test,
"com.lihaoyi" %%% "scalatags" % "0.6.7" % Test
)

jsDependencies +=
"org.webjars" % "jquery" % "3.3.1" / "3.3.1/jquery.js" minified "3.3.1/jquery.min.js"
"org.webjars" % "jquery" % "3.3.1" % Test / "3.3.1/jquery.js" minified "3.3.1/jquery.min.js"

lazy val root = project.in(file("."))
.enablePlugins(ScalaJSPlugin)
Expand Down
4 changes: 3 additions & 1 deletion example/build.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name := "jquery-demo"

inThisBuild(Seq(
version := "1.2.0",
version := "2.0.0",
organization := "io.udash",
scalaVersion := "2.12.6",
crossScalaVersions := Seq("2.11.12", "2.12.6"),
scalacOptions ++= Seq(
"-feature",
"-deprecation",
Expand Down Expand Up @@ -31,6 +32,7 @@ val copyAssets = taskKey[Unit]("Copies all assets to the target directory.")
val `jquery-demo` = project.in(file(".")).enablePlugins(ScalaJSPlugin)
.settings(
libraryDependencies ++= Dependencies.deps.value,
jsDependencies ++= Dependencies.jsDeps.value,

/* move these files out of target/. */
Compile / fullOptJS / crossTarget := generatedDir,
Expand Down
7 changes: 6 additions & 1 deletion example/project/Dependencies.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
import sbt._

object Dependencies {
val udashCoreVersion = "0.6.1"
val udashJQueryVersion = "1.2.0"
val udashJQueryVersion = "2.0.0"

val deps = Def.setting(Seq[ModuleID](
"io.udash" %%% "udash-core-frontend" % udashCoreVersion,
"io.udash" %%% "udash-jquery" % udashJQueryVersion
))

val jsDeps = Def.setting(Seq[org.scalajs.sbtplugin.JSModuleID](
"org.webjars" % "jquery" % "3.3.1" / "3.3.1/jquery.js" minified "3.3.1/jquery.min.js"
))
}
2 changes: 1 addition & 1 deletion example/project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version = 1.1.4
sbt.version = 1.2.0
2 changes: 1 addition & 1 deletion example/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
logLevel := Level.Warn

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.24")
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version = 1.1.4
sbt.version = 1.2.0
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ logLevel := Level.Warn

libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.2.0"

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.24")