From 12e2044dbfb9443404a765a8b241e422376f3553 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Thu, 1 Oct 2020 23:17:45 -0400 Subject: [PATCH 1/4] Migrate to Contributors tooling --- .editorconfig | 13 ++++++ .eslintrc.json | 53 +++++++++++------------- .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/contributing.md | 51 ----------------------- .github/pull_request_template.md | 15 ------- .github/workflows/ci.yml | 51 +++++++++++++++++++++++ .gitignore | 20 ++++----- CHANGELOG.md | 30 ++++++++++++++ CONTRIBUTING.md | 5 +++ README.md | 43 ++++++++++++++----- docs/README.md | 3 ++ package.json | 10 ++--- packages.dhall | 8 ++++ spago.dhall | 5 +++ test/Main.purs | 11 +++++ 18 files changed, 251 insertions(+), 126 deletions(-) create mode 100644 .editorconfig 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 delete mode 100644 .github/contributing.md delete 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 create mode 100644 packages.dhall 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 index 910f3a7..17f167d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,34 +1,29 @@ { - "parserOptions": { - "ecmaVersion": 5 - }, + "env": { "browser": true, "commonjs": true }, "extends": "eslint:recommended", - "env": { - "commonjs": true - }, + "parserOptions": { "ecmaVersion": 5 }, "rules": { - "strict": [2, "global"], - "block-scoped-var": 2, - "consistent-return": 2, - "eqeqeq": [2, "smart"], - "guard-for-in": 2, - "no-caller": 2, - "no-extend-native": 2, - "no-loop-func": 2, - "no-new": 2, - "no-param-reassign": 2, - "no-return-assign": 2, - "no-unused-expressions": 2, - "no-use-before-define": 2, - "radix": [2, "always"], - "indent": [2, 2, { "SwitchCase": 1 }], - "quotes": [2, "double"], - "semi": [2, "always"] - }, - "globals": { - "setTimeout": true, - "clearTimeout": true, - "setInterval": true, - "clearInterval": true + "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/contributing.md b/.github/contributing.md deleted file mode 100644 index 462c330..0000000 --- a/.github/contributing.md +++ /dev/null @@ -1,51 +0,0 @@ -# Contribution - -Thank you for contributing to `purescript-now`! - -Following these guidelines helps ensure we're able to carefully consider your contribution and help you finalize your pull request. Your time (like ours) is valuable, and we try to at least provide constructive feedback on every contribution. - -### Contributions we love -`purescript-now` is an open-source library and we love to receive contributions. There are many ways you can contribute: - -* Help expand our test coverage -* Help fix open issues, even if that simply means adding a helpful comment -* Help push along open pull requests that need more work to be complete -* Improve or add new usage examples to better demonstrate how to use the library in real-world scenarios -* Update documentation and tutorials to be easier to understand, more comprehensive, and above all -- up to date! - -### Contributions we should discuss -Some contributions will take some discussion before we accept an update to the project. If your contribution includes one of the below examples (or seems to be reasonably similar), please consider reaching out to us before putting in a lot of work to build the feature. We're active on the [PureScript user forum](https://discourse.purescript.org) and the [functional programming Slack](https://functionalprogramming.slack.com/) community (new? [use this link to join](https://fpchat-invite.herokuapp.com/)!). For feature requests, feel free to open an issue with a tag. - -* New features and functions that will change the library's public API -* New tutorials (while we love seeing new tutorials, we won't always be able to feature them in the readme) - -# Ground Rules - -We have a small set of quality-of-life guidelines for contributing to `purescript-now`. These include: - -* All pull requests must pass continuous integration. -* If you are adding new functionality, you should provide tests and documentation for your code. If you're fixing an existing bug, please provide a failing test case your patch solves. -* If possible, please avoid requiring new dependencies. - -### Filing issues -If you have a general question about the project, it's best to ask on the [PureScript user forum](https://discourse.purescript.org) or the [functional programming Slack](https://functionalprogramming.slack.com/) than to open a new issue. If you have run into a bug in the project, then please do open an issue! When you do, we ask that you follow a few steps which are outlined in our issues template. The gist of it is here: - -* Verify the problem is indeed with `purescript-now` (not with Pulp, Bower, or PureScript); -* Record what versions you are using for PureScript and `purescript-now` -* Describe the issue with steps to reproduce (as much as you are able). A minimal reproducible example is the absolute best case scenario. - -We promise to address the issue as soon as we can. - -### Suggesting features or enhancements -We love to hear about ways we could make better. If you're wishing for a feature that doesn't exist in `purescript-now`, you're probably not alone; there are bound to be others with similar needs. Please feel free to open an issue on GitHub that describes: - -* the feature you would like to see -* why you need it -* how it should work - -We promise to review your issue, but we aren't always able to accommodate all requests. It helps if you're able to contribute to the implementation, too! - -### Code reviews -The core team looks at pull requests weekly, at which point we will review your code, ensure it meets our ground rules and fits with the philosophy of the project, and -- if necessary -- provide constructive feedback. As soon as at least one member of the team has signed off on your pull request, we will merge your contribution. - -If you opened a pull request and we need to ask a few questions, we expect responses within a month. After that we may close the pull request if it isn't showing any activity to keep things manageable. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 7c16360..0000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,15 +0,0 @@ -## What does this pull request do? - -Please describe the purpose of the pull request, including any background context and links to related issues. If this introduces a large change to the project, please describe what you have implemented. - -## Where should the reviewer start? - -Help save the reviewer time by highlighting the most important sections of code. - -## How should this be manually tested? - -If this is a new feature, you should provide new test coverage. If it fixes an existing bug, you should provide a failing test case this change fixes. Other than automated testing, what manual tests can the reviewer perform to verify your work? - -## Other Notes: - -Does the project documentation need to be updated? Should we introduce a new example, or update any existing examples? Does this PR require any other follow-up tasks? 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 52587f6..5a54e2f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,19 +1,13 @@ -/.* -!/.gitignore -!/.github -!/.travis.yml +.* +!.gitignore +!.github +!.editorconfig +!.eslintrc.json -# Dependencies -bower_components -node_modules - -# Generated files output generated-docs +bower_components -# Lockfiles +node_modules package-lock.json *.lock - -# Extra files -!/.eslintrc.json diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..395b03b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,30 @@ +# 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: + +## [v4.0.0](https://github.com/purescript-contrib/purescript-now/releases/tag/v4.0.0) - 2018-05-25 + +Updated for PureScript 0.12 + +## [v3.0.0](https://github.com/purescript-contrib/purescript-now/releases/tag/v3.0.0) - 2017-04-03 + +- Updated for PureScript 0.11 + +## [v2.0.0](https://github.com/purescript-contrib/purescript-now/releases/tag/v2.0.0) - 2016-10-17 + +- Updated dependencies + +## [v1.0.0](https://github.com/purescript-contrib/purescript-now/releases/tag/v1.0.0) - 2016-06-09 + +Initial release. + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..3cb838a --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,5 @@ +# Contributing to Now + +Thanks for your interest in contributing to `now`! 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 ddf1d3d..b973206 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,44 @@ -# purescript-now +# Now -[![Latest release](http://img.shields.io/github/release/purescript-contrib/purescript-now.svg)](https://github.com/purescript-contrib/purescript-now/releases) -[![Build status](https://travis-ci.org/purescript-contrib/purescript-now.svg?branch=master)](https://travis-ci.org/purescript-contrib/purescript-now) -[![Pursuit](http://pursuit.purescript.org/packages/purescript-now/badge)](http://pursuit.purescript.org/packages/purescript-now/) -[![Maintainer: garyb](https://img.shields.io/badge/maintainer-garyb-lightgrey.svg)](http://github.com/garyb) -[![Maintainer: thomashoneyman](https://img.shields.io/badge/maintainer-thomashoneyman-lightgrey.svg)](http://github.com/thomashoneyman) +[![CI](https://github.com/purescript-contrib/purescript-now/workflows/CI/badge.svg?branch=main)](https://github.com/purescript-contrib/purescript-now/actions?query=workflow%3ACI+branch%3Amain) +[![Release](https://img.shields.io/github/release/purescript-contrib/purescript-now.svg)](https://github.com/purescript-contrib/purescript-now/releases) +[![Pursuit](https://pursuit.purescript.org/packages/purescript-now/badge)](https://pursuit.purescript.org/packages/purescript-now) +[![Maintainer: garyb](https://img.shields.io/badge/maintainer-garyb-teal.svg)](https://github.com/garyb) +[![Maintainer: thomashoneyman](https://img.shields.io/badge/maintainer-thomashoneyman-teal.svg)](https://github.com/thomashoneyman) -Effect type and function for accessing the current machine's date and time. +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 `now` with [Spago](https://github.com/purescript/spago): + +```sh +spago install now ``` -bower install purescript-now -``` + +## 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 -Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-now). +`now` documentation is stored in a few places: + +1. Module documentation is [published on Pursuit](https://pursuit.purescript.org/packages/purescript-now). +2. Written documentation is kept in the [docs directory](./docs). +3. Usage examples can be found in [the test suite](./test). + +If you get stuck, there are several ways to get help: + +- [Open an issue](https://github.com/purescript-contrib/purescript-now/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 -Read the [contribution guidelines](https://github.com/purescript-contrib/purescript-now/blob/master/.github/contributing.md) to get started and see helpful related resources. +You can contribute to `now` in several ways: + +1. If you encounter a problem or have a question, please [open an issue](https://github.com/purescript-contrib/purescript-now/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. + +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/docs/README.md b/docs/README.md new file mode 100644 index 0000000..8b689f5 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,3 @@ +# Now Documentation + +This directory contains documentation for `now`. 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 5addac2..ad3ecca 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,10 @@ { "private": true, "scripts": { - "postinstall": "bower install", - "clean": "rimraf output && rimraf .pulp-cache", - "build": "eslint src && pulp build -- --censor-lib --strict" + "build": "eslint src && spago build --purs-args '--censor-lib --strict'", + "test": "spago test --no-install" }, "devDependencies": { - "eslint": "^6.8.0", - "pulp": "^14.0.0", - "purescript-psa": "^0.7.3", - "rimraf": "^3.0.2" + "eslint": "^7.6.0" } } diff --git a/packages.dhall b/packages.dhall new file mode 100644 index 0000000..3c4876c --- /dev/null +++ b/packages.dhall @@ -0,0 +1,8 @@ +let upstream = + https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20200922/packages.dhall sha256:5edc9af74593eab8834d7e324e5868a3d258bbab75c5531d2eb770d4324a2900 + +let overrides = {=} + +let additions = {=} + +in upstream // overrides // additions diff --git a/spago.dhall b/spago.dhall new file mode 100644 index 0000000..ccfd331 --- /dev/null +++ b/spago.dhall @@ -0,0 +1,5 @@ +{ name = "now" +, dependencies = [ "console", "datetime", "effect", "psci-support" ] +, 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 ecce3668db0e03bb26bc2e2e26a125a0a4b1f711 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Thu, 1 Oct 2020 23:18:14 -0400 Subject: [PATCH 2/4] Update library summary in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b973206..f25fcf1 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Maintainer: garyb](https://img.shields.io/badge/maintainer-garyb-teal.svg)](https://github.com/garyb) [![Maintainer: thomashoneyman](https://img.shields.io/badge/maintainer-thomashoneyman-teal.svg)](https://github.com/thomashoneyman) -The library summary hasn't been written yet (contributions are welcome!). The library summary describes the library's purpose in one to three sentences. +Effect type and function for accessing the current machine's date and time. ## Installation From e0409f6c037d8895222c1b8ef4b78c0b222ee32b Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Thu, 1 Oct 2020 23:24:56 -0400 Subject: [PATCH 3/4] Remove overrides and additions --- packages.dhall | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages.dhall b/packages.dhall index 3c4876c..b5baf39 100644 --- a/packages.dhall +++ b/packages.dhall @@ -1,8 +1,4 @@ let upstream = https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20200922/packages.dhall sha256:5edc9af74593eab8834d7e324e5868a3d258bbab75c5531d2eb770d4324a2900 -let overrides = {=} - -let additions = {=} - -in upstream // overrides // additions +in upstream From 31ab6962ecc9434f93931899002d2ca9d4234f27 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Thu, 1 Oct 2020 23:36:37 -0400 Subject: [PATCH 4/4] Remove Travis config --- .travis.yml | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6da455e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: node_js -dist: trusty -sudo: required -node_js: stable -env: - - PATH=$HOME/purescript:$PATH -install: - - TAG=$(basename $(curl --location --silent --output /dev/null -w %{url_effective} https://github.com/purescript/purescript/releases/latest)) - - curl --location --output $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz - - tar -xvf $HOME/purescript.tar.gz -C $HOME/ - - chmod a+x $HOME/purescript - - npm install -g bower - - npm install - - bower install --production -script: - - npm run -s build - - bower install - - npm run -s test -after_success: - - >- - test $TRAVIS_TAG && - echo $GITHUB_TOKEN | pulp login && - echo y | pulp publish --no-push