-
Notifications
You must be signed in to change notification settings - Fork 477
Expand file tree
/
Copy pathcheck-environment.js
More file actions
48 lines (38 loc) · 1.53 KB
/
Copy pathcheck-environment.js
File metadata and controls
48 lines (38 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
Simple preflight environment checker for the frontend workspace.
Run: node ./scripts/check-environment.js
*/
const {execSync} = require('child_process');
const fs = require('fs');
const path = require('path');
function checkCommand(cmd) {
try {
const out = execSync(`${cmd} --version`, {stdio: 'pipe'}).toString().trim();
return out;
} catch (e) {
return null;
}
}
console.log('== Frontend preflight check ==');
const node = checkCommand('node');
console.log('node:', node || 'NOT FOUND');
const npm = checkCommand('npm');
console.log('npm:', npm || 'NOT FOUND');
const yarn = checkCommand('yarn');
console.log('yarn:', yarn || 'NOT FOUND (optional)');
const expo = checkCommand('expo');
console.log('expo-cli:', expo || 'NOT FOUND (optional for bare workflow)');
const pkgPath = path.resolve(__dirname, '..', 'package.json');
const nodeModulesPath = path.resolve(__dirname, '..', 'node_modules');
if (!fs.existsSync(pkgPath)) {
console.error('Error: package.json not found in frontend/');
process.exitCode = 2;
} else {
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
console.log('package.json found. name:', pkg.name || '(unknown)');
}
console.log('node_modules:', fs.existsSync(nodeModulesPath) ? 'present' : 'missing');
console.log('\nNext steps:');
console.log(' - Run `npm install` or `yarn` inside frontend/ to install dependencies.');
console.log(' - Use `npm run start` or `expo start` to run the app.');
console.log(' - For push notifications, run on a physical device and configure FCM on Android.');