UNPKG

buidler-spdx-license-identifier

Version:

Prepend local Solidity source files with an SPDX License Identifier

44 lines (29 loc) 1.18 kB
# Buidler SPDX License Identifer Prepend Solidity source files in Buidler projects with the SPDX License Identifier specified in `package.json`. ## Installation ```bash yarn add --dev buidler-spdx-license-identifier ``` ## Usage Load plugin in Buidler config: ```javascript usePlugin('buidler-spdx-license-identifier'); ``` Add configuration under the `spdxLicenseIdentifier` key: | option | description | default | |-|-|-| | `overwrite` | whether to overwrite existing SPDX license identifiers | `false` | | `runOnCompile` | whether to automatically prepend identifiers during compilation | `false` | ```javascript spdxLicenseIdentifier: { overwrite: true, runOnCompile: true, } ``` The included Buidler task may be run manually: ```bash yarn run buidler prepend-spdx-license ``` Files which do not contain a license identifier will be prepended with one. Files with a license identifier which does not match that which is specified in `package.json` may be updated, depending on configuration. ### TypeScript Support For TypeScript compatibility, add `'node_modules/buidler-spdx-license-identifier/type-extensions.d.ts'` to the `files` array in `tsconfig.json`.