-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrefactor-courses-simple.js
More file actions
57 lines (47 loc) · 1.46 KB
/
Copy pathrefactor-courses-simple.js
File metadata and controls
57 lines (47 loc) · 1.46 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
// Simple script to help refactor courses - manual extraction needed
// This script will help identify unit boundaries
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const coursesDir = path.join(__dirname, 'src/data/courses');
const coursesToRefactor = [
'react.js',
'git.js',
'tailwind.js',
'dom.js',
'php.js',
'mysql.js',
'python.js',
'jsEs6.js',
'typescript.js',
'node.js',
'mongodb.js',
'nextjs.js',
'cicd.js'
];
coursesToRefactor.forEach(file => {
const filePath = path.join(coursesDir, file);
if (!fs.existsSync(filePath)) {
console.log(`⚠️ ${file} not found`);
return;
}
const content = fs.readFileSync(filePath, 'utf8');
// Find unit boundaries
const unitMatches = content.matchAll(/\/\/\s*={50,}\s*\/\/\s*UNIT\s+\d+[:\s]+([^\n]+)/g);
const units = [];
for (const match of unitMatches) {
units.push({
title: match[1].trim(),
position: match.index
});
}
console.log(`\n📁 ${file}:`);
console.log(` Found ${units.length} units`);
units.forEach((unit, idx) => {
console.log(` Unit ${idx + 1}: ${unit.title} (at position ${unit.position})`);
});
});
console.log('\n✅ Analysis complete!');
console.log('💡 Use this info to manually extract units from each file.');