@aboulbox/vite-plugin-rolling-release
v1.0.0
Published
A plugin to create a symlink to your custom build directory
Maintainers
Readme
⚡️ Vite Plugin Rolling Release

A plugin to build viteJS app in a custom directory and then create a symlink at /dest/current pointing to your custom directory.
My usecase is the following :
- I have a website build with Vite
- My website is served by Caddy as a static site with
file_server - When I update my website, if the build phase is long, Caddy could serve a mid-state site or completely crashed
- My plugin allow me to build in a custom direct, then creating a symlink at
dest/current, pointing to the new build directory once it's finish - This way, i'm 0️ down time.
Installation
npm install @aboulbox/vite-plugin-rolling-release🔌 Usage
Add the plugin to your vite.config.js file.
import { defineConfig } from "vite";
import rollingrelease from "vite-plugin-rolling-release";
const buildDir = "dest/release_" + Date.now(); // Example
const outDir = import.meta.env.DEV ? "dist" : buildDir; // Don't need to change `outDir` for development but outDir must be the same as `buildDir` when building
export default defineConfig({
plugins: [rollingrelease(buildDir)],
outDir: outDir,
});🧰 Options
buildDir
Type:
stringDefault:
''This is your build directory that
dest/currentwill point to.⚠️
buildDirmust be relative to project root.
buildDir
Type:
stringDefault:
''This is your build directory that
dest/currentwill point to.⚠️
buildDirmust be relative to project root.
buildDir
Type:
stringDefault:
''This is your build directory that
dest/currentwill point to.⚠️
buildDirmust be relative to project root.
buildDir
Type:
stringDefault:
''This is your build directory that
dest/currentwill point to.⚠️
buildDirmust be relative to project root.
💡 Ideas
- [x] Add an option to change the default symlink location (
dest/currentfor now) - [ ] Add an option to clean releases and a option
keep: XwhereXis the number of releases to keep. - [ ] Add an option for rolling release names (
release_<gitsha> || <timestamp> || <random>)
🛠️ Development
- Install dependencies:
npm install- Build the library:
npm run build