- Notifications
You must be signed in to change notification settings - Fork 147
Announcing Scala.js 1.0.0. #478
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
Conversation
After 7 years of development, including 5 years of stability within the 0.6.x series, we are finally ready to present Scala.js 1.0.0. | ||
Quoting Antoine de Saint-Exupéry, | ||
| ||
> Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 ❤️ Rigor and obsession in the Scala.js development process is an example for all of us emulate! Thank you!
fa167be
to bf828c9
Compare doc/api.md Outdated
* [scalajs-test-adapter]({{ site.production_url }}/api/scalajs-sbt-test-adapter/latest/org/scalajs/testadapter/index.html) | ||
* [sbt-scalajs]({{ site.production_url }}/api/sbt-scalajs/latest/#org.scalajs.sbtplugin.package) | ||
* [sbt-scalajs-env-phantomjs]({{ site.production_url }}/api/sbt-scalajs-env-phantomjs/latest/#org.scalajs.jsenv.phantomjs.sbtplugin.package) | ||
* [sbt-jsdependencies]({{ site.production_url }}/api/sbt-jsdependencies/latest/#org.scalajs.jsdependencies.sbtplugin.package) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered removing the projects that are not in the core repo from this list? Since they will observe a different release schedule, they might best be put elsewhere? Just like the DOM and jQuery API below?
doc/tutorial/basic/index.md Outdated
org.scalajs.jsenv.Input.Script(file("./jquery.js").toPath) | ||
Compile / jsEnvInput := jQueryScript +: (Compile / jsEnvInput).value | ||
Test / jsEnvInput := jQueryScript +: (Test / jsEnvInput).value | ||
{% endhighlight %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit problematic IMO. We really don't want anybody to think this is a good way to use Scala.js, do we?
How hard would it be to:
- Not rely on a bare JS library.
- Use scala-js-bundler in the tutorial.
Note that I haven't reviewed in detail yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It highlights a limitation of how we set up the jsEnvInput
setting. We should initialize it to Nil
in the no-configuration scope, and add the linked file in each configuration. That way we would only have to write
jsEnvInput += Input.Script(file("./jquery.js").toPath)
in this build.
We can improve that in 1.0.1, but for 1.0.0 we're stuck with this suboptimal config :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not rely on a bare JS library.
That would defeat the purpose of that entire section. Of course we can remove all the section about jQuery, and keep using the DOM until the end. Maybe that would be better?
Use scala-js-bundler in the tutorial.
That's probably going a step too far for this tutorial, which in my opinion lays the ground knowledge of how Scala.js work, and which every Scala.js user needs to know.
But I can write an alternative story where we do that, for comparison.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep using the DOM until the end. Maybe that would be better?
That was my thinking as well. It would avoid some of the boilerplate of dealing with native JS libs. We should defer to the scalajs-bundler
documentation for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have pushed a commit that changes the tutorial to stick to standard DOM, rather than using jQuery. It goes with the following branch of the scalajs-tutorial repo: https://github.com/scala-js/scalajs-tutorial/commits/develop-1.x-no-jquery
Looking at it now, I actually think it's much better overall :)
* `relativeSourceMaps` | ||
* `scalaJSOptimizerOptions` | ||
| ||
Finally, if you are still using sbt 0.13.x, you will have to upgrade to sbt 1.2.1 or later (as of this writing, the latest release is 1.3.4). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.3.8? (taken from below).
| ||
You will not be able to use Scala.js 1.0.0 with sbt 0.13.x. | ||
You will have to upgrade to sbt 1.2.1 or later. | ||
As of this writing, the latest version is 1.3.8. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe put this to the bottom since it was already mentioned?
| ||
* Scala 2.10.x is not supported at all, | ||
* Only 2.11.12 is still supported in the 2.11.x series, and | ||
* 2.12.1 and following are supported in the 2.12.x series, but not 2.12.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a useful thing to mention in "before you upgrade": Upgrading the Scala version can (and should) be done before upgrading Scala.js to minimize simultaneous changes.
| ||
Scala.js 1.x consolidates all of that into one simple task key `jsEnvInput` of type `Seq[org.scalajs.jsenv.Input]`, where an `Input` is an ADT with the following possible alternatives: | ||
| ||
* `Input.Scripts(script)`: a JavaScript file to load as a script |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Input.Script
?
This allows users to simply write jsEnvInput += Input.Script(myJSLibrary) in their build. Discovered while writing the tutorial: scala-js/scala-js-website#478 (comment)
a3202b5
to 882bc2c
Compare @gzm0 I believe I have addressed all your comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only minor nits.
I have reviewed https://github.com/scala-js/scalajs-tutorial/commits/develop-1.x-no-jquery as well.
doc/tutorial/basic/index.md Outdated
We can avoid this issue by building the UI directly from the Scala.js code. | ||
| ||
In your `build.sbt`, set: | ||
Instead of prepare the button in the HTML, we can add the following code to the `main` method in Scala.js: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of preparing
doc/tutorial/basic/index.md Outdated
| ||
val button = jQuery("button:contains('Click me!')") | ||
assert(button.length == 1) | ||
val button = document.querySelector("button") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cast this to HTMLElement
(or HTMLButtonElement
) so you can call click()
?
jsDependencies += | ||
"org.webjars" % "jquery" % "2.2.1" / "jquery.js" minified "jquery.min.js" | ||
val button = document.createElement("button") | ||
button.textContent = "Click me!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In appendPar
we seem to use document.createTextNode
(which seems unnecessarily verbose). Is this inconsistency deliberate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it was not intended. The code in appendPar
is much older, and perhaps at the time textContent
did not exist yet. I have changed appendPar
to use textContent
a well.
Updated to address the nits, and squashed all in one commit. |
This allows users to simply write jsEnvInput += Input.Script(myJSLibrary) in their build. Discovered while writing the tutorial: scala-js/scala-js-website#478 (comment)
This allows users to simply write jsEnvInput += Input.Script(myJSLibrary) in their build. Discovered while writing the tutorial: scala-js/scala-js-website#478 (comment)
This allows users to simply write jsEnvInput += Input.Script(myJSLibrary) in their build. Discovered while writing the tutorial: scala-js/scala-js-website#478 (comment)
And update the website to use 1.x by default everywhere. The tutorial is duplicated, with one version for 1.x (the default), and a legacy version for 0.6.x.
And update the website to use 1.x by default everywhere.
The tutorial is duplicated, with one version for 1.x (the default), and a legacy version for 0.6.x.
Not to be merged yet, but review welcome :)