create-rubrica 0.3.16 → 0.3.17

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +35 -42
  3. package/package.json +11 -11
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # create-rubrica
2
2
 
3
- CLI para criar e configurar projetos [Rubrica](https://github.com/matheusmierzwa/rubrica) — sistema de portfólio profissional com React + Convex.
3
+ CLI para criar e configurar projetos [Rubrica](https://github.com/MierzwaMatheus/rubrica) — sistema de portfólio profissional com React + Convex.
4
4
 
5
5
  ## Instalação
6
6
 
package/dist/index.js CHANGED
@@ -156,8 +156,9 @@ var LAYOUT_FILES = {
156
156
  pages: ["Home.tsx", "Resume.tsx", "Portfolio.tsx", "About.tsx", "Blog.tsx"]
157
157
  },
158
158
  swiss: {
159
- copy: ["Layout.tsx", "Sidebar.tsx"],
160
- remove: ["Navbar.tsx", "Footer.tsx"]
159
+ copy: ["Layout.tsx", "Sidebar.tsx", "SwissShared.tsx"],
160
+ remove: ["Navbar.tsx", "Footer.tsx"],
161
+ pages: ["Home.tsx", "Resume.tsx", "Portfolio.tsx", "About.tsx", "Blog.tsx"]
161
162
  },
162
163
  bento: {
163
164
  copy: ["Layout.tsx", "FloatingDock.tsx"],
@@ -214,40 +215,34 @@ async function applyLayout(layout, options, fsModule = defaultFs) {
214
215
  // src/transforms/applyTheme.ts
215
216
  import * as nodeFsPromises2 from "fs/promises";
216
217
  var PRESETS = {
217
- "editorial-cream": {
218
- root: ` --bg: #faf7f2;
219
- --text: #1a1614;
220
- --primary: #a855f7;
221
- --accent: #ef4444;`,
222
- dark: ``
223
- },
224
- "paper-noir": {
225
- root: ` --bg: #f0eee9;
226
- --text: #0a0a0a;
227
- --primary: #ef4444;
228
- --accent: #3b82f6;`,
229
- dark: ``
230
- },
231
- "midnight-blue": {
232
- root: ` --bg: #0a1224;
233
- --text: #e8e6e0;
234
- --primary: #06b6d4;
235
- --accent: #facc15;`,
236
- dark: ``
237
- },
238
- "solar-warm": {
239
- root: ` --bg: #1a1410;
240
- --text: #f2ede4;
241
- --primary: #f97316;
242
- --accent: #facc15;`,
243
- dark: ``
244
- }
218
+ "editorial-cream": { "--bg": "#faf7f2", "--text": "#1a1614", "--primary": "#a855f7", "--accent": "#ef4444" },
219
+ "paper-noir": { "--bg": "#f0eee9", "--text": "#0a0a0a", "--primary": "#ef4444", "--accent": "#3b82f6" },
220
+ "midnight-blue": { "--bg": "#0a1224", "--text": "#e8e6e0", "--primary": "#06b6d4", "--accent": "#facc15" },
221
+ "solar-warm": { "--bg": "#1a1410", "--text": "#f2ede4", "--primary": "#f97316", "--accent": "#facc15" }
245
222
  };
246
- function replaceBlock(css, selector, newVars) {
247
- const re = new RegExp(`(${selector.replace(".", "\\.")} \\{)[^}]*(\\})`, "s");
248
- return css.replace(re, `$1
249
- ${newVars}
250
- $2`);
223
+ function escapeRegExp(s) {
224
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
225
+ }
226
+ function setVars(css, selector, vars, addMissing) {
227
+ const blockRe = new RegExp(`(^|\\n)(\\s*${escapeRegExp(selector)}\\s*\\{)([^}]*)(\\})`);
228
+ return css.replace(blockRe, (_m, lead, open, body, close) => {
229
+ let updated = body;
230
+ const missing = [];
231
+ for (const [name, value] of Object.entries(vars)) {
232
+ const declRe = new RegExp(`(^|[\\s;{])(${escapeRegExp(name)}\\s*:)[^;}]*`);
233
+ if (declRe.test(updated)) {
234
+ updated = updated.replace(declRe, `$1$2 ${value}`);
235
+ } else if (addMissing) {
236
+ missing.push(` ${name}: ${value};`);
237
+ }
238
+ }
239
+ if (missing.length) {
240
+ updated = `${updated.replace(/\s*$/, "")}
241
+ ${missing.join("\n")}
242
+ `;
243
+ }
244
+ return `${lead}${open}${updated}${close}`;
245
+ });
251
246
  }
252
247
  async function applyTheme(options, cssPath, fsModule = nodeFsPromises2) {
253
248
  const theme = PRESETS[options.preset];
@@ -255,10 +250,8 @@ async function applyTheme(options, cssPath, fsModule = nodeFsPromises2) {
255
250
  throw new Error(`applyTheme: preset "${options.preset}" n\xE3o encontrado.`);
256
251
  }
257
252
  const css = await fsModule.readFile(cssPath, "utf-8");
258
- let updated = replaceBlock(css, ":root", theme.root);
259
- if (theme.dark) {
260
- updated = replaceBlock(updated, ".dark", theme.dark);
261
- }
253
+ let updated = setVars(css, ":root", theme, true);
254
+ updated = setVars(updated, ".dark", theme, false);
262
255
  await fsModule.writeFile(cssPath, updated);
263
256
  }
264
257
 
@@ -1292,7 +1285,7 @@ async function runSetup(deps = {}) {
1292
1285
  try {
1293
1286
  execFileSync(
1294
1287
  "npx",
1295
- ["convex", "run", "siteConfig:setBatch", JSON.stringify({
1288
+ ["convex", "run", "siteConfig:setBatchInternal", JSON.stringify({
1296
1289
  items: [
1297
1290
  { key: "site_title", value: identity.siteName },
1298
1291
  { key: "site_name", value: identity.siteName },
@@ -1312,7 +1305,7 @@ async function runSetup(deps = {}) {
1312
1305
  try {
1313
1306
  execFileSync(
1314
1307
  "npx",
1315
- ["convex", "run", "contactInfo:update", JSON.stringify({
1308
+ ["convex", "run", "contactInfo:updateInternal", JSON.stringify({
1316
1309
  name: identity.authorName,
1317
1310
  email: identity.authorEmail || "",
1318
1311
  showEmail: false
@@ -1370,7 +1363,7 @@ async function runSetup(deps = {}) {
1370
1363
  try {
1371
1364
  execFileSync(
1372
1365
  "npx",
1373
- ["convex", "run", "contactInfo:update", JSON.stringify({ proposalAiContext: aiContext })],
1366
+ ["convex", "run", "contactInfo:updateInternal", JSON.stringify({ proposalAiContext: aiContext })],
1374
1367
  { stdio: "pipe" }
1375
1368
  );
1376
1369
  } catch {
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "create-rubrica",
3
- "version": "0.3.16",
3
+ "version": "0.3.17",
4
4
  "description": "CLI para criar e configurar projetos Rubrica — portfólio profissional com React + Convex",
5
5
  "type": "module",
6
6
  "bin": {
7
- "create-rubrica": "./dist/index.js",
8
- "rubrica": "./dist/index.js"
7
+ "create-rubrica": "dist/index.js",
8
+ "rubrica": "dist/index.js"
9
9
  },
10
10
  "files": [
11
11
  "dist/index.js",
@@ -21,15 +21,20 @@
21
21
  ],
22
22
  "author": "Matheus Mierzwa",
23
23
  "license": "MIT",
24
- "homepage": "https://github.com/matheusmierzwa/rubrica",
24
+ "homepage": "https://github.com/MierzwaMatheus/rubrica",
25
25
  "repository": {
26
26
  "type": "git",
27
- "url": "https://github.com/matheusmierzwa/rubrica.git",
27
+ "url": "git+https://github.com/MierzwaMatheus/rubrica.git",
28
28
  "directory": "cli"
29
29
  },
30
30
  "engines": {
31
31
  "node": ">=20"
32
32
  },
33
+ "scripts": {
34
+ "build": "tsup",
35
+ "test": "vitest run",
36
+ "dev": "tsup --watch"
37
+ },
33
38
  "dependencies": {
34
39
  "@clack/prompts": "^0.9.1",
35
40
  "jose": "^6.0.10"
@@ -42,10 +47,5 @@
42
47
  "tsup": "^8.3.0",
43
48
  "typescript": "^5.7.0",
44
49
  "vitest": "^3.0.0"
45
- },
46
- "scripts": {
47
- "build": "tsup",
48
- "test": "vitest run",
49
- "dev": "tsup --watch"
50
50
  }
51
- }
51
+ }