All new code requires tests to ensure against regressions.
However, if your PR contains zero code changes, feel free to select the checkmark below to indicate so.
[X] Have you ran tests against this code?
[ ] This PR contains zero code changes.
Description of the Change
This PR enables the collection of package details via a specific ref. This means that the backend now supports mono-repos or in the case of #205 supports non-standard repositories such as those mirroring other forges.
The functionality differs slightly between:
Initial Publication
After verifying the repository exists, the backend first requests the available tags on GitHub. After collecting them then the data needed for the package (README.md, package.json) are collected according to each available tag we found earlier. This also has the benefit of resolving a long standing issue where when retroactively publishing other versions on initial publication the data shown for these previous versions was technically incorrect as it'd only show whatever was the latest data.
Publishing a Version
When we publish a new version we take the ref provided within the request. (Which has always been present, but actually the backend has been ignoring and not even collecting this value so far in operation)
This ref is then what's used to collect further details.
During these changes I ended up scraping many of the VCS 'unit' tests, as they were so closely coupled to actual logic and mocks it became unwieldy to rewrite as needed, and instead was easier to rewrite them as full integration tests with nock. With that I was able to discover some new issues, such as the documented return of the version publication endpoint being inaccurate, I discovered that during version publication we didn't ever verify the repository existed first, and finally found that if the version publication failed, the resulting webhook attempt to Discord could cause bigger failures than we'd hope. So of course this PR has also fixed all those above issues.
Requirements
Filling out the template is required.
All new code requires tests to ensure against regressions.
[X] Have you ran tests against this code?
[ ] This PR contains zero code changes.
Description of the Change
This PR enables the collection of package details via a specific
ref
. This means that the backend now supports mono-repos or in the case of #205 supports non-standard repositories such as those mirroring other forges.The functionality differs slightly between:
Initial Publication
After verifying the repository exists, the backend first requests the available tags on GitHub. After collecting them then the data needed for the package (
README.md
,package.json
) are collected according to each available tag we found earlier. This also has the benefit of resolving a long standing issue where when retroactively publishing other versions on initial publication the data shown for these previous versions was technically incorrect as it'd only show whatever was the latest data.Publishing a Version
When we publish a new version we take the
ref
provided within the request. (Which has always been present, but actually the backend has been ignoring and not even collecting this value so far in operation) Thisref
is then what's used to collect further details.During these changes I ended up scraping many of the VCS 'unit' tests, as they were so closely coupled to actual logic and mocks it became unwieldy to rewrite as needed, and instead was easier to rewrite them as full integration tests with
nock
. With that I was able to discover some new issues, such as the documented return of the version publication endpoint being inaccurate, I discovered that during version publication we didn't ever verify the repository existed first, and finally found that if the version publication failed, the resulting webhook attempt to Discord could cause bigger failures than we'd hope. So of course this PR has also fixed all those above issues.Fixes #205 Fixes #255