Skip to content

Update according to Contributors library guidelines #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -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"]
}
}
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -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.
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/change-request.md
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -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).
11 changes: 11 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -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)
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
19 changes: 12 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
/bower_components/
/node_modules/
/.pulp-cache/
/output/
/.psci*
/src/.webpack.js
.psc-ide-port
.*
!.gitignore
!.github
!.editorconfig
!.eslintrc.json

output
generated-docs
bower_components

node_modules
package-lock.json
*.lock
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

97 changes: 97 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# 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.1](https://github.com/purescript-contrib/purescript-formatters/releases/tag/v4.0.1) - 2019-02-09

- Fixed issue where negative numbers with padding would be printed like `00-0.5` rather than `-000.5`
- Fixed issue where negative years would print similarly and would not parse

## [v4.0.0](https://github.com/purescript-contrib/purescript-formatters/releases/tag/v4.0.0) - 2018-06-26

- Update to [email protected] @thomashoneyman

## [v3.0.1](https://github.com/purescript-contrib/purescript-formatters/releases/tag/v3.0.1) - 2017-12-07

Bug fixes:
- Enable timestamp parsing @tippenein

Other changes:
- Update README and tests @tippenein
- Remove self import @paulyoung

## [v3.0.0](https://github.com/purescript-contrib/purescript-formatters/releases/tag/v3.0.0) - 2017-09-11

- Added formats for week day (@tippenein)

## [v2.1.0](https://github.com/purescript-contrib/purescript-formatters/releases/tag/v2.1.0) - 2017-08-08

- Added `Ord` instance for `FormatterCommand`

## [v2.0.2](https://github.com/purescript-contrib/purescript-formatters/releases/tag/v2.0.2) - 2017-07-19

- fix for 24 and `{12,0}{am,pm}` cases #26

## [v2.0.1](https://github.com/purescript-contrib/purescript-formatters/releases/tag/v2.0.1) - 2017-07-11

- fix YYYY formatting #23

## [v2.0.0](https://github.com/purescript-contrib/purescript-formatters/releases/tag/v2.0.0) - 2017-06-27

- Added support for Intervals
- Type of `DateTime.Formatter` has changed (BREAKING)
- Type of `Number.Formatter` has changed (BREAKING)

## [v1.0.1](https://github.com/purescript-contrib/purescript-formatters/releases/tag/v1.0.1) - 2017-05-13

- Fixed `Hours24` to pad to two digits when printing

## [v1.0.0](https://github.com/purescript-contrib/purescript-formatters/releases/tag/v1.0.0) - 2017-04-21

- Updated for PureScript 0.11

## [v0.4.0](https://github.com/purescript-contrib/purescript-formatters/releases/tag/v0.4.0) - 2017-04-15

- Added `MinutesTwoDigits`, `SecondsTwoDigits`, `MillisecondsShort`, and `MillisecondsTwoDigits` (@sectore)

## [v0.3.1](https://github.com/purescript-contrib/purescript-formatters/releases/tag/v0.3.1) - 2017-03-23

- Fixed `DayOfMonthTwoDigits` to zero-pad as necessary when printing (@korayal)

## [v0.3.0](https://github.com/purescript-contrib/purescript-formatters/releases/tag/v0.3.0) - 2017-03-22

- Added support for single-digit day-of-month parsing (@negator)

## [v0.2.0](https://github.com/purescript-contrib/purescript-formatters/releases/tag/v0.2.0) - 2017-03-07

- Updated dependencies

## [v0.1.3](https://github.com/purescript-contrib/purescript-formatters/releases/tag/v0.1.3) - 2017-03-01

- Fix `bower.json` for Pursuit publishing

## [v0.1.1](https://github.com/purescript-contrib/purescript-formatters/releases/tag/v0.1.1) - 2017-02-24

- Fixed behaviour of two-digit year formatting (@dgendill)

