react-native-template-rn-homee
Version:
124 lines (112 loc) ⢠5.04 kB
JavaScript
const kleur = require('kleur');
// Define package.json data directly in the script
const packageJsonData = {
"dependencies": {
"@d11/react-native-fast-image": "^8.9.2",
"@react-native-async-storage/async-storage": "^2.1.2",
"@react-native-community/netinfo": "^11.4.1",
"@react-native-masked-view/masked-view": "^0.3.2",
"@react-navigation/bottom-tabs": "^7.3.10",
"@react-navigation/native": "^7.1.6",
"@react-navigation/native-stack": "^7.3.10",
"@reduxjs/toolkit": "^2.7.0",
"@shopify/flash-list": "^1.8.0",
"axios": "^1.9.0",
"moment": "^2.30.1",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"react": "19.0.0",
"react-native": "0.79.1",
"react-native-change-icon": "^5.0.0",
"react-native-device-info": "^14.0.4",
"react-native-gesture-handler": "^2.25.0",
"react-native-haptic-feedback": "^2.3.3",
"react-native-i18n": "^2.0.15",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-linear-gradient": "^2.8.3",
"react-native-modal": "^14.0.0-rc.1",
"react-native-reanimated": "^3.17.5",
"react-native-responsive-screen": "^1.4.2",
"react-native-safe-area-context": "^5.4.0",
"react-native-screens": "^4.10.0",
"react-native-spinkit": "^1.5.1",
"react-native-toast-message": "^2.3.0",
"react-redux": "^9.2.0",
"reactotron-react-native": "^5.1.13",
"reactotron-redux": "^3.2.0",
"redux-persist": "^6.0.0"
},
"devDependencies": {
"@babel/core": "^7.26.10",
"@babel/preset-env": "^7.26.9",
"@babel/runtime": "^7.27.0",
"@react-native-community/cli": "^18.0.0",
"@react-native-community/cli-platform-android": "^18.0.0",
"@react-native-community/cli-platform-ios": "^18.0.0",
"@react-native/babel-preset": "^0.79.1",
"@react-native/eslint-config": "^0.79.1",
"@react-native/metro-config": "^0.79.1",
"@react-native/typescript-config": "^0.79.1",
"@types/jest": "^29.5.13",
"@types/react": "^19.0.0",
"@types/react-test-renderer": "^19.0.0",
"babel-jest": "^29.7.0",
"eslint": "^9.25.1",
"jest": "^29.7.0",
"metro-react-native-babel-preset": "^0.77.0",
"prettier": "^3.5.3",
"react-test-renderer": "19.0.0",
"typescript": "^5.8.3"
},
"engines": {
"node": ">=18"
},
"packageManager": "yarn@3.6.4"
};
async function readAndDisplayDependencies() {
try {
console.log(kleur.bold().cyan('\nš Reading Dependencies... \n'));
const dependencies = packageJsonData.dependencies || {};
const devDependencies = packageJsonData.devDependencies || {};
const allDependencies = { ...dependencies, ...devDependencies };
const depCount = Object.keys(allDependencies).length;
let progress = 0;
// Create an array to store the dependency lines
const dependencyLines = [];
// List all dependencies (both regular and dev) progressively with a 100ms timeout
for (const depName in allDependencies) {
if (allDependencies.hasOwnProperty(depName)) {
await new Promise((resolve) => {
setTimeout(() => {
progress++;
const progressBar = '[' + '#'.repeat((progress / depCount) * 20) + ' '.repeat(20 - (progress / depCount) * 20) + ']';
const isDevDep = devDependencies.hasOwnProperty(depName) ? kleur.yellow('(Dev)') : '';
const depLine = `${kleur.cyan(`šø ${depName}`)} ${isDevDep}: ${kleur.yellow(allDependencies[depName])}`;
dependencyLines.push(depLine);
console.clear(); // Clear the console to avoid stacking progress bars
console.log(kleur.bold().cyan('š Reading Dependencies... \n'));
console.log(progressBar + ` ${progress}/${depCount}\n`);
console.log(dependencyLines.join('\n'));
resolve();
}, 200);
});
}
}
const messages = [
`\nThank you for choosing Homee's Boilerplate!\n`,
`I Hope You have a good experience.`,
`Happy Coding....`,
`${kleur.bold().cyan('\n\nš Starting installation...')}`,
];
const delay = 500; // Delay between messages in milliseconds
messages.forEach((message, index) => {
setTimeout(() => {
console.log(index === messages.length - 1 ? message + '\n' : kleur.cyan(message));
}, index * delay);
});
} catch (error) {
console.error(kleur.bold().red('š« Error reading package.json:'), error);
}
}
readAndDisplayDependencies();