Coder Social home page Coder Social logo

loic-sharma / baget Goto Github PK

View Code? Open in Web Editor NEW
2.5K 62.0 622.0 4.42 MB

A lightweight NuGet and symbol server

Home Page: https://loic-sharma.github.io/BaGet/

License: MIT License

C# 94.70% CSS 0.94% HTML 3.70% Dockerfile 0.09% JavaScript 0.48% Shell 0.09%
dotnet csharp nuget aspnet azure package-manager

baget's Introduction

BaGet ๐Ÿฅ–

Build status Discord Twitter

A lightweight NuGet and symbol server.

Getting Started

  1. Install the .NET SDK
  2. Download and extract BaGet's latest release
  3. Start the service with dotnet BaGet.dll
  4. Browse http://localhost:5000/ in your browser

For more information, please refer to the documentation.

Features

Stay tuned, more features are planned!

baget's People

Contributors

a-carvallo avatar agriffard avatar alexanderfast avatar altso avatar baklap4 avatar bgrainger avatar chadzhao avatar chaghi avatar daniel-lerch avatar davidackroyd99 avatar davidelettieri avatar euantorano avatar fuzzybair avatar igor-pchelko avatar jeroenlandheer avatar joelverhagen avatar jsreynolds avatar loic-sharma avatar lordmike avatar markzither avatar nimrodolev avatar nloum avatar patriksvensson avatar rkalkani avatar rong0312 avatar sepppenner avatar sipmann avatar tmds avatar viceice avatar wernermairl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

baget's Issues

[UI] Display proper download count

The UI uses the NuGet Registration resource to display a single package. Since the documented registration does not provide download counts for a package, the UI cannot show download counts. So:

  • Add per-version download counts to registration index resource
  • Add overall download counts to registration index resource
  • Display download counts on UI
  • Publication time in search service

Saving the Package Dependency of a target Framework fails when id is null

Reproducion:

  • Blank baget.db
  • create a new c# class library (based on netstandard 2.0)
  • latest sdk tools
  • try to dotnet nuget push ..\ClassLibrary1\bin\Debug\ClassLibrary1.1.0.0.nupkg -s http://localhost:50561/v2/package

The error is: Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'NOT NULL constraint failed: PackageDependencies.Id'.

see:

