bower-json-1.0.0.1: Read bower.json from Haskell

Safe HaskellNone
LanguageHaskell2010

Web.Bower.PackageMeta

Contents

Description

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.

Synopsis

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.

Instances

Eq PackageMeta Source # 
Ord PackageMeta Source # 
Show PackageMeta Source # 
Generic PackageMeta Source # 

Associated Types

type Rep PackageMeta :: * -> * #

ToJSON PackageMeta Source # 
FromJSON PackageMeta Source # 
NFData PackageMeta Source # 

Methods

rnf :: PackageMeta -> () #

type Rep PackageMeta Source # 
type Rep PackageMeta = D1 (MetaData "PackageMeta" "Web.Bower.PackageMeta.Internal" "bower-json-1.0.0.1-1zqeiYZC9agJeWaXTuY4KH" False) (C1 (MetaCons "PackageMeta" PrefixI True) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "bowerName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PackageName)) ((:*:) (S1 (MetaSel (Just Symbol "bowerDescription") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Text))) (S1 (MetaSel (Just Symbol "bowerMain") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [FilePath])))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "bowerModuleType") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [ModuleType])) (S1 (MetaSel (Just Symbol "bowerLicense") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Text]))) ((:*:) (S1 (MetaSel (Just Symbol "bowerIgnore") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Text])) (S1 (MetaSel (Just Symbol "bowerKeywords") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Text]))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "bowerAuthors") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Author])) ((:*:) (S1 (MetaSel (Just Symbol "bowerHomepage") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Text))) (S1 (MetaSel (Just Symbol "bowerRepository") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Repository))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "bowerDependencies") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(PackageName, VersionRange)])) (S1 (MetaSel (Just Symbol "bowerDevDependencies") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(PackageName, VersionRange)]))) ((:*:) (S1 (MetaSel (Just Symbol "bowerResolutions") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(PackageName, Version)])) (S1 (MetaSel (Just Symbol "bowerPrivate") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)))))))

data PackageName Source #

A valid package name for a Bower package.

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.

data Author Source #

Instances

Eq Author Source # 

Methods

(==) :: Author -> Author -> Bool #

(/=) :: Author -> Author -> Bool #

Ord Author Source # 
Show Author Source # 
Generic Author Source # 

Associated Types

type Rep Author :: * -> * #

Methods

from :: Author -> Rep Author x #

to :: Rep Author x -> Author #

ToJSON Author Source # 
FromJSON Author Source # 
NFData Author Source # 

Methods

rnf :: Author -> () #

type Rep Author Source # 
type Rep Author = D1 (MetaData "Author" "Web.Bower.PackageMeta.Internal" "bower-json-1.0.0.1-1zqeiYZC9agJeWaXTuY4KH" False) (C1 (MetaCons "Author" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "authorName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) ((:*:) (S1 (MetaSel (Just Symbol "authorEmail") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Text))) (S1 (MetaSel (Just Symbol "authorHomepage") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Text))))))

data ModuleType Source #

Constructors

Globals 
AMD 
Node 
ES6 
YUI 

Instances

Bounded ModuleType Source # 
Enum ModuleType Source # 
Eq ModuleType Source # 
Ord ModuleType Source # 
Show ModuleType Source # 
Generic ModuleType Source # 

Associated Types

type Rep ModuleType :: * -> * #

ToJSON ModuleType Source # 
FromJSON ModuleType Source # 
NFData ModuleType Source # 

Methods

rnf :: ModuleType -> () #

type Rep ModuleType Source # 
type Rep ModuleType = D1 (MetaData "ModuleType" "Web.Bower.PackageMeta.Internal" "bower-json-1.0.0.1-1zqeiYZC9agJeWaXTuY4KH" False) ((:+:) ((:+:) (C1 (MetaCons "Globals" PrefixI False) U1) (C1 (MetaCons "AMD" PrefixI False) U1)) ((:+:) (C1 (MetaCons "Node" PrefixI False) U1) ((:+:) (C1 (MetaCons "ES6" PrefixI False) U1) (C1 (MetaCons "YUI" PrefixI False) U1))))

data Repository Source #

Constructors

Repository 

Instances

Eq Repository Source # 
Ord Repository Source # 
Show Repository Source # 
Generic Repository Source # 

Associated Types

type Rep Repository :: * -> * #

ToJSON Repository Source # 
FromJSON Repository Source # 
NFData Repository Source # 

Methods

rnf :: Repository -> () #

type Rep Repository Source # 
type Rep Repository = D1 (MetaData "Repository" "Web.Bower.PackageMeta.Internal" "bower-json-1.0.0.1-1zqeiYZC9agJeWaXTuY4KH" False) (C1 (MetaCons "Repository" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "repositoryUrl") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) (S1 (MetaSel (Just Symbol "repositoryType") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text))))

newtype Version Source #

Constructors

Version 

Fields

Instances

Eq Version Source # 

Methods

(==) :: Version -> Version -> Bool #

(/=) :: Version -> Version -> Bool #

Ord Version Source # 
Show Version Source # 
Generic Version Source # 

Associated Types

type Rep Version :: * -> * #

Methods

from :: Version -> Rep Version x #

to :: Rep Version x -> Version #

ToJSON Version Source # 
FromJSON Version Source # 
NFData Version Source # 

Methods

rnf :: Version -> () #

type Rep Version Source # 
type Rep Version = D1 (MetaData "Version" "Web.Bower.PackageMeta.Internal" "bower-json-1.0.0.1-1zqeiYZC9agJeWaXTuY4KH" True) (C1 (MetaCons "Version" PrefixI True) (S1 (MetaSel (Just Symbol "runVersion") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

newtype VersionRange Source #

Constructors

VersionRange 

Instances

Eq VersionRange Source # 
Ord VersionRange Source # 
Show VersionRange Source # 
Generic VersionRange Source # 

Associated Types

type Rep VersionRange :: * -> * #

ToJSON VersionRange Source # 
FromJSON VersionRange Source # 
NFData VersionRange Source # 

Methods

rnf :: VersionRange -> () #

type Rep VersionRange Source # 
type Rep VersionRange = D1 (MetaData "VersionRange" "Web.Bower.PackageMeta.Internal" "bower-json-1.0.0.1-1zqeiYZC9agJeWaXTuY4KH" True) (C1 (MetaCons "VersionRange" PrefixI True) (S1 (MetaSel (Just Symbol "runVersionRange") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

data PackageNameError Source #

Instances

Eq PackageNameError Source # 
Ord PackageNameError Source # 
Show PackageNameError Source # 
Generic PackageNameError Source # 
NFData PackageNameError Source # 

Methods

rnf :: PackageNameError -> () #

type Rep PackageNameError Source # 
type Rep PackageNameError = D1 (MetaData "PackageNameError" "Web.Bower.PackageMeta.Internal" "bower-json-1.0.0.1-1zqeiYZC9agJeWaXTuY4KH" False) ((:+:) ((:+:) (C1 (MetaCons "NotEmpty" PrefixI False) U1) ((:+:) (C1 (MetaCons "TooLong" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int))) (C1 (MetaCons "InvalidChars" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Char]))))) ((:+:) (C1 (MetaCons "RepeatedSeparators" PrefixI False) U1) ((:+:) (C1 (MetaCons "MustNotBeginSeparator" PrefixI False) U1) (C1 (MetaCons "MustNotEndSeparator" PrefixI False) U1))))

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.