react-native-integrate
Version:
Automate integration of additional code into React Native projects
20 lines (19 loc) • 845 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateOldProjectPath = validateOldProjectPath;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
function validateOldProjectPath(oldProjectPath) {
const fullPath = path_1.default.resolve(oldProjectPath);
if (!oldProjectPath)
return;
if (!fs_1.default.existsSync(fullPath))
return 'such path does not exist';
if (!fs_1.default.lstatSync(fullPath).isDirectory())
return 'path must be a directory';
if (!fs_1.default.existsSync(path_1.default.join(fullPath, 'package.json')))
return 'path must contain a package.json file';
}