-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(cli): add lb4 copyright command to generate/update file headers
#4994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bajtos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea 👍
Since this new command is a part of the public package @loopback/cli, we need to write some documentation.
- As a LB user dealing with copyright headers, how am I going to discover that LB4 CLI provides a tool for my situation?
- As a LB user not using copyright headers yet, when I discover a new
copyrightcommand in CLI help, where can I learn more about this command and whether (or when) to use it in my project? - As a LB user interested in using this new command, how can I learn about the configuration options - how to set the copyright owner, etc.
| const LICENSE = [ | ||
| 'This file is licensed under the <%= license %>.', | ||
| 'License text available <%= ref %>', | ||
| ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered using ES6 template literals instead of lodash templates?
function license({license, ref}) {
return [
`This file is licensed under the ${license}.`,
`License text available ${ref}`,
];
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit involved. We can defer it for future improvement.
dhmlau
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on having docs on the usage. Other than that, LGTM. Thanks @raymondfeng !
a16d0f3 to
5bb2719
Compare
dhmlau
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a question about the default owner value.
Please also update https://github.com/strongloop/loopback-next/blob/master/docs/site/Command-line-interface.md to include the command as well.
Other than that, LGTM. No need further reviews from me. Thanks.
5bb2719 to
67dd285
Compare
|
Updated |
cc3cd67 to
194d1f3
Compare
194d1f3 to
bdc277b
Compare
|
It's probably out-of-scope, but we could create a future improvement PR to...
I'm wondering if it should be ported into the LoopBack CLI. A copyright header management tool may be better-suited as a separate package that can be depended upon and called from the LoopBack CLI. This would allow users to utilize the tool a-la carte without needing the entire LoopBack CLI. |
e1473e2 to
2442a09
Compare
Thank you for the suggestion. I would like to integrate with the module but it will add at least 7MB to the dependency tree :-(.
The utility is ported from https://www.npmjs.com/package/strong-tools and improved with lerna support. We can possibly break down |
847cd9b to
87020c6
Compare
|
@achrinza I have improved the PR to use spdx list and https://www.npmjs.com/package/inquirer-autocomplete-prompt. But it seems to be causing test issues. |
92fcce6 to
56029c5
Compare
56029c5 to
652e2f8
Compare
lb4 copyright command to generate/update file headers
015c13a to
9eab09c
Compare
- Add `lb4 copyright` command - Ported from https://www.npmjs.com/package/strong-tools - Use spdx license list - Use inquirer autocomplete plugin
9eab09c to
69482ac
Compare
Add
lb4 copyrightcommand to update JS/TS file headers with copyright and license. Ported fromstrong-toolswith enhancement to support lerna managed monorepo.Todos:
Checklist
👉 Read and sign the CLA (Contributor License Agreement) 👈
npm testpasses on your machinepackages/cliwere updatedexamples/*were updated👉 Check out how to submit a PR 👈