Skip to content

Commit 06f08d6

Browse files
committed
build: avoid dynamic date in build
1 parent 3a1b4a4 commit 06f08d6

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
MIT License
22

33
Copyright (c) 2019 datavisyn GmbH
4-
Copyright (c) 2020 Samuel Gratzl
4+
Copyright (c) 2021 Samuel Gratzl
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy
77
of this software and associated documentation files (the "Software"), to deal

rollup.config.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,22 @@ import fs from 'fs';
1010

1111
const pkg = JSON.parse(fs.readFileSync('./package.json'));
1212

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+
1324
const banner = `/**
1425
* ${pkg.name}
1526
* ${pkg.homepage}
1627
*
17-
* Copyright (c) ${new Date().getFullYear()} ${pkg.author.name} <${pkg.author.email}>
28+
* Copyright (c) ${year} ${pkg.author.name} <${pkg.author.email}>
1829
*/
1930
`;
2031

0 commit comments

Comments
 (0)