Skip to content

Commit

Permalink
Updated versions - now using npm package json, added helpers and info…
Browse files Browse the repository at this point in the history
… notice keys, renamed folder for plugin, added web assets to test, updated sbt version.
  • Loading branch information
jmparsons committed May 5, 2016
1 parent f964f2d commit b2b905c
Show file tree
Hide file tree
Showing 16 changed files with 54 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -16,3 +16,5 @@ project/plugins/project/
.idea/
.idea_modules/

# node
node_modules
5 changes: 0 additions & 5 deletions build.sbt
Expand Up @@ -8,11 +8,6 @@ sbtPlugin := true

scalaVersion := "2.10.4"

libraryDependencies ++= Seq(
"org.webjars" % "mkdirp" % "0.5.0",
"org.webjars" % "dustjs-linkedin" % "2.7.2"
)

addSbtPlugin("com.typesafe.sbt" %% "sbt-js-engine" % "1.1.3")

scriptedSettings
Expand Down
8 changes: 8 additions & 0 deletions package.json
@@ -0,0 +1,8 @@
{
"name": "sbt-dustjs-linkedin",
"dependencies": {
"mkdirp": "~0.5.0",
"dustjs-linkedin": "^2.7.2",
"dustjs-helpers": "1.7.3"
}
}
8 changes: 8 additions & 0 deletions sbt-dustjs-linkedin-tester/package.json
@@ -0,0 +1,8 @@
{
"name": "sbt-dustjs-linkedin-tester",
"dependencies": {
"mkdirp": "~0.5.0",
"dustjs-linkedin": "^2.7.2",
"dustjs-helpers": "1.7.3"
}
}
2 changes: 1 addition & 1 deletion sbt-dustjs-linkedin-tester/project/build.properties
@@ -1 +1 @@
sbt.version=0.13.5
sbt.version=0.13.11
4 changes: 3 additions & 1 deletion sbt-dustjs-linkedin-tester/project/plugins.sbt
@@ -1,3 +1,5 @@
lazy val root = Project("plugins", file(".")).dependsOn(plugin)

lazy val plugin = file("../").getCanonicalFile.toURI
lazy val plugin = file("../").getCanonicalFile.toURI

resolvers += Classpaths.sbtPluginSnapshots
12 changes: 12 additions & 0 deletions src/main/resources/dust-shell.js
Expand Up @@ -18,6 +18,18 @@
var target = args[TARGET_ARG];
var options = JSON.parse(args[OPTIONS_ARG]);

if (options.helpers) {
try {
require("dustjs-helpers");
} catch (e) {
console.log(e);
}
}

if (options.infoNotice) {
console.log("DustJs version:", dust.version, " helpers:", ((options.helpers) ? "" : "in") + "active");
}

var sourcesToProcess = sourceFileMappings.length;
var results = [];
var problems = [];
Expand Down
10 changes: 7 additions & 3 deletions src/main/scala/com/jmparsons/sbt/dustjs/SbtDustJs.scala
Expand Up @@ -10,6 +10,9 @@ object Import {

object DustJsKeys {
val dustjs = TaskKey[Seq[File]]("dustjs", "Invoke the DustJs compiler.")

val helpers = SettingKey[Boolean]("dustjs-helpers", "Load in DustJs helpers.")
val infoNotice = SettingKey[Boolean]("dustjs-info-notice", "Show DustJs notice.")
}

}
Expand All @@ -28,22 +31,23 @@ object SbtDustJs extends AutoPlugin {
import autoImport.DustJsKeys._

val dustjsUnscopedSettings = Seq(

includeFilter := "*.tl",

jsOptions := JsObject(
"helpers" -> JsBoolean(helpers.value),
"infoNotice" -> JsBoolean(infoNotice.value)
).toString()
)

override def projectSettings = Seq(
helpers := false,
infoNotice := false
) ++ inTask(dustjs)(
SbtJsTask.jsTaskSpecificUnscopedSettings ++
inConfig(Assets)(dustjsUnscopedSettings) ++
inConfig(TestAssets)(dustjsUnscopedSettings) ++
Seq(
moduleName := "dustjs",
shellFile := getClass.getClassLoader.getResource("dust-shell.js"),

taskMessage in Assets := "DustJs compiling",
taskMessage in TestAssets := "DustJs test compiling"
)
Expand Down

This file was deleted.

This file was deleted.

8 changes: 8 additions & 0 deletions src/sbt-test/sbt-dustjs-linkedin-plugin/dustjs/package.json
@@ -0,0 +1,8 @@
{
"name": "sbt-dustjs-linkedin-plugin",
"dependencies": {
"mkdirp": "~0.5.0",
"dustjs-linkedin": "^2.7.2",
"dustjs-helpers": "1.7.3"
}
}
@@ -0,0 +1 @@
sbt.version=0.13.11
@@ -0,0 +1,3 @@
resolvers += Classpaths.sbtPluginSnapshots

addSbtPlugin("com.jmparsons.sbt" % "sbt-dustjs-linkedin" % sys.props("project.version"))
@@ -1,4 +1,5 @@
# Compile a template file
> web-assets:webNodeModules
> assets
$ exists target/web/public/main/dustjs/main.tl
$ exists target/web/public/main/dustjs/main.js

0 comments on commit b2b905c

Please sign in to comment.