Skip to content

Commit

Permalink
Optimize the npm package by removing useless files (chartjs#6105)
Browse files Browse the repository at this point in the history
Explicitly target files that should be included in the npm package, making it 10x smaller by removing the docs, samples, scripts, sources, tests and other useless files.
  • Loading branch information
simonbrunel committed Mar 3, 2019
1 parent 1d6d5c8 commit ae38802
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 21 deletions.
13 changes: 0 additions & 13 deletions .npmignore

This file was deleted.

4 changes: 2 additions & 2 deletions karma.conf.js
Expand Up @@ -49,12 +49,12 @@ module.exports = function(karma) {
{pattern: 'test/fixtures/**/*.png', included: false},
'node_modules/moment/min/moment.min.js',
'test/index.js',
'src/chart.js'
'src/index.js'
].concat(args.inputs),

preprocessors: {
'test/index.js': ['rollup'],
'src/chart.js': ['sources']
'src/index.js': ['sources']
},

rollupPreprocessor: {
Expand Down
6 changes: 6 additions & 0 deletions package.json
Expand Up @@ -22,6 +22,12 @@
"bugs": {
"url": "https://github.com/chartjs/Chart.js/issues"
},
"files": [
"bower.json",
"composer.json",
"dist/*.css",
"dist/*.js"
],
"devDependencies": {
"clean-css": "^4.2.1",
"coveralls": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Expand Up @@ -7,7 +7,7 @@ const optional = require('./rollup.plugins').optional;
const stylesheet = require('./rollup.plugins').stylesheet;
const pkg = require('./package.json');

const input = 'src/chart.js';
const input = 'src/index.js';
const banner = `/*!
* Chart.js v${pkg.version}
* ${pkg.homepage}
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/scales/scale.category.js
Expand Up @@ -130,5 +130,5 @@ module.exports = Scale.extend({
}
});

// INTERNAL: static default options, registered in src/chart.js
// INTERNAL: static default options, registered in src/index.js
module.exports._defaults = defaultConfig;
2 changes: 1 addition & 1 deletion src/scales/scale.linear.js
Expand Up @@ -186,5 +186,5 @@ module.exports = LinearScaleBase.extend({
}
});

// INTERNAL: static default options, registered in src/chart.js
// INTERNAL: static default options, registered in src/index.js
module.exports._defaults = defaultConfig;
2 changes: 1 addition & 1 deletion src/scales/scale.logarithmic.js
Expand Up @@ -345,5 +345,5 @@ module.exports = Scale.extend({
}
});

// INTERNAL: static default options, registered in src/chart.js
// INTERNAL: static default options, registered in src/index.js
module.exports._defaults = defaultConfig;
2 changes: 1 addition & 1 deletion src/scales/scale.radialLinear.js
Expand Up @@ -530,5 +530,5 @@ module.exports = LinearScaleBase.extend({
}
});

// INTERNAL: static default options, registered in src/chart.js
// INTERNAL: static default options, registered in src/index.js
module.exports._defaults = defaultConfig;
2 changes: 1 addition & 1 deletion src/scales/scale.time.js
Expand Up @@ -764,5 +764,5 @@ module.exports = Scale.extend({
}
});

// INTERNAL: static default options, registered in src/chart.js
// INTERNAL: static default options, registered in src/index.js
module.exports._defaults = defaultConfig;

0 comments on commit ae38802

Please sign in to comment.