Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: asdf-vm/actions/install@v1
- run: spago build --path example/**/*.purs
- run: spago test
- run: spago -x spago.example.dhall build
- run: spago -x spago.test.dhall test
- run: for example in $(ls example); do spago run -m Example.${example%.*} -p example/$example; done
6 changes: 3 additions & 3 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodejs 14.15.4
spago 0.19.1
purescript 0.14.0
nodejs 16.15.0
spago 0.20.9
purescript 0.15.2
28 changes: 19 additions & 9 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,24 @@
"output"
],
"dependencies": {
"purescript-console": "^v5.0.0",
"purescript-effect": "^v3.0.0",
"purescript-node-fs-aff": "^v7.0.0",
"purescript-node-process": "^v8.1.0",
"purescript-parsing": "^v6.0.0",
"purescript-psci-support": "^v5.0.0",
"purescript-run": "^v4.0.0",
"purescript-spec": "^v5.0.0",
"purescript-sunde": "^v2.0.0"
"purescript-aff": "^v7.0.0",
"purescript-arrays": "^v7.0.0",
"purescript-control": "^v6.0.0",
"purescript-effect": "^v4.0.0",
"purescript-either": "^v6.1.0",
"purescript-exceptions": "^v6.0.0",
"purescript-foldable-traversable": "^v6.0.0",
"purescript-maybe": "^v6.0.0",
"purescript-node-buffer": "^v8.0.0",
"purescript-node-child-process": "^v9.0.0",
"purescript-node-fs-aff": "^v9.0.0",
"purescript-node-process": "^v10.0.0",
"purescript-parsing": "^v10.0.0",
"purescript-prelude": "^v6.0.0",
"purescript-run": "^v5.0.0",
"purescript-strings": "^v6.0.0",
"purescript-sunde": "^v3.0.0",
"purescript-transformers": "^v6.0.0",
"purescript-tuples": "^v7.0.0"
}
}
20 changes: 10 additions & 10 deletions packages.dhall
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
let mkPackage =
https://github.com/purescript/package-sets/psc-0.13.0-20190626/src/mkPackage.dhall sha256:0b197efa1d397ace6eb46b243ff2d73a3da5638d8d0ac8473e8e4a8fc528cf57

let upstream =
https://github.com/purescript/package-sets/releases/download/psc-0.14.0-20210324/packages.dhall sha256:b4564d575da6aed1c042ca7936da97c8b7a29473b63f4515f09bb95fae8dddab

let overrides = {=}

let additions = {=}

in upstream // overrides // additions
https://github.com/purescript/package-sets/releases/download/psc-0.15.2-20220706/packages.dhall
sha256:7a24ebdbacb2bfa27b2fc6ce3da96f048093d64e54369965a2a7b5d9892b6031

in upstream
with parsing.version = "v10.0.0"
with sunde =
{ dependencies = [ "aff", "effect", "node-child-process", "prelude" ]
, repo = "https://github.com/justinwoo/purescript-sunde.git"
, version = "v3.0.0"
}
39 changes: 23 additions & 16 deletions spago.dhall
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
{ sources =
[ "src/**/*.purs", "test/**/*.purs" ]
, name =
"dotenv"
{ name = "dotenv"
, license = "MIT"
, repository = "https://github.com/nsaunders/purescript-dotenv.git"
, dependencies =
[ "console"
, "effect"
, "node-fs-aff"
, "node-process"
, "parsing"
, "psci-support"
, "run"
, "spec"
, "sunde"
]
, packages =
./packages.dhall
[ "aff"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These dependencies were added because they are used in your source code but not explicitly listed as dependencies. Spago now throws an error if you do that, so I needed to install these.

Also, I've split your Spago file into a file for your library and other files for tests and examples. In the future the package sets will use the Spago file from your repository to determine your dependencies (rather than a separate list in the package-sets repo) so that helps you ship only the dependencies you need to.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Terrific news, thanks @thomashoneyman !

, "arrays"
, "control"
, "effect"
, "either"
, "exceptions"
, "foldable-traversable"
, "maybe"
, "node-buffer"
, "node-child-process"
, "node-fs-aff"
, "node-process"
, "parsing"
, "prelude"
, "run"
, "strings"
, "sunde"
, "transformers"
, "tuples"
]
, sources = [ "src/**/*.purs" ]
, packages = ./packages.dhall
}
11 changes: 11 additions & 0 deletions spago.example.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
let conf = ./spago.dhall

in conf // {
sources = conf.sources # [ "example/**/*.purs" ],
dependencies = conf.dependencies #
[ "console"
, "foreign-object"
, "integers"
, "lists"
]
}
6 changes: 6 additions & 0 deletions spago.test.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
let conf = ./spago.dhall

