Skip to content

Commit

Permalink
Updates for 0.11 (#84)
Browse files Browse the repository at this point in the history
* Updates for 0.11

* Add .travis.yml
  • Loading branch information
paf31 authored Apr 6, 2017
1 parent bc2d367 commit 0b5cc30
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.*
!/.bowerrc
!/.gitignore
!/.travis.yml
/output/
/node_modules/
/bower_components/
Expand Down
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: node_js
dist: trusty
sudo: required
node_js: 6
install:
- npm install -g bower
- npm install
- bower install --production
script:
- npm run -s build
after_success:
- >-
test $TRAVIS_TAG &&
echo $GITHUB_TOKEN | pulp login &&
echo y | pulp publish --no-push
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
`purescript-thermite` is a PureScript wrapper for [`purescript-react`](http://github.com/purescript-contrib/purescript-react). It does not provide all of the functionality of React, but instead to provide a clean API to the most commonly-used parts of its API. It is possible to use `purescript-react` for more specialized use cases.

- [Try Thermite!](http://try.purescript.org/?backend=thermite)
- [Module Documentation](docs/)
- [Module Documentation](generated-docs/Thermite.md)
- Example Project: [Code](test/), [Demo](http://functorial.com/purescript-thermite-todomvc/)

## Building
Expand Down
14 changes: 7 additions & 7 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
"url": "git://github.com/paf31/purescript-thermite.git"
},
"dependencies": {
"purescript-dom": "^3.1.0",
"purescript-profunctor-lenses": "^2.0.0",
"purescript-react": "^2.0.0",
"purescript-react-dom": "^2.0.0",
"purescript-freet": "^2.0.0",
"purescript-aff": "^2.0.0",
"purescript-coroutines": "^3.0.0"
"purescript-aff": "^3.0.0",
"purescript-coroutines": "^4.0.0",
"purescript-dom": "^4.0.0",
"purescript-freet": "^3.0.0",
"purescript-profunctor-lenses": "^3.0.0",
"purescript-react-dom": "^3.0.0",
"purescript-react": "^3.0.0"
}
}
File renamed without changes.
27 changes: 11 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
{
"name": "purescript-thermite",
"version": "1.0.0",
"description": "",
"private": true,
"scripts": {
"pretest": "pulp build",
"test": "pulp test --runtime cat > html/index.js && open html/index.html"
"clean": "rimraf output && rimraf .pulp-cache",
"build": "pulp build -- --censor-lib --strict",
"example": "pulp test -r cat > html/index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/paf31/purescript-thermite.git"
},
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/paf31/purescript-thermite/issues"
},
"homepage": "https://github.com/paf31/purescript-thermite#readme",
"devDependencies": {
"dependnecies": {
"react": "^0.14.7",
"react-dom": "^0.14.7"
},
"devDependencies": {
"pulp": "^11.0.0",
"purescript-psa": "^0.5.0",
"purescript": "^0.11.1",
"rimraf": "^2.5.4"
}
}
5 changes: 2 additions & 3 deletions src/Thermite.purs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ import Data.Lens (Prism', Lens', matching, view, review, preview, lens, over)
import Data.List (List(..), (!!), modifyAt)
import Data.Maybe (Maybe(Just), fromMaybe)
import Data.Monoid (class Monoid)
import Data.Nullable (toMaybe)
import Data.Tuple (Tuple(..))
import React (createFactory)
import React.DOM (div')
Expand Down Expand Up @@ -243,7 +242,7 @@ createReactSpec' wrap (Spec spec) =
Right (CoTransform f k) -> do
st <- liftEff (coerceEff (React.readState this))
let newState = f st
makeAff \_ k1 -> unsafeCoerceEff do
_ <- makeAff \_ k1 -> unsafeCoerceEff do
void $ React.writeStateWithCallback this newState (unsafeCoerceEff (k1 newState))
pure (Loop (k (Just newState)))

Expand Down Expand Up @@ -271,7 +270,7 @@ defaultMain
defaultMain spec initialState props = void do
let component = createClass spec initialState
document <- DOM.window >>= DOM.document
container <- toMaybe <$> DOM.body document
container <- DOM.body document
traverse_ (render (createFactory component props) <<< DOM.htmlElementToElement) container

-- | This function captures the state of the `Spec` as a function argument.
Expand Down
2 changes: 1 addition & 1 deletion test/Components/Task.purs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ taskSpec = T.simpleSpec performAction render
performAction (ChangeCompleted b) _ _ = void do
-- This is a test for issue #65.
-- In practice, we only need one `modifyState` here.
T.modifyState id
_ <- T.modifyState id
T.modifyState (_ { completed = b })
performAction _ _ _ = pure unit
7 changes: 5 additions & 2 deletions test/Components/TaskList.purs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ taskList = container $ fold
-- The `NewTask` action is handled here
-- Everything else is handled by some other child component so is ignored here.
performAction :: T.PerformAction eff TaskListState props TaskListAction
performAction (NewTask s) _ _ = void $ T.modifyState $ \state -> state { tasks = Cons (initialTask s) state.tasks }
performAction _ _ _ = pure unit
performAction (NewTask s) _ _ = void $ T.modifyState $ \state ->
state { tasks = Cons (initialTask s) state.tasks
, editText = ""
}
performAction _ _ _ = pure unit

-- This function wraps a `Spec`'s `Render` function to filter out tasks.
applyFilter :: forall action. Filter -> T.Spec eff Task props action -> T.Spec eff Task props action
Expand Down

0 comments on commit 0b5cc30

Please sign in to comment.