All Projects → ThoughtWorksInc → sbt-scala-js-map

ThoughtWorksInc / sbt-scala-js-map

Licence: Apache-2.0 License
A Sbt plugin that configures source mapping for Scala.js projects hosted on Github

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to sbt-scala-js-map

sbt-graphql
SBT plugin to generate and validate graphql schemas written with Sangria
Stars: ✭ 94 (+213.33%)
Mutual labels:  sbt-plugin
sbt-bazel
Easily convert SBT projects to Bazel workspaces
Stars: ✭ 55 (+83.33%)
Mutual labels:  sbt-plugin
sbt-ethereum
An sbt-based solidity / scala development environment, and general command-line power tool, for Ethereum.
Stars: ✭ 97 (+223.33%)
Mutual labels:  sbt-plugin
gatling-sbt-plugin
Gatling Plugin for SBT
Stars: ✭ 105 (+250%)
Mutual labels:  sbt-plugin
sbt-travisci
An sbt plugin to integrate with Travis CI
Stars: ✭ 44 (+46.67%)
Mutual labels:  sbt-plugin
sbt-guardrail
Principled code generation from OpenAPI specifications
Stars: ✭ 24 (-20%)
Mutual labels:  sbt-plugin
sbt-sonar
An sbt plugin which provides an easy way to integrate Scala projects with SonarQube.
Stars: ✭ 62 (+106.67%)
Mutual labels:  sbt-plugin
sbt-kubeyml
Sbt plugin to help deploy Scala applications to Kubernetes
Stars: ✭ 37 (+23.33%)
Mutual labels:  sbt-plugin
sbt-project-switcher
A sbt plugin to switch project in a snappy way⚡️
Stars: ✭ 36 (+20%)
Mutual labels:  sbt-plugin
chuckwagon
a Scala/sbt AWS Lambda Toolkit
Stars: ✭ 29 (-3.33%)
Mutual labels:  sbt-plugin
sbt-swagger-2
sbt plugin for generating Swagger JSON schemas during build
Stars: ✭ 13 (-56.67%)
Mutual labels:  sbt-plugin
benchdb
A database and query tool for JMH benchmark results
Stars: ✭ 58 (+93.33%)
Mutual labels:  sbt-plugin
xsbt-webstart
A Webstart plugin for sbt
Stars: ✭ 12 (-60%)
Mutual labels:  sbt-plugin
sbt-findbugs
FindBugs static analysis plugin for sbt.
Stars: ✭ 47 (+56.67%)
Mutual labels:  sbt-plugin
sbt-flaky
Detect flaky tests with sbt
Stars: ✭ 35 (+16.67%)
Mutual labels:  sbt-plugin
sbt-sass
A fork of the sbt-sass repository which seems to be abandoned.
Stars: ✭ 32 (+6.67%)
Mutual labels:  sbt-plugin
sbt-play-npm
Integrate a Npm application with Play framework
Stars: ✭ 10 (-66.67%)
Mutual labels:  sbt-plugin
sbt-elm
Scala Build Tool (SBT) plugin for the Elm programming language
Stars: ✭ 44 (+46.67%)
Mutual labels:  sbt-plugin
sbt-example
Run Scaladoc as unit tests
Stars: ✭ 30 (+0%)
Mutual labels:  sbt-plugin
playwarts
WartRemover warts for Play Framework.
Stars: ✭ 23 (-23.33%)
Mutual labels:  sbt-plugin

sbt-scala-js-map

Build Status Maven Central

sbt-scala-js-map is a Sbt plugin that configures source mapping for Scala.js projects hosted on Github.

Motivation

I have some Scala.js libraries hosted on Github (Binding.scala and some private libraries). Then, other Scala.js applications would depend on these libraries. When I debug the Scala.js application in a browser, I want to see the Scala source files of the original libraries.

However, by default, the generated *.js.map files maps the generated JavaScript to the absolute Scala source path where the original library compiled. For me, the path is on a Travis CI worker, like /home/travis/build/ThoughtWorksInc/.../Binding.scala. The path obviously does not exist on my local computer that debugs the application. Too bad.

This sbt plugin detects if a library is hosted on Github repository and let source map point to https://raw.githubusercontent.com/ instead of a local file path.

Showcase

Browse http://todomvc.com/examples/binding-scala/ then open the inspector of your browser. You will be able to debug the Scala.js code in your browser now.

Debugging Scala.js

Alternative options

An alternative option is specifying Scala.js's relative source mappings flag.

However, this approach enforce library users cloning the library's source files into their local file system before debugging their applications.

On the other hand, libraries published with this plugin enable the library users to view the source (of correct revision), automatically.

Usage

Step 1: Add the dependencies in your Scala.js library's project/plugins.sbt

addSbtPlugin("com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "latest.release")

Note that sbt-scala-js-map 2.x requires sbt 0.13.x, sbt-api-mappings 3.x requires sbt 1.x.

Step 2: Publish your Scala.js library

Execute the release command if you have setup sbt-release correctly。

sbt release

Step 3: Debug it!

Now switch your Scala.js application to the newly published Scala.js library, build it, browse your web page, and open the debugger in your browser. You will see the Scala source files hosted under https://raw.githubusercontent.com/ and you can set break points at code lines in these Scala files.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].