From a224402646de8c40b18b008a06e2a1f3c64fc717 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Thu, 8 Oct 2020 17:49:00 -0700 Subject: [PATCH 1/5] Migrate to Spago --- packages.dhall | 4 ++++ psc-package.json | 9 --------- spago.dhall | 5 +++++ test/Main.purs | 11 +++++++++++ 4 files changed, 20 insertions(+), 9 deletions(-) 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/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/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 941c4672af04a86af7bfe8b7057614e3e1081b8e Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Thu, 8 Oct 2020 17:55:23 -0700 Subject: [PATCH 2/5] Update for Contributors library guidelines --- .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 +++++---- CHANGELOG.md | 64 ++++++++++++++++++++++++ CONTRIBUTING.md | 5 ++ README.md | 48 +++++++++++++++--- bower.json | 2 +- docs/README.md | 3 ++ package.json | 10 ++-- src/ReactDOM.js | 1 - 15 files changed, 284 insertions(+), 25 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 create mode 100644 CHANGELOG.md create mode 100644 CONTRIBUTING.md create mode 100644 docs/README.md 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/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..501a89a --- /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..cf0a55b --- /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..4e45024 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..42b9a72 --- /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/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"); From 6c98914c106fed837db89cd4c23762e3a0041376 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Thu, 8 Oct 2020 17:56:25 -0700 Subject: [PATCH 3/5] Changelog formatting --- CHANGELOG.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 501a89a..37e3f37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ Other improvements: ## [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 @@ -44,21 +45,20 @@ Other improvements: ## [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) +- 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 +- 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) +- 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) +- 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` - +- Initial release compatible with `purescript-react#v0.6.0` From 0cff9fade48896efd53932877f84ea410f2154f8 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Thu, 8 Oct 2020 18:00:55 -0700 Subject: [PATCH 4/5] Remove travis file --- .travis.yml | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .travis.yml 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 From ef92a50b2bf860604afef5e0e0f48ac7cf67106c Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Thu, 8 Oct 2020 18:01:39 -0700 Subject: [PATCH 5/5] Dom -> DOM --- CONTRIBUTING.md | 2 +- README.md | 2 +- docs/README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cf0a55b..ee46c33 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -# Contributing to React Dom +# 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. diff --git a/README.md b/README.md index 4e45024..3daef35 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# React Dom +# React DOM [![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) diff --git a/docs/README.md b/docs/README.md index 42b9a72..6a446cf 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,3 +1,3 @@ -# React Dom Documentation +# 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.