forked from Cognigy/WebchatWidget
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-license.js
26 lines (24 loc) · 880 Bytes
/
update-license.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const checker = require('license-checker');
const fs = require('fs');
checker.init({
start: "./",
development: false,
production: true,
}, function (err, packages) {
if (err) {
console.log(err);
} else {
const updatedLicenseText = `${getDateString()}\n\n${JSON.stringify(packages, null, 2)}`;
fs.writeFileSync("./OSS_LICENSES.txt", updatedLicenseText);
}
});
function getDateString() {
const date = new Date();
const year = date.getFullYear();
const month = `${date.getMonth() + 1}`.padStart(2, '0');
const day =`${date.getDate()}`.padStart(2, '0');
const hours = `${date.getHours()}`.padStart(2, '0');
const minutes = `${date.getMinutes()}`.padStart(2, '0');
const seconds = `${date.getSeconds()}`.padStart(2, '0');
return `Created on ${day}-${month}-${year} at ${hours}:${minutes}:${seconds}`;
}