Skip to content

Commit

Permalink
tools: remove faulty early termination logic from update-timezone.mjs
Browse files Browse the repository at this point in the history
We do not build Node.js in the workflow so
https://github.com/nodejs/node/blob/f4815fcd7691364d8139b44c1295dbc46f6ee4a8/tools/update-timezone.mjs#L18
is actually the version of `tzdata` in the Node.js in the runner instead
of what's in `main`.

The script is pretty fast even when the versions differ and there is an
update, so this optimization doesn't seem to be worth having given the
problem.

Signed-off-by: Darshan Sen <[email protected]>
PR-URL: nodejs/node#44870
Fixes: nodejs/node#44865
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
RaisinTen authored and guangwong committed Jan 3, 2023
1 parent f25536d commit 5954779
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions tools/update-timezone.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Usage: tools/update-timezone.mjs
import { execSync } from 'node:child_process';
import { renameSync, readdirSync, rmSync } from 'node:fs';
import { exit } from 'node:process';

const fileNames = [
'zoneinfo64.res',
Expand All @@ -15,14 +14,8 @@ const availableVersions = readdirSync('icu-data/tzdata/icunew', { withFileTypes:
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name);

const currentVersion = process.versions.tz;
const latestVersion = availableVersions.sort().at(-1);

if (latestVersion === currentVersion) {
console.log(`Terminating early, tz version is latest @ ${currentVersion}`);
exit();
}

execSync('bzip2 -d deps/icu-small/source/data/in/icudt*.dat.bz2');
fileNames.forEach((file) => {
renameSync(`icu-data/tzdata/icunew/${latestVersion}/44/le/${file}`, `deps/icu-small/source/data/in/${file}`);
Expand Down

0 comments on commit 5954779

Please sign in to comment.