From 66ccbec7a323ffde91b967ad0e44e2210da48ec2 Mon Sep 17 00:00:00 2001 From: Adrien Menella Date: Tue, 30 Jan 2024 18:11:57 +0100 Subject: [PATCH] fix: fix undefined '__dirname' (in ES module) for debug option --- src/log-plugin-version.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/log-plugin-version.js b/src/log-plugin-version.js index 7df61eb..e8cf3e9 100644 --- a/src/log-plugin-version.js +++ b/src/log-plugin-version.js @@ -1,4 +1,5 @@ -import { resolve } from 'path'; +import { resolve, dirname } from 'path'; +import { fileURLToPath } from 'url'; import readPkg from 'read-pkg'; import createDebug from 'debug'; @@ -6,6 +7,7 @@ const debug = createDebug('semantic-release:monorepo'); const logPluginVersion = type => plugin => async (pluginConfig, config) => { if (config.options.debug) { + const __dirname = dirname(fileURLToPath(import.meta.url)); const { version } = await readPkg(resolve(__dirname, '../')); debug('Running %o version %o', type, version); }