@solidstate/hardhat-license-identifier
Version:
Prepend local Solidity source files with an SPDX License Identifier
30 lines (23 loc) • 653 B
text/typescript
import {
filterSourcePaths,
readSourceLicenses,
} from '../lib/license_identifier.js';
import { printSourceLicenses } from '../lib/print.js';
import type { NewTaskActionFunction } from 'hardhat/types/tasks';
interface TaskActionArguments {}
const action: NewTaskActionFunction<TaskActionArguments> = async (
args,
hre,
) => {
const config = hre.config.licenseIdentifier;
const sourcePaths = filterSourcePaths(
config,
await hre.solidity.getRootFilePaths(),
);
const sourceLicenses = await readSourceLicenses(
sourcePaths,
hre.config.paths.root,
);
printSourceLicenses(sourceLicenses);
};
export default action;