d3ro-voice/apps/desktop/check_all_tokens.cjs
Yun Chan 708e20f747
Some checks failed
CI Pipeline / Code Quality & Typecheck (push) Waiting to run
CI Pipeline / Test Suite (macos-latest) (push) Blocked by required conditions
CI Pipeline / Test Suite (ubuntu-latest) (push) Blocked by required conditions
CI Pipeline / Test Suite (windows-latest) (push) Blocked by required conditions
CI Pipeline / Build Validation (admin) (push) Blocked by required conditions
CI Pipeline / Build Validation (desktop) (push) Blocked by required conditions
Deploy Landing Page / deploy (push) Blocked by required conditions
Deploy Landing Page / build (push) Waiting to run
Release & Packaging Pipeline / Build & Publish Admin Docker Image (push) Failing after 8s
Release & Code Signing CA Pipeline / build-and-sign-windows (push) Failing after 1m51s
Build macOS / Build & Package (macOS) (push) Failing after 4s
Build macOS / Build & Package (macOS)-1 (push) Failing after 5s
Release & Code Signing CA Pipeline / build-and-sign-macos (push) Failing after 3s
Release & Packaging Pipeline / Package macOS Desktop App (push) Failing after 4s
Release & Packaging Pipeline / Package Windows Desktop App (push) Failing after 2m28s
Release & Packaging Pipeline / Publish Official GitHub Release (push) Has been skipped
feat: complete release preparation, 10+ ad mediation, CI/CD, and docker deployment
2026-08-20 11:12:05 +09:00

53 lines
1.9 KiB
JavaScript

const fs = require('fs');
const path = require('path');
function walk(dir) {
let results = [];
const list = fs.readdirSync(dir);
list.forEach(function(file) {
file = path.join(dir, file);
const stat = fs.statSync(file);
if (stat && stat.isDirectory()) {
results = results.concat(walk(file));
} else {
if (file.endsWith('.tsx') || file.endsWith('.ts')) {
results.push(file);
}
}
});
return results;
}
const tokens = ['d3roPalette', 'd3roTypo', 'd3roRadius', 'd3roShadow', 'd3roFontSans'];
const files = walk(path.join(__dirname, 'src/renderer'));
let updatedCount = 0;
files.forEach(file => {
let content = fs.readFileSync(file, 'utf8');
let modified = false;
const usedTokens = tokens.filter(t => content.includes(t));
if (usedTokens.length > 0) {
const importRegex = /import\s+\{([^}]*)\}\s+from\s+['"]@d3ro\/ui\/theme['"]/;
const match = importRegex.exec(content);
if (match) {
const existing = match[1].split(',').map(s => s.trim()).filter(Boolean);
const missing = usedTokens.filter(t => !existing.includes(t));
if (missing.length > 0) {
const allTokens = Array.from(new Set([...existing, ...missing]));
content = content.replace(importRegex, `import { ${allTokens.join(', ')} } from '@d3ro/ui/theme'`);
fs.writeFileSync(file, content, 'utf8');
console.log(`Updated ${path.relative(__dirname, file)} with tokens: ${missing.join(', ')}`);
updatedCount++;
}
} else {
// Add new import statement at top
content = `import { ${usedTokens.join(', ')} } from '@d3ro/ui/theme';\n` + content;
fs.writeFileSync(file, content, 'utf8');
console.log(`Added new theme import to ${path.relative(__dirname, file)}: ${usedTokens.join(', ')}`);
updatedCount++;
}
}
});
console.log(`Total files updated: ${updatedCount}`);