Skip to content
This repository was archived by the owner on Nov 25, 2021. It is now read-only.

Commit 973c2e8

Browse files
committed
build es6 module
1 parent 49edec4 commit 973c2e8

File tree

5 files changed

+40
-29
lines changed

5 files changed

+40
-29
lines changed

package-lock.json

Lines changed: 21 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
"url": "https://github.com/datavisyn/chartjs-scale-hierarchical.git"
1414
},
1515
"main": "build/Chart.Hierarchical.js",
16-
"jsnext:main": "build/Chart.Hierarchical.js",
17-
"module": "build/Chart.Hierarchical.js",
16+
"module": "build/Chart.Hierarchical.mjs",
1817
"files": [
1918
"build",
2019
"src/**/*.js"
@@ -28,8 +27,6 @@
2827
"babel-jest": "^23.6.0",
2928
"eslint": "^5.10.0",
3029
"jest": "^23.6.0",
31-
"package-preamble": "^0.1.0",
32-
"regenerator-runtime": "^0.13.1",
3330
"release-it": "^9.2.0",
3431
"rimraf": "^2.6.2",
3532
"rollup": "^0.68.0",

rollup.config.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import resolve from 'rollup-plugin-node-resolve';
33
import commonjs from 'rollup-plugin-commonjs';
44
import babel from 'rollup-plugin-babel';
55

6-
export default {
6+
export default [{
77
output: {
88
file: 'build/Chart.Hierarchical.js',
99
name: 'ChartHierarchical',
@@ -18,4 +18,19 @@ export default {
1818
commonjs(),
1919
babel()
2020
]
21-
};
21+
}, {
22+
output: {
23+
file: 'build/Chart.Hierarchical.mjs',
24+
name: 'ChartHierarchical',
25+
format: 'esm',
26+
globals: {
27+
'chart.js': 'Chart'
28+
}
29+
},
30+
external: ['chart.js'],
31+
plugins: [
32+
resolve(),
33+
commonjs(),
34+
babel()
35+
]
36+
}];

src/plugin/hierarchical.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,6 @@ const HierarchicalPlugin = {
459459
const node = parents[i];
460460
const isParentOfFirstChild = node.children[0] === parents[i + 1] || i === parents.length - 1;
461461

462-
console.log(node.label, 'in range');
463-
464462
const parent = flat[node.parent];
465463

466464
// first child of expanded parent

src/utils.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,8 @@ export function flatChildren(node, flat) {
147147
// not the last child
148148
const nextSibling = flat[node.parent].children[node.relIndex + 1];
149149
return flat.slice(firstChild.index, nextSibling.index);
150-
} else {
151-
return flat.slice(firstChild.index); // till end
152150
}
151+
return flat.slice(firstChild.index); // till end
153152
}
154153

155154
/**

0 commit comments

Comments
 (0)