rollup-plugin-generate-package-json
Advanced tools
Comparing version 1.0.0 to 2.0.0
{ | ||
"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 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
5265
52
91
1
2
11
+ Addedread-pkg@^3.0.0
+ Addedwrite-pkg@^3.1.0
+ Addeddetect-indent@5.0.0(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhosted-git-info@2.8.9(transitive)
+ Addedimurmurhash@0.1.4(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-core-module@2.16.0(transitive)
+ Addedis-plain-obj@1.1.0(transitive)
+ Addedjson-parse-better-errors@1.0.2(transitive)
+ Addedload-json-file@4.0.0(transitive)
+ Addedmake-dir@1.3.0(transitive)
+ Addednormalize-package-data@2.5.0(transitive)
+ Addedparse-json@4.0.0(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpath-type@3.0.0(transitive)
+ Addedpify@3.0.0(transitive)
+ Addedread-pkg@3.0.0(transitive)
+ Addedresolve@1.22.9(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedsort-keys@2.0.0(transitive)
+ Addedspdx-correct@3.2.0(transitive)
+ Addedspdx-exceptions@2.5.0(transitive)
+ Addedspdx-expression-parse@3.0.1(transitive)
+ Addedspdx-license-ids@3.0.20(transitive)
+ Addedstrip-bom@3.0.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedvalidate-npm-package-license@3.0.4(transitive)
+ Addedwrite-file-atomic@2.4.3(transitive)
+ Addedwrite-json-file@2.3.0(transitive)
+ Addedwrite-pkg@3.2.0(transitive)