malliina / sbt-utils Edit

SBT plugin collection

Version Matrix

Build Status

sbt-utils

A repository of sbt plugins that I find useful.

  • sbt-bundler for integrating servers using sbt-revolver with clients built with Scala.js and scalajs-bundler
  • sbt-utils-maven for publishing GitHub projects to Maven Central
  • sbt-utils-bintray for publishing to Bintray
  • sbt-nodejs for working with Scala and Node.js projects

The Maven Central plugin populates the required POM XML and delegates publishing to sbt-sonatype. The user must provide a couple of values to correctly populate the POM XML, see Usage.

Installation

To use sbt-bundler:

addSbtPlugin("com.malliina" % "sbt-bundler" % "1.2.6")

To publish to Maven Central:

addSbtPlugin("com.malliina" % "sbt-utils-maven" % "1.2.6")

The Node.js plugin:

addSbtPlugin("com.malliina" % "sbt-nodejs" % "1.2.6")

Usage

sbt-bundler

Define your project:

// Scala.js project
val client = project
  .in(file("client"))
  .enablePlugins(ClientPlugin)

// Backend restarted with sbt-revolver
val server = project
  .in(file("server"))
  .enablePlugins(ServerPlugin)
  .settings(
    clientProject := client
  )

To run:

sbt ~start

The start command will fingerprint assets generated by scalajs-bundler (via webpack) and make them available as resources to the server module. Any changes to either the client or server will rebuild and reload. See example/build.sbt for a minimal example.

Maven Central

To publish to Maven Central, enable the MavenCentralPlugin SBT autoplugin for your project:

val myLibrary = Project("my-library", file("."))
  .enablePlugins(MavenCentralPlugin)

Define the following SBT settings in order to populate the Maven POM XML correctly:

gitUserName := "My GitHub Username Here",
developerName := "My Name Here"

To publish the artifacts, run:

sbt release

You need credentials to publish.

The generated POM XML declares a license of https://opensource.org/licenses/MIT.

Bintray

Enable the BintrayReleasePlugin autoplugin:

val myLibrary = Project("my-library", file("."))
  .enablePlugins(BintrayReleasePlugin)

To publish the artifacts, run:

sbt release

Node.js

Plugin NodeJsPlugin lets you run npm commands from the sbt shell.

val myApp = project.in(file("."))
  .enablePlugins(NodeJsPlugin)

Then run e.g.

front ncu