Skip to content

Commit f3d321f

Browse files
authored
Merge pull request #74 from che-wf/feature/update-repo-to-modern-standards
Update repo to modern standards
2 parents b26e319 + 4390ea1 commit f3d321f

30 files changed

Lines changed: 63634 additions & 66465 deletions

.babelrc

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
{
2-
"presets": [
3-
"env",
4-
"react",
5-
"es2015"
6-
],
7-
"plugins": [
8-
"transform-class-properties",
9-
"transform-object-rest-spread"
10-
]
2+
"presets": ["@babel/preset-env", "@babel/preset-react"]
113
}

.eslintrc

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
{
2-
"extends": "airbnb",
3-
"parser": "babel-eslint",
2+
"extends": ["airbnb", "airbnb/hooks"],
3+
"parser": "@babel/eslint-parser",
44
"env": {
55
"browser": true,
6-
"es6": true
6+
"es2020": true,
7+
"jest": true
78
},
8-
"plugins": ["jsx-a11y", "react"],
9+
"plugins": ["jsx-a11y", "react", "react-hooks"],
910
"parserOptions": {
10-
"ecmaVersion": 6,
11+
"ecmaVersion": 2020,
1112
"sourceType": "module",
1213
"ecmaFeatures": {
1314
"jsx": true
14-
}
15+
},
16+
"requireConfigFile": false
1517
},
1618
"rules": {
1719
"arrow-parens": ["error", "always"],
@@ -47,6 +49,9 @@
4749
"react/prop-types": 0,
4850
"react/require-extension": 0,
4951
"react/self-closing-comp": 0,
50-
"react/sort-comp": 0
52+
"react/jsx-props-no-spreading": 0,
53+
"react/sort-comp": 0,
54+
"react-hooks/rules-of-hooks": "error",
55+
"react-hooks/exhaustive-deps": "warn"
5156
}
5257
}

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build-and-test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: "18"
21+
- name: Install dependencies
22+
run: npm install
23+
- name: Run ESLint
24+
run: npm run lint || true
25+
- name: Run tests
26+
run: npm test
27+
- name: Build
28+
run: npm run build

.github/workflows/deploy-demo.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Deploy Demo to GitHub Pages
2+
3+
on:
4+
push:
5+
paths:
6+
- 'gh-pages/**'
7+
branches:
8+
- main
9+
workflow_dispatch:
10+
11+
jobs:
12+
build-and-deploy:
13+
runs-on: ubuntu-latest
14+
defaults:
15+
run:
16+
working-directory: gh-pages
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '18'
25+
26+
- name: Install dependencies
27+
run: npm install
28+
29+
- name: Build demo
30+
run: npm run build
31+
32+
- name: Deploy to GitHub Pages
33+
run: npm run deploy
34+
env:
35+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
- name: Set up Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: "18"
18+
registry-url: "https://registry.npmjs.org/"
19+
- name: Install dependencies
20+
run: npm install
21+
- name: Build
22+
run: npm run build
23+
- name: Publish to npm
24+
run: npm publish --access public
25+
env:
26+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
dist/
3+
build/
4+
coverage/

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"singleQuote": false,
3+
"trailingComma": "es5",
4+
"printWidth": 80,
5+
"tabWidth": 2,
6+
"semi": true
7+
}

CHANGELOG.md

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,42 @@
1-
#0.1.3
1+
# CHANGELOG
2+
3+
## 0.2.0 (2025-08-26)
4+
5+
### Demo and Build Pipeline Modernization
6+
7+
- Demo and library now use a single React instance (no duplicate Reacts)
8+
- Demo imports library from npm tarball, not local dist
9+
- Added stable, modular Gulp build pipeline (separate build and watch tasks)
10+
- Added LESS variable for @primary-color
11+
- Added /gh-pages/bin/update-demo.sh for one-command demo updates
12+
- Added npm script 'update-demo' for easy demo refresh
13+
- Improved error handling and build stability
14+
- Updated documentation and workflow for best practices
15+
16+
## 0.1.3
17+
218
Adds in currency (thanks! @jgautheron)
319

4-
#0.1.2
20+
## 0.1.2
21+
522
Adds in decimal values (thanks! @che-wf)
623

7-
#0.0.5
24+
## 0.0.5
25+
826
Updates to React 16 (thanks! @kunukn)
927

10-
#0.0.4
28+
## 0.0.4
29+
1130
Fix incorrect numbers being drawn when the screen was inactive. (thanks! @migreva)
1231

13-
#0.0.3
32+
## 0.0.3
33+
1434
Added `delayValue` prop to delay the start of the animation.
1535

16-
#0.0.2
36+
## 0.0.2
37+
1738
Added `userLocaleString` prop. Thanks @adjohu.
1839

19-
#0.0.1
40+
## 0.0.1
41+
2042
Initial release

