packages feed

neuron-1.0.0.0: neuron.cabal

cabal-version: 2.4
name: neuron
-- This version must be in sync with what's in Default.dhall
version: 1.0.0.0
license: AGPL-3.0-only
copyright: 2020 Sridhar Ratnakumar
maintainer: srid@srid.ca
author: Sridhar Ratnakumar
category: Web
homepage: https://neuron.zettel.page
bug-reports: https://github.com/srid/neuron/issues
synopsis:
  Future-proof system for plain-text notes.
description:
  neuron is a future-proof system for managing your plain-text Zettelkasten notes.
data-files:
  src-js/search.js
  src-bash/neuron-search

source-repository head
    type: git
    location: https://github.com/srid/neuron

flag ghcid
    default: False
    manual: True

common ghc-common
  ghc-options:
    -Wall
    -Wincomplete-record-updates
    -Wincomplete-uni-patterns

common library-common
  import: ghc-common
  default-language: Haskell2010
  build-depends:
    base >=4.12 && < 4.14,
    aeson,
    mtl,
    text,
    time,
    relude,
    filepath,
    algebraic-graphs >= 0.5,
    parser-combinators,
    containers,
    filepattern,
    megaparsec,
    commonmark ^>= 0.1.0.2,
    commonmark-extensions ^>= 0.2.0.0,
    commonmark-pandoc >= 0.1.0.0 && < 0.3,
    pandoc-types >= 1.21,
    parsec,
    modern-uri,
    HsYAML,
    aeson-gadt-th,
    dependent-sum,
    dependent-sum-template,
    dependent-sum-aeson-orphans >= 0.2.1.0,
    data-default,
    reflex,
    reflex-dom-core,
    reflex-dom-pandoc >= 0.6.0.0,
    clay,
    tagged

library
  import: library-common
  hs-source-dirs: src/lib
  exposed-modules:
    Neuron.Config.Type
    Neuron.Reader.Markdown
    Neuron.Reader.Type
    Neuron.Zettelkasten.ID
    Neuron.Zettelkasten.Zettel
    Neuron.Zettelkasten.Zettel.Meta
    Neuron.Zettelkasten.Zettel.Parser
    Neuron.Zettelkasten.Connection
    Neuron.Zettelkasten.Query
    Neuron.Zettelkasten.Query.Graph
    Neuron.Zettelkasten.Query.Error
    Neuron.Zettelkasten.Query.Eval
    Neuron.Zettelkasten.Query.Parser
    Neuron.Zettelkasten.Query.Theme
    Neuron.Zettelkasten.Graph
    Neuron.Zettelkasten.Graph.Type
    Neuron.Zettelkasten.Graph.Build
    Neuron.Web.Route
    Neuron.Web.Manifest
    Neuron.Web.Common
    Neuron.Web.Widget
    Neuron.Web.Widget.AutoScroll
    Neuron.Web.Widget.InvertedTree
    Neuron.Web.Query.View
    Neuron.Web.Zettel.View
    Neuron.Web.Zettel.CSS
    Neuron.Web.ZIndex
    Neuron.Web.Theme
    Neuron.Orphans
    Text.Megaparsec.Simple
    Text.Pandoc.Util
    Text.URI.Util
    Data.TagTree
    Data.PathTree
    Data.Graph.Labelled
    Data.Graph.Labelled.Type
    Data.Graph.Labelled.Algorithm
    Data.Graph.Labelled.Build
    Data.Time.DateMayTime

common app-common
  import: library-common
  default-language: Haskell2010
  build-depends:
    base >=4.12 && < 4.14,
    aeson,
    clay -any,
    mtl,
    containers,
    directory,
    exceptions,
    file-embed,
    optparse-applicative,
    pandoc,
    -- Use skylighting >= 0.9 as they are written in pure Haskell
    skylighting-core >= 0.9,
    relude,
    iso8601-time,
    rib-core >=1.0,
    shake -any,
    time,
    text,
    modern-uri,
    foldl,
    filepath,
    dhall >= 1.30,
    which,
    unix,
    megaparsec >= 8.0,
    dependent-sum >= 0.7,
    dependent-sum-template,
    data-default,
    uuid,
    shake,
    with-utf8,
    shower,
    either,
    uri-encode

-- Everything below will have to be stripped away, if whoever uses this repo
-- will want to avoid non-core dependencies. Cabal doesn't seem to provide a way
-- to selectively dependent on a library without pulling in every stanza defined
-- here.
-- cf. https://www.srid.ca/2012605.html

library neuron-app-lib
  import: app-common
  hs-source-dirs: src/app
  exposed-modules:
    Data.Structured.Breadcrumb
    Data.Structured.OpenGraph
    Data.Structured.OpenGraph.Render
    Neuron.CLI
    Neuron.CLI.New
    Neuron.CLI.Open
    Neuron.CLI.Rib
    Neuron.CLI.Search
    Neuron.CLI.Types
    Neuron.Config
    Neuron.Config.Alias
    Neuron.Config.Orphans
    Neuron.Version
    Neuron.Web.Cache
    Neuron.Web.HeadHtml
    Neuron.Web.Generate
    Neuron.Web.Generate.Route
    Neuron.Web.View
    Neuron.Web.StructuredData
    Neuron.Reader
    Neuron.Reader.Org
    Neuron.Zettelkasten.ID.Scheme
  autogen-modules:
    Paths_neuron
  other-modules:
    Paths_neuron
  -- A trick to make ghcid reload if library dependencies change
  -- https://www.srid.ca/2012605.html
  if flag(ghcid)
    hs-source-dirs: src/lib
  else
    build-depends: neuron

test-suite neuron-test
  import: app-common
  type: exitcode-stdio-1.0
  hs-source-dirs: test
  main-is: Spec.hs
  build-depends:
    relude,
    hspec,
    QuickCheck,
    time
  default-language:    Haskell2010
  if (flag(ghcid))
    hs-source-dirs: src/lib src/app
  else
    build-depends: neuron, neuron-app-lib
    other-modules:
      Data.PathTreeSpec
      Data.TagTreeSpec
      Data.Graph.Labelled.AlgorithmSpec
      Neuron.Config.AliasSpec
      Neuron.VersionSpec
      Neuron.Zettelkasten.ID.SchemeSpec
      Neuron.Zettelkasten.IDSpec
      Neuron.Zettelkasten.Query.ParserSpec
      Neuron.Zettelkasten.ZettelSpec
      Neuron.Zettelkasten.Zettel.ParserSpec

-- To profile: ghc-options: -fexternal-interpreter -prof -fprof-auto -rtsopts
executable neuron
  import: app-common
  hs-source-dirs: src/exe
  main-is: Main.hs
  ghc-options: -threaded -rtsopts -with-rtsopts=-N
  if (flag(ghcid))
    hs-source-dirs: src/lib src/app
  else
    build-depends: neuron, neuron-app-lib