0.1.0-alpha.1 • Published 5 months ago

rollup-plugin-package-json-sanitize v0.1.0-alpha.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

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

NameRequiredTypeDefaultDescription
sourceFilePathfalsestring./package.jsonThe package.json which should be sanitized
targetDirectoryfalsestring./distThe destination directory name
targetFileNamefalsestringpackage.jsonThe name of your destination file
configtrueObject-The plugin configuration for sanitizing the package.json

Supported Configuration

remove

  • The remove operation can be used to remove properties and according values from a package.json file. The properties to remove are declared as a string[]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

  1. Install depencencies

    npm install
  2. Build the package as prod

    npm run build
    
    # npm run build:dev # For debugging purpose
0.1.0-alpha.1

5 months ago

0.1.0-alpha.0

5 months ago