]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
#3182 Gulp task to generate bower.json file
authorSimon Brunel <simonbrunel@users.noreply.github.com>
Thu, 25 Aug 2016 19:13:27 +0000 (21:13 +0200)
committerSimon Brunel <simonbrunel@users.noreply.github.com>
Sun, 28 Aug 2016 16:21:10 +0000 (18:21 +0200)
.gitignore
.travis.yml
docs/00-Getting-Started.md
gulpfile.js
package.json

index 27254e97e3f96dedac79f754b69f4f887993e01f..478edb5eca4cfa000542a9eed21e627b9b0cc9b3 100644 (file)
@@ -6,3 +6,4 @@
 
 .DS_Store
 .idea
+bower.json
index 4643c405e4e531c1c37a3b54def06ff319a85f1b..df409f0ec884c8d8ab63f175ceb4df0b93989b55 100644 (file)
@@ -15,6 +15,7 @@ script:
   - gulp test
   - gulp coverage
   - gulp package
+  - gulp bower
   - cat ./coverage/lcov.info | ./node_modules/.bin/coveralls
 
 notifications:
index d6e9f0f2716869db0860220cf49d21ba925ffd59..a04925f55ee71a5a35217c90bf7e2fb022bebfaa 100644 (file)
@@ -5,7 +5,7 @@ anchor: getting-started
 
 ### Download Chart.js
 
-You can download the latest version of [Chart.js on GitHub](https://github.com/chartjs/Chart.js/releases/latest) or just use these [Chart.js CDN](https://cdnjs.com/libraries/Chart.js) links. 
+You can download the latest version of [Chart.js on GitHub](https://github.com/chartjs/Chart.js/releases/latest) or just use these [Chart.js CDN](https://cdnjs.com/libraries/Chart.js) links.
 If you download or clone the repository, you must run `gulp build` to generate the dist files. Chart.js no longer comes with prebuilt release versions, so an alternative option to downloading the repo is **strongly** advised.
 
 ### Installation
@@ -18,24 +18,12 @@ npm install chart.js --save
 
 #### bower
 
-Bower support has been dropped since version 2.2.0 but you can still use Chart.js with Bower thanks to [bower-npm-resolver](https://www.npmjs.com/package/bower-npm-resolver).
-
-First, add the resolver in your .bowerrc file:
-```json
-{
-  "resolvers": [
-    "bower-npm-resolver"
-  ]
-}
-```
-
-Then:
-
 ```bash
-npm install -g bower-npm-resolver
-bower install npm:chart.js --save
+bower install Chart.js --save
 ```
 
+> Note: Bower native support has been reintroduced at version 2.2.3 (previously dropped at version 2.2.0).
+
 ### Selecting the Correct Build
 
 Chart.js provides two different builds that are available for your use. The `Chart.js` and `Chart.min.js` files include Chart.js and the accompanying color parsing library. If this version is used and you require the use of the time axis, [Moment.js](http://momentjs.com/) will need to be included before Chart.js.
index cec632ed4761df4c4ebcc073ade1be474b63dce1..e278e159f0777f3f064fb4b0901057b7ea1370a4 100644 (file)
@@ -1,5 +1,6 @@
 var gulp = require('gulp'),
   concat = require('gulp-concat'),
+  file = require('gulp-file'),
   uglify = require('gulp-uglify'),
   util = require('gulp-util'),
   jshint = require('gulp-jshint'),
@@ -48,6 +49,7 @@ var testFiles = [
   '!./test/defaultConfig.tests.js',
 ];
 
+gulp.task('bower', bowerTask);
 gulp.task('build', buildTask);
 gulp.task('package', packageTask);
 gulp.task('coverage', coverageTask);
@@ -65,9 +67,25 @@ gulp.task('library-size', librarySizeTask);
 gulp.task('module-sizes', moduleSizesTask);
 gulp.task('_open', _openTask);
 gulp.task('dev', ['server', 'default']);
-
 gulp.task('default', ['build', 'watch']);
 
+/**
+ * Generates the bower.json manifest file which will be pushed along release tags.
+ * Specs: https://github.com/bower/spec/blob/master/json.md
+ */
+function bowerTask() {
+  var json = JSON.stringify({
+      name: package.name,
+      description: package.description,
+      homepage: package.homepage,
+      license: package.license,
+      version: package.version,
+      main: outDir + "Chart.js"
+    }, null, 2);
+
+  return file('bower.json', json, { src: true })
+    .pipe(gulp.dest('./'));
+}
 
 function buildTask() {
 
index a9a0af248075ef2f2b84fb8d58dea66babbf36dc..a7feccad2adaaa3e023d2a8f9b988ef36670cede 100644 (file)
@@ -17,6 +17,7 @@
     "gulp": "3.9.x",
     "gulp-concat": "~2.1.x",
     "gulp-connect": "~2.0.5",
+    "gulp-file": "^0.3.0",
     "gulp-html-validator": "^0.0.2",
     "gulp-insert": "~0.5.0",
     "gulp-jshint": "~1.5.1",