Coder Social home page Coder Social logo

goebeler / nugetacknowledgementexporter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wojciech-kulik/nugetacknowledgementexporter

0.0 1.0 0.0 82 KB

Exports automatically acknowledgements for all Nuget Packages included in .NET projects

Home Page: https://wojciechkulik.pl/nugetacknowledgementsexporter

License: MIT License

C# 100.00%

nugetacknowledgementexporter's Introduction

BuyMeACoffee

Nuget Acknowledgement Exporter

version NuGet License

Small tool responsible for extracting licenses from NuGet packages included in .NET projects.

Usage of Third-Party Libraries usually requires to include licenses within an application. This command-line tool can be used for auto-generating the “Acknowledgement” / “Third-Party Libraries” page in your project.

NugetAcknowledgementsExporter finds all CSPROJs in a directory from the argument, extracts all included NuGet packages and downloads their licenses. Based on gained data it builds two files:

  • acknowledgements.txt – text file containing all acknowledgements for NuGet packages. It could be directly included within your application in a scrollable text field.
  • project_packages.json – JSON file containing an array of used NuGet packages including downloaded licenses. It could be used to build a more interesting UI for acknowledgements, generated from code based on this file.

Features

  • Detecting *.csproj files recursively in project directory
  • Extracting NuGet packages from *.csproj
  • Extracting NuGet packages from packages.json
  • Grouping packages with the same authors, projectUrl and licenseUrl
  • Downloading licenses from licenseUrl (included in NuGet nuspec file)
  • Adding custom licenses (edit file: licenses/licenses.json)
  • Excluding packages (edit file: licenses/exclude.json)
  • Including custom packages (edit file: licenses/include.json)
  • Windows and MacOS support

Requirements

  1. Download latest .NET Core
https://dotnet.microsoft.com/download/
  1. Download latest NuGet commandline tool
Windows: https://www.nuget.org/downloads (+ add to PATH)
MacOS: brew install nuget

Usage

  1. Download code:
git clone https://github.com/wojciech-kulik/NugetAcknowledgementExporter.git
  1. Restore NuGet packages for all projects. Application uses NuGet cache, so it needs to be there.

  2. Build & run:

dotnet run -- <args or --help>

Arguments

Usage: NugetAcknowledgementExporter <project directory> [args]

Available parameters:
	o|output=		directory where generated files will be saved (by default project directory)
	sj|skipJson		skips generating json file with acknowledgements
	st|skipTxt		skips generating text file with acknowledgements
	h|help			shows all available parameters

To add custom licenses or packages please edit:
- licenses/licenses.json
- licenses/include.json
- licenses/exclude.json

Sample command

dotnet run -- "/Users/YYY/repositories/my-project/source" -output="/Users/YYY/Desktop"

or once it's built, you can navigate to binary and run it directly:

MacOS: ./NugetAcknowledgementExporter "/Users/YYY/repositories/my-project/source" -output="/Users/YYY/Desktop"
Windows: NugetAcknowledgementExporter "C:\Users\YYY\repositories\my-project\source" -output="C:\Users\YYY\Desktop"

Sample Output

Plugin.Permissions

Authors: James Montemagno
Project URL: https://github.com/jamesmontemagno/PermissionsPlugin
License URL: https://github.com/jamesmontemagno/PermissionsPlugin/blob/master/LICENSE

The MIT License (MIT)

Copyright (c) 2016 James Montemagno

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), (...)

----------------------------

Plugin.StoreReview

Authors: James Montemagno
Project URL: https://github.com/jamesmontemagno/StoreReviewPlugin
License URL: https://github.com/jamesmontemagno/StoreReviewPlugin/blob/master/LICENSE

The MIT License (MIT)

Copyright (c) 2016 James Montemagno

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), (...)

(...)

TODO

  • More testing
  • Code refactoring - split Program.cs into classes
  • Download and cache nuspec from https://www.nuget.org/api/v2/package/{packageID} instead of relying on NuGet's cache
  • Custom templates for acknowledgements.txt
  • Recognizing popular URLs with well-known licenses (like already done for: opensource.org/licenses/mit and licenses.nuget.org/mit)
  • Automatic run when dotnet restore or nuget restore called (if possible?)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.