From 7814669377ab7aa2ea1bb1881945807564cb5f44 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Wed, 6 Nov 2024 15:50:12 +0000 Subject: [PATCH] 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 Reviewed-By: Luigi Pinca --- tools/dep_updaters/update-c-ares.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/dep_updaters/update-c-ares.mjs b/tools/dep_updaters/update-c-ares.mjs index c5057e666de70d..bd99dfd34129e2 100644 --- a/tools/dep_updaters/update-c-ares.mjs +++ b/tools/dep_updaters/update-c-ares.mjs @@ -1,8 +1,9 @@ // Synchronize the sources for our c-ares gyp file from c-ares' Makefiles. import { readFileSync, writeFileSync } from 'node:fs'; 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' }; // Extract list of sources from the gyp file.