Skip to content

A CLI tool to fetch Lucide icons from GitHub raw files and save it directly to your working directory.

License

Notifications You must be signed in to change notification settings

shivamdevs/lucide-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lucide-cli

npm version npm downloads Install Size GitHub GitHub issues GitHub pull requests

A CLI tool to fetch Lucide icons from GitHub raw files and save it directly to your working directory.

This CLI tool is inspired by and based on Lucide icons.
It uses the raw files from the lucide/icons folder to fetch the icons.

Information

This CLI tool currently supports React framework only.
New features and frameworks will be added in due time.
Support for both TypeScript and JavaScript is available.

Initialization

  1. Initial the tool to your project by running the following command:

    npx lucide-cli init

    This will also install the tool automatically, if not installed previously.

  2. You will be asked to select the framework you are using.

    ℹ Welcome to Lucide CLI - <0.0.0> #current version
    ? Select the framework you are using: (Use arrow keys)
    ❯ React

    Currently, only React is supported.

  3. Next, you will be asked whether you are using TypeScript or not.

    ? Are you using TypeScript? (Use arrow keys)
    ❯ Yes
      No
  4. After this, you will be asked to provide the directory where you want to save the icons.

    ? Where do you want to save the icons? (src/components/lucide)

    The default directory is src/components/lucide.

  5. Next, you will be asked to provide the default size and stroke width for the icons.

    ? Default size for the icons: (24)
    ? Default stroke width for the icons: (2)

    The default size is 24 and the default stroke width is 2.

  6. After providing the directory, the tool will initialize the configuration and save it to the lucide.config.json file.

    ✔ Configuration file created successfully
    ✔ Icon directory created successfully
    ✔ TypeScript definitions file created successfully
    ✔ Lucide CLI has been successfully initialized
  7. That's it.

    Now you can start adding the icons to your project.

    npx lucide-cli add <icon-names...>

Usage

Add Icon

To add an icon to your project, run the following command:

npx lucide-cli add <icon-names...>

# Example
npx lucide-cli add activity
npx lucide-cli add plus

# You can also add multiple icons at once:
npx lucide-cli add activity plus

Remove Icon

To remove an icon from your project, run the following command:

npx lucide-cli remove <icon-names...>

# Example
npx lucide-cli remove activity
npx lucide-cli remove plus

# You can also remove multiple icons at once:
npx lucide-cli remove activity plus

List Icons

To list all the icons which are already added to your project, run the following command:

npx lucide-cli list

# ⠋ Looking for icons...
# ℹ - activity
# ℹ - plus
# ✔ Found 2 icons in your project

Update Icon

To update the icon, to match the latest configuration file, run the following command:

npx lucide-cli update


Adding icon will always use the latest configuration file.
So you can also update specific icons by adding them again.

npx lucide-cli add <icon-names...>

TypeScript Definitions

If you selected TypeScript, the tool will automatically create a TypeScript definitions file for you in the directory you provided with the name .lucide.d.ts.
All the icons added with TypeScript will use type definitions from this file.

Configuration

You can change your project configuration by editing the lucide.config.json file.

Or you can re-initialize the configuration by running the following command:

npx lucide-cli init

Configuration Options

{
	"framework": "React",
	"typescript": false,
	"iconsDirectory": "src/components/lucide",
	"defaultSize": 24,
	"defaultStrokeWidth": 2
}

Always update icons after changing the configuration.

npx lucide-cli update

If you change the directory, the tool will not remove the icons from the previous directory. You have to remove them manually.

CLI

You can also use the CLI command to get the configuration details.

npx lucide-cli config

Aliases

You can also use aliases for all the commands.

npx lucide-cli a <icon-names...> # Add Icon
npx lucide-cli i <icon-names...> # Add Icon
npx lucide-cli install <icon-names...> # Add Icon

npx lucide-cli r <icon-names...> # Remove Icon
npx lucide-cli rm <icon-names...> # Remove Icon
npx lucide-cli remove <icon-names...> # Remove Icon
npx lucide-cli d <icon-names...> # Remove Icon
npx lucide-cli del <icon-names...> # Remove Icon
npx lucide-cli delete <icon-names...> # Remove Icon

npx lucide-cli l # List Icons
npx lucide-cli ls # List Icons

npx lucide-cli u # Update Icons
npx lucide-cli up # Update Icons
npx lucide-cli upgrade # Update Icons
npx lucide-cli refresh # Update Icons

npx lucide-cli c # Configuration

Test Configuration & Server Connection

You can test the configuration and server connection by running the following command:

npx lucide-cli test

License

This project is licensed under the MIT License - see the LICENSE file for details.

Original Lucide Icon Library is licensed under the ISC License - see the LICENSE file for details.

About

A CLI tool to fetch Lucide icons from GitHub raw files and save it directly to your working directory.

Topics

Resources

License

Stars

Watchers

Forks