Skip to content

Commit 1430251

Browse files
committed
first commit
0 parents  commit 1430251

4 files changed

Lines changed: 180 additions & 0 deletions

File tree

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Dependencies
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
package-lock.json
7+
yarn.lock
8+
9+
# Environment variables
10+
.env
11+
.env.local
12+
.env.*.local
13+
14+
# IDE and editor files
15+
.vscode/
16+
.idea/
17+
*.swp
18+
*.swo
19+
*~
20+
.DS_Store
21+
22+
# OS files
23+
.DS_Store
24+
Thumbs.db
25+
26+
# Logs
27+
logs/
28+
*.log
29+
30+
# Build outputs
31+
dist/
32+
build/
33+
*.tsbuildinfo
34+
35+
# Testing
36+
coverage/
37+
.nyc_output/
38+
39+
# Temporary files
40+
tmp/
41+
temp/
42+
*.tmp

README.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# ScrapeGraph CLI
2+
3+
A basic command-line interface (CLI) tool built with Node.js, following best practices for CLI development.
4+
5+
## Features
6+
7+
- 🎨 Beautiful terminal output with colors and boxes using `chalk` and `boxen`
8+
- 📝 Command-line argument parsing with `yargs`
9+
- 🚀 Easy to install and use globally
10+
- 🔧 Extensible architecture
11+
12+
## Installation
13+
14+
### Local Development
15+
16+
1. Clone the repository:
17+
```bash
18+
git clone <repository-url>
19+
cd scrapegraph-cli
20+
```
21+
22+
2. Install dependencies:
23+
```bash
24+
npm install
25+
```
26+
27+
3. Install globally (from the project root):
28+
```bash
29+
npm install -g .
30+
```
31+
32+
## Usage
33+
34+
After installation, you can use the CLI from anywhere in your terminal:
35+
36+
```bash
37+
# Run the CLI
38+
scrapegraphai
39+
40+
# Show help
41+
scrapegraphai --help
42+
```
43+
44+
### Command Options
45+
46+
- `--help`: Show help message
47+
- `--version`: Show version number
48+
49+
## Project Structure
50+
51+
```
52+
scrapegraph-cli/
53+
├── bin/
54+
│ └── index.js # CLI entry point
55+
├── package.json # Project configuration
56+
└── README.md # This file
57+
```
58+
59+
## Development
60+
61+
The CLI is built using:
62+
63+
- **[yargs](https://www.npmjs.com/package/yargs)** - Command-line argument parsing
64+
- **[chalk](https://www.npmjs.com/package/chalk)** - Terminal string styling
65+
- **[boxen](https://www.npmjs.com/package/boxen)** - Create boxes in terminal
66+
67+
## Customization
68+
69+
To customize the CLI:
70+
71+
1. **Change the command name**: Edit the `bin` field in `package.json`
72+
2. **Add new options**: Modify the `yargs` configuration in `bin/index.js`
73+
3. **Update functionality**: Extend the main CLI logic in `bin/index.js`
74+
75+
## License
76+
77+
ISC
78+
79+
## Contributing
80+
81+
Contributions are welcome! Please feel free to submit a Pull Request.

bin/index.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env node
2+
3+
const chalk = require('chalk');
4+
const figlet = require('figlet');
5+
6+
// Clear screen and display banner
7+
console.clear();
8+
9+
// Display ASCII art banner on startup with orange-brown color
10+
// Using 'Small' font which uses _ and | characters for a blocky ASCII art style
11+
const banner = figlet.textSync('SCRAPEGRAPH CLI', {
12+
font: 'Small',
13+
horizontalLayout: 'default',
14+
verticalLayout: 'default'
15+
});
16+
17+
// Use orange-brown color similar to the image (light brown/orange)
18+
const bannerColor = '#DB895F';
19+
20+
// Color the banner with orange-brown color
21+
const bannerLines = banner.split('\n');
22+
const coloredBanner = bannerLines.map(line => chalk.hex(bannerColor)(line)).join('\n');
23+
24+
// Get version from package.json
25+
const packageJson = require('../package.json');
26+
const version = `ScrapeGraph AI v${packageJson.version}`;
27+
const author = 'Created by ScrapeGraph Team';
28+
29+
// Display banner with orange-brown color, version and author
30+
console.log('\n' + coloredBanner);
31+
console.log(chalk.hex(bannerColor)(version));
32+
console.log(chalk.hex('#E0E0E0')(author) + '\n');

package.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "scrapegraph-cli",
3+
"version": "1.0.0",
4+
"description": "A basic CLI tool built with Node.js",
5+
"main": "bin/index.js",
6+
"bin": {
7+
"scrapegraphai": "./bin/index.js"
8+
},
9+
"scripts": {
10+
"test": "echo \"Error: no test specified\" && exit 1"
11+
},
12+
"keywords": [
13+
"cli",
14+
"command-line"
15+
],
16+
"author": "",
17+
"license": "ISC",
18+
"dependencies": {
19+
"boxen": "^5.1.2",
20+
"chalk": "^4.1.2",
21+
"figlet": "^1.10.0",
22+
"inquirer": "^8.2.7",
23+
"yargs": "^17.7.2"
24+
}
25+
}

0 commit comments

Comments
 (0)