-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcheck.js
More file actions
67 lines (56 loc) · 2.08 KB
/
check.js
File metadata and controls
67 lines (56 loc) · 2.08 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Simple check script for all Orbit chain JavaScript files
const fs = require('fs');
const path = require('path');
// Get all .js files in the current directory, excluding check scripts and utility files
const jsFiles = fs.readdirSync('./').filter(file =>
file.endsWith('.js') &&
!file.startsWith('check') &&
!file.startsWith('test_') &&
!file.startsWith('validate')
);
console.log(`Found ${jsFiles.length} Orbit chain scripts to check`);
let allPassed = true;
// Check each script
for (const scriptName of jsFiles) {
console.log(`\n==== Checking ${scriptName} ====`);
try {
const content = fs.readFileSync(scriptName, 'utf8');
console.log(`File size: ${(content.length / 1024).toFixed(2)} KB`);
// Basic checks
console.log('Basic script checks:');
const checks = [
{ name: "createRollupChain import", pattern: "createRollupChain" },
{ name: "ethers import", pattern: "require('ethers')" },
{ name: "dotenv config", pattern: "dotenv.config()" },
{ name: "Chain ID configuration", pattern: "chainId:" },
{ name: "Contract deployment", pattern: "deploy" },
{ name: "Error handling", pattern: "catch (error)" }
];
let scriptPassed = true;
for (const check of checks) {
const found = content.includes(check.pattern);
console.log(`[${found ? 'PASS' : 'FAIL'}] ${check.name}`);
if (!found) scriptPassed = false;
}
// Extract chain ID for verification
const chainIdMatch = content.match(/chainId:\s*(\d+)/);
if (chainIdMatch) {
console.log(`Chain ID: ${chainIdMatch[1]}`);
}
// Script summary
console.log(`\nScript status: ${scriptPassed ? '✅ PASSED' : '⚠️ ISSUES FOUND'}`);
if (!scriptPassed) {
allPassed = false;
}
} catch (error) {
console.error(`Error reading script: ${error.message}`);
allPassed = false;
}
}
// Overall summary
console.log('\n==== OVERALL VALIDATION SUMMARY ====');
if (allPassed) {
console.log('✅ All scripts passed validation checks');
} else {
console.log('⚠️ Some scripts have issues to address');
}