/
Zertmark
/
site_for_practice
Обзор
Документация
Войти
/
Zertmark
/
site_for_practice
Код
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
node_modules/read-pkg-up/index.js
27 строк
619 B
zertmark
Github Pages setup
23 апр 2025, 15:06
23 апр 2025, 15:06
93ee661
Код
Авторство
О чём код?
import path from 'node:path'; import {findUp, findUpSync} from 'find-up'; import {readPackage, readPackageSync} from 'read-pkg'; export async function readPackageUp(options) { const filePath = await findUp('package.json', options); if (!filePath) { return; } return { packageJson: await readPackage({...options, cwd: path.dirname(filePath)}), path: filePath, }; } export function readPackageUpSync(options) { const filePath = findUpSync('package.json', options); if (!filePath) { return; } return { packageJson: readPackageSync({...options, cwd: path.dirname(filePath)}), path: filePath, }; }