Files
gerrit/tools/node_tools/node_modules_licenses
David Ostrovsky 6cb69efc86 Bump rules_nodejs to version 3.0.0
Version 3.0.0 fixed some bugs and added new features: [1].

yarn_install and npm_install will now fail if the lockfile is
out-of-date, rather than update it. This assumes that the tooling to
manually update the lockfile is used.

yarn_install now passes --frozen_lockfile by default, but it can use
yarn_install(frozen_lockfile = False) to go back to the old behavior.

New @bazel/typescript module is stricter now and added third party
strictness checks to the typescript compiler.

The new check is flagging this code as invalid:

tools/node_tools/node_modules_licenses/installed-node-modules-map.ts:75:25 - error TS21231: [tsetse] type assert `JSON.parse() as SomeExplicitType` for type & optimization safety.
	See http://tsetse.info/must-type-assert-json-parse.
        const version = JSON.parse(fs.readFileSync(packageJsonFile, {encoding: 'utf-8'}))["version"];

Disable this check: must-type-assert-json-parse, as fixing it is
outside of the scope of this change.

[1] https://github.com/bazelbuild/rules_nodejs/releases/tag/3.0.0

Change-Id: I6835e29a00080ca90b649663361e261ad6ef0f8b
2020-12-20 21:05:15 +01:00
..
2020-07-22 13:47:39 +02:00

This directory contains a tool to produce json file with information about licenses for npm workspace.

The tool consists of:

  • Command-line tool (entry point license-map-generator.ts) which gets as input a list of files in a node_modules folder, licenses config and produces a json file with packages grouped by their licenses. If the tool finds a file with an inappropriate license, then it returns error.

    Exact format for input and output data of the tool can be found in the source code.

  • Bazel rule node_modules_licenses (in the node_modules_licenses.bzl file), which wraps command-line tool and allows to call it during the build