Safe Haskell | None |
---|---|
Language | Haskell2010 |
A data type representing the Bower.json package description file, together with a parser and related functions.
This code is based on the specification at https://github.com/bower/bower.json-spec.
- data PackageMeta = PackageMeta {
- bowerName :: PackageName
- bowerDescription :: Maybe String
- bowerMain :: [FilePath]
- bowerModuleType :: [ModuleType]
- bowerLicence :: [String]
- bowerIgnore :: [String]
- bowerKeywords :: [String]
- bowerAuthors :: [Author]
- bowerHomepage :: Maybe String
- bowerRepository :: Maybe Repository
- bowerDependencies :: [(PackageName, VersionRange)]
- bowerDevDependencies :: [(PackageName, VersionRange)]
- bowerResolutions :: [(PackageName, Version)]
- bowerPrivate :: Bool
- data PackageName
- runPackageName :: PackageName -> String
- mkPackageName :: String -> Either PackageNameError PackageName
- data Author = Author {}
- data ModuleType
- moduleTypes :: [(String, ModuleType)]
- data Repository = Repository {}
- newtype Version = Version {
- runVersion :: String
- newtype VersionRange = VersionRange {}
- data BowerError
- showBowerError :: BowerError -> Text
- data PackageNameError
- showPackageNameError :: PackageNameError -> Text
- decodeFile :: FilePath -> IO (Either (ParseError BowerError) PackageMeta)
- asPackageMeta :: Parse BowerError PackageMeta
- parseModuleType :: String -> Either BowerError ModuleType
- parsePackageName :: String -> Either BowerError PackageName
- asAuthor :: Parse e Author
- asRepository :: Parse e Repository
Data types
data PackageMeta Source
A data type representing the data stored in a bower.json package manifest file.
Note that the ToJSON
/ FromJSON
instances don't exactly match; for
example, it is not always the case that decoding from JSON and then encoding
to JSON will give you the exact same JSON that you started with. However, if
you start with a PackageMeta value, encode to JSON, and then decode, you
should always get the same value back.
PackageMeta | |
|
data PackageName Source
A valid package name for a Bower package.
mkPackageName :: String -> Either PackageNameError PackageName Source
A smart constructor for a PackageName. It ensures that the package name satisfies the restrictions described at https://github.com/bower/bower.json-spec#name.
data ModuleType Source
moduleTypes :: [(String, ModuleType)] Source
data Repository Source
newtype VersionRange Source
showBowerError :: BowerError -> Text Source
data PackageNameError Source
Parsing
decodeFile :: FilePath -> IO (Either (ParseError BowerError) PackageMeta) Source
Read and attempt to decode a bower.json file.
asPackageMeta :: Parse BowerError PackageMeta Source
A parser for bower.json files, using the aeson-better-errors package.