mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
71e9bc1108
The spawnSync call was previously silently failing with this error: ```sh icupkg: unable to open input file "icudt*.dat" ``` because spawnSync doesn't support globbing. This change replaces the spawnSync call with execSync because that supports globbing. I have tested this workflow with some minor modifications in my fork and I can confirm that it works as expected now. The bot opened this PR - https://github.com/RaisinTen/node/pull/2 which updates deps/icu-small/source/data/in/icudt71l.dat.bz2. Fixes: https://github.com/nodejs/node/issues/44865 Signed-off-by: Darshan Sen <raisinten@gmail.com> PR-URL: https://github.com/nodejs/node/pull/44870 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
34 lines
1.1 KiB
JavaScript
Executable File
34 lines
1.1 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
// 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',
|
|
'windowsZones.res',
|
|
'timezoneTypes.res',
|
|
'metaZones.res',
|
|
];
|
|
|
|
const availableVersions = readdirSync('icu-data/tzdata/icunew', { withFileTypes: true })
|
|
.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}`);
|
|
execSync(`icupkg -a ${file} icudt*.dat`, { cwd: 'deps/icu-small/source/data/in/' });
|
|
rmSync(`deps/icu-small/source/data/in/${file}`);
|
|
});
|
|
execSync('bzip2 -z deps/icu-small/source/data/in/icudt*.dat');
|
|
rmSync('icu-data', { recursive: true });
|