hardhat-spdx-license-identifier
v2.3.1
Published
Prepend local Solidity source files with an SPDX License Identifier
Maintainers
Readme
Hardhat SPDX License Identifier
Prepend Solidity source files in Hardhat projects with the SPDX License Identifier specified in package.json.
Versions of this plugin prior to
2.0.0were released asbuidler-spdx-license-identifier.
Installation
npm install --save-dev hardhat-spdx-license-identifier
# or
yarn add --dev hardhat-spdx-license-identifierUsage
Load plugin in Hardhat config:
require('hardhat-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 |
| only | Array of String matchers used to select included paths, defaults to all contracts if length is 0 | [] |
| except | Array of String matchers used to exclude paths | [] |
spdxLicenseIdentifier: {
overwrite: true,
runOnCompile: true,
except: ['vendor/']
}The included Hardhat task may be run manually:
npx hardhat prepend-spdx-license
# or
yarn run hardhat prepend-spdx-licenseFiles 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.
Development
Install dependencies via Yarn:
yarn installSetup Husky to format code on commit:
yarn prepare