tools: fix c-ares updater script for Node.js 18

GitHub Actions is by default running the tools updater workflow
with Node.js 18. Avoid use of `import.meta.dirname`, which wasn't
backported to Node.js 18.

PR-URL: https://github.com/nodejs/node/pull/55717
Refs: https://github.com/nodejs/node/pull/55445
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Richard Lau 2024-11-06 15:50:12 +00:00 committed by GitHub
parent 6f12f1e500
commit e0145b4c38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,8 +1,9 @@
// Synchronize the sources for our c-ares gyp file from c-ares' Makefiles. // Synchronize the sources for our c-ares gyp file from c-ares' Makefiles.
import { readFileSync, writeFileSync } from 'node:fs'; import { readFileSync, writeFileSync } from 'node:fs';
import { join } from 'node:path'; import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
const srcroot = join(import.meta.dirname, '..', '..'); const srcroot = fileURLToPath(new URL('../../', import.meta.url));
const options = { encoding: 'utf8' }; const options = { encoding: 'utf8' };
// Extract list of sources from the gyp file. // Extract list of sources from the gyp file.