1.0.1 • Published 1 year ago

rollup-plugin-write-only-changes v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

rollup-plugin-write-only-changes

Latest version Dependency status

A Rollup Rollup plugin for writing files to the output directoriy only if their contents actually changed.

Requirements

This plugin requires Node.js (currently 18, at least 14.8) and Rollup 1.20 or newer.

Installation

Using npm:

npm i -D rollup-plugin-write-only-changes

Usage

Create a rollup.config.js configuration file and import the plugin:

import { writeOnlyChanges } from 'rollup-plugin-write-only-changes';

export default {
  input: 'src/index.js',
  output: {
    dir: 'output',
    format: 'cjs'
  },
  plugins: [writeOnlyChanges()]
}

Then call rollup either via the command-line or the programmatically.

Options

The plugin can be customised by the following options, which can be passed as an object with the properties below.

verbose

Type: boolean | { missing, failing, existed, created, changed, intact } Default: { failing: true }

Logging configuration. All cases can be enabled by true and disabled by false. ingle cases are selectable by specifying an object with the following boolean properties, which are false by default, except for failing, which true by default:

  • missing: Log files, which were missing in the output directory.
  • failing: Log files, which failed when they tried to be read from the output directory.
  • existed: Log files, which already existed in the output directory and were read.
  • created: Log files, which had to be created in the output directory, because they did not exist there.
  • changed: Log files, which had to be rewritten in the output directory, because their content was different.
  • intact: Log files, which did not have to be rewritten in the output directory, because their content remained the same.

rebuild

Type: boolean Default: false

If the output files should be forcibly written at least once, when rollup starts and the project is built at first, before the watcher starts.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Lint and test your code.

License

Copyright (C) 2023 Ferdinand Prantl

Licensed under the MIT License.