Skip to content
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

Add CHART.JS v4 compatibility #169

Merged
merged 15 commits into from
Dec 10, 2022
2 changes: 1 addition & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
node: true

parserOptions:
ecmaVersion: 2018
ecmaVersion: 2022
sourceType: module
ecmaFeatures:
impliedStrict: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/compressed-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: preactjs/compressed-size-action@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
16 changes: 6 additions & 10 deletions .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: 16
- uses: actions/checkout@v3
uses: actions/setup-node@v3
with:
cache: npm
- name: Test
run: |
npm ci
Expand All @@ -32,11 +31,8 @@ jobs:
needs: [test, setup]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Setup and build
run: |
npm ci
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,8 @@ on:
- 2.x

jobs:
correct_repository:
runs-on: ubuntu-latest
steps:
- name: fail on fork
if: github.repository_owner != 'kurkle'
run: exit 1

update_release_draft:
needs: correct_repository
if: github.repository_owner == 'kurkle'
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
Expand Down
24 changes: 17 additions & 7 deletions docs/.vuepress/config.js → docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const path = require('path');
import * as path from 'path';
import { DefaultThemeConfig, defineConfig, PluginTuple } from 'vuepress/config';

module.exports = {
export default defineConfig({
title: 'chartjs-chart-treemap',
description: 'Chart.js module for creating treemap charts',
theme: 'chartjs',
base: '',
//base: '',
dest: path.resolve(__dirname, '../../dist/docs'),
head: [
['link', {rel: 'icon', href: '/favicon.ico'}],
Expand All @@ -17,8 +18,17 @@ module.exports = {
{base: '/samples', alternative: ['basic']},
],
}],
],
] as PluginTuple[],
chainWebpack: (config) => {
config.module
.rule('chart.js')
.include.add(path.resolve('node_modules/chart.js')).end()
.use('babel-loader')
.loader('babel-loader')
.options({
presets: ['@babel/preset-env']
})
.end();
config.merge({
resolve: {
alias: {
Expand All @@ -27,7 +37,7 @@ module.exports = {
}
}
});
},
},
themeConfig: {
repo: 'kurkle/chartjs-chart-treemap',
logo: '/favicon.ico',
Expand Down Expand Up @@ -73,5 +83,5 @@ module.exports = {
'usage'
],
}
}
};
} as DefaultThemeConfig
});
9 changes: 5 additions & 4 deletions karma.conf.js → karma.conf.cjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const istanbul = require('rollup-plugin-istanbul');
const resolve = require('@rollup/plugin-node-resolve').nodeResolve;
const json = require('@rollup/plugin-json');
const builds = require('./rollup.config');
const env = process.env.NODE_ENV;

module.exports = function(karma) {
const build = builds[0];
module.exports = async function(karma) {
const builds = (await import('./rollup.config.js')).default;
const regex = karma.autoWatch ? /chartjs-chart-treemap\.js$/ : /chartjs-chart-treemap\.min\.js$/;
const build = builds.filter(v => v.output.file && v.output.file.match(regex))[0];

if (env === 'test') {
build.plugins = [
Expand Down Expand Up @@ -59,7 +60,7 @@ module.exports = function(karma) {
files: [
{pattern: './test/fixtures/**/*.js', included: false},
{pattern: './test/fixtures/**/*.png', included: false},
'node_modules/chart.js/dist/chart.js',
'node_modules/chart.js/dist/chart.umd.js',
'node_modules/chartjs-adapter-date-fns/dist/chartjs-adapter-date-fns.bundle.js',
{pattern: 'test/index.js', watched: false},
{pattern: 'src/index.js', watched: false},
Expand Down
Loading