* [grunt/build] refactor _build:notice task to not depend on npm The _build:notice task used to rely on the output of `npm ls` to determine where modules were defined, but the task now just asks `license-checker` to include the `realPath` of the modules it describes in it's output, which is ultimately the same thing but works with `yarn` too. * [grunt/licenses] convert to use lib/packages/getInstalledPackages() * [grunt/notice/generate] test generateNoticeText() * [grunt/licenses] tested assertLicensesValid() * [npm] remove npm dev dep * [tasks/lib/packages] do not include kibana in "installed packages" * [tasks/lib/notice] join all notices with the same separator
30 lines
655 B
JavaScript
30 lines
655 B
JavaScript
import {
|
|
getInstalledPackages,
|
|
assertLicensesValid
|
|
} from './lib';
|
|
|
|
export default function licenses(grunt) {
|
|
grunt.registerTask('licenses', 'Checks dependency licenses', async function () {
|
|
const done = this.async();
|
|
|
|
try {
|
|
const options = this.options({
|
|
licenses: [],
|
|
overrides: {}
|
|
});
|
|
|
|
assertLicensesValid({
|
|
packages: await getInstalledPackages({
|
|
directory: grunt.config.get('root'),
|
|
licenseOverrides: options.overrides
|
|
}),
|
|
validLicenses: options.licenses
|
|
});
|
|
done();
|
|
} catch (err) {
|
|
grunt.fail.fatal(err);
|
|
done(err);
|
|
}
|
|
});
|
|
}
|