Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-clean-package

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-clean-package

Gulp plugin to clean a `package.json` files.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
Maintainers
1
Weekly downloads
 
Created
Source

Gulp plugin to clean a package.json files.

It's remove unnecessary properties, configurable, ready to use out of the box.

Installation

Install it as development dependency

npm install -D gulp-clean-package

Usage

const cleanPackage = require('gulp-clean-package');
 
gulp.task('scripts', function() {
  return gulp.src('./package.json')
    .pipe(cleanPackage())
    .pipe(gulp.dest('./dist'));
});

This will remove unnecessary properties from package.json:

Input:

{
	"name": "gulp-clean-package",
	"version": "0.0.1",
	"repository": {
		"type": "git",
		"url": "git+https://github.com/vitonsky/gulp-clean-package.git"
	},
	"keywords": [],
	"license": "Apache-2.0",
	"bugs": {
		"url": "https://github.com/vitonsky/gulp-clean-package/issues"
	},
	"homepage": "https://github.com/vitonsky/gulp-clean-package#readme",
	"scripts": {
		// ...
	},
	"devDependencies": {
		// ...
	},
	"dependencies": {
		"plugin-error": "^2.0.0",
		"through2": "^4.0.2"
	},
	"eslint": {
		// ...
	},
	"foo": {
		// ...
	},
	"bar": 42,
}

Output:

{
	"name": "gulp-clean-package",
	"version": "0.0.1",
	"repository": {
		"type": "git",
		"url": "git+https://github.com/vitonsky/gulp-clean-package.git"
	},
	"keywords": [],
	"license": "Apache-2.0",
	"bugs": {
		"url": "https://github.com/vitonsky/gulp-clean-package/issues"
	},
	"homepage": "https://github.com/vitonsky/gulp-clean-package#readme",
	"dependencies": {
		"plugin-error": "^2.0.0",
		"through2": "^4.0.2"
	}
}

Options

/**
 * New props. It will overwrite exists
 */
additionalProperties = {},

/**
 * This props will not remove
 */
publicProperties = [],

/**
 * This props will remove anyway
 */
propertiesToRemove = [],

/**
 * Disable default list of ignored props
 */
noUseDefaultProperties = false,

/**
 * Style of spaces for JSON result
 */
indentStyle = '\t',

Example for input above with config:

const cleanPackage = require('gulp-clean-package');
 
gulp.task('scripts', function() {
  return gulp.src('./package.json')
    .pipe(cleanPackage({
		publicProperties: ['foo'],
		propertiesToRemove: ['repository'],
		additionalProperties: {
			name: 'newName',
			baz: 123,
		}
	}))
    .pipe(gulp.dest('./dist'));
});

Output:

{
	"name": "newName",
	"version": "0.0.1",
	"keywords": [],
	"license": "Apache-2.0",
	"bugs": {
		"url": "https://github.com/vitonsky/gulp-clean-package/issues"
	},
	"homepage": "https://github.com/vitonsky/gulp-clean-package#readme",
	"dependencies": {
		"plugin-error": "^2.0.0",
		"through2": "^4.0.2"
	},
	"foo": {
		// ...
	},
	"baz": 123
}

Keywords

FAQs

Package last updated on 08 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc