File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1
1
MIT License
2
2
3
3
Copyright (c) 2019 datavisyn GmbH
4
- Copyright (c) 2020 Samuel Gratzl
4
+ Copyright (c) 2021 Samuel Gratzl
5
5
6
6
Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
of this software and associated documentation files (the "Software"), to deal
Original file line number Diff line number Diff line change @@ -10,11 +10,22 @@ import fs from 'fs';
10
10
11
11
const pkg = JSON . parse ( fs . readFileSync ( './package.json' ) ) ;
12
12
13
+ function resolveYear ( ) {
14
+ // Extract copyrights from the LICENSE.
15
+ const license = fs . readFileSync ( "./LICENSE" , "utf-8" ) . toString ( ) ;
16
+ const matches = Array . from ( license . matchAll ( / \( c \) ( \d + ) / gm) ) ;
17
+ if ( ! matches || matches . length === 0 ) {
18
+ return 2021 ;
19
+ }
20
+ return matches [ matches . length - 1 ] [ 1 ] ;
21
+ }
22
+ const year = resolveYear ( ) ;
23
+
13
24
const banner = `/**
14
25
* ${ pkg . name }
15
26
* ${ pkg . homepage }
16
27
*
17
- * Copyright (c) ${ new Date ( ) . getFullYear ( ) } ${ pkg . author . name } <${ pkg . author . email } >
28
+ * Copyright (c) ${ year } ${ pkg . author . name } <${ pkg . author . email } >
18
29
*/
19
30
` ;
20
31
You can’t perform that action at this time.
0 commit comments