]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Make the build reproducible (#6817)
authorChris Lamb <chris@chris-lamb.co.uk>
Sat, 7 Dec 2019 15:41:56 +0000 (15:41 +0000)
committerEvert Timberg <evert.timberg+github@gmail.com>
Sat, 7 Dec 2019 15:41:56 +0000 (10:41 -0500)
Whilst working on the Reproducible Builds effort [0] we noticed that
Chart.js could not be built reproducibly.

This is because it was embedding another build date in a "banner"
comment. This patch uses the value from SOURCE_DATE_EPOCH [1] if
present.

This was originally filed in Debian as #946333 [2].

 [0] https://reproducible-builds.org/
 [1] https://reproducible-builds.org/specs/source-date-epoch/
 [2] https://bugs.debian.org/946333

Signed-off-by: Chris Lamb <lamby@debian.org>
rollup.config.js

index e8b59379345a33f93b471d2d87951dfa29e38686..3cbfe0b5c9028802c0a338dcd38851e0ec10b750 100644 (file)
@@ -12,7 +12,7 @@ const input = 'src/index.js';
 const banner = `/*!
  * Chart.js v${pkg.version}
  * ${pkg.homepage}
- * (c) ${new Date().getFullYear()} Chart.js Contributors
+ * (c) ${(new Date(process.env.SOURCE_DATE_EPOCH ? (process.env.SOURCE_DATE_EPOCH * 1000) : new Date().getTime())).getFullYear()} Chart.js Contributors
  * Released under the MIT License
  */`;