INNER CODE UNIT · JavaScript
relativeToProject
reactnativecn/react-native-update · scripts/build-harmony-har.js:488
function relativeToProject(filePath) {
return path.relative(projectRoot, filePath) || '.';
}
function fail(message) {
throw new Error(message);
}
function hasDependencies(dir) {
try {
const pkgPath = path.join(dir, 'oh-package.json5');
if (!fs.existsSync(pkgPath)) {
return false;
}
const pkgContent = fs.readFileSync(pkgPath, 'utf8');
const cleanJson = pkgContent.replace(
/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm,
''