Code Monkey home page Code Monkey logo

scala-js-website's Introduction

Website for Scala.js

This is the source code for the Scala.js website at http://www.scala-js.org/.

If you intended to look at the Scala.js source code itself, you can find it here: github.com/scala-js/scala-js.

Contributing

The key to contributing is being able to edit and preview your content. Your pull requests are welcome!

Set up

With Docker

You need to have Docker Engine and Docker Compose installed on your machine. Under Mac OS (Intel or Apple silicon), instead of installing Docker Desktop you can also use HomeBrew with Colima: brew install colima docker docker-compose.

docker compose up --build

On Linux you may have to prefix that command with sudo, depending on your Docker setup.

The generated site is available at http://localhost:4000.

When the website dependencies change (the content of the Gemfile), you have to kill and re-run the command.

If you have problems with the Docker image or want to force the rebuild of the Docker image:

docker compose build --no-cache

Manually with Ruby tooling

As this website is built with Jekyll, we will need to set up some Ruby tooling.

First, install RVM (Ruby Version Manager): https://rvm.io/rvm/install Then run the following commands:

$ rvm use 2.7.5 --install

# Set up Bundler, a Ruby package manager
# It downloads dependencies specified in a Gemfile
# but into a local path unlike gem
$ gem install bundler
 # and if this fails, try installing libffi first (distro-specific):
 # sudo apt install libffi-dev

# Install dependencies such as Jekyll and its plugins:
$ bundle install

# Do a full build:
$ bundle exec jekyll build

Editing live

This is what you would do after the initial installation:

$ bundle exec jekyll serve --watch

scala-js-website's People

Contributors

alexitc avatar atry avatar cornerman avatar cquiroz avatar dependabot[bot] avatar gzm0 avatar japgolly avatar jducoeur avatar jokade avatar jonas avatar lihaoyi avatar mathieuleclaire avatar netzwerg avatar nicolasstucki avatar ochrons avatar plusjade avatar raquo avatar rparree avatar rpiaggio avatar rubenverg avatar scalawilliam avatar sebnozzi avatar sethtisue avatar sjrd avatar spaced avatar studiomohawk avatar tindzk avatar vattay avatar xerial avatar xuwei-k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scala-js-website's Issues

Easier access to libraries (top level menu item)?

From Gitter:

But where is the list of SJS wrappers in the new website?
That was one of the most useful parts in the last one

sjrd 12:17:
http://www.scala-js.org/community/libraries/
How did you search for it? Where were you expecting to see links to it that you did not find?

mkotsbak 12:18
A bit hidden. I looked at "community", but did not notice the menu on the right
What about a "LIBRARIES" top level menu?

sjrd 12:27
We could do that, yes.

ochrons 12:33
yea, the Community is a bit abstract, so Libraries top item would be good
although that then leaves the community part quite bare

mkotsbak 12:33
No, I don't think so. It contains what you expect to find there
libs was 0 clicks in old webiste, so it should not be more than 1 click in the new
Actually it is two as there are sections
Sections could be dropdown menu or filters

Link to the github file from each page of the website for easier collaboration

I'm lazy, but I've heard that's a good trait for a developer :-)

I was reading the docs of the new homepage and wanted to submit a pull request to correct some minor errors on a specific page. It would have been much easier if the page had an "Improve this doc" link right there on the page (like in the footer).

