create-rubrica 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +256 -45
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1103,7 +1103,13 @@ var init_i18n = __esm({
|
|
|
1103
1103
|
});
|
|
1104
1104
|
|
|
1105
1105
|
// ../core/src/i18n/ui-texts.ts
|
|
1106
|
-
|
|
1106
|
+
function defaultUiText(key, locale, kind) {
|
|
1107
|
+
const entry = kind === "empresa" && EMPRESA_UI_TEXTS[key] || DEFAULT_UI_TEXTS[key];
|
|
1108
|
+
if (!entry) return void 0;
|
|
1109
|
+
const base3 = locale.split("-")[0].toLowerCase();
|
|
1110
|
+
return entry[locale] ?? entry[base3] ?? entry.en;
|
|
1111
|
+
}
|
|
1112
|
+
var APP_UI_TEXTS, DEFAULT_UI_TEXTS, EMPRESA_UI_TEXTS;
|
|
1107
1113
|
var init_ui_texts = __esm({
|
|
1108
1114
|
"../core/src/i18n/ui-texts.ts"() {
|
|
1109
1115
|
"use strict";
|
|
@@ -1309,10 +1315,12 @@ var init_ui_texts = __esm({
|
|
|
1309
1315
|
"nav.menu": { pt: "Menu", en: "Menu", es: "Men\xFA" },
|
|
1310
1316
|
"sidebar.contact": { pt: "Contato", en: "Contact", es: "Contacto" },
|
|
1311
1317
|
"sidebar.talk": { pt: "Fale comigo", en: "Talk to me", es: "Hablemos" },
|
|
1318
|
+
"sidebar.downloadCV": { pt: "Baixar CV", en: "Download CV", es: "Descargar CV" },
|
|
1312
1319
|
"nav.language": { pt: "Idioma", en: "Language", es: "Idioma" },
|
|
1313
1320
|
"theme.toggle": { pt: "Alternar tema claro e escuro", en: "Toggle light and dark theme", es: "Cambiar tema claro y oscuro" },
|
|
1314
1321
|
"common.readMore": { pt: "Ler mais", en: "Read more", es: "Leer m\xE1s" },
|
|
1315
1322
|
"common.back": { pt: "Voltar", en: "Back", es: "Volver" },
|
|
1323
|
+
"common.close": { pt: "Fechar", en: "Close", es: "Cerrar" },
|
|
1316
1324
|
"blog.readingTime": { pt: "{minutes} min de leitura", en: "{minutes} min read", es: "{minutes} min de lectura" },
|
|
1317
1325
|
"blog.publishedAt": { pt: "Publicado em {date}", en: "Published on {date}", es: "Publicado el {date}" },
|
|
1318
1326
|
"blog.related": { pt: "Leia tamb\xE9m", en: "Read next", es: "Lee tambi\xE9n" },
|
|
@@ -1321,12 +1329,19 @@ var init_ui_texts = __esm({
|
|
|
1321
1329
|
"case.client": { pt: "Cliente", en: "Client", es: "Cliente" },
|
|
1322
1330
|
"case.year": { pt: "Ano", en: "Year", es: "A\xF1o" },
|
|
1323
1331
|
"case.role": { pt: "Papel", en: "Role", es: "Rol" },
|
|
1332
|
+
"case.myRole": { pt: "Meu papel", en: "My role", es: "Mi rol" },
|
|
1333
|
+
"case.back": { pt: "Voltar ao portf\xF3lio", en: "Back to the portfolio", es: "Volver al portafolio" },
|
|
1334
|
+
"case.gallery": { pt: "Imagens do projeto", en: "Project images", es: "Im\xE1genes del proyecto" },
|
|
1324
1335
|
"resume.download": { pt: "Baixar curr\xEDculo em PDF", en: "Download r\xE9sum\xE9 (PDF)", es: "Descargar CV en PDF" },
|
|
1325
1336
|
"resume.experience": { pt: "Experi\xEAncia", en: "Experience", es: "Experiencia" },
|
|
1326
1337
|
"resume.education": { pt: "Forma\xE7\xE3o", en: "Education", es: "Formaci\xF3n" },
|
|
1327
1338
|
"resume.skill": { pt: "Compet\xEAncias", en: "Skills", es: "Habilidades" },
|
|
1328
1339
|
"resume.certification": { pt: "Certifica\xE7\xF5es", en: "Certifications", es: "Certificaciones" },
|
|
1329
1340
|
"resume.language": { pt: "Idiomas", en: "Languages", es: "Idiomas" },
|
|
1341
|
+
"resume.volunteer": { pt: "Voluntariado", en: "Volunteer work", es: "Voluntariado" },
|
|
1342
|
+
"resume.soft-skill": { pt: "Compet\xEAncias comportamentais", en: "Soft skills", es: "Habilidades blandas" },
|
|
1343
|
+
"resume.showOlder": { pt: "Ver experi\xEAncias anteriores ({count})", en: "Show earlier experience ({count})", es: "Ver experiencias anteriores ({count})" },
|
|
1344
|
+
"resume.hideOlder": { pt: "Ocultar experi\xEAncias anteriores", en: "Hide earlier experience", es: "Ocultar experiencias anteriores" },
|
|
1330
1345
|
"resume.present": { pt: "atual", en: "present", es: "actual" },
|
|
1331
1346
|
"pricing.highlighted": { pt: "Mais escolhido", en: "Most popular", es: "M\xE1s elegido" },
|
|
1332
1347
|
"location.hours": { pt: "Hor\xE1rio", en: "Opening hours", es: "Horario" },
|
|
@@ -1411,6 +1426,25 @@ var init_ui_texts = __esm({
|
|
|
1411
1426
|
"notFound.home": { pt: "Ir para a p\xE1gina inicial", en: "Go to the home page", es: "Ir a la p\xE1gina de inicio" },
|
|
1412
1427
|
...APP_UI_TEXTS
|
|
1413
1428
|
};
|
|
1429
|
+
EMPRESA_UI_TEXTS = {
|
|
1430
|
+
"sidebar.talk": { pt: "Fale conosco", en: "Talk to us", es: "Hablemos" },
|
|
1431
|
+
"case.myRole": { pt: "Nosso papel", en: "Our role", es: "Nuestro rol" },
|
|
1432
|
+
"case.back": { pt: "Voltar aos cases", en: "Back to the case studies", es: "Volver a los casos" },
|
|
1433
|
+
"whatsapp.float": { pt: "Fale conosco no WhatsApp", en: "Chat with us on WhatsApp", es: "Habla con nosotros por WhatsApp" },
|
|
1434
|
+
"contactForm.message": { pt: "Conte um pouco mais", en: "Tell us a bit more", es: "Cu\xE9ntanos un poco m\xE1s" },
|
|
1435
|
+
"contactForm.you": { pt: "Como falar com voc\xEA?", en: "How can we reach you?", es: "\xBFC\xF3mo podemos contactarte?" },
|
|
1436
|
+
"contactForm.successBody": {
|
|
1437
|
+
pt: "Obrigado pelo contato. Respondemos assim que poss\xEDvel.",
|
|
1438
|
+
en: "Thanks for reaching out. We'll reply as soon as we can.",
|
|
1439
|
+
es: "Gracias por escribir. Responderemos lo antes posible."
|
|
1440
|
+
},
|
|
1441
|
+
"proposal.expiredHint": { pt: "Fale conosco para receber uma vers\xE3o atualizada.", en: "Get in touch with us for an updated version.", es: "Escr\xEDbenos para recibir una versi\xF3n actualizada." },
|
|
1442
|
+
"checkout.error.NOT_CONFIGURED": {
|
|
1443
|
+
pt: "Os pagamentos ainda n\xE3o est\xE3o configurados neste site. Fale conosco para combinar outra forma de pagamento.",
|
|
1444
|
+
en: "Payments aren't set up on this site yet. Get in touch with us to arrange another way to pay.",
|
|
1445
|
+
es: "Los pagos a\xFAn no est\xE1n configurados en este sitio. Escr\xEDbenos para acordar otra forma de pago."
|
|
1446
|
+
}
|
|
1447
|
+
};
|
|
1414
1448
|
}
|
|
1415
1449
|
});
|
|
1416
1450
|
|
|
@@ -7368,6 +7402,19 @@ function loc(base3, translations) {
|
|
|
7368
7402
|
if (en) out[EN] = en;
|
|
7369
7403
|
return out;
|
|
7370
7404
|
}
|
|
7405
|
+
function v1FullTitle(title, siteTitle) {
|
|
7406
|
+
if (!siteTitle) return title;
|
|
7407
|
+
const out = {};
|
|
7408
|
+
for (const [l, t] of Object.entries(title)) if (t) out[l] = t.includes(siteTitle) ? t : `${t} | ${siteTitle}`;
|
|
7409
|
+
return out;
|
|
7410
|
+
}
|
|
7411
|
+
function sameInBoth(value) {
|
|
7412
|
+
const v = value[PT] ?? value[EN];
|
|
7413
|
+
return v ? { [PT]: v, [EN]: value[EN] ?? v } : value;
|
|
7414
|
+
}
|
|
7415
|
+
function v1Navigation(items) {
|
|
7416
|
+
return V1_NAV_ORDER.map((href) => items.find((n) => n.href === href)).filter((n) => !!n);
|
|
7417
|
+
}
|
|
7371
7418
|
function locAny(value) {
|
|
7372
7419
|
if (typeof value === "string") return loc(value);
|
|
7373
7420
|
if (value && typeof value === "object") return loc(value.ptBR, value);
|
|
@@ -7385,11 +7432,12 @@ function slugify(text2) {
|
|
|
7385
7432
|
return text2.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80) || "item";
|
|
7386
7433
|
}
|
|
7387
7434
|
function parsePeriod(period) {
|
|
7388
|
-
const
|
|
7435
|
+
const years = /^(\d{4})\s*-\s*(\d{4})$/.exec(period.trim());
|
|
7436
|
+
const parts = years ? [years[1], years[2]] : period.split(/\s+(?:-|–|—|a|até|to)\s+|\s*[–—]\s*|\s+-\s+/i).map((p) => p.trim()).filter(Boolean);
|
|
7389
7437
|
const one = (p) => {
|
|
7390
7438
|
const numeric = /^(\d{1,2})[/.-](\d{4})$/.exec(p);
|
|
7391
7439
|
if (numeric) return `${numeric[2]}-${numeric[1].padStart(2, "0")}`;
|
|
7392
|
-
const named = /^([a-zç]{3})[a-zç]*\.?[\s/de]*(\d{4})$/i.exec(p.normalize("NFD").replace(/[̀-ͯ]/g, ""));
|
|
7440
|
+
const named = /^([a-zç]{3})[a-zç]*\.?[\s/de-]*(\d{4})$/i.exec(p.normalize("NFD").replace(/[̀-ͯ]/g, ""));
|
|
7393
7441
|
if (named && MONTHS[named[1].toLowerCase()]) return `${named[2]}-${MONTHS[named[1].toLowerCase()]}`;
|
|
7394
7442
|
const year = /^(\d{4})$/.exec(p);
|
|
7395
7443
|
return year ? year[1] : void 0;
|
|
@@ -7412,7 +7460,7 @@ function convertPosts(ctx, docs) {
|
|
|
7412
7460
|
content: loc(d.content, d.contentTranslations),
|
|
7413
7461
|
cover: ctx.image(d.imageId, d.imageUrl),
|
|
7414
7462
|
seo: compact({
|
|
7415
|
-
title: loc(d.seoTitle, d.seoTitleTranslations),
|
|
7463
|
+
title: v1FullTitle(loc(d.seoTitle, d.seoTitleTranslations), ctx.siteTitle),
|
|
7416
7464
|
description: loc(d.seoDescription, d.seoDescriptionTranslations),
|
|
7417
7465
|
image: ctx.image(d.ogImageId, d.ogImageUrl)
|
|
7418
7466
|
}),
|
|
@@ -7462,7 +7510,7 @@ function convertProjects(ctx, docs) {
|
|
|
7462
7510
|
const links = [];
|
|
7463
7511
|
if (str2(d.demoLink)) links.push({ label: ctx.t("portfolio.liveDemo"), href: d.demoLink });
|
|
7464
7512
|
if (str2(d.githubLink)) links.push({ label: ctx.t("portfolio.code"), href: d.githubLink });
|
|
7465
|
-
const tags = [
|
|
7513
|
+
const tags = [...new Set(d.tags ?? [])];
|
|
7466
7514
|
return compact({
|
|
7467
7515
|
...meta2(d),
|
|
7468
7516
|
slug,
|
|
@@ -7504,14 +7552,14 @@ function convertResume(ctx, docs) {
|
|
|
7504
7552
|
case "skill":
|
|
7505
7553
|
return compact({ ...base3, kind: "skill", title: loc(c.name, { enUS: en.name }), description: loc(c.level, { enUS: en.level }), group: str2(c.group) ? loc(c.group, { enUS: en.group }) : void 0, tags: str2(c.group) ? [c.group] : void 0 });
|
|
7506
7554
|
case "soft_skill":
|
|
7507
|
-
return compact({ ...base3, kind: "skill", title: loc(c.text, tr2)
|
|
7555
|
+
return compact({ ...base3, kind: "soft-skill", title: loc(c.text, tr2) });
|
|
7508
7556
|
case "course":
|
|
7509
7557
|
return compact({ ...base3, kind: "certification", title: loc(c.text, tr2) });
|
|
7510
7558
|
case "language":
|
|
7511
7559
|
return compact({ ...base3, kind: "language", title: loc(c.name, tr2.enUS ? { enUS: typeof tr2.enUS === "string" ? tr2.enUS : tr2.enUS.name } : void 0), description: str2(c.level) ? loc(c.level) : void 0 });
|
|
7512
7560
|
case "volunteer":
|
|
7513
|
-
if (str2(c.text)) return compact({ ...base3, kind: "
|
|
7514
|
-
return compact({ ...base3, kind: "
|
|
7561
|
+
if (str2(c.text)) return compact({ ...base3, kind: "volunteer", title: loc(c.text, tr2) });
|
|
7562
|
+
return compact({ ...base3, kind: "volunteer", title: loc(c.role, { enUS: en.role }), organization: str2(c.company), description: loc(c.description, { enUS: en.description }), ...period(c.period) });
|
|
7515
7563
|
default:
|
|
7516
7564
|
ctx.warnings.push(`Curr\xEDculo: item do tipo desconhecido "${d.type}" ficou de fora.`);
|
|
7517
7565
|
return null;
|
|
@@ -7571,8 +7619,8 @@ function convertSettings(ctx, input, plugins) {
|
|
|
7571
7619
|
}
|
|
7572
7620
|
if (ctx.config.get("theme_colors_per_mode") === true) ctx.warnings.push("As cores separadas por modo (claro/escuro) do painel da v1 n\xE3o foram convertidas: ajuste em Apar\xEAncia.");
|
|
7573
7621
|
const social = [
|
|
7574
|
-
["linkedin", contact?.linkedinUrl],
|
|
7575
7622
|
["github", contact?.githubUrl],
|
|
7623
|
+
["linkedin", contact?.linkedinUrl],
|
|
7576
7624
|
["behance", contact?.behanceUrl]
|
|
7577
7625
|
].filter(([, url2]) => str2(url2)).map(([network, url2]) => ({ network, url: url2 }));
|
|
7578
7626
|
const url = (c("site_url") ?? id.siteUrl ?? "").replace(/\/+$/, "");
|
|
@@ -7602,7 +7650,9 @@ function convertSettings(ctx, input, plugins) {
|
|
|
7602
7650
|
name: str2(contact?.name) ?? id.authorName ?? "",
|
|
7603
7651
|
jobTitle: contact ? loc(contact.role, contact.roleTranslations) : void 0,
|
|
7604
7652
|
email: contact?.showEmail ? str2(contact.email) : void 0,
|
|
7605
|
-
photo: contact?.avatarStorageId
|
|
7653
|
+
photo: contact?.avatarStorageId ? { url: "", storageId: contact.avatarStorageId } : ctx.image(void 0, str2(contact?.avatarUrl)),
|
|
7654
|
+
// A sidebar da v1 mostrava o telefone (com o ícone do WhatsApp) quando "mostrar" estava ligado.
|
|
7655
|
+
whatsapp: contact?.showPhone ? str2(contact.phone) : void 0
|
|
7606
7656
|
}) : void 0,
|
|
7607
7657
|
plugins,
|
|
7608
7658
|
ogImage: ogStorage || c("og_image_url") ? compact({ url: c("og_image_url") ?? "", storageId: ogStorage }) : void 0,
|
|
@@ -7610,6 +7660,16 @@ function convertSettings(ctx, input, plugins) {
|
|
|
7610
7660
|
whatsapp: convertWhatsApp(ctx)
|
|
7611
7661
|
});
|
|
7612
7662
|
}
|
|
7663
|
+
function highlightNumbersHtml(text2) {
|
|
7664
|
+
const escape = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
7665
|
+
let out = "";
|
|
7666
|
+
let last = 0;
|
|
7667
|
+
for (const m of text2.matchAll(NUMBER_WITH_UNIT)) {
|
|
7668
|
+
out += escape(text2.slice(last, m.index)) + `<strong>${escape(m[0])}</strong>`;
|
|
7669
|
+
last = m.index + m[0].length;
|
|
7670
|
+
}
|
|
7671
|
+
return out + escape(text2.slice(last));
|
|
7672
|
+
}
|
|
7613
7673
|
function homeTestimonialsSource(ctx, path5, block) {
|
|
7614
7674
|
if (path5 !== "/" || block.type !== "depoimentos" || block.source) return {};
|
|
7615
7675
|
const list2 = (ctx.tables.testimonials ?? []).filter((d) => d.deletedAt === void 0);
|
|
@@ -7651,7 +7711,7 @@ function buildPages(ctx, input, plugins, report) {
|
|
|
7651
7711
|
dropped.push({ type: block.type, reason: "a v1 n\xE3o tinha esta se\xE7\xE3o nesta p\xE1gina" });
|
|
7652
7712
|
continue;
|
|
7653
7713
|
}
|
|
7654
|
-
const fields = fill(ctx, plugins);
|
|
7714
|
+
const fields = fill(ctx, plugins, page.blocks);
|
|
7655
7715
|
if (!fields) {
|
|
7656
7716
|
dropped.push({ type: block.type, reason: "sem conte\xFAdo na v1" });
|
|
7657
7717
|
continue;
|
|
@@ -7681,7 +7741,8 @@ function buildPages(ctx, input, plugins, report) {
|
|
|
7681
7741
|
path: page.path,
|
|
7682
7742
|
title,
|
|
7683
7743
|
seo: m.seo && Object.keys(m.seo).length ? m.seo : void 0,
|
|
7684
|
-
|
|
7744
|
+
// `fields` é obrigatório no schema, mesmo vazio: fica fora do compact (que tira objetos vazios).
|
|
7745
|
+
blocks: kept.map((b, i) => ({ ...compact({ id: ids[i], type: b.type, variant: b.variant, visible: true, source: b.source }), fields: b.fields ?? {} })),
|
|
7685
7746
|
published: true,
|
|
7686
7747
|
system: true,
|
|
7687
7748
|
createdAt: now,
|
|
@@ -7706,17 +7767,30 @@ function buildUiTexts(ctx, report, now) {
|
|
|
7706
7767
|
const v2 = UI_TEXT_MAP[key];
|
|
7707
7768
|
if (v2) {
|
|
7708
7769
|
if (out.some((t) => t.key === v2)) continue;
|
|
7709
|
-
out.push({ key: v2, value: ctx.t(key), updatedAt: now });
|
|
7770
|
+
out.push({ key: v2, value: adaptText(key, ctx.t(key)), updatedAt: now });
|
|
7710
7771
|
report.texts.ui.push({ v1: key, v2 });
|
|
7711
7772
|
} else if (!key.startsWith("admin.")) {
|
|
7712
7773
|
report.texts.unmapped.push({ key, pt: String(ctx.siteTexts.get(key)?.ptBR ?? ctx.projectTexts[key]?.pt ?? "").slice(0, 120) });
|
|
7713
7774
|
}
|
|
7714
7775
|
}
|
|
7776
|
+
for (const key of V1_LABELS) {
|
|
7777
|
+
const v2 = UI_TEXT_MAP[key];
|
|
7778
|
+
if (out.some((t) => t.key === v2)) continue;
|
|
7779
|
+
const value = adaptText(key, ctx.t(key));
|
|
7780
|
+
if (!hasText(value)) continue;
|
|
7781
|
+
if (Object.entries(value).every(([locale, text2]) => text2 === defaultUiText(v2, locale))) continue;
|
|
7782
|
+
out.push({ key: v2, value, updatedAt: now });
|
|
7783
|
+
report.texts.ui.push({ v1: key, v2 });
|
|
7784
|
+
}
|
|
7715
7785
|
return out;
|
|
7716
7786
|
}
|
|
7787
|
+
function adaptText(key, value) {
|
|
7788
|
+
const adapt = UI_TEXT_ADAPT[key];
|
|
7789
|
+
return adapt ? mapLoc(value, adapt) : value;
|
|
7790
|
+
}
|
|
7717
7791
|
function convertV1(input) {
|
|
7718
7792
|
const t = input.tables;
|
|
7719
|
-
const ctx = new Ctx(t, input.projectTexts);
|
|
7793
|
+
const ctx = new Ctx(t, input.projectTexts, input.storage);
|
|
7720
7794
|
const report = { tables: [], pages: [], texts: { sectionKeys: 0, ui: [], unmapped: [] }, plugins: [], pending: [], dropped: [], unknownTables: [], warnings: ctx.warnings };
|
|
7721
7795
|
const now = input.now ?? Date.now();
|
|
7722
7796
|
const out = {};
|
|
@@ -7756,7 +7830,7 @@ function convertV1(input) {
|
|
|
7756
7830
|
report.plugins = plugins.report;
|
|
7757
7831
|
const settings = convertSettings(ctx, input, plugins.record);
|
|
7758
7832
|
const pages = buildPages(ctx, input, plugins.record, report);
|
|
7759
|
-
settings.navigation = navigationFromPages(pages);
|
|
7833
|
+
settings.navigation = v1Navigation(navigationFromPages(pages));
|
|
7760
7834
|
put("siteSettings", "", [compact({ ...settings, updatedAt: now })]);
|
|
7761
7835
|
put("pages", "", pages);
|
|
7762
7836
|
put("uiTexts", "", buildUiTexts(ctx, report, now));
|
|
@@ -7777,7 +7851,7 @@ function convertV1(input) {
|
|
|
7777
7851
|
for (const u of report.unknownTables) ctx.warnings.push(`Tabela pr\xF3pria do projeto na v1 (${u.table}, ${u.count} documentos): n\xE3o convertida. Leve-a para o convex/ do projeto v2 (schema e fun\xE7\xF5es) e importe \xE0 parte.`);
|
|
7778
7852
|
return { tables: out, sources, pending, report };
|
|
7779
7853
|
}
|
|
7780
|
-
var V1_TEXTS, PT, EN, LOCALES, V1_PLUGIN_DEFAULTS, TABLE_MAP, DROPPED_TABLES, str2, hasText, compact, meta2, lifecycle, MONTHS, PRESENT, Ctx, CASE_SECTIONS, link2, ABOUT_TEXT, SECTION_FILLERS, PAGE_META, SECTION_KEYS, UI_TEXT_MAP;
|
|
7854
|
+
var V1_TEXTS, PT, EN, LOCALES, V1_PLUGIN_DEFAULTS, TABLE_MAP, DROPPED_TABLES, str2, V1_NAV_ORDER, hasText, compact, meta2, lifecycle, MONTHS, PRESENT, Ctx, CASE_SECTIONS, link2, ABOUT_TEXT, RESULT_UNITS, NUMBER_WITH_UNIT, RESUME_SUMMARY, hasHeader, header, HOME_METRICS, SECTION_FILLERS, PAGE_META, SECTION_KEYS, UI_TEXT_MAP, V1_LABELS, UI_TEXT_ADAPT;
|
|
7781
7855
|
var init_convert = __esm({
|
|
7782
7856
|
"src/migrate/convert.ts"() {
|
|
7783
7857
|
"use strict";
|
|
@@ -7840,6 +7914,7 @@ var init_convert = __esm({
|
|
|
7840
7914
|
contactInfo: "convertido nas configura\xE7\xF5es do site (pessoa, redes)"
|
|
7841
7915
|
};
|
|
7842
7916
|
str2 = (v) => typeof v === "string" && v.trim() ? v : void 0;
|
|
7917
|
+
V1_NAV_ORDER = ["/", "/curriculo", "/portfolio", "/sobre", "/blog"];
|
|
7843
7918
|
hasText = (l) => Object.keys(l).length > 0;
|
|
7844
7919
|
compact = (doc) => Object.fromEntries(Object.entries(doc).filter(([, v]) => v !== void 0 && !(typeof v === "object" && v !== null && !Array.isArray(v) && Object.keys(v).length === 0)));
|
|
7845
7920
|
meta2 = (d) => ({ _id: d._id, _creationTime: d._creationTime });
|
|
@@ -7873,9 +7948,10 @@ var init_convert = __esm({
|
|
|
7873
7948
|
};
|
|
7874
7949
|
PRESENT = /atual|presente|present|hoje|now|current|o momento|em andamento/i;
|
|
7875
7950
|
Ctx = class {
|
|
7876
|
-
constructor(tables, projectTexts = {}) {
|
|
7951
|
+
constructor(tables, projectTexts = {}, storage = []) {
|
|
7877
7952
|
this.tables = tables;
|
|
7878
7953
|
this.projectTexts = projectTexts;
|
|
7954
|
+
for (const f of storage) if (typeof f.internalId === "string" && typeof f._id === "string") this.storageByUrlId.set(f.internalId, f._id);
|
|
7879
7955
|
for (const f of tables.imageFolders ?? []) this.folders.set(f._id, f.path);
|
|
7880
7956
|
for (const m of tables.imageMetadata ?? []) this.media.set(m._id, m);
|
|
7881
7957
|
for (const t of tables.siteTexts ?? []) this.siteTexts.set(t.key, t);
|
|
@@ -7892,13 +7968,25 @@ var init_convert = __esm({
|
|
|
7892
7968
|
home = /* @__PURE__ */ new Map();
|
|
7893
7969
|
config = /* @__PURE__ */ new Map();
|
|
7894
7970
|
contact;
|
|
7971
|
+
/** `internalId` (o UUID das URLs `/api/storage/<uuid>` da v1) → id do arquivo, que o import mantém. */
|
|
7972
|
+
storageByUrlId = /* @__PURE__ */ new Map();
|
|
7973
|
+
/** O `site_title` da v1, que o componente SEO punha no fim dos títulos. */
|
|
7974
|
+
get siteTitle() {
|
|
7975
|
+
return str2(this.config.get("site_title"));
|
|
7976
|
+
}
|
|
7895
7977
|
/** Imagem da biblioteca da v1 (id do imageMetadata), ou só a URL. */
|
|
7978
|
+
/** Arquivo do export a partir de uma URL do storage da v1 (que deixa de existir com o banco velho). */
|
|
7979
|
+
storageIdFromUrl(url) {
|
|
7980
|
+
const m = /\/api\/storage\/([0-9a-f-]{36})/i.exec(str2(url) ?? "");
|
|
7981
|
+
return m ? this.storageByUrlId.get(m[1].toLowerCase()) : void 0;
|
|
7982
|
+
}
|
|
7896
7983
|
image(imageId, url) {
|
|
7897
7984
|
const m = imageId ? this.media.get(imageId) : void 0;
|
|
7898
7985
|
if (!m && !str2(url)) return void 0;
|
|
7986
|
+
const fromUrl = m?.storageId ? void 0 : this.storageIdFromUrl(url);
|
|
7899
7987
|
return compact({
|
|
7900
|
-
url: str2(url) ?? "",
|
|
7901
|
-
storageId: m?.storageId,
|
|
7988
|
+
url: fromUrl ? "" : str2(url) ?? "",
|
|
7989
|
+
storageId: m?.storageId ?? fromUrl,
|
|
7902
7990
|
alt: m?.altText ? loc(m.altText) : void 0,
|
|
7903
7991
|
width: m?.width,
|
|
7904
7992
|
height: m?.height
|
|
@@ -7945,7 +8033,49 @@ var init_convert = __esm({
|
|
|
7945
8033
|
{ field: "learnings", key: "portfolio.learnings" }
|
|
7946
8034
|
];
|
|
7947
8035
|
link2 = (label, href) => hasText(label) ? { label, href } : void 0;
|
|
7948
|
-
ABOUT_TEXT = (ctx) => mapLoc(
|
|
8036
|
+
ABOUT_TEXT = (ctx) => mapLoc(
|
|
8037
|
+
locAny(ctx.home.get("about_text")),
|
|
8038
|
+
(text2) => /<(p|h[1-6]|ul|ol|div|blockquote)[\s>]/i.test(text2) ? text2 : text2.split(/\n\s*\n/).map((p) => p.trim()).filter(Boolean).map((p) => `<p>${highlightNumbersHtml(p).replace(/\n/g, "<br>")}</p>`).join("")
|
|
8039
|
+
);
|
|
8040
|
+
RESULT_UNITS = [
|
|
8041
|
+
"skills",
|
|
8042
|
+
"automa\xE7\xF5es",
|
|
8043
|
+
"\xE1reas",
|
|
8044
|
+
"chamados",
|
|
8045
|
+
"horas",
|
|
8046
|
+
"minutos",
|
|
8047
|
+
"meses",
|
|
8048
|
+
"anos",
|
|
8049
|
+
"iniciativas",
|
|
8050
|
+
"pessoas",
|
|
8051
|
+
"times",
|
|
8052
|
+
"sistemas",
|
|
8053
|
+
"projetos",
|
|
8054
|
+
"automations",
|
|
8055
|
+
"areas",
|
|
8056
|
+
"tickets",
|
|
8057
|
+
"hours",
|
|
8058
|
+
"minutes",
|
|
8059
|
+
"months",
|
|
8060
|
+
"years",
|
|
8061
|
+
"initiatives",
|
|
8062
|
+
"people",
|
|
8063
|
+
"teams",
|
|
8064
|
+
"systems",
|
|
8065
|
+
"projects"
|
|
8066
|
+
];
|
|
8067
|
+
NUMBER_WITH_UNIT = new RegExp(`(?<![\\p{L}\\d.])~?\\d+(?:[.,]\\d+)*\\+?\\s(?:${RESULT_UNITS.join("|")})(?![\\p{L}])`, "gu");
|
|
8068
|
+
RESUME_SUMMARY = (ctx) => mapLoc(locAny(ctx.home.get("about_text")), (text2) => {
|
|
8069
|
+
const first = text2.split(/\n\s*\n/).map((p) => p.trim()).find(Boolean);
|
|
8070
|
+
return first ? `<p>${highlightNumbersHtml(first)}</p>` : "";
|
|
8071
|
+
});
|
|
8072
|
+
hasHeader = (recipe) => recipe?.[0]?.type === "hero";
|
|
8073
|
+
header = (ctx, prefix) => compact({ title: ctx.t(`${prefix}.title`), subtitle: hasText(ctx.t(`${prefix}.subtitle`)) ? ctx.t(`${prefix}.subtitle`) : void 0 });
|
|
8074
|
+
HOME_METRICS = (ctx) => {
|
|
8075
|
+
const metrics = ctx.home.get("home_metrics") ?? [];
|
|
8076
|
+
if (!metrics.length) return null;
|
|
8077
|
+
return { items: metrics.slice(0, 8).map((m) => ({ value: String(m.value), label: loc(m.label, m.labelTranslations) })) };
|
|
8078
|
+
};
|
|
7949
8079
|
SECTION_FILLERS = {
|
|
7950
8080
|
"/": {
|
|
7951
8081
|
hero: (ctx, plugins) => {
|
|
@@ -7953,7 +8083,8 @@ var init_convert = __esm({
|
|
|
7953
8083
|
const availability = ctx.home.get("availability_status");
|
|
7954
8084
|
const title = ctx.t("home.hero.headline");
|
|
7955
8085
|
return compact({
|
|
7956
|
-
|
|
8086
|
+
// O selo da v1 é o texto home.greeting ("whoami"), não o cargo (que aparece abaixo).
|
|
8087
|
+
eyebrow: ctx.t("home.greeting"),
|
|
7957
8088
|
title: hasText(title) ? title : loc(ctx.home.get("hero_title")),
|
|
7958
8089
|
subtitle: ctx.t("home.hero.description"),
|
|
7959
8090
|
primaryCta: plugins.portfolio !== false ? link2(ctx.t("home.hero.ctaCases"), "#cases") : void 0,
|
|
@@ -7962,11 +8093,7 @@ var init_convert = __esm({
|
|
|
7962
8093
|
showAvailability: availability?.available === true
|
|
7963
8094
|
});
|
|
7964
8095
|
},
|
|
7965
|
-
numeros:
|
|
7966
|
-
const metrics = ctx.home.get("home_metrics") ?? [];
|
|
7967
|
-
if (!metrics.length) return null;
|
|
7968
|
-
return { items: metrics.slice(0, 8).map((m) => ({ value: String(m.value), label: loc(m.label, m.labelTranslations) })) };
|
|
7969
|
-
},
|
|
8096
|
+
numeros: HOME_METRICS,
|
|
7970
8097
|
cases: (ctx) => compact({ anchor: "cases", title: ctx.t("home.cases.title"), cta: link2(ctx.t("home.cases.viewAll"), "/portfolio") }),
|
|
7971
8098
|
texto: (ctx) => {
|
|
7972
8099
|
const body = ABOUT_TEXT(ctx);
|
|
@@ -7997,22 +8124,43 @@ var init_convert = __esm({
|
|
|
7997
8124
|
"lista-itens": (ctx) => {
|
|
7998
8125
|
const items = (ctx.home.get("work_principles") ?? []).filter((p) => str2(p.title));
|
|
7999
8126
|
if (!items.length) return null;
|
|
8000
|
-
return { title: ctx.t("about.principles.title"), numbered:
|
|
8127
|
+
return { title: ctx.t("about.principles.title"), numbered: false, items: items.slice(0, 12).map((p) => compact({ title: loc(p.title, p.titleTranslations), body: loc(p.description, p.descriptionTranslations) })) };
|
|
8001
8128
|
},
|
|
8002
8129
|
galeria: (ctx) => ({ title: ctx.t("about.dailyRoutine.title") }),
|
|
8003
8130
|
faq: (ctx) => ({ title: ctx.t("about.faq.title") })
|
|
8004
8131
|
},
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
"/
|
|
8008
|
-
|
|
8132
|
+
// A página da v1: título e apoio, o resumo (1º parágrafo do "sobre"), os números e o PDF no
|
|
8133
|
+
// topo, depois o currículo. Numa receita sem o cabeçalho (hero), o título fica no currículo.
|
|
8134
|
+
"/curriculo": {
|
|
8135
|
+
hero: (ctx) => header(ctx, "resume"),
|
|
8136
|
+
texto: (ctx) => {
|
|
8137
|
+
const body = RESUME_SUMMARY(ctx);
|
|
8138
|
+
return hasText(body) ? { body } : null;
|
|
8139
|
+
},
|
|
8140
|
+
numeros: HOME_METRICS,
|
|
8141
|
+
curriculo: (ctx, _plugins, recipe) => hasHeader(recipe) ? { showDownload: true } : { title: ctx.t("resume.title"), intro: ctx.t("resume.subtitle"), showDownload: true }
|
|
8142
|
+
},
|
|
8143
|
+
// Páginas de lista: com um cabeçalho (hero) na receita, o título e o apoio da v1 vão para ele.
|
|
8144
|
+
"/portfolio": {
|
|
8145
|
+
hero: (ctx) => header(ctx, "portfolio"),
|
|
8146
|
+
cases: (ctx, _p, recipe) => hasHeader(recipe) ? {} : { title: ctx.t("portfolio.title"), intro: ctx.t("portfolio.subtitle") }
|
|
8147
|
+
},
|
|
8148
|
+
"/blog": {
|
|
8149
|
+
hero: (ctx) => header(ctx, "blog"),
|
|
8150
|
+
"posts-recentes": (ctx, _p, recipe) => hasHeader(recipe) ? { showTagFilter: true } : { title: ctx.t("blog.title"), intro: ctx.t("blog.subtitle"), showTagFilter: true }
|
|
8151
|
+
},
|
|
8152
|
+
"/depoimentos": {
|
|
8153
|
+
hero: (ctx) => header(ctx, "testimonials"),
|
|
8154
|
+
depoimentos: (ctx, plugins, recipe) => compact({ ...hasHeader(recipe) ? {} : { title: ctx.t("testimonials.title"), intro: ctx.t("testimonials.subtitle") }, allowSubmission: plugins["testimonials-intake"] !== false })
|
|
8155
|
+
}
|
|
8009
8156
|
};
|
|
8010
8157
|
PAGE_META = {
|
|
8011
|
-
|
|
8012
|
-
"/
|
|
8013
|
-
"/
|
|
8014
|
-
"/
|
|
8015
|
-
"/
|
|
8158
|
+
// O título e a descrição da home ficavam no siteConfig, sem tradução: valiam nos dois idiomas.
|
|
8159
|
+
"/": (ctx) => ({ title: ctx.t("navigation.home"), seo: compact({ title: sameInBoth(loc(ctx.config.get("seo_home_title"))), description: sameInBoth(loc(ctx.config.get("seo_home_description"))) }) }),
|
|
8160
|
+
"/sobre": (ctx) => ({ title: ctx.t("navigation.about"), seo: compact({ title: v1FullTitle(ctx.t("seo.aboutTitle"), ctx.siteTitle), description: ctx.t("seo.aboutDescription") }) }),
|
|
8161
|
+
"/curriculo": (ctx) => ({ title: ctx.t("navigation.resume"), seo: compact({ title: v1FullTitle(ctx.t("seo.resumeTitle"), ctx.siteTitle), description: ctx.t("seo.resumeDescription") }) }),
|
|
8162
|
+
"/portfolio": (ctx) => ({ title: ctx.t("navigation.portfolio"), seo: compact({ title: v1FullTitle(ctx.t("seo.portfolioTitle"), ctx.siteTitle), description: ctx.t("seo.portfolioDescription") }) }),
|
|
8163
|
+
"/blog": (ctx) => ({ title: ctx.t("navigation.blog"), seo: compact({ title: v1FullTitle(ctx.t("seo.blogTitle"), ctx.siteTitle), description: ctx.t("seo.blogDescription") }) }),
|
|
8016
8164
|
"/depoimentos": (ctx) => ({ title: ctx.t("testimonials.title"), seo: compact({ description: ctx.t("seo.testimonialsDescription") }) })
|
|
8017
8165
|
};
|
|
8018
8166
|
SECTION_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -8044,6 +8192,7 @@ var init_convert = __esm({
|
|
|
8044
8192
|
"portfolio.subtitle",
|
|
8045
8193
|
"testimonials.title",
|
|
8046
8194
|
"testimonials.subtitle",
|
|
8195
|
+
"home.greeting",
|
|
8047
8196
|
"navigation.home",
|
|
8048
8197
|
"navigation.about",
|
|
8049
8198
|
"navigation.resume",
|
|
@@ -8080,6 +8229,13 @@ var init_convert = __esm({
|
|
|
8080
8229
|
"resume.courses": "resume.certification",
|
|
8081
8230
|
"resume.languages": "resume.language",
|
|
8082
8231
|
"resume.downloadCV": "resume.download",
|
|
8232
|
+
"resume.softSkills": "resume.soft-skill",
|
|
8233
|
+
"resume.volunteer": "resume.volunteer",
|
|
8234
|
+
"resume.showOlder": "resume.showOlder",
|
|
8235
|
+
"resume.hideOlder": "resume.hideOlder",
|
|
8236
|
+
"contactWizard.trigger": "sidebar.talk",
|
|
8237
|
+
"sidebar.downloadCV": "sidebar.downloadCV",
|
|
8238
|
+
"portfolio.screenshots": "case.gallery",
|
|
8083
8239
|
"home.cases.read": "case.view",
|
|
8084
8240
|
"blog.filterByTags": "blog.filter",
|
|
8085
8241
|
"sidebar.language": "nav.language",
|
|
@@ -8095,6 +8251,26 @@ var init_convert = __esm({
|
|
|
8095
8251
|
"portfolio.myRole": "case.role",
|
|
8096
8252
|
"home.availability.label": "hero.available"
|
|
8097
8253
|
};
|
|
8254
|
+
V1_LABELS = [
|
|
8255
|
+
"resume.experience",
|
|
8256
|
+
"resume.education",
|
|
8257
|
+
"resume.skills",
|
|
8258
|
+
"resume.softSkills",
|
|
8259
|
+
"resume.courses",
|
|
8260
|
+
"resume.languages",
|
|
8261
|
+
"resume.volunteer",
|
|
8262
|
+
"resume.downloadCV",
|
|
8263
|
+
"resume.showOlder",
|
|
8264
|
+
"resume.hideOlder",
|
|
8265
|
+
"contactWizard.trigger",
|
|
8266
|
+
"sidebar.downloadCV",
|
|
8267
|
+
"testimonials.leaveTestimonial",
|
|
8268
|
+
"portfolio.screenshots",
|
|
8269
|
+
"blog.filterByTags"
|
|
8270
|
+
];
|
|
8271
|
+
UI_TEXT_ADAPT = {
|
|
8272
|
+
"resume.showOlder": (s) => s.includes("{count}") ? s : `${s} ({count})`
|
|
8273
|
+
};
|
|
8098
8274
|
}
|
|
8099
8275
|
});
|
|
8100
8276
|
|
|
@@ -8528,6 +8704,10 @@ function pendingZip(result, source) {
|
|
|
8528
8704
|
const tableNumbers = Object.fromEntries(Object.keys(result.pending).filter((t) => source.tableNumbers[t] !== void 0).map((t) => [t, source.tableNumbers[t]]));
|
|
8529
8705
|
return snapshotZip({ tables: result.pending, tableNumbers, storage: {} });
|
|
8530
8706
|
}
|
|
8707
|
+
function storageDocs(snapshot) {
|
|
8708
|
+
const bytes = snapshot.storage["_storage/documents.jsonl"];
|
|
8709
|
+
return bytes ? parseJsonl(strFromU8(bytes)) : [];
|
|
8710
|
+
}
|
|
8531
8711
|
var toJsonl;
|
|
8532
8712
|
var init_snapshot = __esm({
|
|
8533
8713
|
"src/migrate/snapshot.ts"() {
|
|
@@ -8641,7 +8821,7 @@ function renderReport(input) {
|
|
|
8641
8821
|
out.push("");
|
|
8642
8822
|
}
|
|
8643
8823
|
} else {
|
|
8644
|
-
out.push("## Dados", "", "Sem export da v1 ainda. Rode `npx convex export --path .rubrica/migracao/export-v1.zip` (
|
|
8824
|
+
out.push("## Dados", "", "Sem export da v1 ainda. Rode `npx convex export --prod --include-file-storage --path .rubrica/migracao/export-v1.zip` (do banco com o conte\xFAdo de verdade, em geral a produ\xE7\xE3o; o export s\xF3 l\xEA) e depois `npx create-rubrica migrar dados --export .rubrica/migracao/export-v1.zip`.", "");
|
|
8645
8825
|
}
|
|
8646
8826
|
out.push("## Personaliza\xE7\xF5es (comparando com a v1 de refer\xEAncia)", "");
|
|
8647
8827
|
if (input.customizationsError) out.push(`N\xE3o deu para comparar: ${input.customizationsError}`, "");
|
|
@@ -8741,6 +8921,7 @@ var migrate_exports = {};
|
|
|
8741
8921
|
__export(migrate_exports, {
|
|
8742
8922
|
BRANCH: () => BRANCH,
|
|
8743
8923
|
LAST_V1: () => LAST_V1,
|
|
8924
|
+
MIGRATE_HELP: () => MIGRATE_HELP,
|
|
8744
8925
|
WORK_DIR: () => WORK_DIR,
|
|
8745
8926
|
convertExport: () => convertExport,
|
|
8746
8927
|
readV1: () => readV1,
|
|
@@ -8801,7 +8982,7 @@ function v2StateFrom(v1, theme, plugins, now = /* @__PURE__ */ new Date()) {
|
|
|
8801
8982
|
}
|
|
8802
8983
|
function convertExport(exportPath, v1, theme, recipe, outDir, storageUrl, texts) {
|
|
8803
8984
|
const snapshot = readSnapshot(exportPath);
|
|
8804
|
-
const result = convertV1({ tables: snapshot.tables, v1, theme, recipe, ...texts?.texts && { projectTexts: texts.texts } });
|
|
8985
|
+
const result = convertV1({ tables: snapshot.tables, storage: storageDocs(snapshot), v1, theme, recipe, ...texts?.texts && { projectTexts: texts.texts } });
|
|
8805
8986
|
result.report.warnings.push(...texts?.warnings ?? []);
|
|
8806
8987
|
mkdirSync3(outDir, { recursive: true });
|
|
8807
8988
|
const files = {};
|
|
@@ -8831,7 +9012,8 @@ async function customizationsFor(projectDir, v1, packageName, deps, templateDir)
|
|
|
8831
9012
|
const dir = mkdtempSync(join24(tmpdir2(), "rubrica-v1-pristine-"));
|
|
8832
9013
|
try {
|
|
8833
9014
|
await (deps.pristine ?? defaultPristine)(dir, v1, packageName, templateDir);
|
|
8834
|
-
|
|
9015
|
+
const templateRoots = new Set(readdirSync6(dir));
|
|
9016
|
+
return { list: listCustomizations(projectDir, dir, gitFiles(projectDir, deps.runner ?? run)), templateRoots };
|
|
8835
9017
|
} catch (err) {
|
|
8836
9018
|
return { error: `${err.message}${templateDir ? "" : " (sem internet? passe --template-v1 <pasta com o reposit\xF3rio do Rubrica>)"}` };
|
|
8837
9019
|
} finally {
|
|
@@ -8863,7 +9045,7 @@ async function runReport(projectDir, values, deps) {
|
|
|
8863
9045
|
if (values.export) {
|
|
8864
9046
|
const snapshot = readSnapshot(resolve3(deps.cwd, values.export));
|
|
8865
9047
|
const texts = readV1ProjectTexts(projectDir, resolve3(projectDir, WORK_DIR));
|
|
8866
|
-
data = convertV1({ tables: snapshot.tables, v1, theme: theme.tema, recipe: CORE_RECIPES.pessoal, ...texts.texts && { projectTexts: texts.texts } }).report;
|
|
9048
|
+
data = convertV1({ tables: snapshot.tables, storage: storageDocs(snapshot), v1, theme: theme.tema, recipe: CORE_RECIPES.pessoal, ...texts.texts && { projectTexts: texts.texts } }).report;
|
|
8867
9049
|
data.warnings.push(...texts.warnings);
|
|
8868
9050
|
}
|
|
8869
9051
|
const report = renderReport({
|
|
@@ -8877,7 +9059,7 @@ async function runReport(projectDir, values, deps) {
|
|
|
8877
9059
|
nextSteps: [
|
|
8878
9060
|
v1.version === LAST_V1 ? "A v1 est\xE1 na \xFAltima vers\xE3o: d\xE1 para migrar." : `Atualize a v1 para a ${LAST_V1} antes (npx create-rubrica@1 update).`,
|
|
8879
9061
|
"Fa\xE7a commit de tudo e rode `npx create-rubrica@latest migrar` (cria a branch rubrica-v2; nada muda na branch atual).",
|
|
8880
|
-
...values.export ? [] : ["Exporte os dados do
|
|
9062
|
+
...values.export ? [] : ["Exporte os dados da v1 do banco com o conte\xFAdo de verdade, em geral a produ\xE7\xE3o (`npx convex export --prod --include-file-storage --path .rubrica/migracao/export-v1.zip`; o export s\xF3 l\xEA) para ver no relat\xF3rio o que eles viram."]
|
|
8881
9063
|
]
|
|
8882
9064
|
});
|
|
8883
9065
|
if (values.saida) writeFileSync7(resolve3(deps.cwd, values.saida), report);
|
|
@@ -8895,7 +9077,7 @@ async function runCompare(values, deps) {
|
|
|
8895
9077
|
return formatComparison(results.filter((r) => r.missing !== "v1"));
|
|
8896
9078
|
}
|
|
8897
9079
|
async function runData(projectDir, values, deps) {
|
|
8898
|
-
if (!values.export) throw new Cancelled(`Uso: npx create-rubrica migrar dados --export <arquivo.zip>. Para gerar o export: npx convex export --path ${WORK_DIR}/export-v1.zip`);
|
|
9080
|
+
if (!values.export) throw new Cancelled(`Uso: npx create-rubrica migrar dados --export <arquivo.zip>. Para gerar o export (s\xF3 l\xEA; em geral da produ\xE7\xE3o): npx convex export --prod --include-file-storage --path ${WORK_DIR}/export-v1.zip`);
|
|
8899
9081
|
const raw = JSON.parse(readFileSync16(join24(projectDir, STATE_FILE), "utf-8"));
|
|
8900
9082
|
const migrated = raw.rubrica === 2 ? raw : null;
|
|
8901
9083
|
const v1 = migrated ? raw.v1 ?? { layout: migrated.migracao?.layoutV1 ?? "", version: migrated.migracao?.de } : readV1(projectDir);
|
|
@@ -8954,7 +9136,16 @@ async function runFull(projectDir, values, flags, deps) {
|
|
|
8954
9136
|
}
|
|
8955
9137
|
const previous = JSON.parse(readFileSync16(join24(projectDir, "package.json"), "utf-8"));
|
|
8956
9138
|
const oldGitignore = existsSync17(join24(projectDir, ".gitignore")) ? readFileSync16(join24(projectDir, ".gitignore"), "utf-8") : "";
|
|
8957
|
-
|
|
9139
|
+
const kept = [];
|
|
9140
|
+
for (const entry of readdirSync6(projectDir)) {
|
|
9141
|
+
if (KEEP.has(entry)) continue;
|
|
9142
|
+
if (custom.templateRoots && !custom.templateRoots.has(entry)) {
|
|
9143
|
+
kept.push(entry);
|
|
9144
|
+
continue;
|
|
9145
|
+
}
|
|
9146
|
+
rmSync3(join24(projectDir, entry), { recursive: true, force: true });
|
|
9147
|
+
}
|
|
9148
|
+
if (kept.length) log2.info(`Ficaram na raiz (n\xE3o s\xE3o do template da v1): ${kept.join(", ")}`);
|
|
8958
9149
|
rmSync3(join24(projectDir, "public", "data"), { recursive: true, force: true });
|
|
8959
9150
|
const state = v2StateFrom(v1, theme);
|
|
8960
9151
|
const depSpecs = values.local ? localDependencySpecs(resolve3(deps.cwd, values.local), theme.tema) : defaultDependencySpecs();
|
|
@@ -8976,6 +9167,7 @@ ${extra.join("\n")}
|
|
|
8976
9167
|
if (!flags.has("sem-instalar")) {
|
|
8977
9168
|
s.start(`Instalando com o ${pm}...`);
|
|
8978
9169
|
try {
|
|
9170
|
+
rmSync3(join24(projectDir, "node_modules"), { recursive: true, force: true });
|
|
8979
9171
|
runner(pm, ["install"], { cwd: projectDir });
|
|
8980
9172
|
s.stop("Instalado.");
|
|
8981
9173
|
const core = await loadInstalledCore(projectDir);
|
|
@@ -9022,7 +9214,7 @@ ${tail(errorOutput(err))}`);
|
|
|
9022
9214
|
...custom.error && { customizationsError: custom.error },
|
|
9023
9215
|
outputs: { ...data?.files ?? {}, Relat\u00F3rio: join24(outDir, "relatorio.md") },
|
|
9024
9216
|
nextSteps: [
|
|
9025
|
-
...data ? [] : [`Exporte os dados da v1
|
|
9217
|
+
...data ? [] : [`Exporte os dados da v1 do banco com o conte\xFAdo de verdade, em geral a produ\xE7\xE3o (o export s\xF3 l\xEA): \`npx convex export --prod --include-file-storage --path ${WORK_DIR}/export-v1.zip\`, e rode \`npx create-rubrica migrar dados --export ${WORK_DIR}/export-v1.zip\`.`],
|
|
9026
9218
|
`Build com os dados convertidos: ${build}. Compare com o site no ar: \`npx create-rubrica migrar conferir --v1 ${v1.identity?.siteUrl ?? "<url da v1>"} --v2 dist\`.`,
|
|
9027
9219
|
...importSteps(join24(WORK_DIR), projectPackageManager(projectDir)),
|
|
9028
9220
|
"Para cada personaliza\xE7\xE3o listada, siga a sugest\xE3o (bloco pr\xF3prio, ejetar, tokens). Depois: pnpm check, pnpm test, commit na branch rubrica-v2."
|
|
@@ -9036,6 +9228,10 @@ O Convex n\xE3o foi tocado: siga os pr\xF3ximos passos do relat\xF3rio.`);
|
|
|
9036
9228
|
}
|
|
9037
9229
|
async function runMigrate(argv, deps) {
|
|
9038
9230
|
const out = deps.out ?? ((t) => console.log(t));
|
|
9231
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
9232
|
+
out(MIGRATE_HELP);
|
|
9233
|
+
return;
|
|
9234
|
+
}
|
|
9039
9235
|
const args = parseArgs(argv, {
|
|
9040
9236
|
values: ["export", "template-v1", "saida", "v1", "v2", "local", "convex-url"],
|
|
9041
9237
|
flags: ["relatorio", "yes", "sem-instalar", "sem-build"],
|
|
@@ -9070,7 +9266,7 @@ async function runMigrate(argv, deps) {
|
|
|
9070
9266
|
}
|
|
9071
9267
|
await runFull(projectDir, args.values, args.flags, deps);
|
|
9072
9268
|
}
|
|
9073
|
-
var LAST_V1, BRANCH, WORK_DIR, KEEP;
|
|
9269
|
+
var LAST_V1, BRANCH, WORK_DIR, KEEP, MIGRATE_HELP;
|
|
9074
9270
|
var init_migrate = __esm({
|
|
9075
9271
|
"src/commands/migrate.ts"() {
|
|
9076
9272
|
"use strict";
|
|
@@ -9101,6 +9297,21 @@ var init_migrate = __esm({
|
|
|
9101
9297
|
BRANCH = "rubrica-v2";
|
|
9102
9298
|
WORK_DIR = ".rubrica/migracao";
|
|
9103
9299
|
KEEP = /* @__PURE__ */ new Set([".git", "public", "docs", "README.md", "LICENSE", ".agents", ".claude", ".github", ".rubrica", "node_modules", ".env.local", ".env", ".vscode", ".idea"]);
|
|
9300
|
+
MIGRATE_HELP = `Uso: npx create-rubrica@latest migrar [op\xE7\xF5es]
|
|
9301
|
+
|
|
9302
|
+
Leva um projeto da v1 (1.13.1) para a v2, numa branch nova (rubrica-v2). O Convex n\xE3o \xE9 tocado.
|
|
9303
|
+
|
|
9304
|
+
--relatorio s\xF3 mostra o que vai acontecer (tema, personaliza\xE7\xF5es, dados), sem gravar
|
|
9305
|
+
--export <zip> export da v1 (npx convex export --prod --include-file-storage --path .rubrica/migracao/export-v1.zip)
|
|
9306
|
+
--yes, -y n\xE3o pede confirma\xE7\xE3o
|
|
9307
|
+
--sem-instalar n\xE3o instala as depend\xEAncias
|
|
9308
|
+
--sem-build n\xE3o faz o build de confer\xEAncia
|
|
9309
|
+
--saida <pasta> onde gravar os arquivos da migra\xE7\xE3o (padr\xE3o: .rubrica/migracao)
|
|
9310
|
+
|
|
9311
|
+
migrar dados --export <zip> s\xF3 converte os dados (sem trocar o c\xF3digo)
|
|
9312
|
+
migrar conferir --v1 <url> --v2 dist compara t\xEDtulo, h1 e texto das p\xE1ginas
|
|
9313
|
+
|
|
9314
|
+
Guia: https://userubrica.vercel.app/docs/guia/migrar`;
|
|
9104
9315
|
}
|
|
9105
9316
|
});
|
|
9106
9317
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-rubrica",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "CLI do Rubrica v2: cria, configura, publica, atualiza e migra sites feitos com @rubrica/core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"tsup": "^8.3.0",
|
|
47
47
|
"typescript": "^5.9.0",
|
|
48
48
|
"vitest": "^3.2.4",
|
|
49
|
-
"@rubrica/core": "^2.
|
|
49
|
+
"@rubrica/core": "^2.1.0"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsup",
|