Copying vendor scripts like a code monkey is a miserable way to build websites. Vendrop exists because dealing with giant dependencies manually makes me sick. It grabs your files, minifies them, and spits them out exactly where they belong.
It works seamlessly as a CLI, a Vite Plugin, or an Astro Integration.
- 📦 Automated Copying: Easily move files from
node_modulesto your public folder. - ⚡ On-the-fly Minification: Uses Terser to minify JavaScript files automatically.
- 🧩 Multi-environment: Built-in support for Vite and Astro.
- 🛠️ Config-driven: Use a simple
vendrop.config.mjsfor all your projects. - 🔍 Smart Resolution: Automatically looks into
node_modulesif a local file is not found.
# Using npm
npm install -D vendrop
# Using pnpm
pnpm add -D vendrop
# Using yarn
yarn add -D vendropCreate a vendrop.config.mjs file in your project root to share settings across CLI, Vite, and Astro.
/** @type {import('vendrop').VendropConfig} */
export default [
{
// Resolves automatically from node_modules/jquery/dist/jquery.js
src: 'jquery/dist/jquery.js',
out: 'public/vendors/jquery.min.js'
},
{
src: 'bootstrap/dist/js/bootstrap.bundle.js',
out: 'public/vendors/bootstrap.min.js'
},
{
src: 'src/scripts/local-utils.js',
out: 'public/vendors/utils.min.js',
minify: false // Disable minification for this specific entry
}
];If you have a vendrop.config.mjs, just run:
npx vendropOr use flags for one-off tasks:
npx vendrop --src jquery/dist/jquery.js --out public/vendors/jquery.min.jsAdd it to your vite.config.js:
import { defineConfig } from 'vite';
import { viteVendrop } from 'vendrop';
import config from './vendrop.config.mjs';
export default defineConfig({
plugins: [
viteVendrop(config)
]
});Add it as an integration in astro.config.mjs:
import { defineConfig } from 'astro/config';
import { astroVendrop } from 'vendrop';
import config from './vendrop.config.mjs';
export default defineConfig({
integrations: [
astroVendrop(config)
]
});import { vendrop } from 'vendrop';
await vendrop([
{ src: 'jquery/dist/jquery.js', out: 'public/vendors/jquery.min.js' }
]);| Property | Type | Description |
|---|---|---|
src |
string |
Source path (relative to root or in node_modules). |
out |
string |
Destination path (relative to your project root). |
minify |
boolean |
(Optional) Override global minification for this file. |
| Property | Type | Description |
|---|---|---|
minify |
boolean |
Global minification toggle. Defaults to true. |
rootDir |
string |
Base directory for path resolution. Defaults to process.cwd(). |
MIT © J.P. Esparza