From d30acd832144816168a914a5c36d61e11bb101c6 Mon Sep 17 00:00:00 2001 From: digoarthur Date: Sat, 25 Oct 2025 11:24:20 +0100 Subject: [PATCH 01/44] feat: build example page --- examples/nextjs/page.tsx | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/nextjs/page.tsx b/examples/nextjs/page.tsx index 89dda9f..1c3fe05 100644 --- a/examples/nextjs/page.tsx +++ b/examples/nextjs/page.tsx @@ -5,7 +5,7 @@ import React from "react"; import { useGitHubAutomatedRepos, StackIcons, StackLabels } from "github-automated-repos"; -export default function Home() { +export default function Projects() { const { data, isLoading } = useGitHubAutomatedRepos('digoarthur', 'attached'); if (isLoading) return

Loading...

; diff --git a/package.json b/package.json index d4bc982..215b5b1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "github-automated-repos-cli", - "version": "1.0.0", + "version": "1.0.1", "description": "CLI para gerar página de exemplo usando github-automated-repos em projetos Next.js, React ou Vite", "bin": { "github-automated-repos-example": "bin/index.js" From ddfc3ae28bb11ed61eee20b0b9bd1b14d02bec90 Mon Sep 17 00:00:00 2001 From: digoarthur Date: Sun, 26 Oct 2025 11:38:37 +0000 Subject: [PATCH 02/44] feat (page): build example page ( WIP) --- bin/index.js | 8 +- example/page.tsx | 178 +++++++++++++++++++++++++++++++++++++++ examples/nextjs/page.tsx | 61 -------------- package.json | 4 +- 4 files changed, 184 insertions(+), 67 deletions(-) create mode 100644 example/page.tsx delete mode 100644 examples/nextjs/page.tsx diff --git a/bin/index.js b/bin/index.js index 65158d7..6e417e4 100755 --- a/bin/index.js +++ b/bin/index.js @@ -21,15 +21,15 @@ let targetDir; switch (framework) { case "next": - sourceDir = path.join(__dirname, "../examples/nextjs/page.tsx"); + sourceDir = path.join(__dirname, "../example/Project.tsx"); targetDir = path.join(process.cwd(), "src/app/projects/page.tsx"); break; case "react": - sourceDir = path.join(__dirname, "../examples/react/Project.jsx"); - targetDir = path.join(process.cwd(), "src/components/Project.jsx"); + sourceDir = path.join(__dirname, "../example/Project.tsx"); + targetDir = path.join(process.cwd(), "src/components/Project.tsx"); break; case "vite": - sourceDir = path.join(__dirname, "../examples/vite/Project.tsx"); + sourceDir = path.join(__dirname, "../example/Project.tsx"); targetDir = path.join(process.cwd(), "src/components/Project.tsx"); break; } diff --git a/example/page.tsx b/example/page.tsx new file mode 100644 index 0000000..32cefbf --- /dev/null +++ b/example/page.tsx @@ -0,0 +1,178 @@ +"use client"; +import React from "react"; + +"use client"; +import { useGitHubAutomatedRepos, StackIcons, StackLabels } from "github-automated-repos"; + + +export default function Projects() { + + const { data, isLoading } = useGitHubAutomatedRepos('digoarthur', 'attached'); + if (isLoading) return

Loading...

; + + return ( +
+ Header + + {/* === 🔹 ELEGANT INSTRUCTION CARDS === */} +
+ + {/* CARD 1 */} +
+
1
+

Set up the Hook

+

+ In the code, adjust the gitHubUsername and keyword in the hook — the keyword is chosen by you. +

+ + useGitHubAutomatedRepos + ( + "your-user" + , + "your-keyword" + ) + +
+ + {/* CARD 2 */} +
+
2
+ +

Select Your Repositories

+ +

+ Don’t forget to fill in: +

+ +
    +
  • Repository description
  • +
  • Project banner /public/bannerXYZ.png
  • +
  • Technology logos (Topics)
  • +
    + react-icons + .NET Core + MySQL + MongoDB + Linux + Vue + Vite + TypeScript + Tailwind + Swift +
    +
+
+ + {/* CARD 3 */} +
+
3
+

Add the Keyword

+

+ In your repository:
+ About → ⚙️ → Topics +

+ +
+
+ Topics (separate with spaces) +
+
+ + keyword + X + +
+
+
+
+ {/* === 🔹 END OF CARDS === */} + + + {data?.map((repo) => ( +
+

{repo.name}

+ +
+ {repo.banner.map((url) => Banner)} +
+ +
+ {repo.topics.map((stackName) => ( + + + + ))} +
+ +

{repo.description}

+ +
+ 🔗 Homepage + 🔗 Repository +
+
+ ))} + + +
+ ); +} diff --git a/examples/nextjs/page.tsx b/examples/nextjs/page.tsx deleted file mode 100644 index 1c3fe05..0000000 --- a/examples/nextjs/page.tsx +++ /dev/null @@ -1,61 +0,0 @@ -"use client"; -import React from "react"; - -"use client"; -import { useGitHubAutomatedRepos, StackIcons, StackLabels } from "github-automated-repos"; - - -export default function Projects() { - - const { data, isLoading } = useGitHubAutomatedRepos('digoarthur', 'attached'); - if (isLoading) return

Loading...

; - - return ( -
- Header - - {data?.map((repo) => ( -
-

{repo.name}

- -
- {repo.banner.map((url) => Banner)} -
- -
- {repo.topics.map((stackName) => ( - - - - ))} -
- -

{repo.description}

- -
- 🔗 Homepage - 🔗 Repository -
-
- ))} - - -
- ); -} diff --git a/package.json b/package.json index 215b5b1..a2b80a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "github-automated-repos-cli", - "version": "1.0.1", + "version": "1.0.0", "description": "CLI para gerar página de exemplo usando github-automated-repos em projetos Next.js, React ou Vite", "bin": { "github-automated-repos-example": "bin/index.js" @@ -14,6 +14,6 @@ "dependencies": {}, "files": [ "bin", - "examples" + "example" ] } From 0e934f945abafc55d5c2fd97996dd8a6e26cbeba Mon Sep 17 00:00:00 2001 From: digoarthur Date: Mon, 27 Oct 2025 21:42:27 +0000 Subject: [PATCH 03/44] feat(page): add structions cards: icons, topics, explain (WIP) --- example/page.tsx | 125 ++++++----------------------------------------- 1 file changed, 16 insertions(+), 109 deletions(-) diff --git a/example/page.tsx b/example/page.tsx index 32cefbf..809d848 100644 --- a/example/page.tsx +++ b/example/page.tsx @@ -11,123 +11,30 @@ export default function Projects() { if (isLoading) return

Loading...

; return ( -
- Header +
+ Header {/* === 🔹 ELEGANT INSTRUCTION CARDS === */} -
+
{/* CARD 1 */} -
-
1
-

Set up the Hook

-

- In the code, adjust the gitHubUsername and keyword in the hook — the keyword is chosen by you. -

- - useGitHubAutomatedRepos - ( - "your-user" - , - "your-keyword" - ) - -
+ +
1
hook icon

Set up the Hook

In the code, adjust the githubUsername and keyword in the hook — the keyword is chosen by you.

useGitHubAutomatedRepos (
"githubUsername" , "your-keyword" )
{/* CARD 2 */} -
-
2
- -

Select Your Repositories

- -

- Don’t forget to fill in: -

- -
    -
  • Repository description
  • -
  • Project banner /public/bannerXYZ.png
  • -
  • Technology logos (Topics)
  • -
    - react-icons - .NET Core - MySQL - MongoDB - Linux - Vue - Vite - TypeScript - Tailwind - Swift -
    -
-
+
2
github icon

Select Your Repositories

Don't forget to fill in:

  • Repository descriptioninfo
  • Project bannerinfo
    /public/bannerXYZ.png
  • Technology logos (Topics)info
react-icons .NET Core MySQL MongoDB Linux Vue Vite TypeScript Tailwind Swift
{/* CARD 3 */} -
-
3
-

Add the Keyword

-

- In your repository:
- About → ⚙️ → Topics -

- -
-
- Topics (separate with spaces) -
-
- - keyword - X - -
-
-
-
+ +
3
key icon

Add the Keyword

In your repository:
About → ⚙️ → Topics

Topics (separate with spaces)
keywordX
{/* === 🔹 END OF CARDS === */} From cf0f4389688cc0c79b1f7e8217c3856f19be0de1 Mon Sep 17 00:00:00 2001 From: digoarthur Date: Mon, 10 Nov 2025 21:24:23 +0000 Subject: [PATCH 04/44] chore: add chalk for colored output and commander for command handling, add .gitignore --- .gitignore | 2 + bin/index.js | 109 +++++++++++++++++++++++++++++++++++---------------- package.json | 22 +++++++---- 3 files changed, 93 insertions(+), 40 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ccb2c80 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +package-lock.json \ No newline at end of file diff --git a/bin/index.js b/bin/index.js index 6e417e4..1f5ceab 100755 --- a/bin/index.js +++ b/bin/index.js @@ -1,41 +1,84 @@ #!/usr/bin/env node +import { Command } from "commander"; +import chalk from "chalk"; import fs from "fs"; import path from "path"; +import { execSync } from "child_process"; import { fileURLToPath } from "url"; +const program = new Command(); const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); -const args = process.argv.slice(2); -const framework = args[0] || "next"; - -if (!["next", "react", "vite"].includes(framework)) { - console.log("Uso: npx github-automated-repos-example [next|react|vite]"); - process.exit(1); -} - -console.log(`🚀 Gerando exemplo para ${framework}...`); - -let sourceDir; -let targetDir; - -switch (framework) { - case "next": - sourceDir = path.join(__dirname, "../example/Project.tsx"); - targetDir = path.join(process.cwd(), "src/app/projects/page.tsx"); - break; - case "react": - sourceDir = path.join(__dirname, "../example/Project.tsx"); - targetDir = path.join(process.cwd(), "src/components/Project.tsx"); - break; - case "vite": - sourceDir = path.join(__dirname, "../example/Project.tsx"); - targetDir = path.join(process.cwd(), "src/components/Project.tsx"); - break; -} - -fs.mkdirSync(path.dirname(targetDir), { recursive: true }); - -fs.copyFileSync(sourceDir, targetDir); -console.log(`✅ Exemplo criado em: ${targetDir}`); -console.log("💡 Agora você pode acessar a página no seu projeto Next.js em /projects"); +program + .name("github-automated-repos-cli") + .description("CLI oficial do github-automated-repos para gerar exemplos e automações") + .version("1.0.0"); + +// ---------------------- +// Comando: INIT +// ---------------------- +program + .command("init") + .description("Inicializa a configuração do github-automated-repos no projeto") + .action(() => { + console.log(chalk.blueBright("⚙️ Iniciando configuração do github-automated-repos...")); + + try { + const pkgPath = path.join(process.cwd(), "package.json"); + if (!fs.existsSync(pkgPath)) { + console.log(chalk.red("❌ Nenhum package.json encontrado. Execute dentro de um projeto Node/React.")); + process.exit(1); + } + + const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8")); + + // Adiciona dependência se não existir + if (!pkg.dependencies?.["github-automated-repos"]) { + console.log(chalk.yellow("📦 Instalando dependência 'github-automated-repos'...")); + execSync("npm install github-automated-repos", { stdio: "inherit" }); + } + + + + console.log(chalk.green("🎉 github-automated-repos configurado com sucesso!")); + } catch (error) { + console.error(chalk.red("❌ Erro durante o init:"), error.message); + } + }); + +// ---------------------- +// Comando: ADD +// ---------------------- +program + .command("add