From 583bdd7180235a2b99f4b60b199d0f8af4982197 Mon Sep 17 00:00:00 2001 From: Marcin Szamotulski Date: Thu, 12 Oct 2017 01:10:52 +0200 Subject: [PATCH 01/22] Added refToNode (#8) * Added refToNode https://github.com/purescript-contrib/purescript-react/pull/100 * refToNode :: Nullable Ref -> Maybe Node https://github.com/purescript-contrib/purescript-react/pull/100/commits/1b0d54244fc5e9f48ad2a7b075cf2654e0c0251c --- src/ReactDOM.purs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/ReactDOM.purs b/src/ReactDOM.purs index d3c7afd..0ead509 100644 --- a/src/ReactDOM.purs +++ b/src/ReactDOM.purs @@ -4,15 +4,18 @@ module ReactDOM , findDOMNode , renderToString , renderToStaticMarkup + , refToNode ) where import Control.Monad.Eff (Eff) import Control.Monad.Eff.Uncurried (runEffFn1, EffFn4, EffFn1, runEffFn4) +import DOM (DOM) +import DOM.Node.Types (Element, Node) import Data.Function.Uncurried (runFn1, Fn1) import Data.Maybe (Maybe(..)) -import DOM (DOM) -import DOM.Node.Types (Element) -import React (ReactElement, ReactComponent) +import Data.Nullable (Nullable, toMaybe) +import React (ReactElement, ReactComponent, Ref) +import Unsafe.Coerce (unsafeCoerce) -- | Render a React element in a document element. Returns Nothing for stateless components. render @@ -66,3 +69,9 @@ foreign import findDOMNodeImpl foreign import renderToStringImpl :: Fn1 ReactElement String foreign import renderToStaticMarkupImpl :: Fn1 ReactElement String + +refToNode :: Nullable Ref -> Maybe Node +refToNode ref = toMaybe (coerce ref) + where + coerce :: Nullable Ref -> Nullable Node + coerce = unsafeCoerce From 1a8fc3b24fe50e960a4db577c94469594cf66e0e Mon Sep 17 00:00:00 2001 From: eric thul Date: Wed, 11 Oct 2017 19:13:58 -0400 Subject: [PATCH 02/22] Remove generated-docs --- README.md | 2 +- generated-docs/ReactDOM.md | 44 -------------------------------------- 2 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 generated-docs/ReactDOM.md diff --git a/README.md b/README.md index a075ab3..525838b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Low-level React DOM bindings for PureScript -- [Module Documentation](generated-docs/) +- [Module Documentation](https://pursuit.purescript.org/packages/purescript-react-dom/) ## Installation diff --git a/generated-docs/ReactDOM.md b/generated-docs/ReactDOM.md deleted file mode 100644 index 12b3c9d..0000000 --- a/generated-docs/ReactDOM.md +++ /dev/null @@ -1,44 +0,0 @@ -## Module ReactDOM - -#### `render` - -``` purescript -render :: forall eff. ReactElement -> Element -> Eff (dom :: DOM | eff) (Maybe ReactComponent) -``` - -Render a React element in a document element. Returns Nothing for stateless components. - -#### `unmountComponentAtNode` - -``` purescript -unmountComponentAtNode :: forall eff. Element -> Eff (dom :: DOM | eff) Boolean -``` - -Removes a mounted React element in a document element. -Returns true if it was unmounted, false otherwise. - -#### `findDOMNode` - -``` purescript -findDOMNode :: forall eff. ReactComponent -> Eff (dom :: DOM | eff) Element -``` - -Finds the DOM node rendered by the component. - -#### `renderToString` - -``` purescript -renderToString :: ReactElement -> String -``` - -Render a React element as a string. - -#### `renderToStaticMarkup` - -``` purescript -renderToStaticMarkup :: ReactElement -> String -``` - -Render a React element as static markup string without extra DOM attributes. - - From f8899a12d897ba5c979bc1c8099480701c18acdd Mon Sep 17 00:00:00 2001 From: eric thul Date: Wed, 11 Oct 2017 19:22:02 -0400 Subject: [PATCH 03/22] Add LICENSE file --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5b8ce82 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015-2017 various contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From cab9f13113aca6cbf2722183faa932fde83299fd Mon Sep 17 00:00:00 2001 From: Jan Vincent Liwanag Date: Sat, 16 Dec 2017 22:45:42 +0800 Subject: [PATCH 04/22] Upgrade to react 16, purescript-react 5 (#10) --- bower.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index ef769ea..825f539 100644 --- a/bower.json +++ b/bower.json @@ -17,7 +17,7 @@ }, "dependencies": { "purescript-dom": "^4.5.0", - "purescript-react": "^4.0.0", + "purescript-react": "^5.0.0", "purescript-eff": "^3.1.0" } } diff --git a/package.json b/package.json index 48b8218..09ca905 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,6 @@ "rimraf": "^2.5.4" }, "peerDependencies": { - "react-dom": "^15.6.1" + "react-dom": "^16.0.0" } } From fd476c80c440bf278e597ffec6ddaeb02f3c2fcf Mon Sep 17 00:00:00 2001 From: Nathan Faubion Date: Sat, 9 Jun 2018 12:19:46 -0700 Subject: [PATCH 05/22] Updates for 0.12 (#11) * Updates for 0.12 * Bump PS deps Resolves #9 --- bower.json | 6 +++--- package.json | 6 +++--- src/ReactDOM.purs | 45 ++++++++++++++------------------------------- 3 files changed, 20 insertions(+), 37 deletions(-) diff --git a/bower.json b/bower.json index 825f539..d73afe6 100644 --- a/bower.json +++ b/bower.json @@ -16,8 +16,8 @@ "url": "git://github.com/purescript-contrib/purescript-react-dom.git" }, "dependencies": { - "purescript-dom": "^4.5.0", - "purescript-react": "^5.0.0", - "purescript-eff": "^3.1.0" + "purescript-web-dom": "^1.0.0", + "purescript-react": "https://github.com/natefaubion/purescript-react.git#compiler/0.12", + "purescript-effect": "^2.0.0" } } diff --git a/package.json b/package.json index 09ca905..991760f 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,9 @@ "build": "pulp build" }, "devDependencies": { - "pulp": "^11.0.0", - "purescript-psa": "^0.5.0", - "purescript": "^0.11.1", + "pulp": "^12.0.0", + "purescript-psa": "^0.6.0", + "purescript": "^0.12.0", "rimraf": "^2.5.4" }, "peerDependencies": { diff --git a/src/ReactDOM.purs b/src/ReactDOM.purs index 0ead509..f990b74 100644 --- a/src/ReactDOM.purs +++ b/src/ReactDOM.purs @@ -4,35 +4,30 @@ module ReactDOM , findDOMNode , renderToString , renderToStaticMarkup - , refToNode ) where -import Control.Monad.Eff (Eff) -import Control.Monad.Eff.Uncurried (runEffFn1, EffFn4, EffFn1, runEffFn4) -import DOM (DOM) -import DOM.Node.Types (Element, Node) +import Effect (Effect) +import Effect.Uncurried (runEffectFn1, EffectFn4, EffectFn1, runEffectFn4) import Data.Function.Uncurried (runFn1, Fn1) import Data.Maybe (Maybe(..)) -import Data.Nullable (Nullable, toMaybe) -import React (ReactElement, ReactComponent, Ref) -import Unsafe.Coerce (unsafeCoerce) +import React (ReactElement, ReactComponent) +import Web.DOM.Element (Element) -- | Render a React element in a document element. Returns Nothing for stateless components. render - :: forall eff - . ReactElement + :: ReactElement -> Element - -> Eff (dom :: DOM | eff) (Maybe ReactComponent) -render = runEffFn4 renderImpl Nothing Just + -> Effect (Maybe ReactComponent) +render = runEffectFn4 renderImpl Nothing Just -- | Removes a mounted React element in a document element. -- | Returns true if it was unmounted, false otherwise. -unmountComponentAtNode :: forall eff. Element -> Eff (dom :: DOM | eff) Boolean -unmountComponentAtNode = runEffFn1 unmountComponentAtNodeImpl +unmountComponentAtNode :: Element -> Effect Boolean +unmountComponentAtNode = runEffectFn1 unmountComponentAtNodeImpl -- | Finds the DOM node rendered by the component. -findDOMNode :: forall eff. ReactComponent -> Eff (dom :: DOM | eff) Element -findDOMNode = runEffFn1 findDOMNodeImpl +findDOMNode :: ReactComponent -> Effect Element +findDOMNode = runEffectFn1 findDOMNodeImpl -- | Render a React element as a string. renderToString :: ReactElement -> String @@ -43,9 +38,7 @@ renderToStaticMarkup :: ReactElement -> String renderToStaticMarkup = runFn1 renderToStaticMarkupImpl foreign import renderImpl - :: forall eff - . EffFn4 - (dom :: DOM | eff) + :: EffectFn4 (Maybe ReactComponent) (ReactComponent -> Maybe ReactComponent) ReactElement @@ -53,25 +46,15 @@ foreign import renderImpl (Maybe ReactComponent) foreign import unmountComponentAtNodeImpl - :: forall eff - . EffFn1 - (dom :: DOM | eff) + :: EffectFn1 Element Boolean foreign import findDOMNodeImpl - :: forall eff - . EffFn1 - (dom :: DOM | eff) + :: EffectFn1 ReactComponent Element foreign import renderToStringImpl :: Fn1 ReactElement String foreign import renderToStaticMarkupImpl :: Fn1 ReactElement String - -refToNode :: Nullable Ref -> Maybe Node -refToNode ref = toMaybe (coerce ref) - where - coerce :: Nullable Ref -> Nullable Node - coerce = unsafeCoerce From 987a9fe78e75d48bf1399acad3f82c6198ff43f2 Mon Sep 17 00:00:00 2001 From: eric thul Date: Sat, 9 Jun 2018 15:21:54 -0400 Subject: [PATCH 06/22] Update react dependency --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index d73afe6..ed5b41e 100644 --- a/bower.json +++ b/bower.json @@ -17,7 +17,7 @@ }, "dependencies": { "purescript-web-dom": "^1.0.0", - "purescript-react": "https://github.com/natefaubion/purescript-react.git#compiler/0.12", + "purescript-react": "^6.0.0", "purescript-effect": "^2.0.0" } } From 0730f25d601f58a69e0a91ada480fbb5cb102755 Mon Sep 17 00:00:00 2001 From: Athan Clark Date: Sun, 10 Mar 2019 06:37:41 -0600 Subject: [PATCH 07/22] Update web-dom version (#12) --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index ed5b41e..1df91e4 100644 --- a/bower.json +++ b/bower.json @@ -16,7 +16,7 @@ "url": "git://github.com/purescript-contrib/purescript-react-dom.git" }, "dependencies": { - "purescript-web-dom": "^1.0.0", + "purescript-web-dom": "^2.0.0", "purescript-react": "^6.0.0", "purescript-effect": "^2.0.0" } From 8e02c0b54980ac6a6969049acf57580b685720b8 Mon Sep 17 00:00:00 2001 From: starper <0.s.t.a.r.p.e.r.0@gmail.com> Date: Sun, 5 May 2019 16:35:54 +0300 Subject: [PATCH 08/22] Add `hydrate` function (#14) --- psc-package.json | 45 ++++----------------------------------------- src/ReactDOM.js | 9 ++++++--- src/ReactDOM.purs | 31 +++++++++++++++++++++++-------- 3 files changed, 33 insertions(+), 52 deletions(-) diff --git a/psc-package.json b/psc-package.json index bc5211c..e2ac77c 100644 --- a/psc-package.json +++ b/psc-package.json @@ -1,46 +1,9 @@ { "name": "purescript-react-dom", - "set": "psc-0.10.1", - "source": "https://raw.githubusercontent.com/purescript/package-sets/psc-0.10.1/packages.json", + "set": "psc-0.12.5-20190504", + "source": "https://github.com/purescript/package-sets.git", "depends": [ - "arrays", - "bifunctors", - "control", - "datetime", - "distributive", - "dom", - "eff", - "eff-functions", - "either", - "enums", - "exceptions", - "foldable-traversable", - "foreign", - "functions", - "generics", - "identity", - "integers", - "invariant", - "js-date", - "lazy", - "lists", - "math", - "maybe", - "media-types", - "monoid", - "newtype", - "nonempty", - "nullable", - "partial", - "prelude", - "proxy", - "react", - "st", - "strings", - "tailrec", - "transformers", - "tuples", - "unfoldable", - "unsafe-coerce" + "web-dom", + "react" ] } diff --git a/src/ReactDOM.js b/src/ReactDOM.js index a8913fc..454fa19 100644 --- a/src/ReactDOM.js +++ b/src/ReactDOM.js @@ -4,9 +4,12 @@ var ReactDOM = require("react-dom"); var ReactDOMServer = require("react-dom/server"); -exports.renderImpl = function (nothing, just, element, container) { - var result = ReactDOM.render(element, container); - return result === null ? nothing : just(result); +exports.renderImpl = function (element, container) { + return ReactDOM.render(element, container); +}; + +exports.hydrateImpl = function (element, container) { + return ReactDOM.hydrate(element, container); }; exports.unmountComponentAtNodeImpl = ReactDOM.unmountComponentAtNode; diff --git a/src/ReactDOM.purs b/src/ReactDOM.purs index f990b74..387787f 100644 --- a/src/ReactDOM.purs +++ b/src/ReactDOM.purs @@ -1,15 +1,19 @@ module ReactDOM ( render + , hydrate , unmountComponentAtNode , findDOMNode , renderToString , renderToStaticMarkup ) where -import Effect (Effect) -import Effect.Uncurried (runEffectFn1, EffectFn4, EffectFn1, runEffectFn4) +import Prelude + import Data.Function.Uncurried (runFn1, Fn1) -import Data.Maybe (Maybe(..)) +import Data.Maybe (Maybe) +import Data.Nullable (Nullable, toMaybe) +import Effect (Effect) +import Effect.Uncurried (EffectFn1, EffectFn2, runEffectFn1, runEffectFn2) import React (ReactElement, ReactComponent) import Web.DOM.Element (Element) @@ -18,7 +22,14 @@ render :: ReactElement -> Element -> Effect (Maybe ReactComponent) -render = runEffectFn4 renderImpl Nothing Just +render rEl el = toMaybe <$> runEffectFn2 renderImpl rEl el + +-- | Same as `render`, but is used to hydrate a container whose HTML contents were rendered on the server. +hydrate + :: ReactElement + -> Element + -> Effect (Maybe ReactComponent) +hydrate rEl el = toMaybe <$> runEffectFn2 hydrateImpl rEl el -- | Removes a mounted React element in a document element. -- | Returns true if it was unmounted, false otherwise. @@ -38,12 +49,16 @@ renderToStaticMarkup :: ReactElement -> String renderToStaticMarkup = runFn1 renderToStaticMarkupImpl foreign import renderImpl - :: EffectFn4 - (Maybe ReactComponent) - (ReactComponent -> Maybe ReactComponent) + :: EffectFn2 + ReactElement + Element + (Nullable ReactComponent) + +foreign import hydrateImpl + :: EffectFn2 ReactElement Element - (Maybe ReactComponent) + (Nullable ReactComponent) foreign import unmountComponentAtNodeImpl :: EffectFn1 From c7715d5ac2f857a1a39ac6508c02493a4fa5e0a1 Mon Sep 17 00:00:00 2001 From: Harry Garrood Date: Tue, 28 May 2019 00:48:25 +0100 Subject: [PATCH 09/22] Relax upper bound on purescript-react This is necessary to allow this package to compile with purs v0.13.0 (see also: https://github.com/purescript-contrib/purescript-react/pull/171) --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 1df91e4..1f7f120 100644 --- a/bower.json +++ b/bower.json @@ -17,7 +17,7 @@ }, "dependencies": { "purescript-web-dom": "^2.0.0", - "purescript-react": "^6.0.0", + "purescript-react": ">= 6.0.0 < 8.0.0", "purescript-effect": "^2.0.0" } } From 441e1705ab8fc5fb382d9b3b3516f40ef7234e6c Mon Sep 17 00:00:00 2001 From: Harry Garrood Date: Tue, 28 May 2019 13:14:36 +0100 Subject: [PATCH 10/22] v6.1.0 From 3b117b3645cd85a5ee97d408af260636ec174e31 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Fri, 9 Oct 2020 16:20:05 -0700 Subject: [PATCH 11/22] Update for Contributors library guidelines (#18) --- .editorconfig | 13 +++++ .eslintrc.json | 29 +++++++++++ .github/ISSUE_TEMPLATE/bug-report.md | 19 +++++++ .github/ISSUE_TEMPLATE/change-request.md | 21 ++++++++ .github/ISSUE_TEMPLATE/config.yml | 8 +++ .github/PULL_REQUEST_TEMPLATE.md | 11 ++++ .github/workflows/ci.yml | 51 +++++++++++++++++++ .gitignore | 24 +++++---- .travis.yml | 15 ------ CHANGELOG.md | 64 ++++++++++++++++++++++++ CONTRIBUTING.md | 5 ++ README.md | 48 +++++++++++++++--- bower.json | 2 +- docs/README.md | 3 ++ package.json | 10 ++-- packages.dhall | 4 ++ psc-package.json | 9 ---- spago.dhall | 5 ++ src/ReactDOM.js | 1 - test/Main.purs | 11 ++++ 20 files changed, 304 insertions(+), 49 deletions(-) create mode 100644 .editorconfig create mode 100644 .eslintrc.json create mode 100644 .github/ISSUE_TEMPLATE/bug-report.md create mode 100644 .github/ISSUE_TEMPLATE/change-request.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml create mode 100644 CHANGELOG.md create mode 100644 CONTRIBUTING.md create mode 100644 docs/README.md create mode 100644 packages.dhall delete mode 100644 psc-package.json create mode 100644 spago.dhall create mode 100644 test/Main.purs diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7c68b07 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +# https://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..17f167d --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,29 @@ +{ + "env": { "browser": true, "commonjs": true }, + "extends": "eslint:recommended", + "parserOptions": { "ecmaVersion": 5 }, + "rules": { + "block-scoped-var": "error", + "consistent-return": "error", + "eqeqeq": "error", + "guard-for-in": "error", + "no-bitwise": "error", + "no-caller": "error", + "no-extra-parens": "off", + "no-extend-native": "error", + "no-loop-func": "error", + "no-new": "error", + "no-param-reassign": "error", + "no-return-assign": "error", + "no-sequences": "error", + "no-unused-expressions": "error", + "no-use-before-define": "error", + "no-undef": "error", + "no-eq-null": "error", + "radix": ["error", "always"], + "indent": ["error", 2, { "SwitchCase": 1 }], + "quotes": ["error", "double"], + "semi": ["error", "always"], + "strict": ["error", "global"] + } +} diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 0000000..b79b995 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,19 @@ +--- +name: Bug report +about: Report an issue +title: "" +labels: bug +assignees: "" +--- + +**Describe the bug** +A clear and concise description of the bug. + +**To Reproduce** +A minimal code example (preferably a runnable example on [Try PureScript](https://try.purescript.org)!) or steps to reproduce the issue. + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/change-request.md b/.github/ISSUE_TEMPLATE/change-request.md new file mode 100644 index 0000000..a2ee685 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/change-request.md @@ -0,0 +1,21 @@ +--- +name: Change request +about: Propose an improvement to this library +title: "" +labels: "" +assignees: "" +--- + +**Is your change request related to a problem? Please describe.** +A clear and concise description of the problem. + +Examples: + +- It's frustrating to have to [...] +- I was looking for a function to [...] + +**Describe the solution you'd like** +A clear and concise description of what a good solution to you looks like, including any solutions you've already considered. + +**Additional context** +Add any other context about the change request here. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..c47a263 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: PureScript Discourse + url: https://discourse.purescript.org/ + about: Ask and answer questions here. + - name: Functional Programming Slack + url: https://functionalprogramming.slack.com + about: For casual chat and questions (use https://fpchat-invite.herokuapp.com to join). diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..d8780f7 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,11 @@ +**Description of the change** +Clearly and concisely describe the purpose of the pull request. If this PR relates to an existing issue or change proposal, please link to it. Include any other background context that would help reviewers understand the motivation for this PR. + +--- + +**Checklist:** + +- [ ] Added the change to the changelog's "Unreleased" section with a link to this PR and your username +- [ ] Linked any existing issues or proposals that this pull request should close +- [ ] Updated or added relevant documentation in the README and/or documentation directory +- [ ] Added a test for the contribution (if applicable) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0b3ca67 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up PureScript toolchain + uses: purescript-contrib/setup-purescript@main + + - name: Cache PureScript dependencies + uses: actions/cache@v2 + with: + key: ${{ runner.os }}-spago-${{ hashFiles('**/*.dhall') }} + path: | + .spago + output + + - name: Set up Node toolchain + uses: actions/setup-node@v1 + with: + node-version: "12.x" + + - name: Cache NPM dependencies + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Install NPM dependencies + run: npm install + + - name: Build the project + run: npm run build + + - name: Run tests + run: npm run test diff --git a/.gitignore b/.gitignore index 5544435..5a54e2f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,13 @@ -.DS_Store -.psci -.psci_modules -.pulp-cache -npm-debug.log -node_modules/ -bower_components/ -tmp/ -output/ -.psc-ide-port -.psc-package/ +.* +!.gitignore +!.github +!.editorconfig +!.eslintrc.json + +output +generated-docs +bower_components + +node_modules +package-lock.json +*.lock diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 968390b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: node_js -dist: trusty -sudo: required -node_js: stable -install: - - npm install -g bower - - npm install - - bower install -script: - - npm run -s build -after_success: -- >- - test $TRAVIS_TAG && - echo $GITHUB_TOKEN | pulp login && - echo y | pulp publish --no-push diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..37e3f37 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,64 @@ +# Changelog + +Notable changes to this project are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +Breaking changes (😱!!!): + +New features: + +Bugfixes: + +Other improvements: + +## [v6.1.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v6.1.0) - 2019-05-28 + +**Updates** + +* #14 Add `hydrate` function (@starper) +* #17 Relax upper bound on `purescript-react` for v0.13.x compiler compatibility (@hdgarrood) + +## [v6.0.1](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v6.0.1) - 2019-03-10 + +**Updates** + + - #12 update web-dom dependency (@athanclark) + +## [v6.0.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v6.0.0) - 2018-06-09 + +**Breaking Changes** + +- Updates for PureScript 0.12 and React 6.0.0 #11 (@natefaubion) + +## [v5.0.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v5.0.0) - 2017-12-16 + +**Breaking** + + - #10 Updates dependencies (@jvliwanag) + +## [v4.1.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v4.1.0) - 2017-10-11 + +**Features** + + - #8 Added `refToNode` (@coot) + +## [v4.0.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v4.0.0) - 2017-07-11 + +- Updates for the latest `purescript-react` release (@coot) + +## [v3.0.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v3.0.0) - 2017-04-05 + +- Updates for 0.11 compiler + +## [v1.0.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v1.0.0) - 2016-06-12 + +- Compatible with PureScript compiler versions >= 0.9.1 (@spicydonuts) + +## [v0.2.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v0.2.0) - 2016-03-05 + +- Release compatible with `purescript-react#v0.7.0` (@kRITZCREEK) + +## [v0.1.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v0.1.0) - 2016-01-25 + +- Initial release compatible with `purescript-react#v0.6.0` diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..ee46c33 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,5 @@ +# Contributing to React DOM + +Thanks for your interest in contributing to `react-dom`! We welcome new contributions regardless of your level of experience or familiarity with PureScript. + +Every library in the Contributors organization shares a simple handbook that helps new contributors get started. With that in mind, please [read the short contributing guide on purescript-contrib/governance](https://github.com/purescript-contrib/governance/blob/main/contributing.md) before contributing to this library. diff --git a/README.md b/README.md index 525838b..3daef35 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,51 @@ -# purescript-react-dom +# React DOM -Low-level React DOM bindings for PureScript +[![CI](https://github.com/purescript-contrib/purescript-react-dom/workflows/CI/badge.svg?branch=main)](https://github.com/purescript-contrib/purescript-react-dom/actions?query=workflow%3ACI+branch%3Amain) +[![Release](https://img.shields.io/github/release/purescript-contrib/purescript-react-dom.svg)](https://github.com/purescript-contrib/purescript-react-dom/releases) +[![Pursuit](https://pursuit.purescript.org/packages/purescript-react-dom/badge)](https://pursuit.purescript.org/packages/purescript-react-dom) +[![Maintainer: ethul](https://img.shields.io/badge/maintainer-ethul-teal.svg)](https://github.com/ethul) -- [Module Documentation](https://pursuit.purescript.org/packages/purescript-react-dom/) +Low-level React DOM bindings for PureScript. You may also be interested in the higher-level [`react-basic-dom`](https://github.com/lumihq/purescript-react-basic-dom) library. + +The library summary hasn't been written yet (contributions are welcome!). The library summary describes the library's purpose in one to three sentences. ## Installation +Install `react-dom` with [Spago](https://github.com/purescript/spago): + +```sh +spago install react-dom ``` -bower install purescript-react-dom + +You will also need to install the `react-dom` package from NPM: + +```sh +npm install --save react-dom ``` -## Example +## Quick start + +The quick start hasn't been written yet (contributions are welcome!). The quick start covers a common, minimal use case for the library, whereas longer examples and tutorials are kept in the [docs directory](./docs). + +## Documentation + +`react-dom` documentation is stored in a few places: + +1. Module documentation is [published on Pursuit](https://pursuit.purescript.org/packages/purescript-react-dom). +2. Written documentation is kept in the [docs directory](./docs). +3. You can use the [react-example](https://github.com/ethul/purescript-react-example) to see these bindings in action. + +If you get stuck, there are several ways to get help: + +- [Open an issue](https://github.com/purescript-contrib/purescript-react-dom/issues) if you have encountered a bug or problem. +- [Search or start a thread on the PureScript Discourse](https://discourse.purescript.org) if you have general questions. You can also ask questions in the `#purescript` and `#purescript-beginners` channels on the [Functional Programming Slack](https://functionalprogramming.slack.com) ([invite link](https://fpchat-invite.herokuapp.com/)). + +## Contributing + +You can contribute to `react-dom` in several ways: + +1. If you encounter a problem or have a question, please [open an issue](https://github.com/purescript-contrib/purescript-react-dom/issues). We'll do our best to work with you to resolve or answer it. + +2. If you would like to contribute code, tests, or documentation, please [read the contributor guide](./CONTRIBUTING.md). It's a short, helpful introduction to contributing to this library, including development instructions. -Please refer to [purescript-react-example](https://github.com/ethul/purescript-react-example) +3. If you have written a library, tutorial, guide, or other resource based on this package, please share it on the [PureScript Discourse](https://discourse.purescript.org)! Writing libraries and learning resources are a great way to help this library succeed. diff --git a/bower.json b/bower.json index 1f7f120..02c5bb9 100644 --- a/bower.json +++ b/bower.json @@ -13,7 +13,7 @@ ], "repository": { "type": "git", - "url": "git://github.com/purescript-contrib/purescript-react-dom.git" + "url": "https:://github.com/purescript-contrib/purescript-react-dom.git" }, "dependencies": { "purescript-web-dom": "^2.0.0", diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..6a446cf --- /dev/null +++ b/docs/README.md @@ -0,0 +1,3 @@ +# React DOM Documentation + +This directory contains documentation for `react-dom`. If you are interested in contributing new documentation, please read the [contributor guidelines](../CONTRIBUTING.md) and [What Nobody Tells You About Documentation](https://documentation.divio.com) for help getting started. diff --git a/package.json b/package.json index 991760f..d913a47 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,12 @@ { "private": true, "scripts": { - "clean": "rimraf output && rimraf .pulp-cache", - "build": "pulp build" + "build": "eslint src && spago build --purs-args '--censor-lib --strict'", + "test": "spago test --no-install" }, "devDependencies": { - "pulp": "^12.0.0", - "purescript-psa": "^0.6.0", - "purescript": "^0.12.0", - "rimraf": "^2.5.4" + "eslint": "^7.6.0", + "purescript-psa": "^0.8.0" }, "peerDependencies": { "react-dom": "^16.0.0" diff --git a/packages.dhall b/packages.dhall new file mode 100644 index 0000000..80f5fe6 --- /dev/null +++ b/packages.dhall @@ -0,0 +1,4 @@ +let upstream = + https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20201007/packages.dhall sha256:35633f6f591b94d216392c9e0500207bb1fec42dd355f4fecdfd186956567b6b + +in upstream diff --git a/psc-package.json b/psc-package.json deleted file mode 100644 index e2ac77c..0000000 --- a/psc-package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "purescript-react-dom", - "set": "psc-0.12.5-20190504", - "source": "https://github.com/purescript/package-sets.git", - "depends": [ - "web-dom", - "react" - ] -} diff --git a/spago.dhall b/spago.dhall new file mode 100644 index 0000000..d46ced5 --- /dev/null +++ b/spago.dhall @@ -0,0 +1,5 @@ +{ name = "react-dom" +, dependencies = [ "console", "effect", "psci-support", "react", "web-dom" ] +, packages = ./packages.dhall +, sources = [ "src/**/*.purs", "test/**/*.purs" ] +} diff --git a/src/ReactDOM.js b/src/ReactDOM.js index 454fa19..1bd7f0a 100644 --- a/src/ReactDOM.js +++ b/src/ReactDOM.js @@ -1,4 +1,3 @@ -/* global exports */ "use strict"; var ReactDOM = require("react-dom"); diff --git a/test/Main.purs b/test/Main.purs new file mode 100644 index 0000000..f91f98c --- /dev/null +++ b/test/Main.purs @@ -0,0 +1,11 @@ +module Test.Main where + +import Prelude + +import Effect (Effect) +import Effect.Class.Console (log) + +main :: Effect Unit +main = do + log "🍝" + log "You should add some tests." From f0a8621dbf2b1b8256674c84d680a5e265fa5d95 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Fri, 9 Oct 2020 16:20:33 -0700 Subject: [PATCH 12/22] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 3daef35..2afa5bd 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,6 @@ Low-level React DOM bindings for PureScript. You may also be interested in the higher-level [`react-basic-dom`](https://github.com/lumihq/purescript-react-basic-dom) library. -The library summary hasn't been written yet (contributions are welcome!). The library summary describes the library's purpose in one to three sentences. - ## Installation Install `react-dom` with [Spago](https://github.com/purescript/spago): From b01192a35a150288adaddb6e41bed1d3f6fcad0f Mon Sep 17 00:00:00 2001 From: JordanMartinez Date: Mon, 7 Dec 2020 17:48:07 -0800 Subject: [PATCH 13/22] Update to v0.14.0-rc3 (#20) * Update packages.dhall to prepare-0.14 bootstrap * Update CI to use v0.14.0-rc3 PS release --- .github/workflows/ci.yml | 2 ++ packages.dhall | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b3ca67..c842755 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,8 @@ jobs: - name: Set up PureScript toolchain uses: purescript-contrib/setup-purescript@main + with: + purescript: "0.14.0-rc3" - name: Cache PureScript dependencies uses: actions/cache@v2 diff --git a/packages.dhall b/packages.dhall index 80f5fe6..9c3ee6f 100644 --- a/packages.dhall +++ b/packages.dhall @@ -1,4 +1,4 @@ let upstream = - https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20201007/packages.dhall sha256:35633f6f591b94d216392c9e0500207bb1fec42dd355f4fecdfd186956567b6b + https://raw.githubusercontent.com/purescript/package-sets/prepare-0.14/src/packages.dhall in upstream From 073344262dd33ae38e878a08f090243d7c7f17d4 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Sun, 24 Jan 2021 07:43:33 -0800 Subject: [PATCH 14/22] Update changelog since v6.1.0 (#22) --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 33 +++++++++++++++++---------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c842755..4f5f40c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - name: Set up PureScript toolchain uses: purescript-contrib/setup-purescript@main with: - purescript: "0.14.0-rc3" + purescript: "0.14.0-rc5" - name: Cache PureScript dependencies uses: actions/cache@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 37e3f37..5ed1874 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,59 +5,60 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] Breaking changes (😱!!!): +- Added support for PureScript 0.14 and dropped support for all previous versions (#20) New features: Bugfixes: Other improvements: +- Changed default branch to `main` from `master` +- Updated to comply with Contributors library guidelines by adding new issue and pull request templates, updating documentation, and migrating to Spago for local development and CI (#18) ## [v6.1.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v6.1.0) - 2019-05-28 -**Updates** +New improvements: -* #14 Add `hydrate` function (@starper) -* #17 Relax upper bound on `purescript-react` for v0.13.x compiler compatibility (@hdgarrood) +- Added `hydrate` function (#14, @starper) +- Relaxed upper bound on `purescript-react` for v0.13.x compiler compatibility (#17, @hdgarrood) ## [v6.0.1](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v6.0.1) - 2019-03-10 -**Updates** - - - #12 update web-dom dependency (@athanclark) +- Updated `web-dom` dependency (#12, @athanclark) ## [v6.0.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v6.0.0) - 2018-06-09 -**Breaking Changes** +Breaking changes: -- Updates for PureScript 0.12 and React 6.0.0 #11 (@natefaubion) +- Updated for PureScript 0.12 and React 6.0.0 (#11 by @natefaubion) ## [v5.0.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v5.0.0) - 2017-12-16 -**Breaking** +Breaking changes: - - #10 Updates dependencies (@jvliwanag) +- Updated dependencies (#10 by @jvliwanag) ## [v4.1.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v4.1.0) - 2017-10-11 -**Features** +New features: - - #8 Added `refToNode` (@coot) +- Added `refToNode` (#8, @coot) ## [v4.0.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v4.0.0) - 2017-07-11 -- Updates for the latest `purescript-react` release (@coot) +- Updated for the latest `purescript-react` release (@coot) ## [v3.0.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v3.0.0) - 2017-04-05 -- Updates for 0.11 compiler +- Updated for PureScript 0.11 ## [v1.0.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v1.0.0) - 2016-06-12 -- Compatible with PureScript compiler versions >= 0.9.1 (@spicydonuts) +- Updated for PureScript compiler versions >= 0.9.1 (@spicydonuts) ## [v0.2.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v0.2.0) - 2016-03-05 -- Release compatible with `purescript-react#v0.7.0` (@kRITZCREEK) +- Updated for `purescript-react#v0.7.0` (@kRITZCREEK) ## [v0.1.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v0.1.0) - 2016-01-25 From 2a8106315c52c48355dd0124aad175f314f3294a Mon Sep 17 00:00:00 2001 From: Cyril Date: Fri, 26 Feb 2021 23:29:38 +0100 Subject: [PATCH 15/22] Prepare v7.0.0 release (#23) * Update CI to build with the latest version of the compiler * Update the bower repository URL to match the URL in the registry * Upgrade bower dependencies * Update the changelog --- .github/workflows/ci.yml | 2 -- CHANGELOG.md | 12 +++++++++++- bower.json | 11 +++++++---- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f5f40c..0b3ca67 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,8 +15,6 @@ jobs: - name: Set up PureScript toolchain uses: purescript-contrib/setup-purescript@main - with: - purescript: "0.14.0-rc5" - name: Cache PureScript dependencies uses: actions/cache@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ed1874..53f0af1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,17 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] -Breaking changes (😱!!!): +Breaking changes: + +New features: + +Bugfixes: + +Other improvements: + +## [v7.0.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v7.0.0) - 2021-02-26 + +Breaking changes: - Added support for PureScript 0.14 and dropped support for all previous versions (#20) New features: diff --git a/bower.json b/bower.json index 02c5bb9..c055e0b 100644 --- a/bower.json +++ b/bower.json @@ -13,11 +13,14 @@ ], "repository": { "type": "git", - "url": "https:://github.com/purescript-contrib/purescript-react-dom.git" + "url": "https://github.com/purescript-contrib/purescript-react-dom.git" }, "dependencies": { - "purescript-web-dom": "^2.0.0", - "purescript-react": ">= 6.0.0 < 8.0.0", - "purescript-effect": "^2.0.0" + "purescript-effect": "^3.0.0", + "purescript-react": "^9.0.0", + "purescript-web-dom": "^5.0.0" + }, + "devDependencies": { + "purescript-console": "^5.0.0" } } From 533c3af2a80797e2d609f46dd058b37bfacc5ea5 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Sat, 27 Feb 2021 17:08:08 -0800 Subject: [PATCH 16/22] Update packages.dhall for PureScript 0.14 --- packages.dhall | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages.dhall b/packages.dhall index 9c3ee6f..2a4e0b9 100644 --- a/packages.dhall +++ b/packages.dhall @@ -1,4 +1,4 @@ let upstream = - https://raw.githubusercontent.com/purescript/package-sets/prepare-0.14/src/packages.dhall + https://github.com/purescript/package-sets/releases/download/psc-0.14.0/packages.dhall sha256:710b53c085a18aa1263474659daa0ae15b7a4f453158c4f60ab448a6b3ed494e in upstream From e7e997c55bdb8e847c6a5d91929029bb07560c5d Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Sun, 25 Jul 2021 12:35:46 -0400 Subject: [PATCH 17/22] Replace Slack links with Discord (#24) --- .github/ISSUE_TEMPLATE/config.yml | 8 ++++---- README.md | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index c47a263..d63c9d7 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,7 +2,7 @@ blank_issues_enabled: false contact_links: - name: PureScript Discourse url: https://discourse.purescript.org/ - about: Ask and answer questions here. - - name: Functional Programming Slack - url: https://functionalprogramming.slack.com - about: For casual chat and questions (use https://fpchat-invite.herokuapp.com to join). + about: Ask and answer questions on the PureScript discussion forum. + - name: PureScript Discord + url: https://discord.com/invite/sMqwYUbvz6/ + about: Ask and answer questions on the PureScript chat. diff --git a/README.md b/README.md index 2afa5bd..328d93d 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ The quick start hasn't been written yet (contributions are welcome!). The quick If you get stuck, there are several ways to get help: - [Open an issue](https://github.com/purescript-contrib/purescript-react-dom/issues) if you have encountered a bug or problem. -- [Search or start a thread on the PureScript Discourse](https://discourse.purescript.org) if you have general questions. You can also ask questions in the `#purescript` and `#purescript-beginners` channels on the [Functional Programming Slack](https://functionalprogramming.slack.com) ([invite link](https://fpchat-invite.herokuapp.com/)). +- Ask general questions on the [PureScript Discourse](https://discourse.purescript.org) forum or the [PureScript Discord](https://discord.com/invite/sMqwYUbvz6) chat. ## Contributing From 13f2d030e08c0c867eade6550158c714e18fe49b Mon Sep 17 00:00:00 2001 From: JordanMartinez Date: Sun, 25 Jul 2021 09:53:24 -0700 Subject: [PATCH 18/22] Fix spago transitive deps issue (#25) --- packages.dhall | 2 +- spago.dhall | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages.dhall b/packages.dhall index 2a4e0b9..7a6905b 100644 --- a/packages.dhall +++ b/packages.dhall @@ -1,4 +1,4 @@ let upstream = - https://github.com/purescript/package-sets/releases/download/psc-0.14.0/packages.dhall sha256:710b53c085a18aa1263474659daa0ae15b7a4f453158c4f60ab448a6b3ed494e + https://github.com/purescript/package-sets/releases/download/psc-0.14.3-20210722/packages.dhall sha256:1ceb43aa59436bf5601bac45f6f3781c4e1f0e4c2b8458105b018e5ed8c30f8c in upstream diff --git a/spago.dhall b/spago.dhall index d46ced5..5f90df3 100644 --- a/spago.dhall +++ b/spago.dhall @@ -1,5 +1,15 @@ { name = "react-dom" -, dependencies = [ "console", "effect", "psci-support", "react", "web-dom" ] +, dependencies = + [ "console" + , "effect" + , "functions" + , "maybe" + , "nullable" + , "prelude" + , "psci-support" + , "react" + , "web-dom" + ] , packages = ./packages.dhall , sources = [ "src/**/*.purs", "test/**/*.purs" ] } From 1dffee718aa042e3aebe6aca8ab07fd349affeb7 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Wed, 4 Aug 2021 13:01:39 -0400 Subject: [PATCH 19/22] Replace Discord links with PS chat --- .github/ISSUE_TEMPLATE/config.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index d63c9d7..8d7661e 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -4,5 +4,5 @@ contact_links: url: https://discourse.purescript.org/ about: Ask and answer questions on the PureScript discussion forum. - name: PureScript Discord - url: https://discord.com/invite/sMqwYUbvz6/ + url: https://purescript.org/chat about: Ask and answer questions on the PureScript chat. diff --git a/README.md b/README.md index 328d93d..963287c 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ The quick start hasn't been written yet (contributions are welcome!). The quick If you get stuck, there are several ways to get help: - [Open an issue](https://github.com/purescript-contrib/purescript-react-dom/issues) if you have encountered a bug or problem. -- Ask general questions on the [PureScript Discourse](https://discourse.purescript.org) forum or the [PureScript Discord](https://discord.com/invite/sMqwYUbvz6) chat. +- Ask general questions on the [PureScript Discourse](https://discourse.purescript.org) forum or the [PureScript Discord](https://purescript.org/chat) chat. ## Contributing From 0f1659a45d5c09a5aa2e7d9f4f75dc8f8c6dd5ca Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Wed, 17 Nov 2021 10:47:04 -0500 Subject: [PATCH 20/22] Add purs-tidy formatter (#26) --- .github/workflows/ci.yml | 9 +++++++-- .gitignore | 1 + .tidyrc.json | 10 ++++++++++ CHANGELOG.md | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 .tidyrc.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b3ca67..43f9f20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,8 @@ jobs: - name: Set up PureScript toolchain uses: purescript-contrib/setup-purescript@main + with: + purs-tidy: "latest" - name: Cache PureScript dependencies uses: actions/cache@v2 @@ -25,9 +27,9 @@ jobs: output - name: Set up Node toolchain - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: - node-version: "12.x" + node-version: "14.x" - name: Cache NPM dependencies uses: actions/cache@v2 @@ -49,3 +51,6 @@ jobs: - name: Run tests run: npm run test + + - name: Check formatting + run: purs-tidy check src test diff --git a/.gitignore b/.gitignore index 5a54e2f..6a45203 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ !.gitignore !.github !.editorconfig +!.tidyrc.json !.eslintrc.json output diff --git a/.tidyrc.json b/.tidyrc.json new file mode 100644 index 0000000..4f013c1 --- /dev/null +++ b/.tidyrc.json @@ -0,0 +1,10 @@ +{ + "importSort": "source", + "importWrap": "source", + "indent": 2, + "operatorsFile": null, + "ribbon": 1, + "typeArrowPlacement": "first", + "unicode": "never", + "width": null +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 53f0af1..d3b2ff0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ New features: Bugfixes: Other improvements: +- Added `purs-tidy` formatter (#26 by @thomashoneyman) ## [v7.0.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v7.0.0) - 2021-02-26 From b9c3442b7f0164ebe508d2539fb73d21352e1abc Mon Sep 17 00:00:00 2001 From: JordanMartinez Date: Tue, 22 Mar 2022 16:02:10 -0500 Subject: [PATCH 21/22] Update to PureScript v0.15.0 (#28) * Update .eslintrc.json to ES6 * Migrated FFI to ES modules via 'lebab' * Replaced 'export var' with 'export const' * Removed '"use strict";' in FFI files * Update to CI to use 'unstable' purescript * Add CI test: verify 'bower.json' file works via pulp * Ignore spago-based tests (temporarily) * Update Bower dependencies to master or main * Update packages.dhall to 'prepare-0.15' package set * Removed unneeded 'psci-support' package * Update psa to 0.8.2 * Added changelog entry --- .eslintrc.json | 4 ++-- .github/workflows/ci.yml | 14 ++++++++++++-- CHANGELOG.md | 1 + bower.json | 8 ++++---- package.json | 2 +- packages.dhall | 2 +- spago.dhall | 1 - src/ReactDOM.js | 23 ++++++++++------------- 8 files changed, 31 insertions(+), 24 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 17f167d..240b092 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,7 +1,7 @@ { - "env": { "browser": true, "commonjs": true }, + "env": { "browser": true }, "extends": "eslint:recommended", - "parserOptions": { "ecmaVersion": 5 }, + "parserOptions": { "ecmaVersion": 6, "sourceType": "module" }, "rules": { "block-scoped-var": "error", "consistent-return": "error", diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43f9f20..e16f413 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ jobs: - name: Set up PureScript toolchain uses: purescript-contrib/setup-purescript@main with: + purescript: "unstable" purs-tidy: "latest" - name: Cache PureScript dependencies @@ -49,8 +50,17 @@ jobs: - name: Build the project run: npm run build - - name: Run tests - run: npm run test +# - name: Run tests +# run: npm run test - name: Check formatting run: purs-tidy check src test + + - name: Verify Bower & Pulp + run: | + npm install bower pulp@16.0.0-0 + npx bower install + npx pulp build -- --censor-lib --strict + if [ -d "test" ]; then + npx pulp test + fi diff --git a/CHANGELOG.md b/CHANGELOG.md index d3b2ff0..362269d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] Breaking changes: +- Migrate FFI to ES modules (#28 by @JordanMartinez) New features: diff --git a/bower.json b/bower.json index c055e0b..d8b9c9b 100644 --- a/bower.json +++ b/bower.json @@ -16,11 +16,11 @@ "url": "https://github.com/purescript-contrib/purescript-react-dom.git" }, "dependencies": { - "purescript-effect": "^3.0.0", - "purescript-react": "^9.0.0", - "purescript-web-dom": "^5.0.0" + "purescript-effect": "master", + "purescript-react": "main", + "purescript-web-dom": "master" }, "devDependencies": { - "purescript-console": "^5.0.0" + "purescript-console": "master" } } diff --git a/package.json b/package.json index d913a47..2382bdb 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ }, "devDependencies": { "eslint": "^7.6.0", - "purescript-psa": "^0.8.0" + "purescript-psa": "^0.8.2" }, "peerDependencies": { "react-dom": "^16.0.0" diff --git a/packages.dhall b/packages.dhall index 7a6905b..582d6d3 100644 --- a/packages.dhall +++ b/packages.dhall @@ -1,4 +1,4 @@ let upstream = - https://github.com/purescript/package-sets/releases/download/psc-0.14.3-20210722/packages.dhall sha256:1ceb43aa59436bf5601bac45f6f3781c4e1f0e4c2b8458105b018e5ed8c30f8c + https://raw.githubusercontent.com/purescript/package-sets/prepare-0.15/src/packages.dhall in upstream diff --git a/spago.dhall b/spago.dhall index 5f90df3..1294aae 100644 --- a/spago.dhall +++ b/spago.dhall @@ -6,7 +6,6 @@ , "maybe" , "nullable" , "prelude" - , "psci-support" , "react" , "web-dom" ] diff --git a/src/ReactDOM.js b/src/ReactDOM.js index 1bd7f0a..87b77bc 100644 --- a/src/ReactDOM.js +++ b/src/ReactDOM.js @@ -1,18 +1,15 @@ -"use strict"; +import ReactDOM from "react-dom"; +import ReactDOMServer from "react-dom/server"; -var ReactDOM = require("react-dom"); -var ReactDOMServer = require("react-dom/server"); - -exports.renderImpl = function (element, container) { +export function renderImpl(element, container) { return ReactDOM.render(element, container); -}; +} -exports.hydrateImpl = function (element, container) { +export function hydrateImpl(element, container) { return ReactDOM.hydrate(element, container); -}; - -exports.unmountComponentAtNodeImpl = ReactDOM.unmountComponentAtNode; -exports.findDOMNodeImpl = ReactDOM.findDOMNode; +} -exports.renderToStringImpl = ReactDOMServer.renderToString; -exports.renderToStaticMarkupImpl = ReactDOMServer.renderToStaticMarkup; +export const unmountComponentAtNodeImpl = ReactDOM.unmountComponentAtNode; +export const findDOMNodeImpl = ReactDOM.findDOMNode; +export const renderToStringImpl = ReactDOMServer.renderToString; +export const renderToStaticMarkupImpl = ReactDOMServer.renderToStaticMarkup; From 733e4ec521d0b9569290b69811aacb16a2c4dc16 Mon Sep 17 00:00:00 2001 From: JordanMartinez Date: Wed, 27 Apr 2022 18:21:20 -0500 Subject: [PATCH 22/22] Prepare v8.0.0 release (1st PS 0.15.0-compatible release) (#30) * Update the bower dependencies * Uncomment spago tests * Update the changelog --- .github/workflows/ci.yml | 4 ++-- CHANGELOG.md | 10 ++++++++++ bower.json | 8 ++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e16f413..fc54710 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,8 +50,8 @@ jobs: - name: Build the project run: npm run build -# - name: Run tests -# run: npm run test + - name: Run tests + run: npm run test - name: Check formatting run: purs-tidy check src test diff --git a/CHANGELOG.md b/CHANGELOG.md index 362269d..ab7ff21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] +Breaking changes: + +New features: + +Bugfixes: + +Other improvements: + +## [v8.0.0](https://github.com/purescript-contrib/purescript-react-dom/releases/tag/v8.0.0) - 2022-04-27 + Breaking changes: - Migrate FFI to ES modules (#28 by @JordanMartinez) diff --git a/bower.json b/bower.json index d8b9c9b..d3dc30c 100644 --- a/bower.json +++ b/bower.json @@ -16,11 +16,11 @@ "url": "https://github.com/purescript-contrib/purescript-react-dom.git" }, "dependencies": { - "purescript-effect": "master", - "purescript-react": "main", - "purescript-web-dom": "master" + "purescript-effect": "^4.0.0", + "purescript-react": "^10.0.1", + "purescript-web-dom": "^6.0.0" }, "devDependencies": { - "purescript-console": "master" + "purescript-console": "^6.0.0" } }