Skip to content

Commit

Permalink
Run scalafmt (ScalablyTyped#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
steinybot committed Aug 13, 2024
1 parent d0d3331 commit a95fc79
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class Phase1ReadTypescript(
/* There are often whole trees parallel to what is specified in `typings` (or similar). This ignores some of them. */
val main = packageJsonMain(f)
val includedFiles = packageJsonFiles(f)
val bound = (f.shortenedFiles ++ main ++ includedFiles).map(_.folder).distinct.filter(_.path.toIO.exists())
val bound =
(f.shortenedFiles ++ main ++ includedFiles).map(_.folder).distinct.filter(_.path.toIO.exists())
bound.flatMap(PathsFromTsLibSource.filesFrom).distinct
}

Expand Down Expand Up @@ -347,13 +348,13 @@ object Phase1ReadTypescript {

private def packageJsonMain(fromFolder: LibTsSource.FromFolder): IArray[InFile] = {
val baseDirectory = fromFolder.folder.path
val main = os.RelPath(fromFolder.packageJsonOpt.flatMap(_.main).getOrElse("index.js"))
val main = os.RelPath(fromFolder.packageJsonOpt.flatMap(_.main).getOrElse("index.js"))
IArray(InFile(baseDirectory / main))
}

private def packageJsonFiles(fromFolder: LibTsSource.FromFolder): IArray[InFile] = {
val baseDirectory = fromFolder.folder.path
val globs = fromFolder.packageJsonOpt.flatMap(_.files)
val globs = fromFolder.packageJsonOpt.flatMap(_.files)
val files = globs.fold(os.walk(baseDirectory))(GlobWalker.walkFiles(baseDirectory, _)).map(InFile(_))
IArray.fromTraversable(files)
}
Expand Down

0 comments on commit a95fc79

Please sign in to comment.