rollup-plugin-package-json-sanitize
v0.1.0-alpha.1
Published
This is a rollup plugin to clean several sections from a package.json during build process before publishing it.
Readme
rollup-plugin-package-json-sanitize
This is a rollup plugin to clean several sections from a package.json during build process before publishing it.
Content
Table of Contents
Usage
Parameters
| Name | Required | Type | Default | Description |
| :---------------- | :------- | ------ | :--------------- | :--------------------------------------------------------- |
| sourceFilePath | false | string | ./package.json | The package.json which should be sanitized |
| targetDirectory | false | string | ./dist | The destination directory name |
| targetFileName | false | string | package.json | The name of your destination file |
| config | true | Object | - | The plugin configuration for sanitizing the package.json |
Supported Configuration
remove
- The
removeoperation can be used to remove properties and according values from apackage.jsonfile. The properties to remove are declared as astring[]Types:string[]
Example configuration
The plugin can simply added to your existing rollup.config.js configuration file:
...
import cleanPackageJson from "rollup-plugin-package-json-sanitize";
...
export default {
input: "src/index.ts",
...
},
plugins: [
...
cleanPackageJson({
sourceFilePath: "./package.json",
targetDirectory: "./dist",
targetFileName: "package.json",
config: [
{
operation: "remove",
propertyNames: ["dependencies", "devDependencies", "scripts"],
},
],
}),
...
],
};
Development
Build
Install depencencies
npm installBuild the package as prod
npm run build # npm run build:dev # For debugging purpose
