Skip to content
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

Handle multiple extracted versions of same webjar #24

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ developers += Developer(
addSbtJsEngine("1.3.5")

libraryDependencies ++= Seq(
"com.typesafe" % "jstranspiler" % "1.0.1",
"org.webjars" % "mkdirp" % "0.5.0",
"org.webjars" % "stylus" % "0.51.1",
"org.webjars" % "stylus-nib" % "1.1.0",
"org.webjars" % "when-node" % "3.5.2-3"
"org.webjars.npm" % "node-require-fallback" % "1.0.0",
"com.typesafe" % "jstranspiler" % "1.0.1", // sync with src/main/resources/stylus-shell.js
"org.webjars" % "mkdirp" % "0.5.0", // sync with src/main/resources/stylus-shell.js
"org.webjars" % "stylus" % "0.51.1", // sync with src/main/resources/stylus-shell.js
"org.webjars" % "stylus-nib" % "1.1.0", // sync with src/main/resources/stylus-shell.js
"org.webjars" % "when-node" % "3.5.2-3", // sync with src/main/resources/stylus-shell.js
)

// Customise sbt-dynver's behaviour to make it work with tags which aren't v-prefixed
Expand Down
13 changes: 7 additions & 6 deletions src/main/resources/stylus-shell.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*global process, require */

var fs = require("fs"),
jst = require("jstranspiler"),
nodefn = require("when/node"),
mkdirp = require("mkdirp"),
var requireIfExists = require('node-require-fallback'),
fs = require("fs"),
jst = requireIfExists("jstranspiler/1.0.1", "jstranspiler"), // sync with build.sbt
nodefn = requireIfExists("when/3.5.2-3/node", "when/node"), // sync with build.sbt
mkdirp = requireIfExists("mkdirp/0.5.0", "mkdirp"), // sync with build.sbt
path = require("path"),
stylus = require("stylus"),
nib = require("nib");
stylus = requireIfExists("stylus/0.51.1", "stylus"), // sync with build.sbt
nib = requireIfExists("nib/1.1.0", "nib"); // sync with build.sbt

var promised = {
mkdirp: nodefn.lift(mkdirp),
Expand Down
6 changes: 6 additions & 0 deletions src/sbt-test/sbt-stylus/normal/test
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ $ exists target/web/public/main/css/main.css
> assets
-$ exists target/web/public/main/css/main.css
$ exists target/web/public/main/css/main.min.css

$ exists project/target/node-modules/webjars/jstranspiler/src/main.js
$ exists project/target/node-modules/webjars/mkdirp/index.js
$ exists project/target/node-modules/webjars/stylus/index.js
$ exists project/target/node-modules/webjars/nib/lib/nib.js
$ exists project/target/node-modules/webjars/when/when.js
Loading