Skip to content

Commit

Permalink
fix: 🐛 handle run npx bin
Browse files Browse the repository at this point in the history
  • Loading branch information
blogic-kietlt committed Nov 13, 2024
1 parent 4d09606 commit cc837a5
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 14 deletions.
52 changes: 41 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
# optimize-icons-cli

[![npm version](https://img.shields.io/npm/v/optimize-icons-cli.svg)](https://www.npmjs.com/package/optimize-icons-cli)
[![npm downloads](https://img.shields.io/npm/dm/optimize-icons-cli.svg)](https://www.npmjs.com/package/optimize-icons-cli)
[![License](https://img.shields.io/npm/l/optimize-icons-cli.svg)](https://github.com/yourusername/optimize-icons-cli/blob/main/LICENSE)
<p align="center">
<img src="assets/logo.png" alt="Optimize Icons CLI" width="300" height="300"/>
</p>

<h1 align="center">optimize-icons-cli</h1>

<p align="center">
<a href="https://www.npmjs.com/package/optimize-icons-cli">
<img src="https://img.shields.io/npm/v/optimize-icons-cli.svg" alt="npm version" />
</a>
<a href="https://www.npmjs.com/package/optimize-icons-cli">
<img src="https://img.shields.io/npm/dm/optimize-icons-cli.svg" alt="npm downloads" />
</a>
<a href="https://github.com/yourusername/optimize-icons-cli/blob/main/LICENSE">
<img src="https://img.shields.io/npm/l/optimize-icons-cli.svg" alt="license" />
</a>
<a href="https://github.com/yourusername/optimize-icons-cli/stargazers">
<img src="https://img.shields.io/github/stars/yourusername/optimize-icons-cli" alt="stars" />
</a>
</p>

<p align="center">
A powerful CLI tool for optimizing icons in your web projects with focus on performance and simplicity.
</p>

A command-line tool for optimizing icons in your web projects. This tool helps reduce icon file sizes and improve loading performance.

Expand Down Expand Up @@ -54,17 +75,18 @@ optimize-icons
```

The tool will prompt you for:

- Output path (default: dist/browser)
- Verbose mode (yes/no)

### Options

| Option | Alias | Description |
|--------|-------|-------------|
| `--output-path` | `-o` | Specify the output directory for optimized icons |
| `--verbose` | `-v` | Enable verbose output |
| `--version` | - | Show version number |
| `--help` | - | Show help |
| Option | Alias | Description |
| --------------- | ----- | ------------------------------------------------ |
| `--output-path` | `-o` | Specify the output directory for optimized icons |
| `--verbose` | `-v` | Enable verbose output |
| `--version` | - | Show version number |
| `--help` | - | Show help |

## Programmatic Usage

Expand All @@ -83,7 +105,15 @@ The tool accepts the following configuration options:

```typescript
interface OptimizeIconsOptions {
outputPath: string; // Path where optimized icons will be saved
verbose: boolean; // Enable detailed logging
outputPath: string; // Path where optimized icons will be saved
verbose: boolean; // Enable detailed logging
}
```

## 💫 Deployment

Add additional notes about how to deploy this on a live system.

---

<p align="center">Made with ❤️ by <a href="https://github.com/zenkiet">Kiet Le</a></p>
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions bin/cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node

require('../dist/cli').default.getInstance().run();
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "optimize-icons-cli",
"version": "1.1.0",
"version": "1.1.2",
"description": "CLI tool for optimizing icons",
"main": "dist/cli.js",
"types": "dist/types/index.d.ts",
"bin": {
"optimize-icons": "./dist/cli.js"
"optimize-icons": "./bin/cli.js"
},
"scripts": {
"build": "npx tsc",
Expand Down
4 changes: 3 additions & 1 deletion src/core/icon-optimize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ export class IconOptimizer {
});
}

this.logger.log(`Found ${this.usedIcons.size} used icons`);
console.log(this.usedIcons);

this.logger.log(`\nFound ${this.usedIcons.size} used icons`);
}

/**
Expand Down

0 comments on commit cc837a5

Please sign in to comment.