diff --git a/src/versions.js b/src/versions.js index 4a14da9..fd8bca8 100644 --- a/src/versions.js +++ b/src/versions.js @@ -1,14 +1,16 @@ -const getModulePath = moduleName => require.resolve(`${moduleName}/package.json`).replace(/\/package\.json$/, ''); +const { join } = require('path'); + +const getModulePath = moduleName => require.resolve(join(moduleName, 'package.json')).replace(join(' ', 'package.json').substr(1), ''); const markoPath = getModulePath('marko'); /* eslint-disable-next-line global-require, import/no-dynamic-require */ -const { version: markoVersion } = require(`${markoPath}/package`); +const { version: markoVersion } = require(join(markoPath, 'package')); let markoWidgetsPath; let markoWidgetsVersion; try { markoWidgetsPath = getModulePath('marko-widgets'); /* eslint-disable-next-line global-require, import/no-dynamic-require */ - markoWidgetsVersion = require(`${markoWidgetsPath}/package`).version; + markoWidgetsVersion = require(join(markoWidgetsPath, 'package')).version; } catch (error) { /* */ } module.exports = {