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

rollup-plugin-generate-package-json

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-generate-package-json - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

dist/index.js

37

package.json
{
"name": "rollup-plugin-generate-package-json",
"description": "Generate package.json file with packages from your bundle using Rollup",
"version": "1.0.0",
"version": "2.0.0",
"author": "Vlad Shcherbin <vlad.shcherbin@gmail.com>",
"repository": "VladShcherbin/rollup-plugin-generate-package-json",
"main": "src/index.js",
"repository": "vladshcherbin/rollup-plugin-generate-package-json",
"main": "dist/index.js",
"scripts": {
"lint": "eslint src tests",
"test": "jest",
"coverage": "yarn test --coverage && yarn codecov && yarn rimraf coverage",
"prepublishOnly": "yarn lint && yarn test"
"build": "babel src -d dist",
"clean": "rimraf dist",
"codecov": "yarn test --coverage && yarn codecov && yarn rimraf coverage",
"prepublishOnly": "yarn lint && yarn test && yarn build",
"postpublish": "yarn clean"
},
"dependencies": {
"read-pkg": "^3.0.0",
"write-pkg": "^3.1.0"
},
"devDependencies": {
"@babel/cli": "^7.0.0-beta.40",
"@babel/core": "^7.0.0-beta.40",
"@babel/preset-env": "^7.0.0-beta.40",
"babel-core": "^7.0.0-0",
"babel-jest": "^22.4.1",
"codecov": "^3.0.0",
"eslint": "^4.16.0",
"eslint": "^4.18.2",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "^2.8.0",
"jest": "^22.1.4",
"memfs": "^2.6.2",
"eslint-plugin-import": "^2.9.0",
"jest": "^22.4.2",
"rimraf": "^2.6.2"
},
"files": [
"src",
"dist",
"readme.md"

@@ -33,8 +44,6 @@ ],

],
"jest": {
"roots": [
"<rootDir>/tests"
]
"engines": {
"node" : ">=6"
},
"license": "MIT"
}
# rollup-plugin-generate-package-json
[![Build Status](https://travis-ci.org/VladShcherbin/rollup-plugin-generate-package-json.svg?branch=master)](https://travis-ci.org/VladShcherbin/rollup-plugin-generate-package-json)
[![Codecov](https://img.shields.io/codecov/c/github/VladShcherbin/rollup-plugin-generate-package-json.svg)](https://codecov.io/gh/VladShcherbin/rollup-plugin-generate-package-json)
[![Build Status](https://travis-ci.org/vladshcherbin/rollup-plugin-generate-package-json.svg?branch=master)](https://travis-ci.org/vladshcherbin/rollup-plugin-generate-package-json)
[![Codecov](https://codecov.io/gh/vladshcherbin/rollup-plugin-generate-package-json/branch/master/graph/badge.svg)](https://codecov.io/gh/vladshcherbin/rollup-plugin-generate-package-json)
Generate `package.json` file with packages from your bundle using Rollup.
## Why
## About

@@ -24,15 +24,6 @@ This plugin is useful when you have a lot of packages in your current `package.json` and want to create a lean one with only packages from your generated bundle, probably for deployment.

// rollup.config.js
import path from 'path'
import generatePackageJson from 'rollup-plugin-generate-package-json'
const basePackageJson = {
scripts: {
start: 'node app.js'
},
dependencies: {},
private: true
}
export default {
input: 'src/main.js',
input: 'src/index.js',
output: {

@@ -43,13 +34,3 @@ file: 'dist/app.js',

plugins: [
generatePackageJson({
// By default, the plugin searches for package.json file.
// Optionally, you can specify its path
inputFile: path.resolve(__dirname, '../package.json'),
// Set output folder, where generated package.json file will be saved
outputFolder: path.resolve(__dirname, '../dist'),
// Optionally, you can set base contents for your generated package.json file
baseContents: basePackageJson
})
generatePackageJson()
]

@@ -59,4 +40,54 @@ }

### Options
There are some useful options, all of them are optional:
**inputPackageJson**
Set input `package.json` file path, it can be a file or a directory. By default, root `package.json` file is used.
```js
generatePackageJson({
inputPackageJson: 'nested/folder'
})
```
**outputFolder**
Set output folder where generated `package.json` file will be saved. By default, it is the same folder where bundle was saved.
```js
generatePackageJson({
outputFolder: 'dist'
})
```
**baseContents**
Set base contents for your generated `package.json` file.
```js
generatePackageJson({
baseContents: {
scripts: {
start: 'node app.js'
},
dependencies: {},
private: true
}
})
```
**additionalDependencies**
Set additional dependencies which were not used in the bundle, but are used by the app.
```js
generatePackageJson({
additionalDependencies: ['pg']
})
```
## License
MIT
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