Quick Start
This page walks you through adding your first function and customizing your setup.
Prerequisites
- Node.js and
npx(or usepnpxetc.).
Add Your First Function
npx fnclip add pipeDone!
This will:
- Add the
pipefunction to your default directory (src/utils/fnclip/pipe.tsor.js + .d.ts). - Automatically create or update
src/utils/fnclip/index.tswithexport * from './pipe'.
Common CLI Commands
npx fnclip add <name>(aliases:i,install) — Add a functionnpx fnclip remove <name>(aliases:rm,delete,del) — Remove a functionnpx fnclip list(aliases:l) — List installed functions (--remotefor remote list)npx fnclip clear— Remove all fnclip functionsnpx fnclip config— Create afnclip.config.jsfile in your project root
Add Multiple Functions
npx fnclip i objectKeys objectMap nonNullableCustom Target Path
Add a function to a different directory:
npx fnclip add pipe --cwd packages/other --dir fnclip--cwd: Working directory (default: current directory)--dir: Target folder relative to cwd
Controlling the Index File
By default, fnclip maintains an export index file (src/utils/fnclip/index.ts).
- Use
--no-indexto disable index updates. - Use
--index-pathto specify a custom index file (extension optional).
# Disable index
npx fnclip add pipe --no-index
# Custom index path
npx fnclip add pipe --index-path ../fnclip.jsTypeScript or JavaScript
fnclip auto-detects project type (via tsconfig.json, .ts files, etc.). You can override manually:
npx fnclip add pipe --ts # Force TypeScript
npx fnclip add pipe --no-ts # Force JavaScript (.js + .d.ts)Pre-configuration
Create a project-level fnclip.config.js with:
// fnclip.config.js
export default {
dir: 'src/utils/my-fn',
index: 'src/utils/my-fn/index.ts',
ts: true
}And also there is a helper command for that, to create a file like that above with better type hints:
npx fnclip configfnclip will automatically detect the config file while running.
Or define npm scripts for convenience:
{
"scripts": {
"fnclip:add": "npx fnclip add --no-index --ts --dir src/utils/my-fn",
"fnclip:clear": "npx fnclip clear --dir src/utils/my-fn"
}
}Now you can simply run:
npm run fnclip:add -- pipeListing Functions
npx fnclip list— Show installed functions.npx fnclip list --remote— Show all available functions from the remote repository.
Tips & Troubleshooting
Q: I don’t want an index file.
A: Just use --no-index.
Q: I am using nuxt and it cannot auto-import those functions.
A: Because nuxt only auto-import the top level files in utils directory. To support it, just change the index path:
npx fnclip add pipe --index-path ../fnclip.jsThis will add index.js to src/utils/fnclip.js, and function files still in src/utils/fnclip/*