Skip to content
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
wants to merge 42 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
da7ec0c
preview implementation of the Laminas ecosystem RFC
Jurj-Bogdan Nov 1, 2024
810aef0
listing page redesign, data refresh cron changes, db no longer regene…
Jurj-Bogdan Nov 19, 2024
c6b5790
listing page design, db tweaks
Jurj-Bogdan Nov 25, 2024
0c5b576
clear filters button
Jurj-Bogdan Nov 25, 2024
4719966
missing image fix, extra heading & navbar changes
Jurj-Bogdan Dec 2, 2024
0325362
JSON validation GitHub workflow
Jurj-Bogdan Dec 10, 2024
3b467e2
jquery replaced with vanilla js
Jurj-Bogdan Dec 13, 2024
b2c5860
package homepage fix
Jurj-Bogdan Dec 13, 2024
d188f98
Lock file maintenance
renovate[bot] Nov 4, 2024
769a70a
Wrong pattern of an URL for a blog article
arhimede Oct 16, 2024
7e64063
add article about October 2024 meeting
arhimede Oct 25, 2024
93ffe62
add article about October 2024 meeting
arhimede Oct 25, 2024
ae72ceb
Fix wrong usage of the GHA context in shell. Improve verbiage
Xerkus Nov 4, 2024
646ac54
Lock file maintenance
renovate[bot] Nov 11, 2024
0dc8ec7
Update dependency laminas/laminas-config-aggregator to ^1.16.0
renovate[bot] Nov 11, 2024
d2f16d2
Update dependency laminas/laminas-config-aggregator to ^1.17.0
renovate[bot] Nov 17, 2024
061cc33
Lock file maintenance
renovate[bot] Nov 18, 2024
1188098
add article about November 2024 meeting
arhimede Nov 15, 2024
019c78f
complete the article with other news
arhimede Nov 15, 2024
6f6a545
removed other news
arhimede Nov 18, 2024
319ac01
Add new article about October developments
gsteel Nov 18, 2024
902e0d2
fix missing extend tag.
arhimede Nov 19, 2024
d939eac
added linting action && fixed linting errors
Jurj-Bogdan Nov 28, 2024
a913a18
linting fix
Jurj-Bogdan Nov 28, 2024
4a7c3f3
reverted first headlines && minor config change
Jurj-Bogdan Nov 28, 2024
bf0f179
laminas-ci linting rules
Jurj-Bogdan Nov 29, 2024
16cfffc
md014 fix & excluded files
Jurj-Bogdan Dec 3, 2024
9aa4e5b
Update Laminas packages (#234)
renovate[bot] Dec 3, 2024
c312918
Lock file maintenance (#235)
renovate[bot] Dec 3, 2024
832c04b
Lock file maintenance
renovate[bot] Dec 9, 2024
8d11b86
Lock file maintenance
renovate[bot] Dec 16, 2024
7e7cf95
Lock file maintenance
renovate[bot] Dec 23, 2024
4741236
Lock file maintenance
renovate[bot] Dec 30, 2024
8b1a593
Lock file maintenance
renovate[bot] Jan 6, 2025
ab35953
Lock file maintenance
renovate[bot] Jan 13, 2025
fcc8c6c
listing page redesign, data refresh cron changes, db no longer regene…
Jurj-Bogdan Nov 19, 2024
3fc424b
package removal logic, psalm fixes, initial unit tests
Jurj-Bogdan Jan 14, 2025
5730358
missing key added
Jurj-Bogdan Jan 14, 2025
0bd2f2d
Merge branch 'staging' into laminas-ecosystem-issue199
Jurj-Bogdan Jan 14, 2025
c0cc32e
package card design update
Jurj-Bogdan Feb 20, 2025
8384e20
Merge branch 'staging' into laminas-ecosystem-issue199
Jurj-Bogdan Feb 20, 2025
40b9190
platform.sh config
Jurj-Bogdan Feb 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/validate-packages.yml
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
19 changes: 19 additions & 0 deletions .platform.app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ mounts:
'public/share':
source: local
source_path: public/share
'data/ecosystem/database':
source: local
source_path: data/ecosystem/database

hooks:
build: |
Expand Down Expand Up @@ -54,6 +57,7 @@ hooks:
rm -f data/cache/config-cache.php
if [ ! -e data/cache/releases.rss ];then cp templates/releases.rss data/cache/ ;fi
./vendor/bin/laminas repository:generate-data "$PLATFORM_VARIABLES" | base64 --decode | jq '."REPO_TOKEN"'
./vendor/bin/laminas ecosystem:create-db

crons:
snapshot:
Expand All @@ -79,6 +83,21 @@ crons:
./vendor/bin/laminas repository:generate-data "$PLATFORM_VARIABLES" | base64 --decode | jq '."REPO_TOKEN"'
fi
shutdown_timeout: 20
generateecosystem:
# Refresh repository data every 6 hours (UTC).
spec: '0 */6 * * *'
commands:
start: |
if [ "$PLATFORM_BRANCH" = master ]; then
./vendor/bin/laminas ecosystem:seed-db
fi
shutdown_timeout: 20

operations:
rebuildEcosystemDatabase:
role: admin
commands:
start: ./vendor/bin/laminas ecosystem:create-db --force-rebuild

web:
locations:
Expand Down
55 changes: 55 additions & 0 deletions ADD_ECOSYSTEM_PACKAGE.md
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"
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,7 @@ Everyone is welcome to post a blog entry. Once submitted, it will be reviewed by
If it's rejected, the reason for the rejection will be included, so you can update it and resubmit the post if applicable.

The submission process is described in the [ADD_BLOG_ENTRY](ADD_BLOG_ENTRY.md) file.

## Adding packages to the Laminas Ecosystem

The [ADD ECOSYSTEM PACKAGE](ADD_ECOSYSTEM_PACKAGE.md) file describes the process of adding packages to the [Laminas Ecosystem](https://getlaminas.org/ecosystem)
3 changes: 2 additions & 1 deletion bootstrap/gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ function js() {
'node_modules/@popperjs/core/dist/umd/popper.min.js',
'node_modules/bootstrap/dist/js/bootstrap.min.js',
'node_modules/anchor-js/anchor.min.js',
'js/base.js'
'js/base.js',
'js/_ecosystem.js'
]))
.pipe(concat({path: 'laminas.js'}))
.pipe(terser({mangle: false}).on('error', function (e) {
Expand Down
114 changes: 114 additions & 0 deletions bootstrap/js/_ecosystem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
'use strict';

$(document).ready(function () {
Copy link
Member

@froschdesign froschdesign Dec 10, 2024

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.

Copy link
Contributor Author

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

$('.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());
});
});
Loading
Loading