@binary-butterfly/rollup-plugin-version-file
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

rollup plugin version file

Coverage Status

This is a very small rollup plugin to save the current version from your package.json to a static file during the build process.

Usage

First install the plugin npm i --save-dev @binary-butterfly/rollup-plugin-version-file.
Then, in your rollup config add it to the plugins array:

import versionFile from '@binary-butterfly/rollup-plugin-version-file';

export default {
    // ... other config
    plugins: [
        // ... other plugins
        versionFile({
            'outputPath': './public/version',
            'packageFilePath': './package.json',
            'log': true,
        })
    ]
    // ... other config
}

The config parameters given in that example are the defaults, so if you want to use these settings, you may forego providing a value for them.

Config parameters

  • outputPath: Where to store the version file, relative to your project root directory
  • packageFilePath: Where to find your package.json file, relative to your project root directory
  • log: If you want the plugin to log what it wrote once it is done

Vite

Vite uses rollup internally for production builds. To use this plugin within vite, all you have to do is add the above configuration within your vite config's build.rollupOptions.

Readme

Keywords

Package Sidebar

Install

npm i @binary-butterfly/rollup-plugin-version-file

Weekly Downloads

15

Version

1.0.1

License

MIT

Unpacked Size

11 kB

Total Files

8

Last publish

Collaborators

  • grufty
  • dysphoricunicorn