Skip to content

Commit 2f8c17d

Browse files
authored
Chart.js v3.0.0-alpha.2 compatibility (#18)
* Fix imports for ES6, target v3 * Bump version * Remove use of helpers for v2/v3 compatibility * Add esm build * Bump version * Remove gulp & bower * Add package-lock * Update for Chart.js-3.0.0-alpha.2 * Update readme * Update development section * Add eslint
1 parent 1e28356 commit 2f8c17d

File tree

9 files changed

+1135
-86
lines changed

9 files changed

+1135
-86
lines changed

.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
.DS_Store
21
.vscode/
3-
bower.json
4-
cc-test-reporter
5-
coverage/
62
dist/
73
node_modules/
8-
package-lock.json
9-
*.stackdump

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ node_js:
33
- lts/*
44

55
script:
6-
- gulp lint
7-
- gulp build
8-
- gulp bower
6+
- npm run lint
7+
- npm run build
98

109
# IMPORTANT: scripts require GITHUB_AUTH_TOKEN and GITHUB_AUTH_EMAIL environment variables
1110
# IMPORTANT: scripts has to be set executables in the Git repository (error 127)

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
This adapter allows the use of date-fns with Chart.js.
88

9-
Requires [Chart.js](https://github.com/chartjs/Chart.js/releases) **2.8.0** or later and [date-fns](https://date-fns.org/) **2.0.0-alpha.27** or later.
9+
Requires [Chart.js](https://github.com/chartjs/Chart.js/releases) **2.8.0** or later and [date-fns](https://date-fns.org/) **2.0.0** or later.
1010

1111
**Note:** once loaded, this adapter overrides the default date-adapter provided in Chart.js (as a side-effect).
1212

@@ -15,11 +15,11 @@ Requires [Chart.js](https://github.com/chartjs/Chart.js/releases) **2.8.0** or l
1515
### npm
1616

1717
```bash
18-
npm install date-fns@next chartjs-adapter-date-fns@next --save
18+
npm install date-fns chartjs-adapter-date-fns@next --save
1919
```
2020

2121
```javascript
22-
import Chart from 'chart.js';
22+
import { Chart } from 'chart.js';
2323
import 'chartjs-adapter-date-fns';
2424
```
2525

@@ -28,9 +28,8 @@ import 'chartjs-adapter-date-fns';
2828
By default, `https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns@next` returns the latest (minified) version, however it's [highly recommended](https://www.jsdelivr.com/features) to always specify a version in order to avoid breaking changes. This can be achieved by appending `@{version}` to the url:
2929

3030
```html
31-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/Chart.min.js"></script>
32-
<script src="https://cdnjs.cloudflare.com/ajax/libs/date-fns/2.0.0-alpha0/date_fns.min.js"></script>
33-
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns@next"></script>
31+
<script src="https://cdn.jsdelivr.net/npm/chart.js@next/dist/chart.min.js"></script>
32+
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns@next/dist/chartjs-adapter-date-fns.bundle.min.js"></script>
3433
```
3534

3635
Read more about jsDeliver versioning on their [website](http://www.jsdelivr.com/).
@@ -39,7 +38,7 @@ Read more about jsDeliver versioning on their [website](http://www.jsdelivr.com/
3938

4039
### Locale support via scale options
4140

42-
date-fns requires a date-fns locale object to be tagged on to each `format()` call, which requires the locale to be explicitly set via the `adapters.date` option: [Chart.js documentation on adapters.date](https://www.chartjs.org/docs/latest/axes/cartesian/time.html?h=adapter)
41+
date-fns requires a date-fns locale object to be tagged on to each `format()` call, which requires the locale to be explicitly set via the `adapters.date` option: [Chart.js documentation on adapters.date](https://www.chartjs.org/docs/next/axes/cartesian/time#date-adapters)
4342

4443
For example:
4544

@@ -58,7 +57,7 @@ import {de} from 'date-fns/locale';
5857
}
5958
```
6059

61-
Further, read the [Chart.js documentation](https://www.chartjs.org/docs/latest) for other possible date/time related options. For example, the time scale [`time.*` options](https://www.chartjs.org/docs/latest/axes/cartesian/time.html#configuration-options) can be overridden using the [date-fns tokens](https://date-fns.org/v2.0.0-alpha.27/docs/format).
60+
Further, read the [Chart.js documentation](https://www.chartjs.org/docs/next) for other possible date/time related options. For example, the time scale [`time.*` options](https://www.chartjs.org/docs/next/axes/cartesian/time#configuration-options) can be overridden using the [date-fns tokens](https://date-fns.org/docs/format).
6261

6362
## Development
6463

@@ -71,9 +70,8 @@ You first need to install node dependencies (requires [Node.js](https://nodejs.o
7170
The following commands will then be available from the repository root:
7271

7372
```bash
74-
> gulp build // build dist files
75-
> gulp build --watch // build and watch for changes
76-
> gulp lint // perform code linting
73+
> npm run build // build dist files
74+
> npm run lint // perform code linting
7775
```
7876

7977
## License

gulpfile.js

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)