UNPKG

esbuild-plugin-license

Version:

esbuild plugin for generating license for your bundle

52 lines 2.62 kB
{ "name": "esbuild-plugin-license", "version": "1.2.3", "description": "esbuild plugin for generating license for your bundle", "main": "./dist/index.js", "module": "./dist/index.mjs", "exports": { "require": "./dist/index.js", "import": "./dist/index.mjs" }, "types": "./dist/index.d.ts", "files": [ "dist" ], "keywords": [ "license", "esbuild" ], "author": "Yiming Li", "license": "MIT", "bugs": { "url": "https://github.com/upupming/esbuild-plugin-license/issues" }, "homepage": "https://github.com/upupming/esbuild-plugin-license#readme", "devDependencies": { "@babel/core": "7.16.7", "@babel/preset-env": "7.16.11", "@babel/preset-typescript": "7.16.7", "@chialab/esbuild-plugin-commonjs": "0.14.17", "@types/jest": "27.4.0", "@types/lodash-es": "4.17.5", "@types/node": "17.0.9", "esbuild": "0.14.11", "jest": "27.4.7", "lodash": "4.17.21", "lodash-es": "4.17.21", "normalize-package-data": "3.0.3", "read-pkg-up": "9.0.0", "tsup": "5.11.11", "type-fest": "2.11.2", "typescript": "4.5.4" }, "peerDependencies": { "esbuild": "*" }, "scripts": { "test": "jest", "build": "tsup", "dev": "tsup --watch" }, "readme": "# esbuild-plugin-license\r\n\r\n[![npm (tag)](https://img.shields.io/npm/v/esbuild-plugin-license/latest?style=flat-square)](https://www.npmjs.com/package/esbuild-plugin-license)\r\n![npm](https://img.shields.io/npm/dm/esbuild-plugin-license?style=flat-square)\r\n\r\nLicense generation tool similar to https://github.com/mjeanroy/rollup-plugin-license\r\n\r\n## Usage\r\n\r\n```bash\r\nnpm i -D esbuild-plugin-license\r\n```\r\n\r\n```ts\r\nimport * as esbuild from 'esbuild'\r\nimport esbuildPluginLicense from 'esbuild-plugin-license';\r\n\r\nesbuild.build({\r\n entryPoints: ['index.ts'],\r\n outdir: 'dist',\r\n plugins: [esbuildPluginLicense()],\r\n bundle: true,\r\n platform: 'node'\r\n})\r\n\r\n```\r\n\r\n## Config\r\n\r\nExample of default config\r\n\r\n```ts\r\nexport const defaultOptions: DeepRequired<Options> = {\r\n banner: `/*! <%= pkg.name %> v<%= pkg.version %> | <%= pkg.license %> */`,\r\n thirdParty: {\r\n includePrivate: false,\r\n output: {\r\n file: 'dependencies.txt',\r\n // Template function that can be defined to customize report output\r\n template(dependencies) {\r\n return dependencies.map((dependency) => `${dependency.packageJson.name}:${dependency.packageJson.version} -- ${dependency.packageJson.license}`).join('\\n');\r\n },\r\n }\r\n }\r\n} as const\r\n```\r\n" }