But i think null is correct ...(https://github.com/NuGet/NuGetGallery/blob/master/src/NuGetGallery.Core/Entities/PackageDependency.cs)

Add a UI

Add a simple UI that focuses on package search. Yarn does this very well.

Documentation

Build documentation for:

  • Development
    • Current flow for UI development
  • Set up
    • Sqlite & SQL Server & MySql
    • Azure
      • Setting up an App Service
      • Setting up Azure SQL
      • Setting up Azure Blob storage
      • Setting up Azure Search
  • Authentication
    • API Keys
    • Private feeds
  • Indexing nuget.org
    • How to crawl nuget.org's catalog to index all packages
    • Importing downloads from nuget.org
  • Misc
    • Read-through caching
    • How to create a package whose readme is indexed by BaGet
      • This will be replaced by self-contained packages. See: #67
    • Differences between BaGet's APIs and NuGet's documented v3 protocol
      • Readme in flat container
      • Repository URL and repository type in registration
      • Dependents search API
      • Package types in registration

Sections (example I like):

  • Overview
    • Example here. Quick intro, ends with "Next steps" section to quickstarts
  • Quickstarts
  • Tutorials
  • Reference
  • Resources

See https://squidfunk.github.io/mkdocs-material/

Unittesting against official Nuget v3 (core) Client

In the current (first draft) of testing infrastructure we use "Microsoft.AspNetCore.TestHost.TestServer" for testing Controllers.

Idea/Requirement
Inject HttpClient capabilites provided by the TestServer into NuGet.Protocol.HttpSource and use official NuGet.Client Assemblies (V3/Core) to (unit) test our Controllers (in process).

Helpful ?
Any concerns ?

Add google analytics

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-72218961-2"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-72218961-2');
</script>

Need to figure out how to pass configurable values to parcel for the GA id. If this isn't possible, parcel will need to output the front end as a razor view, and asp.net will need to replace the GA id.

Add GitHub templates

Do you want to request a feature or report a bug?

Feature

What did you expect to see?

Currently there's no format for a user to file an issue, bug, feature or pull request. This can be done by adding github templates.

This results in more quality and better formatted issues and is better for the overall quality of the project.

Support more databases

Today, only SQLite is supported. This is great for small-scale deployments but has its limits. Eventually, support for more scalable solutions will be added. I am considering both SQL Server and Cosmos DB.

Add tests

Today, the project is as simple as possible to enable fast iteration. Tests should be added once things stabilize.

Improve validation of AppSettings/IConfiguration

Currently we get a lot of ArgumentNull Exceptions on unexpected locations if we start the App (WebApp or Tests) without config Settings (appsettings.json).

Suggest:

  • fail fast and early wiith better exception types and messages
  • use defaults (Convention over Configuration) instead of exceptions where it is possible
  • include (unit) tests.

Track commonly downloaded together packages

NuGet v4.7+ adds the header X-NuGet-Session-Id to restore operations. This lets us understand what packages were downloaded together for a single restore. The basic flow:

  1. Track packages downloaded together in a single operation
  2. Build a graph of the restore operation
  3. Find the top-level dependencies
  4. Recommend packages that are commonly restored together as top-level dependencies.

See https://docs.microsoft.com/en-us/nuget/api/overview#http-request-headers

Extract packages' readme to flat container

The front-end will need to display the readme. This requires:

  • Indexing a nupkg should store its readme to the flat container
  • The registration should provide a URL to the readme

Azure Integration

Getting BaGet up and running on Azure should be easy. Requirements:

Things to investigate and nice to haves:

  • Application Insights. See this documentation
  • Proper infrastructure deployment. ARM templates? Terraform? #29
  • Azure Search? #19

Redirect for downloads

Today, package content downloads consume a thread for the duration of the download. This will not scale well. Instead, download endpoints should redirect to Azure Blob Storage/CDN.

FilePackageStorageService needs more Spec

Hi
I like the idea of a file based file based PackageStorageserver - specially for simpler scenarios and tests.

I see a few requirements for this service (and probably other file based services) that we should spec out before we improve the code.

  • for debugging/tracing/support the FolderPath that is used by the service should be part of the log.
  • System.IO.Path.GetFullPath can/should be applied to the Path value provided by IConfig (like to see where "./folder" is pointing to (Current Directory is always implicit, for debugging we should print out explicite)
  • System.Environment.ExpandEnvironmentVariables may be also applied (attention there is a issue in CoreFx about xplat problems with "%xxx%" syntax)

if we do things like that, on which layer ?

  • inside the service /constructor
  • before the constructor ?

other detail that needs spec:
Currently the Fodler for this service is created inside class Startup.

We should spec out

  • if the folder MUST be exist for the constructor (then constructor should throw exception if not there)
  • if the folder is created on demand
    • inside the constructor
    • later on demand

my personal opinion/vote:

  1. we inject Logger into FilePackageStorageService.Constructor (may be with a NullLogger as default)
  2. inside the constructor we use System.IO.Path.GetFullPath to resolve the path and we print out the result to logger

2.1 System.Environment.ExpandEnvironmentVariables may be applied here now or later!
3. we CREATE the folder if it does not exists (ensures a early exception in case of missing write permission)
3.1 (in case of a existing folder we can write and delete a file with length 0 to ensure we have write permission, like System.IO.Path.GetTempFile)

[Azure Search] Improve Search

  • Scoring Profiles
    • Make exact id matches always at top
    • Make id results stronger than description/summary
    • Make tag results strong
    • Prefer packages with high downloads
    • Prefer packages with high number of dependents (# packages that depend on this package)
    • Penalize packages that haven't received updates recently
  • Analyzers
    • Typo-tolerant prefix search on id

See https://docs.microsoft.com/en-us/rest/api/searchservice/add-scoring-profiles-to-a-search-index
See https://docs.microsoft.com/en-us/azure/search/search-analyzers
See https://docs.microsoft.com/en-us/rest/api/searchservice/custom-analyzers-in-azure-search#default-analyzer

See https://medium.com/@Herger/chapter-2-azure-search-in-the-spotlight-72da0b4cf39c

See https://github.com/algolia/npm-search#schema

[Azure Search] Index package uploads

Today, the only way to index documents into Azure Search is manually through the ad hoc tool. Newly uploaded packages should be indexed automatically.

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.