All Projects → vladshcherbin → rollup-plugin-generate-package-json

vladshcherbin / rollup-plugin-generate-package-json

Licence: other
Generate package.json file with packages from your bundle using Rollup

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to rollup-plugin-generate-package-json

rollup-plugin-closure-compiler-js
Rollup plugin for optimizing JavaScript with google-closure-compiler-js.
Stars: ✭ 31 (+6.9%)
Mutual labels:  rollup, rollup-plugin
rollup-plugin-markdown
import JavaScript from Markdown code blocks
Stars: ✭ 16 (-44.83%)
Mutual labels:  rollup, rollup-plugin
rollup-plugin-external-globals
Transform external imports into global variables like output.globals.
Stars: ✭ 57 (+96.55%)
Mutual labels:  rollup, rollup-plugin
rollup-plugin-html
Import HTML files as strings in rollup build
Stars: ✭ 36 (+24.14%)
Mutual labels:  rollup, rollup-plugin
rollup-plugin-generate-html-template
Rollup plugin for automatically injecting a script tag with the final bundle into an html file.
Stars: ✭ 58 (+100%)
Mutual labels:  rollup, rollup-plugin
web-config
A Rollup configuration to build modern web applications with sweet features as for example SCSS imports, Service Worker generation with Workbox, Karma testing, live reloading, coping resources, chunking, treeshaking, Typescript, license extraction, filesize visualizer, JSON import, budgets, build progress, minifying and compression with brotli a…
Stars: ✭ 17 (-41.38%)
Mutual labels:  rollup, rollup-plugin
rollup-plugin-collect-sass
Collect Sass, then compile
Stars: ✭ 17 (-41.38%)
Mutual labels:  rollup, rollup-plugin
rollup-plugin-lit-css
Moved to https://github.com/bennypowers/lit-css
Stars: ✭ 35 (+20.69%)
Mutual labels:  rollup, rollup-plugin
rollup-plugin-purs
Bundles PureScript modules with Rollup
Stars: ✭ 71 (+144.83%)
Mutual labels:  rollup, rollup-plugin
rollup-plugin-tagged-template
Use plain HTML files as tagged templates.
Stars: ✭ 24 (-17.24%)
Mutual labels:  rollup, rollup-plugin
rollup-plugin-sizes
Rollup plugin to display bundle contents & size information
Stars: ✭ 77 (+165.52%)
Mutual labels:  rollup, rollup-plugin
rollup-plugin-inject-process-env
Inject environment variables in process.env with Rollup
Stars: ✭ 48 (+65.52%)
Mutual labels:  rollup, rollup-plugin
rollup-plugin-jscc
Conditional compilation and compile-time variable replacement for Rollup
Stars: ✭ 52 (+79.31%)
Mutual labels:  rollup, rollup-plugin
postcss-font-grabber
A postcss plugin, it grabs remote font files and update your CSS, just like that.
Stars: ✭ 26 (-10.34%)
Mutual labels:  rollup, rollup-plugin
rollup-plugin-userscript-metablock
Transform json file to userscript metablock and append on.
Stars: ✭ 26 (-10.34%)
Mutual labels:  rollup, rollup-plugin
rollup-plugin-html-entry
Use HTML files as entry points in your rollup bundle.
Stars: ✭ 13 (-55.17%)
Mutual labels:  rollup-plugin
scriptable-ts-boilerplate
A boilerplate for creating remote-updatable Scriptable widgets. Includes setup, components, utils and examples to develop in the comfort of TypeScript.
Stars: ✭ 40 (+37.93%)
Mutual labels:  rollup
echarts-for-svelte
📈 Baidu Echarts(v3.0 & v4.0) components for Svelte wrapper.
Stars: ✭ 25 (-13.79%)
Mutual labels:  rollup
rollup-plugin-glob-import
A rollup plugin to use glob-star.
Stars: ✭ 18 (-37.93%)
Mutual labels:  rollup
rollup-plugin-stylus-css-modules
A Rollup.js plugin to compile Stylus and inject CSS Modules
Stars: ✭ 15 (-48.28%)
Mutual labels:  rollup-plugin

rollup-plugin-generate-package-json

Build Status Codecov

Generate package.json file with packages from your bundle using Rollup.

About

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

Installation

# yarn
yarn add rollup-plugin-generate-package-json -D

# npm
npm install rollup-plugin-generate-package-json -D

Usage

// rollup.config.js
import generatePackageJson from 'rollup-plugin-generate-package-json'

export default {
  input: 'src/index.js',
  output: {
    file: 'dist/app.js',
    format: 'cjs'
  },
  plugins: [
    generatePackageJson()
  ]
}

Configuration

There are some useful options, all of them are optional:

inputFolder

Type: string
Default: current working directory

Set input package.json folder.

generatePackageJson({
  inputFolder: 'nested/folder'
})

outputFolder

Type: string
Default: bundle output folder

Set output folder for generated package.json file.

generatePackageJson({
  outputFolder: 'dist'
})

baseContents

Type: object | function
Default: {}

Set base contents for your generated package.json file.

generatePackageJson({
  baseContents: {
    scripts: {
      start: 'node app.js'
    },
    dependencies: {},
    private: true
  }
})

It can also be a function, which receives the contents of the input package.json file.

generatePackageJson({
  baseContents: (pkg) => ({
    name: pkg.name,
    main: pkg.main.replace('src', 'dist')
    dependencies: {},
    private: true
  })
})

additionalDependencies

Type: Array | object
Default: []

Set dependencies which are not directly imported in the bundle, but are used by the app.

generatePackageJson({
  additionalDependencies: ['pg']
})

It's also possible to add new dependencies or overwrite dependency version.

generatePackageJson({
  additionalDependencies: {
    pg: '7.12.1',
    'react-calendar': 'file:../react-calendar/react-calendar-v2.13.2.tgz'
  }
})

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].