d9b-energy-index.js 1016 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env node
  2. const fs = require('fs');
  3. const F = 'pages/energy/index.vue';
  4. let src = fs.readFileSync(F, 'utf8');
  5. const MAP = [
  6. ["parent: 'linear-gradient(135deg,#F59E0B,#FBBF24)',",
  7. "parent: `linear-gradient(135deg,${BrandColors.wealth},${BrandColors.warning})`,"],
  8. ["child: 'linear-gradient(135deg,#10B981,#34D399)',",
  9. "child: `linear-gradient(135deg,${BrandColors.success},${BrandColors.successLight3})`,"],
  10. ["teacher:'linear-gradient(135deg,#3B82F6,#60A5FA)'",
  11. "teacher:`linear-gradient(135deg,${BrandColors.infoBlue},${BrandColors.infoBlueLight})`"],
  12. ];
  13. let n = 0;
  14. for (const [f, t] of MAP) {
  15. if (!src.includes(f)) { console.warn('NOT FOUND:', f); continue; }
  16. src = src.replace(f, t); n++;
  17. }
  18. fs.writeFileSync(F, src);
  19. console.log('fixed lines:', n);
  20. const lines = src.split('\n');
  21. let h = 0;
  22. for (let i = 0; i < lines.length; i++) {
  23. if (/#[0-9a-fA-F]{3,8}\b/.test(lines[i])) { console.log('HEX ' + (i + 1) + ': ' + lines[i].trim()); h++; }
  24. }
  25. console.log('remaining hex lines:', h);