https://github.com/vitonsky/gulp-clean-package
Gulp plugin to clean a `package.json` files
https://github.com/vitonsky/gulp-clean-package
build clean-code cleaner gulp gulp-plugin gulp-plugins gulpplugin package-json packagejson plugin
Last synced: 7 months ago
JSON representation
Gulp plugin to clean a `package.json` files
- Host: GitHub
- URL: https://github.com/vitonsky/gulp-clean-package
- Owner: vitonsky
- License: apache-2.0
- Created: 2022-08-07T18:23:36.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-04-28T21:02:36.000Z (almost 3 years ago)
- Last Synced: 2025-03-12T13:18:44.845Z (12 months ago)
- Topics: build, clean-code, cleaner, gulp, gulp-plugin, gulp-plugins, gulpplugin, package-json, packagejson, plugin
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/gulp-clean-package
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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
```js
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:
```json
{
"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:
```json
{
"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
```js
/**
* 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:
```js
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:
```json
{
"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
}
```