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 Text
- bowerMain :: [FilePath]
- bowerModuleType :: [ModuleType]
- bowerLicense :: [Text]
- bowerIgnore :: [Text]
- bowerKeywords :: [Text]
- bowerAuthors :: [Author]
- bowerHomepage :: Maybe Text
- bowerRepository :: Maybe Repository
- bowerDependencies :: [(PackageName, VersionRange)]
- bowerDevDependencies :: [(PackageName, VersionRange)]
- bowerResolutions :: [(PackageName, Version)]
- bowerPrivate :: Bool
- data PackageName
- runPackageName :: PackageName -> Text
- mkPackageName :: Text -> Either PackageNameError PackageName
- data Author = Author {}
- data ModuleType
- moduleTypes :: [(Text, ModuleType)]
- data Repository = Repository {}
- newtype Version = Version {
- runVersion :: Text
- newtype VersionRange = VersionRange {}
- data BowerError
- showBowerError :: BowerError -> Text
- data PackageNameError
- showPackageNameError :: PackageNameError -> Text
- decodeFile :: FilePath -> IO (Either (ParseError BowerError) PackageMeta)
- displayError :: ParseError BowerError -> Text
- asPackageMeta :: Parse BowerError PackageMeta
- parseModuleType :: Text -> Either BowerError ModuleType
- parsePackageName :: Text -> 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.
runPackageName :: PackageName -> Text Source #
mkPackageName :: Text -> 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.
Author | |
|
data ModuleType Source #
moduleTypes :: [(Text, ModuleType)] Source #
data Repository Source #
newtype VersionRange Source #
data BowerError 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.
displayError :: ParseError BowerError -> Text Source #
asPackageMeta :: Parse BowerError PackageMeta Source #
A parser for bower.json files, using the aeson-better-errors package.
asRepository :: Parse e Repository Source #