Skip to main content

Generate a file containing all (locally found) licenses from your project.

Project description

licenses-generator

Generate a file containing all (locally found) licenses from your project.

About

This script is used in production @ Prisma to generate the required attributions for our license page.

How?

It walks the given directory and searches for license files, and after it's done, it will write all of them to a new file, following the given template.

Compatibility

At this time, it's only been tested on JS project (the default folder is node_modules), but it should be compatible with anything that stores licenses locally.

Usage

Recomanded

from generate_licenses import Generator, Template # <- Or you can use DefaultTemplate

template = Template(
    wrapper_template='<div>\n$ctnt\n</div>',
    title_template='<h1>$ctnt</h1>\n',
    license_template='<pre>\n<code>\n$ctnt\n</code>\n</pre>'
)

generator = Generator(template, <initial_dir>, <out_file>, <out_separator>)
generator.write_licenses()

CLI (Not recomanded)

See help: generate_licenses.py -h


How does the Templating work?

Let's start with the given example (from above) - That will generate the following:

<div>
<h1>PACKAGE_NAME</h1>
<pre>
<code>
LICENSE
</code>
</pre>
</div>

Basically you can write whatever you want, and put $ctnt where you want the actual "content" to be put


Contributing Guide

If you wish to contribute to generate_licenses please see CONTRIBUTING.md

Code of Conduct

Please respect our Code of Conduct. It can be found here


Authors

License

Copyright 2021 Prisma

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

(C) Prisma 2021 - https://buyprisma.netlify.app/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

generate_licenses-1.2.0.tar.gz (8.8 kB view hashes)

Uploaded Source

Built Distribution

generate_licenses-1.2.0-py3-none-any.whl (10.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page