small-libs
v0.0.4
Published
The shadcn for small libs. Zero dep. Lightning fast. Bun powered. 8kb cli.
Downloads
389
Readme
small-libs
The shadcn for small libs. Zero dep. Lightning fast. Bun powered. 8kb cli.
small-libs reads a source file, follows its local imports, rewrites linked library imports, and copies everything into named folders under libs/ or your desired folder. This is PoC, therefore breaking changes are likely.
Install project deps
bun installUse
bun index.ts <file-or-url>Examples: (proper lib examples coming soon)
bun index.ts ./testLibs/test/index.ts
bun index.ts https://raw.githubusercontent.com/owner/repo/main/index.tsWhat it does
- reads local files,
file://URLs,http(s)URLs, or localhost URLs - resolves file-relative imports and copies those files into the same output folder
- resolves special library imports marked with
//@path/to/liband installs them into separate folders - rewrites imported library paths to point at the copied folders
- optionally adds a
tsconfigpath entry for the generated library folder
Configuration
Create smallLibs.config.json in the project root.
{
"storagePath": "libs/",
"addTsconfigPath": true,
"nameStyle": "kebab"
}Environment variables:
CONFIG_PATH- use a different config file nameDEBUG=1- enable debug logging and prefersmallLibs.config.test.jsonwhen presentPORT- port for the test file server
Test server
bun server.tsThis serves files from the repo root, libs/, and testLibs/ so you can test remote-style imports locally.
Example input
// name: my-lib
// description: A tiny helper library
// author: @you
// url: https://github.com/you/my-lib
//@testLibs/hmm
import { subtract } from "../hmm";
import hello from "./hello";Output
The generated folder ends up at libs/<name>/index.ts by default, with any local helper files copied beside it.