The Jekyll help (jekyll/jekyll-help#5) says:

If you're hosting the site on GitHub Pages, they inject the source repository into a variable called
site.github.repository_url which you can use in combination with page.path to wire up the URL on
github.com.

Example: <a href="{{site.github.repository_url}}/blob/gh-pages/{{page.path}}">Improve this doc</a>

test can't be run in intellij

hi,

my plugin.scala

addSbtPlugin("org.scala-lang.modules.scalajs" %% "scalajs-sbt-plugin" % "0.5.6")

addSbtPlugin("com.lihaoyi" % "utest-js-plugin" % "0.2.3")

I followed tutorial to step 6, sbt test works fine, but when run TutorialAppTest inside intellij, error occurs:

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.jetbrains.plugins.scala.testingSupport.uTest.UTestRunner.runTestSuites(UTestRunner.java:187)
    at org.jetbrains.plugins.scala.testingSupport.uTest.UTestRunner.main(UTestRunner.java:254)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: scala.NotImplementedError: an implementation is missing
    at scala.Predef$.$qmark$qmark$qmark(Predef.scala:225)
    at org.scalajs.jquery.package$.<init>(package.scala:6)
    at org.scalajs.jquery.package$.<clinit>(package.scala)
    at scalajs.TutorialApp$.setupUI(TutorialApp.scala:22)
    at scalajs.TutorialAppTest$.<init>(TutorialAppTest.scala:10)
    at scalajs.TutorialAppTest$.<clinit>(TutorialAppTest.scala:13)
    at scalajs.TutorialAppTest.tests(TutorialAppTest.scala)
    ... 11 more

Update documentation for 0.3

A number of things have changed in 0.2 and 0.3, and the documentation is not up-to-date anymore. We need to make a complete pass on the Website before we release 0.3.

Add option to export javascript that is executable by node

I'm sorry if I missed the obvious but I when playing around with scala.js I didn't find a way to easily generate js code that can be executed with node right away, e.g. from a bash script or other situations where you would like to avoid starting a JVM. IMHO having that option would increase the attractiveness of scala.js. From playing around with scala.js, I got the impression that I can simply concatenate *-opt.js and *-launcher.js to achieve this goal but it would be nice if there were an options (which is documented in the docs) that would make sbt do this for me. I'm not talking about creating modules that can be loaded from js code via require.

Regards

Check-list for 0.5.0 final

  • Publish Scala.js 0.5.0 on Bintray
  • Bump DOM to 0.6 and make it use Scala.js 0.5.0
    • Publish on Bintray
  • Add jsDependencies to jQuery (sjrd/scala-js-jquery#7) and bump to 0.6, + make it use Scala.js 0.5.0
    • Publish it on Bintray
  • Publish pickling 0.3.1 for 0.5.0
  • Publish scala-parser-combinators 1.0.1 for Scala.js 0.5.0
  • Merge #38
  • Publish APIs for 0.5.0 on the website
  • Publish CLI on website
  • Release notes, aka #43
  • Big "Current release" on the front page (possibly in #38)

Document extending JavaScript interfaces

I believe after https://github.com/scala-js/scala-js-website/blob/master/doc/calling-javascript.md#defining-javascript-interfaces-with-traits it would be beneficial to show extending a Javascript interface. That way users can easily see how to enrich their JavaScript APIs with minimal work. I have provided an example below. However, I am sure a more useful example can be provided.

trait Window extends js.Object { 
  def alert(message: String): Unit = js.native
} 
object Window {
  implicit class RichWindow(val self: Window) extends AnyVal {
    def help: Unit = self.alert("help")
  }
}

Ambiguity of the sentence "Outstanding features are:"

I'm unsure if this is using "outstanding" in the sense of "exceptionally good" or "not yet resolved", meaning I'm unsure if this means the features are included, or are planned but not yet implemented.

I thought it meant the latter, but then one of the linked pages suggested these features are already included, which would be outstanding!*

  • as in, exceptionally good.

Mention `set (scalaJSStage in Test) := FastOptStage`

set scalaJSStage := FastOptStage only works for run and not test, and that's not obvious. I'd guess more people use test from the command line than use run* . Took me a few minutes to figure it out, and I probably know this stuff better than anyone*

*Citation Needed

Can't compile with json4s

I'm trying out ScalaJS, and just made a little program that makes a simple Ajax request and tries to parse it with json4s. The code compiles fine, but the optimizer fails with the message below. json4s uses reflection via extract. The claim on the ScalaJS is that it supports all of scala, so it seems this should be allowed. Is there something else I'm doing wrong? Perhaps the implicit DefaultFormats is somehow not compiled to Javascript?

[info] Fast optimizing /foo/target/scala-2.11/example-fastopt.js
[error] Referring to non-existent class Lorg_json4s_DefaultFormats$
import org.scalajs.dom.ext.Ajax
import scala.concurrent.Future
import scala.scalajs.concurrent.JSExecutionContext.Implicits.queue

import org.json4s.DefaultFormats
import org.json4s.native.JsonMethods.parse

object Pagerduty {
  type Json = org.json4s.JsonAST.JValue
  val token = "foo"
  implicit val formats = DefaultFormats

  def onCall: Future[EscalationPolicy] =
    Ajax.get(
      url = "https://foo.pagerduty.com/api/v1/escalation_policies/on_call"
    ) map (xhr => parse(xhr.responseText).extract[EscalationPolicy])
}

PS: ScalaJS is a nice project.

`String.substring(start, end)` behaves different on scala and scalajs

For the code:

"abcdefg".substring(3, 1)

It will throw exception when running with normal Scala:

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -2
    at java.lang.String.substring(String.java:1937)

But will get a substring without any exception with scala.js:

bc

Shall we make them consistent?

Document scalajs-stubs

Some text could be added (in the "Cross-Building" page?) to describe how (and why) to export shared classes for JS usage.
I've spent some time searching for a solution before realizing it was already available in the form of the stubs library.
It could be a time saver for many people, IMHO.

Misleading remark about JVM options, in particular about PermGen

The remark:
"Troubleshooting: Should you experience errors with the PermGen size of the JVM at this point, you can increase it. Refer, for example, to this StackOverflow question."

should be reviewed. Since Java 8 the PermGen is removed.

  1. The JVM options are difficult especially the memory control options.
  2. The link to StackOverflow addresses old sbt versions.
  3. The possibilities to set them in sbt are hidden and not so well documented. Hidden in a shell script I found this where IMHO /etc/sbt/sbtopts should be read as ${sbt_home}/conf/sbtconfig.txt.

On my Windows machine I am using the Xmx JVM option, contents of ${sbt_home}/conf/sbtconfig.txt is:

# Set the java args to high

-Xmx896M

-XX:ReservedCodeCacheSize=128m

# Set the extra SBT options

-Dsbt.log.format=true```

(With no PermGen options the the annoying "VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0" message will disappear.)

jsDependencies on windows not allowing a sub-directory JS dependency to be referenced

jsDependencies +=
ProvidedJS / "moment-recur/moment-recur.min.js"

When I
sbt publishLocal

Then open the jar file to look at it at
C:\Users\philip.ivy2\local\io.github.widok\scala-js-moment-recur_sjs0.6_2.11\0.1.0-SNAPSHOT\jars
it has
{"libDeps":[{"resourceName":"moment-with-locales.min.js"},{"resourceName":"moment-recur/moment-recur.min.js"}],"origin":{"configuration":"compile","moduleName":"root"}}

So I think the moment-recur/moment-recur.min.js is a problem because of the /

When I tried to import this with SBT it fails with an error message.

However, if I place the moment-recur.min.js in the resources directory NOT in a sub-directory then its fine and works.

Add tutorial to help new developers quickly get an overview of Scala.js

Suggested outline:

  • Getting started: setup an SBT project from scratch and run a "Hello, Scala.js" example
  • Testing your application: how to write Jasmine tests
  • Prototyping with js.Dynamic: interacting with the DOM
  • Using libraries: DOM and jQuery libraries
  • Creating your own typed wrappers: write wrappers for a JavaScript library or JSON response
  • Calling Scala.js from JavaScript
  • Preparing application for production: optimizing and packaging

Possible future additions:

  • Debugging Scala.js applications in the browser^WChrome
  • Performance tips: e.g. use native JS APIs, avoid Scala collections, how to profile a Scala.js application

See discussions at:
https://groups.google.com/d/msg/scala-js/rE1pQniDDlc/TyEW1puCPKQJ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.