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

Generate GIT-REPO#version versions in bower.json for packages that are not found in Bower. #324

Merged
merged 19 commits into from
Jul 19, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ library:
dependencies:
- base >= 4.7 && < 5
- text < 1.3
- Cabal
- turtle
- filepath
- file-embed
Expand Down
10 changes: 9 additions & 1 deletion src/Spago/Bower.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import Data.String (IsString)
import qualified Data.Text as Text
import Data.Text.Lazy (fromStrict)
import Data.Text.Lazy.Encoding (encodeUtf8)
import qualified Distribution.System as System
import Distribution.System (OS (..))
import qualified Turtle
import Web.Bower.PackageMeta (PackageMeta (..))
import qualified Web.Bower.PackageMeta as Bower
Expand All @@ -31,6 +33,12 @@ bowerPath :: IsString t => t
bowerPath = "bower.json"


bowerCmd :: Text
bowerCmd = case System.buildOS of
Windows -> "bower." -- workaround windows issue: https://github.com/haskell/process/issues/140
Dretch marked this conversation as resolved.
Show resolved Hide resolved
_ -> "bower"


writeBowerJson :: Spago m => DryRun -> m ()
writeBowerJson dryRun = do
config@Config{..} <- Config.ensureConfig
Expand Down Expand Up @@ -95,7 +103,7 @@ mkBowerVersion :: Spago m => Bower.PackageName -> Text -> Text -> m Bower.Versio
mkBowerVersion packageName version repo = do

let args = ["info", "--json", Bower.runPackageName packageName <> "#" <> version]
(code, stdout, stderr) <- Turtle.procStrictWithErr "bower" args empty
(code, stdout, stderr) <- Turtle.procStrictWithErr bowerCmd args empty

when (code /= ExitSuccess) $ do
die $ "Failed to run: `bower " <> Text.intercalate " " args <> "`\n" <> stderr
Expand Down