Skip to content

Use license-checker directly instead of grunt-license-report#340

Merged
nkurihar merged 1 commit intoapache:masterfrom
massakam:replace-grunt-license-report
Aug 22, 2023
Merged

Use license-checker directly instead of grunt-license-report#340
nkurihar merged 1 commit intoapache:masterfrom
massakam:replace-grunt-license-report

Conversation

@massakam
Copy link
Contributor

@massakam massakam commented Aug 16, 2023

Motivation

Executing npm run license:report in this repository will report the licenses of dependent modules to report/licenses.html. However, the grunt-license-report module used by this command has not been maintained for nearly a decade, and the GitHub repository is a dead link. As a result, some modules with security vulnerabilities are installed by grunt-license-report dependencies.

Modifications

Removed grunt-license-report from dev dependencies and added license-checker instead. license-checker has already been installed since grunt-license-report depends on it, but its version is 2.0.1 which is very old. Installing license-checker directly bumps its version to 25.0.1.

By the way, license-checker also hasn't been released in about 5 years, but it seems to be much more widely used than grunt-license-report.

Verifying this change

  • Make sure that the change passes the CI checks.

Documentation

  • doc-not-needed

@massakam massakam added no-need-doc dependencies Pull requests that update a dependency file labels Aug 16, 2023
@massakam massakam added this to the 1.10.0 milestone Aug 16, 2023
@massakam massakam self-assigned this Aug 16, 2023
@massakam
Copy link
Contributor Author

Build NAPI macos - Node 18 - arm64 is failing, but it appears to be unrelated to this change.

ld: archive has no table of contents file '/Users/runner/work/pulsar-client-node/pulsar-client-node/pkg/mac/build-pulsar/install/lib/libpulsarwithdeps.a' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Failed to execute '/Users/runner/hostedtoolcache/node/18.17.0/x64/bin/node /Users/runner/hostedtoolcache/node/18.17.0/x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --target_arch=arm64 --module=/Users/runner/work/pulsar-client-node/pulsar-client-node/lib/binding/pulsar.node --module_name=pulsar --module_path=/Users/runner/work/pulsar-client-node/pulsar-client-node/lib/binding --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
make: *** [Release/pulsar.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/runner/hostedtoolcache/node/18.17.0/x64/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23)
gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Darwin 21.6.0
gyp ERR! command "/Users/runner/hostedtoolcache/node/18.17.0/x64/bin/node" "/Users/runner/hostedtoolcache/node/18.17.0/x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--target_arch=arm64" "--module=/Users/runner/work/pulsar-client-node/pulsar-client-node/lib/binding/pulsar.node" "--module_name=pulsar" "--module_path=/Users/runner/work/pulsar-client-node/pulsar-client-node/lib/binding" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v108"
gyp ERR! cwd /Users/runner/work/pulsar-client-node/pulsar-client-node
gyp ERR! node -v v18.17.0
gyp ERR! node-gyp -v v9.3.1
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/Users/runner/hostedtoolcache/node/18.17.0/x64/bin/node /Users/runner/hostedtoolcache/node/18.17.0/x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --target_arch=arm64 --module=/Users/runner/work/pulsar-client-node/pulsar-client-node/lib/binding/pulsar.node --module_name=pulsar --module_path=/Users/runner/work/pulsar-client-node/pulsar-client-node/lib/binding --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/runner/work/pulsar-client-node/pulsar-client-node/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
node-pre-gyp ERR! System Darwin 21.6.0
node-pre-gyp ERR! command "/Users/runner/hostedtoolcache/node/18.17.0/x64/bin/node" "/Users/runner/work/pulsar-client-node/pulsar-client-node/node_modules/.bin/node-pre-gyp" "build" "--target_arch=arm64"
node-pre-gyp ERR! cwd /Users/runner/work/pulsar-client-node/pulsar-client-node
node-pre-gyp ERR! node -v v18.17.0
node-pre-gyp ERR! node-pre-gyp -v v1.0.11
node-pre-gyp ERR! not ok 
Error: Process completed with exit code 1.

@tisonkun
Copy link
Member

I wrote an executable for doing similar things and it's used in some of Pulsar projects like pulsar-site and pulsar-client-go.

This task should be trivial to implement stably and correctly. (Once it's checked in, there should be no bug to "fix".) I'd propose to switch to my tool if we anyway want to make changes and I'm glad to prepare a patch.

@massakam
Copy link
Contributor Author

@tisonkun Is this a tool for checking/adding license headers? The command I modified in this PR does not do that, but lists the licenses of the 3rd party modules that this module depends on.

$ npm run license:report

> pulsar-client@1.10.0-rc.0 license:report
> mkdir -p report && license-checker --json > report/licenses.json

$ head -n 30 report/licenses.json

{
  "@aashutoshrathi/word-wrap@1.2.6": {
    "licenses": "MIT",
    "repository": "https://github.com/aashutoshrathi/word-wrap",
    "publisher": "Jon Schlinkert",
    "url": "https://github.com/jonschlinkert",
    "path": "/home/massakam/github/pulsar-client-node/node_modules/@aashutoshrathi/word-wrap",
    "licenseFile": "/home/massakam/github/pulsar-client-node/node_modules/@aashutoshrathi/word-wrap/LICENSE"
  },
  "@ampproject/remapping@2.2.1": {
    "licenses": "Apache-2.0",
    "repository": "https://github.com/ampproject/remapping",
    "publisher": "Justin Ridgewell",
    "email": "jridgewell@google.com",
    "path": "/home/massakam/github/pulsar-client-node/node_modules/@ampproject/remapping",
    "licenseFile": "/home/massakam/github/pulsar-client-node/node_modules/@ampproject/remapping/LICENSE"
  },
  "@assemblyscript/loader@0.10.1": {
    "licenses": "Apache-2.0",
    "repository": "https://github.com/AssemblyScript/assemblyscript",
    "publisher": "Daniel Wirtz",
    "email": "dcode+assemblyscript@dcode.io",
    "path": "/home/massakam/github/pulsar-client-node/node_modules/@assemblyscript/loader",
    "licenseFile": "/home/massakam/github/pulsar-client-node/node_modules/@assemblyscript/loader/README.md"
  },
  "@babel/code-frame@7.12.11": {
    "licenses": "MIT",
    "repository": "https://github.com/babel/babel",
    "publisher": "Sebastian McKenzie",
    "email": "sebmck@gmail.com",

@tisonkun
Copy link
Member

@massakam Thanks for your explanation! Then my tool doesn't implement that.

@massakam massakam force-pushed the replace-grunt-license-report branch from 77d8ae7 to 5d5320a Compare August 17, 2023 01:14
@massakam
Copy link
Contributor Author

#340 (comment) seems to have been fixed by #341.

Copy link
Contributor

@nkurihar nkurihar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nkurihar nkurihar merged commit cb20be3 into apache:master Aug 22, 2023
@massakam massakam deleted the replace-grunt-license-report branch August 22, 2023 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file no-need-doc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants