Skip to content
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

[CLI] Remove copyright from generated template instances #944

Closed
7 tasks done
virkt25 opened this issue Jan 31, 2018 · 10 comments
Closed
7 tasks done

[CLI] Remove copyright from generated template instances #944

virkt25 opened this issue Jan 31, 2018 · 10 comments
Assignees
Labels
Milestone

Comments

@virkt25
Copy link
Contributor

virkt25 commented Jan 31, 2018

Overview

lb4 app makes an app and the templates have IBM copyright headers on them. I believe we had agreed that templates will not have any copyright headers and think this was added by mistake when we update the headers for 2018.

Acceptance Criteria

  • Remove copyright from existing templates manually (there are like...2 or 3 of them?)
  • Change the templates to use a different filetype suffix (so that the copyright tool doesn't add copyright to it!)
    • From .ts to .ts.template
    • From .js to .js.template (if applicable)
  • Refactor existing CLI code to
    • Use the new template format (change the target path to include the new name)
    • Ensure that the generated files still use the correct suffix!
@bajtos
Copy link
Member

bajtos commented Feb 1, 2018

I believe we had agreed that templates will not have any copyright headers and think this was added by mistake when we update the headers for 2018.

I added IBM copyright headers intentionally, see the discussion here: #867 (comment)

What's important: The template source code files in our repository should have an IBM copyright header in them, IMO they are the same kind of a source code as the other "regular" .js/.ts files.

So the question is whether the output of our CLI tool should include IBM copyright headers or not.

IMO, running our CLI tool to copy template files (while making small changes via EJS) is the same act as if the user copied our source code files manually. I believe copyright headers should be preserved in the latter case and users should add their copyright header above the header from the original file.

Something along the following lines:

// Copyright FooBar Inc 2018. All Rights Reserved
// The content of this file is based on @loopback/cli template
// which has the following notice:
//
// Copyright IBM Corp. 2017,2018. All Rights Reserved.
// Node module: @loopback/cli
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

IMO, this is needed to meet the following part of the MIT license:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

Anyways, I am not a lawyer so it's entirely possible I may be interpreting the terms of MIT in a wrong way. @virkt25 could you please reach out to our legal department (perhaps @rmg or @dhmlau can help you?) and find out a definite answer for which approach we should take?

In the light of my comment above, I am removing "good first issue" label.

Last but not least, if we end up with removing (or commenting out) the copyright headers in our template files, then we need to find a way how to allow automated update of these headers via slt copyright while preserving whatever header style is required. Otherwise we are going to have this discussion every year.

Possibly helpful comment: #867 (comment)

One way around this is to change the file extension to .ejs or something since the copyright tool is specifically looking for .js files.

@bajtos bajtos changed the title cli: Copyright Headers [CLI] Copyright Headers in the scaffolded files Feb 1, 2018
@virkt25
Copy link
Contributor Author

virkt25 commented Feb 1, 2018

I'll follow up with @rmg and @dhmlau. I just find it weird that a project generated using CLI would have the CLI / IBM Copyright headers. If it turns out the header must be a part of the template then I think we need to pre-process the files before outputting them into a project for the user.

I've personally never seen a project generate an app / template with it's own copyright headers ...

  • LoopBack 3 CLI doesn't put headers in generated app / files.
  • Angular CLI doesn't put headers in generate app / files.
  • Express-generator doesn't have any headers either.

Also unsure why every file would need the header given the fact that the entire project is licensed under MIT License. (It's nice to have but I'll try to find out if it's legally necessary).

@kjdelisle
Copy link
Contributor

Obviously, I am not a lawyer.

My concern is that if we add copyright statements to the templated code, are we not asserting some level of ownership over that code in a way that may create a legal grey area for our users, even if we strip the copyright notices from the final products of those templates?

@dhmlau We definitely need some legal advice from one of our IP lawyers about this. I don't want to create legal landmines for users that leverage our templates.

@dhmlau
Copy link
Member

dhmlau commented Feb 1, 2018

Disclaimer: I'm not a lawyer either.

I guess we have 2 questions here, and I can double check with our legal contact.

  1. whether files generated from LB need copyrights

    • I suspect no. Same reasons as @virkt25, and IBM tools like Eclipse, RAD (sorry.. i'm coming from older days) do not put copyrights unless the user explicitly set in the preference.
  2. whether the template text files used to generate those files need copyrights.

    • If we don't need copyrights on the generated files, why do we need it for the original files. On the other hand, is there a requirement that every files (regardless of their usage) in our repos should have copyright statements?

@rmg
Copy link
Contributor

rmg commented Feb 1, 2018

Including the copyright in this repo makes sense, but it should be stripped or replaced with the user's copyright when code is generated but preserved if a file is copied over and not intended to be modified (eg. like bundling a copy of jQuery or Angular in some app scaffolding).

As far as prior art for not including copyrights on generated code, I can add to the list all the frameworks I tested in my app scaffold shootout:

  • LoopBack (3.x)
  • Phoenix
  • Ruby on Rails
  • Sails
  • Swift (yo swiftserver, an IBM project)

I think we'd be causing more trouble by including our copyright header in the generated code - I think it raises more legal questions than stripping them does, because there isn't any license agreement related to generated code and nobody expects their code to be owned by their IDE or text editor.

@bajtos
Copy link
Member

bajtos commented Feb 2, 2018

Including the copyright in this repo makes sense, but it should be stripped or replaced with the user's copyright when code is generated but preserved if a file is copied over and not intended to be modified (eg. like bundling a copy of jQuery or Angular in some app scaffolding).

I think the easiest solution for this is to use EJS comments instead of JS comments for the license header? But then how to keep slt copyright updating copyright year in those EJS files?

At the end, it may be simpler for us to remove our template files to .ejs extension and remove copyright headers from them entirely.

IDK. Thoughts?

@dhmlau
Copy link
Member

dhmlau commented Feb 2, 2018

Team, FYI - I just sent the questions to legal for clarification.

@virkt25
Copy link
Contributor Author

virkt25 commented Feb 2, 2018

I like the idea of switching to .ejs templates because it means we can have EJS linting support. Apart from that maybe we can exclude a templates folder perhaps from slt?

@dhmlau
Copy link
Member

dhmlau commented Feb 7, 2018

Team, got inputs from legal and Savio:

  • The generated files should not contain copyrights.
    • Other framework does not have copyright statements attached to it either
  • (ideally) the templates should contain copyright statements.

@virkt25
Copy link
Contributor Author

virkt25 commented Feb 7, 2018

If a template is to contain the copyright then we have to switch to ejs so we don't have this problem next year when copyright headers are updated or remember to exclude those files manually somehow. But it would also require a quick check to see if we can get yeoman to play nice with ejs templates.

Can this be prioritized? I think this is within MVP scope since people are expected to use the CLI now. @dhmlau ?

@kjdelisle kjdelisle changed the title [CLI] Copyright Headers in the scaffolded files [CLI] Remove copyright from generated template instances Feb 8, 2018
@virkt25 virkt25 self-assigned this Feb 13, 2018
virkt25 added a commit that referenced this issue Feb 13, 2018
use `.template` extension for templates. Rename during project generation. Removes copyright headers from templates.

Fixes #944
virkt25 added a commit that referenced this issue Feb 14, 2018
* fix(cli): remove copyright header from generated app

use `.template` extension for templates. Rename during project generation. Removes copyright headers from templates.

Fixes #944

* fixup! apply feedback - use RegExp for matching instead of extname
@virkt25 virkt25 added this to the February 2018 milestone Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants