UNPKG

better-scripts

Version:

The next level of npm scripts. An npm scripts runner. A better way to organize your npm scripts. Make redundant NPM scripts easier to read, maintain and use.

12 lines (10 loc) 373 B
import {createRequire} from 'node:module'; import {pathToFileURL} from 'node:url'; import {packageDirectorySync} from 'pkg-dir'; export function getUserPkg() { const pkgDir = packageDirectorySync(); const filePath = pathToFileURL(pkgDir).toString(); const require = createRequire(filePath + '/package.json'); const pkg = require('./package.json'); return pkg; }