1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- 'use strict';
- exports.__esModule = true;
- const fs = require('fs');
- const pkgUp = require('./pkgUp').default;
- function stripBOM(str) {
- return str.replace(/^\uFEFF/, '');
- }
- exports.default = function readPkgUp(opts) {
- const fp = pkgUp(opts);
- if (!fp) {
- return {};
- }
- try {
- return {
- pkg: JSON.parse(stripBOM(fs.readFileSync(fp, { encoding: 'utf-8' }))),
- path: fp,
- };
- } catch (e) {
- return {};
- }
- };
|