update cdata.js to rebuild if package.json changes

pull/3875/head
Woody 2024-04-02 20:38:56 +02:00
rodzic a7e17eabff
commit 4db88cf86b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 9872D7F5072789B2
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
* Writes compressed C arrays of data files (web interface)
* How to use it?
*
* 1) Install Node 11+ and npm
* 1) Install Node 20+ and npm
* 2) npm install
* 3) npm run build
*
@ -207,7 +207,7 @@ function isAnyFileInFolderNewerThan(folderPath, time) {
}
// Check if the web UI is already built
function isAlreadyBuilt(folderPath) {
function isAlreadyBuilt(webUIPath, packageJsonPath = "package.json") {
let lastBuildTime = Infinity;
for (const file of output) {
@ -220,7 +220,7 @@ function isAlreadyBuilt(folderPath) {
}
}
return !isAnyFileInFolderNewerThan(folderPath, lastBuildTime) && !isFileNewerThan("tools/cdata.js", lastBuildTime);
return !isAnyFileInFolderNewerThan(webUIPath, lastBuildTime) && !isFileNewerThan(packageJsonPath, lastBuildTime) && !isFileNewerThan(__filename, lastBuildTime);
}
// Don't run this script if we're in a test environment