## [v0.1.0](https://github.com/purescript-contrib/purescript-formatters/releases/tag/v0.1.0) - 2016-11-03

- 0.10 updates

## [0.0.5](https://github.com/purescript-contrib/purescript-formatters/releases/tag/0.0.5) - 2016-09-18

- Fixed AM/PM behavior @doolse

## [0.0.1](https://github.com/purescript-contrib/purescript-formatters/releases/tag/0.0.1) - 2016-07-21

- Initial release
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Contributing to Formatters

Thanks for your interest in contributing to `formatters`! 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.
45 changes: 35 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
# purescript-formatters
# Formatters

[![Latest release](http://img.shields.io/github/release/slamdata/purescript-formatters.svg)](https://github.com/slamdata/purescript-formatters/releases)
[![Build status](https://travis-ci.org/slamdata/purescript-formatters.svg?branch=master)](https://travis-ci.org/slamdata/purescript-formatters)
[![CI](https://github.com/purescript-contrib/purescript-formatters/workflows/CI/badge.svg?branch=main)](https://github.com/purescript-contrib/purescript-formatters/actions?query=workflow%3ACI+branch%3Amain)
[![Release](https://img.shields.io/github/release/purescript-contrib/purescript-formatters.svg)](https://github.com/purescript-contrib/purescript-formatters/releases)
[![Pursuit](https://pursuit.purescript.org/packages/purescript-formatters/badge)](https://pursuit.purescript.org/packages/purescript-formatters)
[![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)

A PureScript alternative to numeral.js, moment.js, etc.

## Installation

Install `formatters` with [Spago](https://github.com/purescript/spago):

```sh
spago install formatters
```
bower install purescript-formatters
```

## Number formatters
## Quick start

**Number formatters**

Formatter has following properties
+ Number of digits before dot
Expand All @@ -20,8 +27,7 @@ Formatter has following properties
+ Should thousands be separated by comma
+ Should output string have abbreviations (like `K` or `M`)

Number will be padded with zeros to have at least this number of leading zeros.
This doesn't restrict number to have more digits then leading zeros in format string.
Number will be padded with zeros to have at least this number of leading zeros. This doesn't restrict number to have more digits then leading zeros in format string.
+ `0000.0` will show 4 digits: `12 → "0012.0"`, `1234 → "1234.0"`
+ `00.0` will show only 2 digits : `12 → "12.0"`, `1234 → "1234.0"`

Expand All @@ -40,7 +46,7 @@ For abbreviation one could use `a` flag. In general it tries to find the closest
then use formatter to result of division of input number and that power.
+ `0a`: `1234567 → "1M"`, `1 → "1"`

## Date/Time formatters
**Date/Time formatters**

This is a subset of common format/parse strings currently supported.

Expand Down Expand Up @@ -69,4 +75,23 @@ Full list is defined [here](https://github.com/slamdata/purescript-formatters/bl

## Documentation

Module documentation is published on Pursuit: [http://pursuit.purescript.org/packages/purescript-formatters](http://pursuit.purescript.org/packages/purescript-formatters)
`formatters` documentation is stored in a few places:

1. Module documentation is [published on Pursuit](https://pursuit.purescript.org/packages/purescript-formatters).
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-formatters/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 `formatters` in several ways:

1. If you encounter a problem or have a question, please [open an issue](https://github.com/purescript-contrib/purescript-formatters/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.
3 changes: 3 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Formatters Documentation

This directory contains documentation for `formatters`. 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.
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{
"private": true,
"scripts": {
"clean": "rimraf output && rimraf .pulp-cache",
"build": "pulp build -- --censor-lib --strict",
"test": "pulp test"
"build": "eslint src && spago build --purs-args '--censor-lib --strict'",
"test": "spago test --no-install"
},
"devDependencies": {
"pulp": "^12.3.0",
"purescript": "^0.12.0",
"purescript-psa": "^0.6.0",
"rimraf": "^2.6.2"
"eslint": "^7.6.0"
}
}
Loading