in conf // {
sources = conf.sources # [ "test/**/*.purs" ],
dependencies = conf.dependencies # [ "ordered-collections", "spec" ]
}
2 changes: 1 addition & 1 deletion src/Dotenv.purs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Effect.Exception (error)
import Node.Encoding (Encoding(UTF8))
import Node.FS.Aff (readTextFile)
import Run (case_, interpret, on)
import Text.Parsing.Parser (parseErrorMessage, runParser)
import Parsing (parseErrorMessage, runParser)

-- | The type of a setting name
type Name = String
Expand Down
4 changes: 2 additions & 2 deletions src/Dotenv/Internal/ChildProcess.purs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ module Dotenv.Internal.ChildProcess (CHILD_PROCESS, ChildProcessF(..), _childPro
import Prelude
import Control.Monad.Error.Class (throwError)
import Data.Maybe (Maybe(Nothing))
import Data.Symbol (SProxy(..))
import Effect.Aff (Aff)
import Effect.Exception (error)
import Node.ChildProcess (Exit(..), defaultSpawnOptions)
import Run (Run, lift)
import Sunde (spawn) as Sunde
import Type.Proxy (Proxy(..))

-- | A data type representing the supported operations
data ChildProcessF a = Spawn String (Array String) (String -> a)

derive instance functorChildProcessF :: Functor ChildProcessF

-- | The effect label used for a child process
_childProcess = SProxy :: SProxy "childProcess"
_childProcess = Proxy :: Proxy "childProcess"

-- | The effect type used for a child process
type CHILD_PROCESS r = (childProcess :: ChildProcessF | r)
Expand Down
4 changes: 2 additions & 2 deletions src/Dotenv/Internal/Environment.purs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ module Dotenv.Internal.Environment

import Prelude
import Data.Maybe (Maybe)
import Data.Symbol (SProxy(..))
import Effect.Aff (Aff)
import Effect.Class (liftEffect)
import Node.Process (lookupEnv, setEnv) as P
import Run (Run, lift)
import Type.Proxy (Proxy(..))

-- | A data type representing the supported operations.
data EnvironmentF a
Expand All @@ -24,7 +24,7 @@ data EnvironmentF a
derive instance functorEnvironmentF :: Functor EnvironmentF

-- The effect label used for reading or modifying the environment.
_environment = SProxy :: SProxy "environment"
_environment = Proxy :: Proxy "environment"

-- | The effect type used for reading or modifying the environment
type ENVIRONMENT r = (environment :: EnvironmentF | r)
Expand Down
14 changes: 8 additions & 6 deletions src/Dotenv/Internal/Parse.purs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
module Dotenv.Internal.Parse where

import Prelude hiding (between)

import Control.Alt ((<|>))
import Data.Array ((:), fromFoldable, head, length, many, some)
import Data.Maybe (fromMaybe)
import Data.String.CodeUnits (fromCharArray)
import Data.Tuple (Tuple(..))
import Dotenv.Internal.Types (Name, Setting, UnresolvedValue(..))
import Text.Parsing.Parser (Parser)
import Text.Parsing.Parser.Combinators ((<?>), lookAhead, notFollowedBy, skipMany, sepEndBy, try)
import Text.Parsing.Parser.String (char, noneOf, oneOf, string, whiteSpace)
import Text.Parsing.Parser.Token (alphaNum)
import Parsing (Parser)
import Parsing.Combinators ((<?>), lookAhead, notFollowedBy, skipMany, sepEndBy, try)
import Parsing.String (char, string)
import Parsing.String.Basic (noneOf, oneOf, whiteSpace)
import Parsing.Token (alphaNum)

-- | Newline characters (carriage return / line feed)
newlineChars :: Array Char
Expand Down Expand Up @@ -47,8 +49,8 @@ variableSubstitution =
commandSubstitution :: Parser String UnresolvedValue
commandSubstitution = do
_ <- string "$("
command <- fromCharArray <$> (some $ noneOf (')' : whitespaceChars))
arguments <- many $ whiteSpace *> (fromCharArray <$> (some $ noneOf (')' : whitespaceChars)))
command <- fromCharArray <$> (some (noneOf (')' : whitespaceChars)))
arguments <- many (whiteSpace *> (fromCharArray <$> (some (noneOf (')' : whitespaceChars)))))
_ <- whiteSpace *> char ')'
pure $ CommandSubstitution command arguments

Expand Down
2 changes: 1 addition & 1 deletion test/Parse.purs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Dotenv.Internal.Parse (settings)
import Dotenv.Internal.Types (UnresolvedValue(..))
import Test.Spec (Spec, describe, it)
import Test.Spec.Assertions (shouldEqual)
import Text.Parsing.Parser (runParser)
import Parsing (runParser)

tests :: Spec Unit
tests = describe "settings (parser)" do
Expand Down