{"id":28491003,"url":"https://github.com/videojs/videojs-generate-rollup-config","last_synced_at":"2025-10-15T06:52:59.955Z","repository":{"id":45856103,"uuid":"145033594","full_name":"videojs/videojs-generate-rollup-config","owner":"videojs","description":"Generate a standard rollup config, so that plugins don't need the same script in every repository.","archived":false,"fork":false,"pushed_at":"2023-08-18T22:39:56.000Z","size":1412,"stargazers_count":3,"open_issues_count":5,"forks_count":10,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-06-08T07:44:12.941Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/videojs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-16T20:00:07.000Z","updated_at":"2023-06-14T22:34:48.000Z","dependencies_parsed_at":"2024-06-18T19:48:20.365Z","dependency_job_id":"46d0741c-b768-4898-a7ad-516681472126","html_url":"https://github.com/videojs/videojs-generate-rollup-config","commit_stats":{"total_commits":73,"total_committers":10,"mean_commits":7.3,"dds":0.5205479452054795,"last_synced_commit":"b9f3943f0301cdf8a191825308e963135fcee180"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/videojs/videojs-generate-rollup-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/videojs%2Fvideojs-generate-rollup-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/videojs%2Fvideojs-generate-rollup-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/videojs%2Fvideojs-generate-rollup-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/videojs%2Fvideojs-generate-rollup-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/videojs","download_url":"https://codeload.github.com/videojs/videojs-generate-rollup-config/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/videojs%2Fvideojs-generate-rollup-config/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264175357,"owners_count":23568447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-08T07:31:04.199Z","updated_at":"2025-10-15T06:52:54.906Z","avatar_url":"https://github.com/videojs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# videojs-generate-rollup-config\n\n[![Build Status](https://travis-ci.org/videojs/videojs-generate-rollup-config.svg?branch=master)](https://travis-ci.org/videojs/videojs-generate-rollup-config)\n[![Greenkeeper badge](https://badges.greenkeeper.io/videojs/videojs-generate-rollup-config.svg)](https://greenkeeper.io/)\n[![Slack Status](http://slack.videojs.com/badge.svg)](http://slack.videojs.com)\n\n[![NPM](https://nodei.co/npm/videojs-generate-rollup-config.png?downloads=true\u0026downloadRank=true)](https://nodei.co/npm/videojs-generate-rollup-config/)\n\nCurrently rollup configs are the same for most plugins, but when the default config changes a bit, every repository has\nto be updated since it is a static file. This package will provide the standard config as a module, so that updates can be\ndeployed much easier.\n\nLead Maintainer: Brandon Casey [@brandonocasey](https://github.com/brandonocasey)\n\nMaintenance Status: Stable\n\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n**Table of Contents**\n\n- [Installation](#installation)\n- [Environment variables](#environment-variables)\n  - [`TEST_BUNDLE_ONLY`](#test_bundle_only)\n  - [`NO_TEST_BUNDLE`](#no_test_bundle)\n- [Function Options](#function-options)\n  - [`input`](#input)\n  - [`minifierPlugin`](#minifierplugin)\n  - [`testInput`](#testinput)\n  - [`distName`](#distname)\n  - [`exportName`](#exportname)\n  - [`excludeCoverage`](#excludecoverage)\n  - [`coverage`](#coverage)\n  - [`browserslist`](#browserslist)\n  - [`checkWatch`](#checkwatch)\n  - [`banner`](#banner)\n  - [`babel`](#babel)\n  - [`globals`](#globals)\n  - [`externals`](#externals)\n  - [`plugins`](#plugins)\n  - [`primedPlugins`](#primedplugins)\n- [Defaults](#defaults)\n  - [defaultGlobals](#defaultglobals)\n  - [defaultExternals](#defaultexternals)\n  - [defaultPlugins](#defaultplugins)\n  - [defaultPrimedPlugins](#defaultprimedplugins)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Installation\n\u003e Note: version 3+ support rollup ^1.0.0. If you need older rollup support please use version 2.\n\n```\n$ npm install --save-dev rollup videojs-generate-rollup-config\n```\n\nThen in your rollup config do\n\n```js\nconst generateRollupConfig = require('videojs-generate-rollup-config');\nconst config = generateRollupConfig();\n\n/**\n * Now you have:\n * - config.settings: An object containing the settings used to generate the builds.\n * - config.builds: An object containing the generated builds, with the name of the build as the key:\n *   - cjs\n *   - es\n *   - test\n *   - browser\n *   - minBrowser, this will be excluded by default in watch mode. See the `checkWatch` option.\n */\n\n// Note that you have to take the values from config.builds, since rollup takes an array.\nexport default Object.values(config.builds);\n```\n\nBefore you exports you can customize the builds, and you can also pass options (outlined below) to customize the builds.\n\n## Environment variables\nThese can be passed via rollup's `--environment` or just setting an environment variable\n\n### `TEST_BUNDLE_ONLY`\n\u003e Type: `Boolean`\n\u003e Default: false\n\nSet this to any JavaScript truthy value, to only create a `test` build target. If this option is present `NO_TEST_BUNDLE` will be ignored.\n\n### `NO_TEST_BUNDLE`\n\u003e Type: `Boolean`\n\u003e Default: false\n\nSet this to any JavaScript truthy value, to create all build targets except `test`. This option will be ignored if `TEST_BUNDLE_ONLY` is set.\n\n\n## Function Options\noptions that are passed as an object to the `generateRollupConfig` function.\n\n### `input`\n\n\u003e Type: `string`\n\u003e Default: `src/plugin.js`\n\nThe entry point for your build.\n\n### `minifierPlugin`\n\n\u003e Type: `string`\n\u003e Default: `uglify`\n\nThe name of the primed plugin to use when minifying\n\n### `testInput`\n\n\u003e Type: `string`\n\u003e Default: `test/**/*.test.js`\n\nThe entry point for tests.\n\n### `distName`\n\n\u003e Type: `string`\n\u003e Default: Your package name minus scope.\n\nDetermines the dist file names for your build. IE:\n`@thing/videojs-foo-bar` would have a `distName` of `videojs-foo-bar` and build to `dist/videojs-foo-var.js` etc.\n\n### `exportName`\n\n\u003e Type: `string`\n\u003e Default: Your package name minus scope in camel case.\n\nDetermines the export name for browser and test dist files of your build. IE:\n* `@thing/videojs-foo-bar` would have a `exportName` of `videojsFooBar`.\n* The `browser`/`minBrowser` dist would be exported to window as `window.videojsFooBar`.\n* The `test` dist would be exported to window as `window.videojsFooBarTests`.\n\n### `excludeCoverage`\n\n\u003e Type: `Function`\n\u003e Default: no default\n\n\nA callback to change the files that are excluded from test coverage.\n\nThis function takes one argument and will be passed the default files that are excluded from coverage, see below. This function **must** return the final list of files that should be excluded from coverage.\n\nDefaults are as follows:\n\n\u003e NOTE: __dirname refers to the directory of `videojs-generate-rollup-config`. This is used because some rollup plugins insert\n\u003e special transforms.\n\n```\n['test/**', path.join(__dirname, '**'), 'node_modules/**', 'package.json']\n```\n\n### `coverage`\n\n\u003e Type: `Boolean`\n\u003e Default: true\n\n\nWhether to include istanbul for the unit test bundle. By default it is included.\n\n\n### `browserslist`\n\n\u003e Type: `string|Array`\n\u003e Default: ['defaults', 'ie 11']\n\nWhat browser syntax should be supported in the browser/test dist files. Can also be specified in the package.json as a top level `browserslist` key/value. See the [browserslist repo](https://github.com/browserslist/browserslist) for more information.\n\n### `checkWatch`\n\n\u003e Type: `boolean`\n\u003e Default: `true`\n\nDetermines if we should check if rollup is in watch mode. If it is we exclude the minBrowser build to save development time.\n\n### `banner`\n\n\u003e Type: `string`\n\u003e Default: `/*! @name ${pkg.name} @version ${pkg.version} @license ${pkg.license} */`\n\nThe banner that should be inserted to the top of all bundles. You probably should not change this from the default!\n\n### `babel`\n\n\u003e Type: `Function`\n\u003e Default: no default\n\nA callback to change the default settings for [`rollup-plugin-babel`](https://github.com/rollup/rollup-plugin-babel).\n\nThis function takes one argument, the default babel config. This function **must** return\nthe final babel config that should be used for [`rollup-plugin-babel`](https://github.com/rollup/rollup-plugin-babel).\n\ndefault babel config:\n```js\n{\n  babelrc: false,\n  exclude: path.join(process.cwd(), 'node_modules/**'),\n  presets: [\n    [presetEnv, {loose: true, modules: false, targets: {browsers: settings.browserslist}}]\n  ],\n  plugins: [\n    transformObjectAssign\n  ]\n};\n```\n\nExample:\n\n```js\nconst config = generateRollupConfig({\n  babel(default) {\n    default.plugins.push('babel-plugin-lodash');\n\n    return default;\n  }\n})\n```\n\n### `globals`\n\n\u003e Type: `Function`\n\u003e Default: no default\n\nA callback to change the build globals for the rollup build before they are used.\n\nThis function takes one argument and will be passed the [defaultGlobals](###defaultGlobals). This function **must** return\nthe final globals that should be used to create the rollup build list.\n\nExample:\n\n```js\nconst config = generateRollupConfig({\n  globals(defaults) {\n    return {\n      browser: Object.assign(defaults.browser, {\n        'foo-bar': 'foo',\n      }),\n      module: Object.assign(defaults.module, {\n        'foo-bar': 'foo'\n      }),\n      test: Object.assign(defaults.test, {\n        'foo-bar': 'foo'\n      }),\n    };\n  }\n})\n};\n```\n\n### `externals`\n\n\u003e Type: `Function`\n\u003e Default: no default\n\nA callback to change the build externals for the rollup build before they are used.\n\nThis function takes one argument and will be passed the [defaultExternals](###defaultExternals). This function **must** return\nthe final externals that should be used to create the rollup build list.\n\n\u003e NOTE: You do not have to re-list globals in this list, all globals will be added as external automatically!\n\nExample:\n\n```js\nconst config = generateRollupConfig({\n  externals(defaults) {\n    return {\n      browser: defaults.browser.concat([\n        'foo',\n      ]),\n      module: defaults.module.concat([\n        'foo'\n      ],\n      test: defaults.test.concat([\n        'foo'\n      ],\n    };\n  }\n});\n```\n\n### `plugins`\n\n\u003e Type: `Function`\n\u003e Default: no default\n\nA callback to change the build plugins and plugin order for the rollup build before they are used.\n\nThis function takes one argument and will be passed the [defaultPlugins](###defaultPlugins). This function **must** return\nthe final plugins that should be used to create the rollup build list.\n\n\u003e NOTE: Plugins can be \"primed\", here or in the `primedPlugins` option. By default all plugins are primed later and\n\u003e       referenced by their key in `primedPlugins`.\n\nExample:\n\n```js\nconst config = generateRollupConfig({\n  plugins(defaults) {\n    return {\n      browser: defaults.browser.concat([\n        'foo',\n      ]),\n      module: defaults.module.concat([\n        'foo'\n      ],\n      test: defaults.test.concat([\n        'foo'\n      ],\n    };\n  }\n});\n```\n\n### `primedPlugins`\n\n\u003e Type: `Function`\n\u003e Default: no default\n\nA callback to change the primed plugins  for the rollup build before they are used.\n\nThis function takes one argument and will be passed the [defaultPrimedPlugins](###defaultPrimedPlugins). This function **must** return\nthe final primed plugins that should be used to create the rollup build list.\n\nExample:\n\n```js\nconst fooPlugin = require('rollup-plugin-foo');\nconst config = generateRollupConfig({\n  primedPlugins(defaults) {\n    return Object.assign(defaults, {\n      foo: fooPlugin();\n    });\n  }\n});\n```\n\n## Defaults\n\n### defaultGlobals\nAn object that contains keys for `browser`, `module`, and `test` globals that will be used by default. See the code for the more info.\n\n```js\nconst defaultGlobals = {\n  browser: {\n    'video.js': 'videojs',\n    'global': 'window',\n    'global/window': 'window',\n    'global/document': 'document'\n  },\n  module: {\n    'video.js': 'videojs'\n  },\n  test: {\n    'qunit': 'QUnit',\n    'qunitjs': 'QUnit',\n    'sinon': 'sinon',\n    'video.js': 'videojs'\n  }\n};\n```\n\n### defaultExternals\nAn object that contains keys for `browser`, `module`, and `test` externals that will be used by default.\n\n\u003e NOTE: that we automatically add on any of globals provided into this list, as that is the default rollup behavior.\n\n```js\n\nconst defaultExternals = {\n  browser: [],\n  module: [\n    'global',\n    'global/document',\n    'global/window'\n  ],\n  test: []\n};\n```\n\n### defaultPlugins\nAn object that contains keys for `browser`, `module`, and `test` plugins that will be used by default.\n\n\u003e NOTE: The plugins are referenced as strings that will be the keys in the primedPlugins that generateRollupConfig uses.\n\n```js\nconst defaultPlugins = {\n  // note that for the minBrowser build uglify will be inserted before\n  // babel.\n  browser: [\n    'resolve',\n    'json',\n    'commonjs',\n    'babel'\n  ],\n\n  module: [\n    'resolve',\n    'json',\n    'commonjs',\n    'babel'\n  ],\n\n  test: [\n    'multiEntry',\n    'resolve',\n    'json',\n    'commonjs',\n    'babel'\n  ]\n};\n```\n\n### defaultPrimedPlugins\nAn object that contains primed rollup plugins\n\n```js\nconst defaultPrimedPlugins = {\n  babel: babel({\n    babelrc: false,\n    exclude: 'node_modules/**',\n    presets: [\n      [presetEnv, {loose: true, modules: false, targets: {browsers: settings.browserslist}}]\n    ],\n    plugins: [\n      externalHelpers,\n      transformObjectAssign\n    ]\n  }),\n  commonjs: commonjs({sourceMap: false}),\n  json: json(),\n  multiEntry: multiEntry({exports: false}),\n  resolve: resolve({browser: true, main: true, jsnext: true}),\n  uglify: uglify({output: {comments: 'some'}}, minify)\n};\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvideojs%2Fvideojs-generate-rollup-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvideojs%2Fvideojs-generate-rollup-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvideojs%2Fvideojs-generate-rollup-config/lists"}