bump-year.js 839 B

12345678910111213141516171819202122232425262728293031323334
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. const gulp = require( 'gulp' );
  7. const path = require( 'path' );
  8. const replace = require( 'gulp-replace' );
  9. const gitignore = require( '../utils/gitignore-filter' );
  10. /**
  11. * Replaces license date in source files with new date
  12. *
  13. * @param {String} workdir
  14. * @returns {Object} stream
  15. */
  16. module.exports = ( workdir ) => {
  17. // Change this to correct year
  18. const year = '2017';
  19. const licenseRegexp = /(@license Copyright \(c\) 2003-)[0-9]{4}(, CKSource - Frederico Knabben\.)/g;
  20. const glob = path.join( workdir, '**/*' );
  21. return gulp.src( glob )
  22. .pipe( gitignore() )
  23. .pipe( replace(
  24. licenseRegexp,
  25. `$1${ year }$2`,
  26. { skipBinary: true }
  27. ) )
  28. .pipe( gulp.dest( workdir ) );
  29. };