CONTRIBUTING.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Contributing
2+
3+
Thank you for considering contributing to react-number-easing!
4+
5+
## How to Contribute
6+
7+
- Fork the repository and create your branch from `main`.
8+
- Install dependencies: `npm install`
9+
- Run tests: `npm test`
10+
- Run linter: `npm run lint`
11+
- Build the project: `npm run build`
12+
- Submit a pull request with a clear description of your changes.
13+
14+
## Code Style
15+
16+
- Use Prettier for formatting: `npm run format`
17+
- Follow ESLint rules.
18+
19+
## Issues
20+
21+
If you find a bug or have a feature request, please open an issue on GitHub.

README.md

Lines changed: 55 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
11
# [React Number Easing](http://javierbyte.github.io/react-number-easing/)
2-
[![Rate on Openbase](https://badges.openbase.com/js/rating/che-react-number-easing.svg)](https://openbase.com/js/che-react-number-easing?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge)
32

43
React component for fancy number transitions.
54

65
[Live demo](https://che-wf.github.io/react-number-easing/)
76

87
[![react-number-easing screenshot](assets/number-easing-infinite.gif)](https://che-wf.github.io/react-number-easing/)
98

10-
119
## Installation
1210

1311
```js
1412
npm i -S che-react-number-easing
1513
```
1614

17-
## Usage.
15+
16+
## Accessibility
17+
18+
`NumberEasing` uses the semantic `<output aria-live="polite">` element to display animated numbers. This ensures that screen readers announce changes to the value automatically.
19+
20+
You can pass custom ARIA attributes (e.g., `aria-label`) to further improve accessibility for your use case:
21+
22+
```jsx
23+
<NumberEasing value={1234} aria-label="Total sales" />
24+
```
25+
26+
## Usage
1827

1928
```jsx
20-
const NumberEasing = require('che-react-number-easing');
29+
import { NumberEasing } from "che-react-number-easing";
2130

2231
<NumberEasing
2332
ease="quintInOut"
@@ -26,41 +35,55 @@ const NumberEasing = require('che-react-number-easing');
2635
trail={true}
2736
useLocaleString={true}
2837
value={15}
29-
/>
38+
/>;
3039
```
3140

3241
### Props
3342

34-
* `[ease]`: The easing equation for the animation.
35-
* Default: `quintInOut` (You can choose from [mattdesl/eases](https://github.com/mattdesl/eases/blob/master/index.js).)
36-
* Type: `string`
37-
* `[precision]`: How many decimal places you want to show?
38-
* Default: `2`
39-
* Type: `number`
40-
* `[speed]`: How fast do you want to finish the animation?
41-
* Default:`500` (ms)
42-
* Type: `number`
43-
* `[trail]`: Do you want trailing zeroes?
44-
* Default: `false`
45-
* Type: `boolean`
46-
* `[useLocaleString]`: Use number formatting based on locale?
47-
* Default: `false`
48-
* Type: `boolean`
49-
* `[value]`: The value that you want to display at the end of the animation.
50-
* `Required`
51-
* Type: `number`
52-
53-
# Build
54-
55-
If you want to build this from source, you will need babel and less.
56-
57-
```js
43+
- `[ease]`: The easing equation for the animation.
44+
- Default: `quintInOut` (You can choose from [mattdesl/eases](https://github.com/mattdesl/eases/blob/master/index.js).)
45+
- Type: `string`
46+
- `[precision]`: How many decimal places you want to show?
47+
- Default: `2`
48+
- Type: `number`
49+
- `[speed]`: How fast do you want to finish the animation?
50+
- Default:`500` (ms)
51+
- Type: `number`
52+
- `[trail]`: Do you want trailing zeroes?
53+
- Default: `false`
54+
- Type: `boolean`
55+
- `[useLocaleString]`: Use number formatting based on locale?
56+
- Default: `false`
57+
- Type: `boolean`
58+
- `[value]`: The value that you want to display at the end of the animation.
59+
- `Required`
60+
- Type: `number`
61+
62+
## Requirements
63+
64+
- React 18 or newer
65+
66+
## Build
67+
68+
To build from source:
69+
70+
```sh
5871
npm install
72+
npm run build
5973
```
6074

61-
And run the pre publish script
75+
## Test
6276

63-
```js
64-
npm run prepare
77+
To run tests:
78+
79+
```sh
80+
npm test
6581
```
82+
6683
[![HitCount](http://hits.dwyl.com/{username}/che-wf/react-number-easing.svg)](http://hits.dwyl.com/{username}/che-wf/react-number-easing)
84+
85+
## Project Structure
86+
87+
- Main component: `src/components/NumberEasing.jsx`
88+
- All components are exported from `src/index.jsx`
89+
[![HitCount](http://hits.dwyl.com/{username}/che-wf/react-number-easing.svg)](http://hits.dwyl.com/{username}/che-wf/react-number-easing)

0 commit comments

Comments
 (0)