UNPKG

@dalao-proxy/utils

Version:

A shared utils module for dalao-proxy and its plugins

20 lines (14 loc) 437 B
const path = require('path'); const { execSync } = require('child_process'); let _prefix; function getNpmConfigPrefixPath() { const prefix = _prefix || (_prefix = execSync('npm config get prefix')); return prefix.toString().replace(/\n/g, ''); } function getGlobalPackagePath() { return path.join(getNpmConfigPrefixPath(), 'lib', 'node_modules', '/'); } module.exports = { getNpmConfigPrefixPath, getGlobalPackagePath, };