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 #

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 # 
Ord PackageMeta # 
Show PackageMeta # 
Generic PackageMeta # 

Associated Types

type Rep PackageMeta :: * -> * #

FromJSON PackageMeta # 
ToJSON PackageMeta # 
NFData PackageMeta # 

Methods

rnf :: PackageMeta -> () #

type Rep PackageMeta # 
type Rep PackageMeta = D1 (MetaData "PackageMeta" "Web.Bower.PackageMeta.Internal" "bower-json-1.0.0.1-kkdd949W4lByUtufk2zgL" 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)))))))

mkPackageName :: Text -> Either PackageNameError PackageName #

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 #

Instances

Eq Author # 

Methods

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

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

Ord Author # 
Show Author # 
Generic Author # 

Associated Types

type Rep Author :: * -> * #

Methods

from :: Author -> Rep Author x #

to :: Rep Author x -> Author #

FromJSON Author # 
ToJSON Author # 
NFData Author # 

Methods

rnf :: Author -> () #

type Rep Author # 
type Rep Author = D1 (MetaData "Author" "Web.Bower.PackageMeta.Internal" "bower-json-1.0.0.1-kkdd949W4lByUtufk2zgL" 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 #

Constructors

Globals 
AMD 
Node 
ES6 
YUI 

Instances

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

Associated Types

type Rep ModuleType :: * -> * #

FromJSON ModuleType # 
ToJSON ModuleType # 
NFData ModuleType # 

Methods

rnf :: ModuleType -> () #

type Rep ModuleType # 
type Rep ModuleType = D1 (MetaData "ModuleType" "Web.Bower.PackageMeta.Internal" "bower-json-1.0.0.1-kkdd949W4lByUtufk2zgL" 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 #

Constructors

Repository 

Instances

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

Associated Types

type Rep Repository :: * -> * #

FromJSON Repository # 
ToJSON Repository # 
NFData Repository # 

Methods

rnf :: Repository -> () #

type Rep Repository # 
type Rep Repository = D1 (MetaData "Repository" "Web.Bower.PackageMeta.Internal" "bower-json-1.0.0.1-kkdd949W4lByUtufk2zgL" 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 #

Constructors

Version 

Fields

Instances

Eq Version # 

Methods

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

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

Ord Version # 
Show Version # 
Generic Version # 

Associated Types

type Rep Version :: * -> * #

Methods

from :: Version -> Rep Version x #

to :: Rep Version x -> Version #

FromJSON Version # 
ToJSON Version # 
NFData Version # 

Methods

rnf :: Version -> () #

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

newtype VersionRange #

Constructors

VersionRange 

data PackageNameError #

Instances

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

Methods

rnf :: PackageNameError -> () #

type Rep PackageNameError # 
type Rep PackageNameError = D1 (MetaData "PackageNameError" "Web.Bower.PackageMeta.Internal" "bower-json-1.0.0.1-kkdd949W4lByUtufk2zgL" 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) #

Read and attempt to decode a bower.json file.

asPackageMeta :: Parse BowerError PackageMeta #

A parser for bower.json files, using the aeson-better-errors package.