Skip to content
This repository has been archived by the owner on Mar 31, 2018. It is now read-only.

Commit

Permalink
Upgrade to Scala.js 0.5.0 and Scala 2.11.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrd committed Jun 13, 2014
1 parent 6a3c58c commit 45de74a
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 105 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: scala
script:
- sbt ++$TRAVIS_SCALA_VERSION test optimizeJS
- sbt ++$TRAVIS_SCALA_VERSION test packageJS fullOptJS
scala:
- 2.10.4
- 2.11.0
- 2.11.1
jdk:
- oraclejdk7
34 changes: 14 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
# Example application written in Scala.js

This is a barebone example of an application written in
[Scala.js](https://github.com/lampepfl/scala-js).
[Scala.js](https://www.scala-js.org/).

## Get started

To get started, open `sbt` in this example project, and issue the task
`packageJS`. This creates the file `target/scala-2.10/example.js` and its
siblings `example-extdeps.js` and `example-intdeps.js`.
You can now open `index-dev.html` in your favorite Web browser!
To get started, open `sbt` in this example project, and execute the task
`fastOptJS`. This creates the file `target/scala-2.11/example-fastopt.js`.
You can now open `index-fastopt.html` in your favorite Web browser!

During development, it is useful to use `~packageJS` in sbt, so that each
During development, it is useful to use `~fastOptJS` in sbt, so that each
time you save a source file, a compilation of the project is triggered.
Hence only a refresh of your Web page is needed to see the effects of your
changes.

## The preoptimized version
## Run the tests

Instead of running `packageJS`, you can also run `preoptimizeJS` to generate
a much more compact version of the JavaScript code in virtually no more time
than you run `packageJS`. In that case, open the `example-preopt.html` file
to execute the application. Note that browser refresh is much faster in this
case.
To run the test suite, execute the task `test`. If you have installed
[Node.js](http://nodejs.org/), you can also run `fastOptStage::test` which is
faster.

`preoptimizeJS` should be fast enough for you to use `~preoptimizeJS` in sbt
for your development cycle.
## The fully optimized version

## The optimized version

For ultimate code size reduction, use `optimizeJS`. This will take several
For ultimate code size reduction, use `fullOptJS`. This will take several
seconds to execute, so typically you only use this for the final, production
version of your application. While `index-dev.html` (resp. `index-preopt.html`)
refers to the JavaScript emitted by `packageJS` (resp. `preoptimizeJS`),
`index.html` refers to the optimized JavaScript emitted by `optimizeJS`.
version of your application. While `index-fastopt.html` refers to the
JavaScript emitted by `fastOptJS`, `index.html` refers to the optimized
JavaScript emitted by `fullOptJS`.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name := "Example"

version := "0.1-SNAPSHOT"

scalaVersion := "2.11.0"
scalaVersion := "2.11.1"

libraryDependencies ++= Seq(
"org.scala-lang.modules.scalajs" %% "scalajs-dom" % "0.4",
"org.scala-lang.modules.scalajs" %%% "scalajs-dom" % "0.6",
"org.scala-lang.modules.scalajs" %% "scalajs-jasmine-test-framework" % scalaJSVersion % "test"
)
27 changes: 0 additions & 27 deletions index-dev.html

This file was deleted.

8 changes: 4 additions & 4 deletions index-preopt.html → index-fastopt.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
</head>
<body>

<h1>Example Scala.js application - optimized version</h1>
<h1>Example Scala.js application - fast-optimized version</h1>

<p>After having compiled and pre-optimized properly the code for the application
(using `sbt preoptimizeJS`), you should see "It works" herebelow.
<p>After having compiled and fast-optimized properly the code for the application
(using `sbt fastOptJS`), you should see "It works" herebelow.
See README.md for detailed explanations.</p>

<div id="playground">
</div>

<script type="text/javascript" src="./target/scala-2.11/example-preopt.js"></script>
<script type="text/javascript" src="./target/scala-2.11/example-fastopt.js"></script>

<script type="text/javascript">
ScalaJSExample().main();
Expand Down
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
</head>
<body>

<h1>Example Scala.js application - optimized version</h1>
<h1>Example Scala.js application - full-optimized version</h1>

<p>After having compiled and optimized properly the code for the application
(using `sbt optimizeJS`), you should see "It works" herebelow.
<p>After having compiled and full-optimized properly the code for the application
(using `sbt fullOptJS`), you should see "It works" herebelow.
See README.md for detailed explanations.</p>

<div id="playground">
Expand Down
2 changes: 1 addition & 1 deletion project/build.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
addSbtPlugin("org.scala-lang.modules.scalajs" % "scalajs-sbt-plugin" % "0.4.4")
addSbtPlugin("org.scala-lang.modules.scalajs" % "scalajs-sbt-plugin" % "0.5.0")
37 changes: 0 additions & 37 deletions testsuite-dev.html

This file was deleted.

6 changes: 1 addition & 5 deletions testsuite-preopt.html → testsuite-fastopt.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="http://cdn.jsdelivr.net/jasmine/1.3.1/jasmine.js"></script>
<script type="text/javascript" src="http://cdn.jsdelivr.net/jasmine/1.3.1/jasmine-html.js"></script>
<script type="text/javascript" src="./target/scala-2.11/example-test-preopt.js"></script>
<script type="text/javascript" src="./target/scala-2.11/example-test-fastopt.js"></script>

<script type="text/javascript">
// Dummy function to prevent tests from failing
// They use it to include jQuery, but its already included above
function importScripts() {}

$(function() {
// Load tests
example.ScalaJSExampleTest();
Expand Down
4 changes: 0 additions & 4 deletions testsuite.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
<script type="text/javascript" src="./target/scala-2.11/example-test-opt.js"></script>

<script type="text/javascript">
// Dummy function to prevent tests from failing
// They use it to include jQuery, but its already included above
function importScripts() {}

$(function() {
// Load tests
example.ScalaJSExampleTest();
Expand Down

0 comments on commit 45de74a

Please sign in to comment.