* update packages
* add plugin to strip autolinks in code blocks
* fix all the documentation for MDXv3
* remove check-docusaurus-versions
in docusaurus 3 this is now a hard error, not just a warning
* port upstream change to Curl component
fixes performing the 'execute' action when pressing enter
* happy path is done: packagist depenency version is returned for dependencyVendor and dependencyRepo
* changes in error handling in packagist dependency version service
* Move to packagist-base common parts of packagist-php and packagist-dep-ver
* the label now shows the name of the dependency
* add comments,slightly modify if statement
* fix unit tests in services/packagist/packagist-php-version.spec.js
* add unit tests for services/packagist/packagist-dependency-version.js
* service tests for packagist-dependency-version.service.js are in progress
* Add additional service tests for packagist-dependency-version.tester.js
* remove toLowerCase()
* resolve from lgtm: 1 for Wrong use of 'this' for static method
* DRY determining the name of the dependency (depVen/depRepo)
* url change in strategy is in progress
* basic examples of packagist/dependency-v work with new url; packagist/php-v redirects to the new url
* service tests should be green
* unit tests for packagist should be fixed
* add toLowerCase()
* part of suggestions from the PR is implemented
* updated tests for packagist dependency version
* fix packagist dependency version spec
* add missing unit tests
* Update services/packagist/packagist-dependency-version.spec.js
Co-authored-by: chris48s <chris48s@users.noreply.github.com>
* Update services/packagist/packagist-dependency-version.spec.js
Co-authored-by: chris48s <chris48s@users.noreply.github.com>
Co-authored-by: chris48s <chris48s@users.noreply.github.com>
* never check for 'require' key in [packagist] /v badge
always use `schema`
closes#7779
* accept str '__unset' for 'require' key in [packagist] /php-v badge
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
* Update Packagist service to use v2 api
Packagist deprecated the original `packagist.org/p/username/package` endpoint in favor of v2 `packagist.org/p2/username/package` endpoint. Because of this, new packages aren't being found using v1.
This PR updates the Packagist service to use the new endpoint.
* Adjust validation schema
Some packages don't return the same data structure as others with the new api endpoints. This changes the validation schema to account for the potential differences.
* Fix typo
* Throw NotFound when license not found
* Expand response and find the correct release
* Address issues raised by reviewer
Address issues raised by @chris48s in #6508, which this PR is base on.
Includes:
* Remove getDefaultBranch() from base class for it is no longer used.
* Change try-catch statement syntax to align code style.
* Rename findRelease() to findLatestRelease() for clarity.
* remove unusued param
* throw if no version found
* require version key
* use a single consistent method for identifying the latest (tagged) release
* don't throw in render()
* rename method (this is not really 'transform' in our usual parlance)
* Improve BasePackagistService testing
* Change BasePackagistService.decompressResponse to static
method BasePackagistService.expandPackageVersions.
* Fix expandPackageVersions implementation.
* Add unit test for the function.
* Extend BasePackagistService.findLatestRelease
* extend BasePackagistService.findLatestRelease to also handle
PackagistVersion.
* remove PackagistVersion.transform.
* Improve BasePackagistService.findLatestRelease
* Update findLatestRelease to throw NotFound itself.
* Update PackagistLicense and PackagistVersion and remove the
NotFound throwing logics.
* Revert unneeded change
* Corrected packagist php version spec
* The test was on a false assumption that '__unset' might appear
inside an array leaf while the composer's MetadataMinifier::minify
never does thing recursively. The '__unset' should be value of the
top level key.
Co-authored-by: Geoff Selby <geoff@geoffcodesthings.com>
Co-authored-by: Koala Yeung <koalay@gmail.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
Instead of assuming dev-master for the default branch, check the package
data from Packagist to see which branch is set as the default, and use
it.
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
Streamline Packagist Badge titles in frontend.
Always add the general topic/category to each badge title.
Closes#5039
Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
* set followRedirect: false by default in tests
* update tests implicitly relying on redirects
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
* Packagist user/repo must be lowercase
An issue has developed recently where the package name and repo name of the packagist packages have an added requirement of being lowercase. This has broken the Shields.io badge for some of my projects where their repo name has capital letters, and the badges have been automatically added by a script.
* Prettier
* Lowercase user and repo in getPackageName function instead
* Lowercase user/repo in fetch function
This moves a few helpers from `lib/` to `services/`:
build-status.js
build-status.spec.js
color-formatters.js
color-formatters.spec.js
contributor-count.js
licenses.js
licenses.spec.js
php-version.js
php-version.spec.js
text-formatters.js
text-formatters.spec.js
version.js
version.spec.js
And one from `lib/` to `core/`:
unhandled-rejection.spec.js
The diff is long, but the changes are straightforward.
Ref #2832
Fixes#2876 with @paulmelnikow's suggestion
Moved imports of `ServiceTester` and `createServiceTester` to a separate file so that dev dependencies are not imported by service classes.
The route helper functions are fairly well isolated from the rest of BaseService, with a few convenient entry points. They are easier to test in isolation.
The way the code was written before, `pathToRegexp` was invoked once for every request, which seems inefficient.
`route` was validated when it was used, though it seems more helpful to validate it up front.
This breaks out `_makeFullUrl`, `_regex`, `_regexFromPath` into new helper functions `makeFullUrl`, `assertValidRoute`, `prepareRoute`, and `namedParamsForMatch`.
It adds validation to route, and updates the services without patterns to include one, in order to pass the new validation rules.
Continue to implement #2698:
- Add `core/base-service/index.js` (but hold off on moving the things it imports)
- Add shortcuts in `services/index.js` for Base*Service, errors, and deprecatedService. This file will be streamlined later to avoid cluttering it with rarely used bits.
- Apply consistent ordering of imports and use of `module.exports` in testers.
- Remove some renaming of imports.
- Remove obsolete tests here and there.
We had only a few function expressions declared with the function keyword; almost everything is using function declarations.
This came up after this discussion: https://github.com/badges/shields/pull/2803#discussion_r249011621 though is actually not related ot that example.
What’s being removed is a third option, which is assigning to a variable a function expression using the `function` keyword. There’s still room for the programmer to choose between arrow function expressions and function declarations.