{"id":26020911,"url":"https://github.com/teclone/rollup-all","last_synced_at":"2025-03-06T08:22:11.336Z","repository":{"id":38175561,"uuid":"141044289","full_name":"teclone/rollup-all","owner":"teclone","description":"A lightweight, extensive and configurable npm package for automating your project source code build in one parse using rollup","archived":false,"fork":false,"pushed_at":"2024-12-25T12:04:01.000Z","size":1346,"stargazers_count":8,"open_issues_count":16,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-03T23:53:35.428Z","etag":null,"topics":["asset-builder","build","esmodules","esnext","generate-dist","generate-lib","minified-versions","presets","rollup","tree-shaking","typescript-library"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/teclone.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-07-15T17:12:57.000Z","updated_at":"2024-12-25T12:03:08.000Z","dependencies_parsed_at":"2024-06-18T11:29:38.641Z","dependency_job_id":"e04deb93-fd4a-41e6-a7ac-253f2799faad","html_url":"https://github.com/teclone/rollup-all","commit_stats":null,"previous_names":["harrison-ifeanyichukwu/rollup-all"],"tags_count":90,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teclone%2Frollup-all","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teclone%2Frollup-all/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teclone%2Frollup-all/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teclone%2Frollup-all/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teclone","download_url":"https://codeload.github.com/teclone/rollup-all/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241758964,"owners_count":20015247,"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":["asset-builder","build","esmodules","esnext","generate-dist","generate-lib","minified-versions","presets","rollup","tree-shaking","typescript-library"],"created_at":"2025-03-06T08:22:10.838Z","updated_at":"2025-03-06T08:22:11.304Z","avatar_url":"https://github.com/teclone.png","language":"TypeScript","readme":"# @teclone/rollup-all\n\n[![Build Status](https://travis-ci.org/teclone/rollup-all.svg?branch=master)](https://travis-ci.org/teclone/rollup-all)\n[![Coverage Status](https://coveralls.io/repos/github/teclone/rollup-all/badge.svg?branch=master)](https://coveralls.io/github/teclone/rollup-all?branch=master)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![npm version](https://badge.fury.io/js/%40teclone%2Frollup-all.svg)](https://badge.fury.io/js/%40teclone%2Frollup-all)\n![npm](https://img.shields.io/npm/dt/%40teclone%2Frollup-all.svg)\n\n**@teclone/rollup-all** is a package for generating javascript/typescript library builds with typescript definition file support.\n\nThis package does the heavy lifting and builds on top of [Rollupjs](https://rollupjs.org/) and [Babel](https://babeljs.io/) making it possible to generate `cjs`, `es`, `umd` and `iife` builds at once.\n\n## Motivation for this package\n\nThe Javascript ecosystem is diverse, and every changing with new language proposals. There is big need to support older environments while writing in modern Javascript syntax.\n\nLibrary developers face the problem of shipping modern Javascript codes to formats that are compatible with NodeJs, browsers and bundle tools (webpack) in the leanest forms.\n\nMoreso, there is need to generate typescript definition files for most projects (javascript and typescript projects alike), sourcemaps, minification, production build, development build, resolution of dynamic imports, etc.\n\nThis library allows you to generate commonjs, es module, and browser builds at once with sourcemaps and typescript definition files. It is very configurable.\n\nThis package automates the whole process with the right configurations and makes it easy to get all target build formats generated in one command with configurability in mind.\n\nit generates typescript definition files for what is built, by leveraging typescript build api.\n\n### Installation with npm\n\n```bash\nnpm install --save-dev @teclone/rollup-all\n```\n\n### Installation with yarn\n\n```bash\nyarn add --dev @teclone/rollup-all\n```\n\n### Run via cli\n\n```bash\nnpx rollup-all\n```\n\n### Run as npm/yarn script\n\nadd a build script to package.json\n\n```json\n{\n  \"scripts\": {\n    \"build\": \"rollup-all\"\n  }\n}\n```\n\nYou can now run it as npm or yarn command\n\n```bash\nyarn rollup-all\n```\n\n### Supported build Formats:\n\nThe following build formats are supported:\n\n- `cjs`: Commonjs build, this output of this build is compatible with Nodejs.\n- `es`: Es module build, the output of this build is compatibile with modern bundle tools such as webpack\n- `umd`: Browser bundle compatible with umd loaders,\n- `iife`: Browser bundle\n\n### Configurations\n\nIt is possible to configure the build process via a config file or via cli options. To configure the build via a config file, create a `rollup.config.js` file in the project's root directory\n\n```javascript\nconst { createConfig } = require('@teclone/rollup-all');\nmodule.exports = createConfig({\n  /**\n   * defines formats to build\n   */\n  formats: ['cjs', 'es'],\n\n  /**\n   * defines default configurations for all build formats\n   */\n  defaults: {\n    src: './src',\n\n    entryFile: './index',\n\n    /**\n     * allowed file extensions\n     */\n    extensions: ['.js', '.ts', '.jsx', '.tsx'],\n\n    /**\n     * boolean indicating if the interop rollup setting should be enabled\n     */\n    interop: true,\n\n    /**\n     * boolean indicating if sourcemap should be generated, can be true, false, or 'inline'\n     */\n    sourcemap: true,\n\n    /**\n     * applies to umd and iife builds\n     */\n    globals: {},\n\n    babelPlugins: [],\n\n    babelPresets: [],\n\n    exclude: [],\n\n    include: [],\n\n    plugins: [],\n  },\n\n  /**\n   * cjs build config\n   */\n  cjs: {\n    out: './build/cjs',\n  },\n\n  /**\n   * es build config\n   */\n  es: {\n    out: './build/es',\n  },\n\n  /**\n   * iife build config, disabled by default\n   */\n  iife: {\n    out: './build/iife',\n\n    // defines outputs\n    outputs: [\n      ['development', 'minified'],\n      ['production', 'minified'],\n    ],\n\n    minifiedSuffix: 'min',\n  },\n\n  /**\n   * umd build config, disabled by default\n   */\n  umd: {\n    out: './build/umd',\n    // defines outputs\n    outputs: [\n      ['development', 'minified'],\n      ['production', 'minified'],\n    ],\n    minifiedSuffix: 'min',\n  },\n});\n```\n\n#### Cli options\n\nThe following options can be parsed to the cli binary\n\n- **--sourcemap**: `boolean`: to generate sourcemaps, default is `true`\n- **--src**: `string`: your code's src folder: default value is `src`\n\n### Environment and minified builds\n\nWhen generating distribution builds, aka `umd` and `iife`, it is desirable to have separate development and production build with minified and non minified versions.\n\nThe build filename format for dist builds is `[filename].[env].[min]?.js`;\n\nProduction build will strip out all development related codes based on evaluation of `process.env.NODE.ENV`.\n\nfor instance, the code sample below will be removed in production builds\n\n```javascript\nif (process.env.NODE_ENV === 'development') {\n  // code snippets here\n}\n```\n\nThis configuration is achieved using the output option as shown below\n\n```typescript\nconst { createConfig } = require('@teclone/rollup-all');\nmodule.exports = createConfig({\n  formats: ['umd'],\n  /**\n   * umd build config\n   */\n  umd: {\n    out: './build/umd',\n    src: './src',\n\n    // defines outputs\n    outputs: [\n      ['development', 'minified'],\n      ['production', 'minified'],\n      ['uni', 'minified'],\n\n      ['development', 'unminified'],\n      ['production', 'unminified'],\n      ['uni', 'unminified'],\n    ],\n\n    minifiedSuffix: 'min',\n  },\n});\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteclone%2Frollup-all","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteclone%2Frollup-all","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteclone%2Frollup-all/lists"}