diff --git a/CHANGELOG.md b/CHANGELOG.md index 3634cc6..ae851d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ + +# 1.0.1 (2025-12-28) + # 1.0.0 (2025-12-22) diff --git a/README.md b/README.md new file mode 100644 index 0000000..642f1fc --- /dev/null +++ b/README.md @@ -0,0 +1,168 @@ + + + + + + + +banner_logo_github-automated-repos-cli + +
+
+ + + + + +
+ +![GitHub](https://img.shields.io/github/license/digoarthur/github-automated-repos-cli?color=9F9FAC) +![NPM Package](https://img.shields.io/npm/v/github-automated-repos-cli?color=blue&label=NPM%20package&logo=npm&logoColor=CB3837) +![CodeFactor](https://img.shields.io/codefactor/grade/github/digoarthur/github-automated-repos-cli?color=brightgreen&label=Code%20Quality&logo=codefactor) +[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)]() + +
+ + + + + +

+
+ github-automated-repos-cli is a command-line tooldesigned to bootstrap and automate example pages + using github-automated-repos + library in modern frontend projects. +

+ + > It helps you quickly generate interactive demo pages for GitHub repositories without manually wiring APIs, + editing repetitive files, or handling complex setup steps. + +

+ +--- + + + + + + + +## Documentation + +This CLI works on top of the **github-automated-repos** library. + +- πŸ“¦ [github-automated-repos](https://github.com/digoarthur/github-automated-repos). + +--- + + + + + +# Getting Started + + +## 1. Run Command + + +```bash +npx github-automated-repos-cli init + +``` + +## 2. Enter data + +#### πŸ¦‘ GitHub Username + +You will be prompted to enter your GitHub username. + +This is used to fetch your public repositories directly from GitHub. + +```yaml +βœ” GitHub username: xxxxxx + +``` + +#### πŸ”‘ Keyword (Repository Filter) + +Next, you’ll choose a keyword (for example: attached , portfolio , featured ). + +This keyword will be used to filter repositories via the GitHub Topics field. + +```yaml +βœ” Keyword to filter (e.g. 'attached'): attached +``` + +> [!IMPORTANT] +> Don't forget to enter your Keyword in the Topics field of each project so it appears on the generated page. + + +![image](https://github.com/DIGOARTHUR/github-automated-repos/assets/59892368/9a0a0aaf-02e8-4a7f-8390-6e7fb4a3ea53) + + + +## 3. Page Generation + + Once confirmed, the CLI will: +- Generate the project page +- Inject the correct logic +- Connect it to github-automated-repos +- Finalize the template + +## 4. Result + +Your project page is now ready πŸŽ‰ + +```arduino +✨ Your project page is ready! +πŸ”— http://localhost:3000/projects +``` +--- + +## Supported Framework Paths + + ### Group 43 Next.js (App Router) + + +```arduino +app/projects/page.tsx +``` + +### dashgo_layout ViteJS + +```arduino +src/pages/projects.tsx +``` + + + + + + + +
+ + +--- + +
+ + + +**Love github-automated-repos CLI? Give our repo a star ⭐ [⬆️](https://github.com/DIGOARTHUR/github-automated-repos-cli) .** + + +`based in:` [Api Github](https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#get-a-repository) + +`by`: [@digoarthur](https://www.linkedin.com/in/digoarthur/) Brazil Flag + + +
+ +**[github-automated-repos](https://github.com/digoarthur/github-automated-repos)** + +
+ diff --git a/package.json b/package.json index 1965601..87428ee 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,18 @@ { "name": "github-automated-repos-cli", - "version": "1.0.0", - "description": "CLI para gerar pΓ‘gina de exemplo usando github-automated-repos em projetos Next.js, React ou Vite.", + "version": "1.0.1", + "description": "CLI that automates the creation of GitHub project pages by integrating github-automated-repos Library into Next.js, React, and Vite workflows.", + + "author": { + "name": "Diego Arthur (@digoarthur)", + "url": "https://www.linkedin.com/in/digoarthur/", + "github": "https://github.com/DIGOARTHUR" + }, + "repository": { + "type": "github", + "url": "https://github.com/digoarthur/github-automated-repos-cli" + }, + "homepage": "https://github-automated-repos.vercel.app", "type": "module", "bin": { "github-automated-repos-cli": "./bin/index.js" @@ -11,9 +22,8 @@ "setup": "git update-index --skip-worktree CHANGELOG.md", "start": "node ./bin/index.js", "changelog": "conventional-changelog --config changelog-config.cjs -i CHANGELOG.md -s -r 0", - "prepublishOnly": "node ./scripts/validate-publish-branch.js" + "prepublishOnly": "node ./scripts/guard-npm-publish.js" }, - "author": "Digo Arthur", "license": "MIT", "dependencies": { "chalk": "^5.6.2", @@ -24,8 +34,12 @@ }, "files": [ "bin", - "example", - "README.md" + "commands", + "utils", + "scripts", + "pageExample", + "README.md", + "LICENSE" ], "devDependencies": { "conventional-changelog-cli": "^5.0.0" diff --git a/scripts/guard-npm-publish.js b/scripts/guard-npm-publish.js index ff23c1f..f917a8e 100644 --- a/scripts/guard-npm-publish.js +++ b/scripts/guard-npm-publish.js @@ -1,26 +1,25 @@ -import { execSync } from "child_process"; +import { execSync } from "node:child_process"; -try { - const branch = execSync("git branch --show-current", { - stdio: ["pipe", "pipe", "ignore"], - }) +function getCurrentBranch() { + return execSync("git branch --show-current", { stdio: ["ignore", "pipe", "ignore"] }) .toString() .trim(); +} + +const branch = getCurrentBranch(); +const registry = process.env.npm_config_registry; - if (branch !== "main") { - console.error(""); - console.error("❌ NPM PUBLISH BLOCKED"); - console.error("--------------------------------"); - console.error("You are not allowed to publish from this branch."); - console.error(""); - console.error(`Current branch: ${branch}`); - console.error("Allowed branch: main"); - console.error(""); - process.exit(1); - } +// πŸ”“ Allow local publishes (yalc, tests, local registry) +if (!registry || !registry.includes("registry.npmjs.org")) { + console.log("ℹ️ Local publish detected (yalc or non-npm registry). Skipping guard."); + process.exit(0); +} - console.log("βœ… Branch validation passed. Publishing from main."); -} catch (error) { - console.error("❌ Failed to detect git branch."); +// πŸ”’ Block real npm publish outside main +if (branch !== "main") { + console.error("❌ npm publish is only allowed from the 'main' branch."); + console.error(`Current branch: ${branch}`); process.exit(1); } + +console.log("βœ… npm publish allowed from main branch."); \ No newline at end of file