Skip to content

Commit

Permalink
ignore json files, phetsims/perennial#362
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Nov 5, 2024
1 parent 8804c8f commit 4220f3c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion js/grunt/updateCopyrightDates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,21 @@
*/

import * as grunt from 'grunt';
import _ from 'lodash';
import updateCopyrightDate from './updateCopyrightDate';

const unsupportedExtensions = [ '.json', 'md' ];

const filesPredicate = ( file: string ) => {
if ( _.some( unsupportedExtensions, extension => file.endsWith( extension ) ) ) {
return false;
}
if ( file.startsWith( 'js/' ) ) {
return true;
}
return false;
};

/**
* @param repo - The repository name for the files to update
* @param predicate - takes a repo-relative path {string} and returns {boolean} if the path should be updated.
Expand All @@ -19,7 +32,7 @@ export default async function( repo: string, predicate = () => true ): Promise<v
grunt.file.recurse( `../${repo}`, ( abspath, rootdir, subdir, filename ) => {
relativeFiles.push( `${subdir}/${filename}` );
} );
relativeFiles = relativeFiles.filter( file => file.startsWith( 'js/' ) ).filter( predicate );
relativeFiles = relativeFiles.filter( filesPredicate ).filter( predicate );

for ( const relativeFile of relativeFiles ) {
await updateCopyrightDate( repo, relativeFile );
Expand Down

0 comments on commit 4220f3c

Please sign in to comment.