INNER CODE UNIT · JavaScript

ensureFileExists

reactnativecn/react-native-update · scripts/build-harmony-har.js:482

function ensureFileExists(filePath, message) {
  if (!fs.existsSync(filePath)) {
    fail(message);
  }
}

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)) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…