Skip to content
Open
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
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI

on:
push:
branches:
- master
pull_request:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [20, 22]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci --no-audit --no-fund

- name: Run tests
run: npm test

- name: Verify generated artifacts are up to date
run: git diff --exit-code

all-checks-pass:
name: all-checks-pass
runs-on: ubuntu-latest
needs: test
if: ${{ always() }}
steps:
- name: Verify matrix result
run: |
if [ "${{ needs.test.result }}" != "success" ]; then
echo "Matrix result was ${{ needs.test.result }}"
exit 1
fi
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ module.exports = function(grunt) {

grunt.config('string-replace.numeral', {
files: {
'src/numeral.js': 'src/numeral.js'
'src/numeral.ts': 'src/numeral.ts'
},
options: {
replacements: [
Expand Down
23 changes: 23 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Migration Guide

## Upgrading to 3.0.0

Version `3.0.0` keeps the public runtime behavior from `2.0.x`, but modernizes the project internals and packaging.

### Breaking changes

1. Node.js requirement is now `>=20`.
2. The project source of truth is now TypeScript in `src/**/*.ts`.

### Notable updates

1. First-party TypeScript declarations are bundled via `numeral.d.ts`.
2. CI now runs on GitHub Actions against Node `20` and `22`.
3. Core build/test scripts now compile TypeScript before running Grunt tasks.

### New development commands

1. `npm run build:core` compiles TypeScript sources into JavaScript files.
2. `npm run build` compiles TypeScript and runs the Grunt build pipeline.
3. `npm run dist` compiles TypeScript and builds minified distribution files.
4. `npm test` compiles TypeScript and runs the Node test suite.
37 changes: 25 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ A javascript library for formatting and manipulating numbers.
[Website and documentation](http://numeraljs.com/)


# Travis Build Status
# CI

Master [![Build Status](https://api.travis-ci.org/adamwdraper/Numeral-js.svg)](https://travis-ci.org/adamwdraper/Numeral-js)
[![CI](https://github.com/adamwdraper/Numeral-js/actions/workflows/ci.yml/badge.svg)](https://github.com/adamwdraper/Numeral-js/actions/workflows/ci.yml)

Develop [![Build Status](https://travis-ci.org/adamwdraper/Numeral-js.svg?branch=develop)](https://travis-ci.org/adamwdraper/Numeral-js)
# v3 Notes

1. `3.0.0` is a TypeScript rewrite with behavior preserved from `2.0.x`.
2. Node.js support is now `>=20`.
3. First-party types are bundled in `numeral.d.ts`.
4. See `MIGRATION.md` for upgrade details.

# NPM

Expand All @@ -21,23 +26,21 @@ Develop [![Build Status](https://travis-ci.org/adamwdraper/Numeral-js.svg?branch

# Contributing

#### Important: Please create your branch from and submit pull requests to the `develop` branch. All pull requests must include the appropriate tests.
#### Important: Please create your branch from and submit pull requests to the `master` branch. All pull requests must include tests.

1. Fork the library

2. [Install grunt](http://gruntjs.com/getting-started#installing-the-cli)

3. Run `npm install` to install dependencies
2. Run `npm install` to install dependencies

4. Create a new branch from `develop`
3. Create a new branch from `master`

5. Add your tests to the files in `/tests`
4. Add your tests to the files in `/tests`

6. To test your tests, run `grunt`
5. Run `npm test`

7. When all your tests are passing, run `grunt dist` to compile and minify all files
6. When tests are passing, run `npm run dist` to compile and minify all files

8. Submit a pull request to the `develop` branch.
7. Submit a pull request to the `master` branch.


### Formats
Expand All @@ -56,6 +59,16 @@ See [the english unit tests](https://github.com/adamwdraper/Numeral-js/blob/mast

# Changelog

### 3.0.0

Breaking change: Node.js engines set to `>=20`

Breaking change: Source of truth moved to TypeScript (`src/**/*.ts`)

Added: Bundled TypeScript types (`numeral.d.ts`)

Added: GitHub Actions CI for Node 20/22

### 2.0.6

Bug fix: Multi letter currency symbols and spacing
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "numeral",
"repo": "adamwdraper/Numeral-js",
"version": "2.0.6",
"version": "3.0.0",
"description": "Format and manipulate numbers.",
"keywords": [
"numeral",
Expand Down
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "numeral",
"repo": "adamwdraper/Numeral-js",
"version": "2.0.6",
"version": "3.0.0",
"description": "Format and manipulate numbers.",
"keywords": [
"numeral",
Expand Down
Loading