Skip to content

Commit

Permalink
Fix sbt file formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyAutrey committed Oct 17, 2024
1 parent 76c6b7a commit 7a55d43
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/sbt-test/sbt-web/asset-pipeline/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jsmin := {
val minFile = targetDir / "js" / "all.min.js"
IO.touch(minFile)
val minMappings = Seq(minFile) pair Path.relativeTo(targetDir)
val convertedMinMappings = minMappings.map{ case (file, path) =>
val convertedMinMappings = minMappings.map { case (file, path) =>
SbtWeb.asFileRef(file, fileConverter.value) -> path
}
convertedMinMappings ++ other
Expand All @@ -43,4 +43,4 @@ pipelineStages := Seq(jsmin)
TaskKey[Unit]("fileCheck") := {
assert((target.value / "jsmin" / "public" / "js" / "all.min.js").exists())
assert((target.value / "web" / "stage" / "coffee" / "a.coffee").exists())
}
}
7 changes: 5 additions & 2 deletions src/sbt-test/sbt-web/deduplicate/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ lazy val root = (project in file(".")).enablePlugins(SbtWeb)
Assets / WebKeys.deduplicators += SbtWeb.selectFileFrom((Assets / sourceDirectory).value)

TaskKey[Unit]("fileCheck") := {
assert(( target.value / "web" / "public" / "main" / "js" / "a.js" ).exists(), "Could not find 'web/public/main/js/a.js'")
}
assert(
(target.value / "web" / "public" / "main" / "js" / "a.js").exists(),
"Could not find 'web/public/main/js/a.js'"
)
}
12 changes: 9 additions & 3 deletions src/sbt-test/sbt-web/dev-pipeline/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ jsTransform := {
Assets / pipelineStages := Seq(jsTransform)

TaskKey[Unit]("fileCheck") := {
assert(!( target.value / "web" / "public" / "main" / "js" / "a.js" ).exists(), "Found 'web/public/main/js/a.js', which should not exist.")
assert(( target.value / "web" / "public" / "main" / "js" / "a.new.js" ).exists(), "Could not find 'web/public/main/js/a.new.js'")
}
assert(
!(target.value / "web" / "public" / "main" / "js" / "a.js").exists(),
"Found 'web/public/main/js/a.js', which should not exist."
)
assert(
(target.value / "web" / "public" / "main" / "js" / "a.new.js").exists(),
"Could not find 'web/public/main/js/a.new.js'"
)
}
5 changes: 4 additions & 1 deletion src/sbt-test/sbt-web/exclude-hidden-files/build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
lazy val root = (project in file(".")).enablePlugins(SbtWeb)

TaskKey[Unit]("fileCheck") := {
assert(!( target.value / "web" / "public" / "main" / ".svn" / "entries" ).exists(), "Found private directory, which should have been excluded.")
assert(
!(target.value / "web" / "public" / "main" / ".svn" / "entries").exists(),
"Found private directory, which should have been excluded."
)
}
23 changes: 12 additions & 11 deletions src/sbt-test/sbt-web/extract-web-jars/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ libraryDependencies ++= Seq(
//-$ exists target/web/public/main/lib/requirejs/require.js
TaskKey[Unit]("fileCheckAssets") := {
assert(
( target.value / "web" / "public" / "main" / "lib" / "jquery" / "jquery.js" ).exists(),
(target.value / "web" / "public" / "main" / "lib" / "jquery" / "jquery.js").exists(),
"Could not find jquery.js"
)
assert(
( target.value / "web" / "public" / "main" / "lib" / "prototype" / "prototype.js" ).exists(),
(target.value / "web" / "public" / "main" / "lib" / "prototype" / "prototype.js").exists(),
"Could not find prototype.js"
)
assert(
!( target.value / "web" / "public" / "main" / "lib" / "requirejs" / "require.js" ).exists(),
!(target.value / "web" / "public" / "main" / "lib" / "requirejs" / "require.js").exists(),
"Found requirejs, which should have been excluded."
)

Expand All @@ -29,7 +29,7 @@ TaskKey[Unit]("fileCheckAssets") := {
//$ exists target/web/node-modules/main/webjars/less/package.json
TaskKey[Unit]("fileCheckNode") := {
assert(
( target.value / "web" / "node-modules" / "main" / "webjars" / "less" / "package.json" ).exists(),
(target.value / "web" / "node-modules" / "main" / "webjars" / "less" / "package.json").exists(),
"Could not find node webjars"
)
}
Expand All @@ -38,7 +38,8 @@ TaskKey[Unit]("fileCheckNode") := {
//$ newer target/foo target/web/public/main/lib/jquery/jquery.js
TaskKey[Unit]("checkJqueryTimestamp") := {
assert(
(baseDirectory.value / "target" / "foo" ).lastModified() > (target.value / "web" / "public" / "main" / "lib" / "jquery" / "jquery.js" ).lastModified(),
(baseDirectory.value / "target" / "foo")
.lastModified() > (target.value / "web" / "public" / "main" / "lib" / "jquery" / "jquery.js").lastModified(),
"target/foo was not newer than jquery.js"
)
}
Expand All @@ -49,15 +50,15 @@ TaskKey[Unit]("checkJqueryTimestamp") := {
//$ exists target/web/web-modules/test/webjars/lib/prototype/prototype.js
TaskKey[Unit]("checkTestAssets") := {
assert(
( target.value / "web" / "web-modules" / "test" / "webjars" / "lib" / "requirejs" / "require.js" ).exists(),
(target.value / "web" / "web-modules" / "test" / "webjars" / "lib" / "requirejs" / "require.js").exists(),
"Could not find requirejs webjars in test"
)
assert(
( target.value / "web" / "web-modules" / "test" / "webjars" / "lib" / "jquery" / "jquery.js" ).exists(),
(target.value / "web" / "web-modules" / "test" / "webjars" / "lib" / "jquery" / "jquery.js").exists(),
"Could not find jquery webjars in test"
)
assert(
( target.value / "web" / "web-modules" / "test" / "webjars" / "lib" / "prototype" / "prototype.js" ).exists(),
(target.value / "web" / "web-modules" / "test" / "webjars" / "lib" / "prototype" / "prototype.js").exists(),
"Could not find prototype webjars in test"
)
}
Expand All @@ -68,15 +69,15 @@ TaskKey[Unit]("checkTestAssets") := {
//$ exists target/web/public/test/lib/requirejs/require.js
TaskKey[Unit]("checkTestLibs") := {
assert(
( target.value / "web" / "public" / "test" / "lib" / "requirejs" / "require.js" ).exists(),
(target.value / "web" / "public" / "test" / "lib" / "requirejs" / "require.js").exists(),
"Could not find requirejs library in test"
)
assert(
( target.value / "web" / "public" / "test" / "lib" / "jquery" / "jquery.js" ).exists(),
(target.value / "web" / "public" / "test" / "lib" / "jquery" / "jquery.js").exists(),
"Could not find jquery library in test"
)
assert(
( target.value / "web" / "public" / "test" / "lib" / "prototype" / "prototype.js" ).exists(),
(target.value / "web" / "public" / "test" / "lib" / "prototype" / "prototype.js").exists(),
"Could not find prototype library in test"
)
}

0 comments on commit 7a55d43

Please sign in to comment.