EventBuzz_Checkin_App/scripts/patch-metro-index.js

27 lines
754 B
JavaScript

/**
* Replaces React Native's default Metro landing page ("Welcome to React Native")
* with EventBuzz Checkins instructions. Runs before `npm start` and on postinstall.
*/
const fs = require('fs');
const path = require('path');
const source = path.join(__dirname, '../dev-server/metro-index.html');
const target = path.join(
__dirname,
'../node_modules/@react-native-community/cli-server-api/build/index.html',
);
if (!fs.existsSync(source)) {
console.warn('[patch-metro-index] Source HTML missing:', source);
process.exit(0);
}
if (!fs.existsSync(path.dirname(target))) {
console.warn(
'[patch-metro-index] cli-server-api not installed yet; skip until after npm install.',
);
process.exit(0);
}
fs.copyFileSync(source, target);