fix: book canonical, fr/de pin warnings, pin grouping per locale, SEO checks
CI / Lint e auditorias (push) Successful in 48s
CI / Trivy (dependências e segredos) (push) Successful in 12s
CI / Imagem Docker (linux/arm64) (push) Successful in 3m41s
Release / Plano (reaproveitar a imagem?) (push) Successful in 6s
Release / ci (push) Skipped
Release / Publica a imagem (linux/arm64) (push) Successful in 16s
Release / Cria a release no Gitea (push) Successful in 6s
CI / Lint e auditorias (push) Successful in 48s
CI / Trivy (dependências e segredos) (push) Successful in 12s
CI / Imagem Docker (linux/arm64) (push) Successful in 3m41s
Release / Plano (reaproveitar a imagem?) (push) Successful in 6s
Release / ci (push) Skipped
Release / Publica a imagem (linux/arm64) (push) Successful in 16s
Release / Cria a release no Gitea (push) Successful in 6s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5a9fe676fc
commit
fe1802f818
67 files changed
+11875
-9596
No files matched your search
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env node
|
||||
import fs from "node:fs";
|
||||
const root=process.argv[2]||".";
|
||||
// Confere que cada idioma agrupa os pinos restritos como o português (os padrões vêm do texto de cada idioma).
|
||||
const src=fs.readFileSync(`${root}/components/PinRestrictions.jsx`,"utf8");
|
||||
const LOCS={pt:"GRUPOS_PT",en:"GRUPOS_EN",es:"GRUPOS_ES",fr:"GRUPOS_FR",de:"GRUPOS_DE","zh-CN":"GRUPOS_ZH"};
|
||||
function combinas(name){
|
||||
const blk=src.match(new RegExp(`const ${name} = \\[([\\s\\S]*?)\\n\\];`))[1];
|
||||
return blk.split(/\n\t\{\n/).slice(1).map(g=>{
|
||||
const id=g.match(/id: "(\w+)"/)[1];
|
||||
const m=g.match(/combina: ([\s\S]*?)\n\t\},?\s*$/)||g.match(/combina: ([\s\S]*?)\n\t\}/);
|
||||
return {id,fn:eval(`(${m[1].replace(/,\s*$/,"")})`)};
|
||||
});
|
||||
}
|
||||
const dir=(l)=>l==="pt"?`${root}/public/conexoes`:`${root}/data/${l}/conexoes`;
|
||||
const chips=fs.readdirSync(dir("pt")).filter(f=>f.endsWith(".json")).map(f=>f.replace(".json",""));
|
||||
const G={};for(const l in LOCS)G[l]=combinas(LOCS[l]);
|
||||
function run(l,chip){
|
||||
const pins=JSON.parse(fs.readFileSync(`${dir(l)}/${chip}.json`,"utf8"));
|
||||
const res={};
|
||||
for(const g of G[l]){res[g.id]=new Set();
|
||||
pins.forEach((p,i)=>{ if(!["io","analog","dedicated"].includes(p.tipo))return;
|
||||
const avisos=(p.avisos||[]).join(" ").toLowerCase(); const cats=p.categorias||[];
|
||||
if(g.fn(avisos,cats)) res[g.id].add(i);});}
|
||||
return {res,pins};
|
||||
}
|
||||
let bad=0;
|
||||
for(const chip of chips){const ref=run("pt",chip).res;
|
||||
for(const l in LOCS){ if(l==="pt")continue; const {res,pins}=run(l,chip);
|
||||
for(const id in ref){const a=[...ref[id]].sort((x,y)=>x-y).join(),b=[...(res[id]||[])].sort((x,y)=>x-y).join();
|
||||
if(a!==b){bad++;const falta=[...ref[id]].filter(i=>!res[id].has(i)),sobra=[...res[id]].filter(i=>!ref[id].has(i));
|
||||
if(process.argv.includes("-v")) console.log(`${chip} ${l} ${id}: faltam ${falta.map(i=>pins[i].nome+":"+(pins[i].avisos||[]).join(" | ").slice(0,90))} | sobram ${sobra.map(i=>pins[i].nome)}`);
|
||||
else console.log(`${chip} ${l} ${id}: faltam ${falta.length} sobram ${sobra.length}`);}}}}
|
||||
console.log(bad===0?" ✔ Restrições de pinos: os 6 idiomas agrupam igual ao português.":` ✖ Restrições de pinos: ${bad} divergência(s) (rode com -v).`);
|
||||
process.exit(bad?1:0);
|
||||
Reference in new issue
Block a user