@sap/generator-cap-project
Version:
Creates a new SAP Cloud Application Programming Model project.
28 lines (23 loc) • 619 B
JavaScript
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,
};
}