-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
preview implementation of the Laminas ecosystem RFC #226
Open
Jurj-Bogdan
wants to merge
8
commits into
laminas:staging
Choose a base branch
from
Jurj-Bogdan:laminas-ecosystem-issue199
base: staging
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
da7ec0c
preview implementation of the Laminas ecosystem RFC
Jurj-Bogdan 810aef0
listing page redesign, data refresh cron changes, db no longer regene…
Jurj-Bogdan c6b5790
listing page design, db tweaks
Jurj-Bogdan 0c5b576
clear filters button
Jurj-Bogdan 4719966
missing image fix, extra heading & navbar changes
Jurj-Bogdan 0325362
JSON validation GitHub workflow
Jurj-Bogdan 3b467e2
jquery replaced with vanilla js
Jurj-Bogdan b2c5860
package homepage fix
Jurj-Bogdan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Validate ecosystem packages JSON file | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
tags: | ||
|
||
jobs: | ||
validate-packages: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: | | ||
packages=$(cat ./data/ecosystem/ecosystem-packages.json); | ||
if [ ! -z "$packages" ] && [ $(echo $packages | jq empty > /dev/null 2>&1; echo $?) -eq 0 ]; then | ||
for key in packagistUrl keywords homepage category usage; do | ||
if ! $(echo $packages | jq ".[]" | jq "has(\"$key\")" | jq 'select(. == false)'); then | ||
echo "Invalid JSON. Missing key \"$key\"." | ||
exit 1; | ||
fi | ||
done | ||
echo "Valid JSON." | ||
exit 0; | ||
else | ||
echo "Invalid JSON." | ||
exit 1; | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Adding your entry to the Laminas Ecosystem | ||
|
||
You can add packages **available via composer** to the `data/ecosystem/ecosystem-packages.json` file by following the steps below: | ||
|
||
- Entries must use the [template](#new-entry-template) as a guide. | ||
- Submit a PR. | ||
|
||
> Use the following command to make sure your submission will be correctly built: | ||
|
||
```bash | ||
composer build | ||
``` | ||
|
||
> The following command can be run individually for testing: | ||
|
||
```bash | ||
./vendor/bin/laminas ecosystem:create-db | ||
``` | ||
|
||
*Used for creating the database.* | ||
|
||
```bash | ||
./vendor/bin/laminas ecosystem:seed-db | ||
``` | ||
|
||
*Used for updating the package data every X hours.* | ||
|
||
## New entry template | ||
|
||
```json | ||
{ | ||
"packagistUrl": "", | ||
"githubUrl": "", | ||
"keywords": [], | ||
"homepage": "", | ||
"category": "" | ||
} | ||
``` | ||
|
||
### New entry fields description | ||
|
||
- `packagistUrl` **required** | ||
**string** - the packagist URL of the entry, with no query parameters | ||
|
||
- `githubUrl` | ||
**string** - optional link to be displayed on the package card | ||
|
||
- `keywords` | ||
**array of strings** - user defined keywords used for filtering results | ||
|
||
- `homepage` | ||
**string** - optional URL to package homepage, will overwrite "homepage" field from Packagist Api data | ||
|
||
- `category` | ||
**string** - package category must be one of "skeleton", "integration", "tool" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
'use strict'; | ||
|
||
$(document).ready(function () { | ||
$('.package-button').click(function (e) { | ||
e.preventDefault(); | ||
|
||
const url = new URL(window.location.href); | ||
const params = new URLSearchParams(url.search); | ||
const entry = $(this).data('value'); | ||
|
||
if ($(this).hasClass('keyword')) { | ||
if (! params.has("keywords[]", entry)) { | ||
params.append("keywords[]", entry); | ||
url.search = params.toString(); | ||
|
||
window.location.replace(url.toString()); | ||
} | ||
} | ||
|
||
if ($(this).hasClass('type')) { | ||
if (! params.has("type", entry)) { | ||
url.searchParams.set('type', entry); | ||
|
||
window.location.replace(url.toString()); | ||
} else if (params.get("type") === entry) { | ||
url.searchParams.delete("type"); | ||
|
||
window.location.replace(url.toString()); | ||
} | ||
} | ||
|
||
if ($(this).hasClass('category')) { | ||
if (! params.has("category", entry)) { | ||
url.searchParams.set('category', entry); | ||
|
||
window.location.replace(url.toString()); | ||
} else if (params.get("category") === entry) { | ||
url.searchParams.delete("category"); | ||
|
||
window.location.replace(url.toString()); | ||
} | ||
} | ||
|
||
if ($(this).hasClass('usage')) { | ||
if (! params.has("usage", entry)) { | ||
url.searchParams.set('usage', entry); | ||
|
||
window.location.replace(url.toString()); | ||
} else if (params.get("usage") === entry) { | ||
url.searchParams.delete("usage"); | ||
|
||
window.location.replace(url.toString()); | ||
} | ||
} | ||
}); | ||
|
||
$('.ecosystem-filter').click(function (e) { | ||
e.preventDefault(); | ||
|
||
const url = new URL(window.location.href); | ||
const params = new URLSearchParams(url.search); | ||
const entry = $(this).data('value'); | ||
|
||
if ($(this).hasClass('keyword')) { | ||
if (params.has("keywords[]", entry)) { | ||
params.delete("keywords[]", entry); | ||
url.search = params.toString(); | ||
|
||
window.location.replace(url.toString()); | ||
} | ||
} | ||
}); | ||
|
||
[...$('#ecosystem-pagination a')].forEach(a => { | ||
const url = new URL(a.href) | ||
for (let [k,v] of new URLSearchParams(window.location.search).entries()) { | ||
if (k === 'keywords[]' || k === 'q' || k === 'type' || k === 'category' || k === 'usage') { | ||
url.searchParams.set(k,v) | ||
} | ||
} | ||
a.href = url.toString(); | ||
}) | ||
|
||
$('#ecosystem-search').keypress(function (e) { | ||
const search = $(this).val(); | ||
if (e.which === 13) { | ||
setSearchQuery(search); | ||
} | ||
}); | ||
|
||
$('#ecosystem-search-btn').click(function (e) { | ||
const search = $('#ecosystem-search').val(); | ||
setSearchQuery(search); | ||
}); | ||
|
||
function setSearchQuery(search) { | ||
const url = new URL(window.location.href); | ||
|
||
url.searchParams.set('q', search); | ||
window.location.replace(url.toString()); | ||
} | ||
|
||
$('#clear-filters-button').click(function (e) { | ||
const url = new URL(window.location.href); | ||
|
||
for (let [k,v] of new URLSearchParams(window.location.search).entries()) { | ||
if (k === 'type' || k === 'category' || k === 'usage') { | ||
url.searchParams.delete(k) | ||
} | ||
} | ||
|
||
window.location.replace(url.toString()); | ||
}); | ||
}); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vanilla JavaScript is good in 2024 and it should be dropped when we move to Bootstrap 5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, I saw jquery was already added as a dependency and went with it, but I'll go ahead and refactor