Skip to content

Commit

Permalink
wip - subtree splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
tadhgboyle committed Oct 22, 2024
1 parent 56a8258 commit 3990914
Show file tree
Hide file tree
Showing 58 changed files with 1,729 additions and 6 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/subtree.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Update Subtrees

on: [push, pull_request]

jobs:
sync-downstream:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
module:
- members

name: Update downstream ${{ matrix.module }} module repository

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: nxtlvlsoftware/git-subtree-action@1.1
with:
repo: 'NamelessMC/${{ matrix.module }}-module'
path: 'modules/${{ matrix.module }}'
deploy_key: ${{ secrets.DOWNSTREAM_GITHUB_DEPLOY_KEY }}
force: true
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
"joypixels/emoji-toolkit": "^7.0",
"geoip2/geoip2": "^2.13",
"jenssegers/agent": "^2.6",
"php-di/php-di": "^6.4",
"namelessmc/members-module": "dev-main"
"php-di/php-di": "^6.4"
},
"require-dev": {
"phpstan/phpstan": "1.6.9",
Expand All @@ -56,6 +55,9 @@
"modules/Forum/classes",
"modules/Forum/hooks",
"modules/Forum/widgets"
]
],
"psr-4": {
"NamelessMC\\Members\\": "modules/Members/src"
}
}
}
21 changes: 18 additions & 3 deletions core/classes/Core/ComposerModuleDiscovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,22 @@ public static function discoverModules(): array
}

$modules = [];
// Check for 1p modules locally
foreach (scandir(ROOT_PATH . '/modules') as $module) {
if (!str_starts_with($module, '.') && is_dir(ROOT_PATH . '/modules/' . $module)) {
if (file_exists(ROOT_PATH . '/modules/' . $module . '/composer.json')) {
$package = json_decode(file_get_contents(ROOT_PATH . '/modules/' . $module . '/composer.json'), true);
$package['source']['url'] = 'https://github.com/NamelessMC/' . strtolower($module) . '-module';
$modules[] = self::fromPackage($package, false);
}
}
}

// Check for 3p modules installed via composer
$packages = json_decode(file_get_contents(ROOT_PATH . '/vendor/composer/installed.json'), true)['packages'];
foreach ($packages as $package) {
if ($package['type'] === 'nameless-module') {
$modules[] = self::fromPackage($package);
$modules[] = self::fromPackage($package, true);
}
}

Expand All @@ -41,15 +53,18 @@ public static function bootModules(\DI\Container $container, array $allEnabledMo
public static function bootModule(\DI\Container $container, ComposerModuleWrapper $composerModule): void
{
/** @var NamelessMC\Framework\Extend\BaseExtender[] $extenders */
$extenders = require_once ROOT_PATH . '/vendor/' . $composerModule->getPackageName() . '/module.php';
$extenders = $composerModule->isInVendor()
? require_once ROOT_PATH . '/vendor/' . $composerModule->getPackageName() . '/module.php'
: require_once ROOT_PATH . '/modules/' . $composerModule->getName() . '/module.php';
foreach ($extenders as $extender) {
$extender->setModule($composerModule)->extend($container);
}
}

public static function fromPackage(array $composerPackage): ComposerModuleWrapper
public static function fromPackage(array $composerPackage, bool $inVendor): ComposerModuleWrapper
{
return new ComposerModuleWrapper(
$inVendor,
$composerPackage['name'],
$composerPackage['extra']['nameless_module']['name'],
$composerPackage['extra']['nameless_module']['display_name'],
Expand Down
8 changes: 8 additions & 0 deletions core/classes/Core/ComposerModuleWrapper.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
class ComposerModuleWrapper extends Module
{
private bool $_inVendor;
private string $_packageName;
private string $_privateName;
private string $_authorName;
Expand All @@ -16,6 +17,7 @@ class ComposerModuleWrapper extends Module
private string $_debugInfoProvider;

public function __construct(
bool $inVendor,
string $packageName,
string $privateName,
string $displayName,
Expand All @@ -25,6 +27,7 @@ public function __construct(
string $namelessVersion,
string $repositoryUrl
) {
$this->_inVendor = $inVendor;
$this->_packageName = $packageName;
$this->_privateName = $privateName;
$this->_authorName = $authorName;
Expand All @@ -34,6 +37,11 @@ public function __construct(
parent::__construct($this, $displayName, $authorName, $moduleVersion, $namelessVersion);
}

public function isInVendor(): bool
{
return $this->_inVendor;
}

public function getPackageName(): string
{
return $this->_packageName;
Expand Down
25 changes: 25 additions & 0 deletions modules/Members/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "namelessmc/members-module",
"type": "nameless-module",
"authors": [
{
"name": "Tadhg Boyle",
"homepage": "https://github.com/tadhgboyle"
}
],
"extra": {
"nameless_module": {
"display_name": "Members",
"name": "members",
"description": "Adds member lists to your website.",
"version": "2.1.2",
"nameless_version": "2.1.0"
}
},
"require": {},
"autoload": {
"psr-4": {
"NamelessMC\\Members\\": "src/"
}
}
}
19 changes: 19 additions & 0 deletions modules/Members/language/cs_CZ.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"members/members": "Členové",
"members/new_members": "Noví členové",
"members/no_members": "Nenalezeni žádní členové.",
"members/member_lists": "Seznam členů",
"members/member_list_hide_banned_users": "Skrýt zabanované uživatele?",
"members/member_list_toggled_enabled": "Seznam {{list}} úspěšně povolen.",
"members/member_list_toggled_disabled": "Seznam {{list}} úspěšně zakázán.",
"members/view_all": "Zobrazit vše",
"members/find_member": "Najít člena",
"members/name": "Jméno...",
"members/view_group": "Zobrazit skupinu",
"members/group": "Skupina...",
"members/viewable_groups": "Zobrazitelné skupiny",
"members/no_results_header": "Nenalezeny žádné výsledky",
"members/no_results_text": "Na váš dotaz nebyly nalezeny žádné výsledky",
"members/no_overview_lists_enabled": "Nejsou povoleny žádné seznamy přehledu.",
"members/settings_updated_successfully": "Nastavení úspěšně aktualizována."
}
1 change: 1 addition & 0 deletions modules/Members/language/da_DK.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
19 changes: 19 additions & 0 deletions modules/Members/language/de_DE.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"members/members": "Mitglieder",
"members/member_lists": "Mitgliederlisten",
"members/find_member": "Mitglied suchen",
"members/no_results_text": "Deine Suche ergab keine Ergebnisse",
"members/new_members": "Neue Mitglieder",
"members/no_members": "Keine Mitglieder gefunden.",
"members/member_list_hide_banned_users": "Gesperrte Benutzer ausblenden?",
"members/member_list_toggled_enabled": "Erfolgreich die Liste {{list}} aktiviert.",
"members/member_list_toggled_disabled": "Die Liste {{list}} wurde erfolgreich deaktiviert.",
"members/view_all": "Alle anzeigen",
"members/name": "Name...",
"members/view_group": "Gruppe anzeigen",
"members/group": "Gruppe...",
"members/viewable_groups": "Sichtbare Gruppen",
"members/no_results_header": "Keine Ergebnisse gefunden",
"members/no_overview_lists_enabled": "Es sind keine Übersichtslisten aktiviert.",
"members/settings_updated_successfully": "Einstellungen erfolgreich aktualisiert."
}
1 change: 1 addition & 0 deletions modules/Members/language/el_GR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
20 changes: 20 additions & 0 deletions modules/Members/language/en_UK.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"members/members": "Members",
"members/new_members": "New members",
"members/no_members": "No members found.",
"members/member_lists": "Member Lists",
"members/member_list_settings": "Settings",
"members/member_list_hide_banned_users": "Hide banned users?",
"members/member_list_toggled_enabled": "Successfully enabled {{list}} list.",
"members/member_list_toggled_disabled": "Successfully disabled {{list}} list.",
"members/view_all": "View all",
"members/find_member": "Find member",
"members/name": "Name...",
"members/view_group": "View group",
"members/group": "Group...",
"members/viewable_groups": "Viewable groups",
"members/no_results_header": "No results found",
"members/no_results_text": "Your search returned no results",
"members/no_overview_lists_enabled": "No overview lists are enabled.",
"members/settings_updated_successfully": "Settings updated successfully."
}
19 changes: 19 additions & 0 deletions modules/Members/language/en_US.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"members/members": "Members",
"members/new_members": "New members",
"members/no_members": "No members found.",
"members/member_lists": "Member Lists",
"members/member_list_hide_banned_users": "Hide banned users?",
"members/member_list_toggled_enabled": "Successfully enabled {{list}} list.",
"members/member_list_toggled_disabled": "Successfully disabled {{list}} list.",
"members/view_all": "View all",
"members/find_member": "Find member",
"members/name": "Name...",
"members/view_group": "View group",
"members/group": "Group...",
"members/no_results_header": "No results found",
"members/no_results_text": "Your search returned no results",
"members/viewable_groups": "Viewable groups",
"members/no_overview_lists_enabled": "No overview lists are enabled.",
"members/settings_updated_successfully": "Settings updated successfully."
}
19 changes: 19 additions & 0 deletions modules/Members/language/es_419.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"members/members": "Miembros",
"members/new_members": "Nuevos miembros",
"members/no_members": "No se encontraron miembros.",
"members/member_lists": "Lista de miembros",
"members/member_list_hide_banned_users": "Ocultar miembros baneados?",
"members/member_list_toggled_enabled": "La lista {{list}} se ha activado correctamente.",
"members/member_list_toggled_disabled": "La lista {{list}} se ha desactivado correctamente.",
"members/view_all": "Ver todo",
"members/find_member": "Buscar miembro",
"members/name": "Nombre...",
"members/view_group": "Ver grupo",
"members/group": "Grupo...",
"members/viewable_groups": "Grupos disponibles",
"members/no_results_header": "No se han encontrado resultados",
"members/no_results_text": "Tu búsqueda no devolvió resultados",
"members/no_overview_lists_enabled": "No se han habilitado listas de resumen.",
"members/settings_updated_successfully": "La configuración se actualizó exitosamente."
}
19 changes: 19 additions & 0 deletions modules/Members/language/es_ES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"members/members": "Miembros",
"members/member_list_hide_banned_users": "¿Ocultar usuarios baneados?",
"members/no_results_header": "No se encontraron resultados",
"members/settings_updated_successfully": "La configuración se actualizó exitosamente.",
"members/new_members": "Nuevos miembros",
"members/no_members": "No se encontraron miembros.",
"members/member_lists": "Listas de miembros",
"members/member_list_toggled_enabled": "Habilitada con éxito la lista {{list}}.",
"members/member_list_toggled_disabled": "Desactivada con éxito la lista {{list}}.",
"members/view_all": "Ver todo",
"members/find_member": "Buscar miembro",
"members/name": "Nombre...",
"members/view_group": "Ver grupo",
"members/group": "Grupo...",
"members/viewable_groups": "Grupos visibles",
"members/no_results_text": "Tu búsqueda no arrojó resultados",
"members/no_overview_lists_enabled": "No se han habilitado listas de resumen."
}
19 changes: 19 additions & 0 deletions modules/Members/language/fa_IR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"members/members": "اعضا",
"members/new_members": "اعضای جدید",
"members/no_members": "هیچ عضوی پیدا نشد.",
"members/member_list_toggled_enabled": "لیست {{list}} با موفقیت فعال شد.",
"members/member_list_toggled_disabled": "لیست {{list}} با موفقیت غیرفعال شد.",
"members/view_all": "مشاهده همه",
"members/find_member": "یافتن عضو",
"members/name": "نام...",
"members/view_group": "مشاهده گروه",
"members/group": "گروه...",
"members/no_results_header": "نتیجه ای پیدا نشد",
"members/no_results_text": "جستجوی شما نتیجه ای نداشت",
"members/no_overview_lists_enabled": "هیچ لیست نمای کلی فعال نیست.",
"members/viewable_groups": "گروه های قابل مشاهده",
"members/member_lists": "لیست اعضا",
"members/member_list_hide_banned_users": "کاربران مسدود شده پنهان شوند؟",
"members/settings_updated_successfully": "تنظیمات با موفقیت به روز شد."
}
1 change: 1 addition & 0 deletions modules/Members/language/fi_FI.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
19 changes: 19 additions & 0 deletions modules/Members/language/fr_FR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"members/members": "Membres",
"members/new_members": "Nouveaux membres",
"members/no_members": "Aucun membre trouvé.",
"members/member_list_hide_banned_users": "Masquer les utilisateurs bannis ?",
"members/member_list_toggled_enabled": "Liste {{list}} activée avec succès.",
"members/member_list_toggled_disabled": "Liste {{list}} désactivée avec succès.",
"members/view_all": "Tout voir",
"members/find_member": "Trouver un membre",
"members/name": "Nom...",
"members/group": "Groupe...",
"members/viewable_groups": "Groupes visibles",
"members/no_results_header": "Aucun résultat trouvé",
"members/no_results_text": "Votre recherche n'a donné aucun résultat",
"members/settings_updated_successfully": "Paramètres mis à jour avec succès.",
"members/member_lists": "Listes des membres",
"members/view_group": "Afficher les groupes",
"members/no_overview_lists_enabled": "Aucune liste d'aperçu n'est activée."
}
1 change: 1 addition & 0 deletions modules/Members/language/hr_HR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
19 changes: 19 additions & 0 deletions modules/Members/language/hu_HU.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"members/settings_updated_successfully": "A beállítások frissítése sikeresen megtörtént.",
"members/members": "Tagok",
"members/new_members": "Új tagok",
"members/no_members": "Nem találhatók tagok.",
"members/member_lists": "Taglisták",
"members/member_list_hide_banned_users": "Tiltott tagok elrejtése?",
"members/member_list_toggled_disabled": "A {{list}} lista sikeresen kikapcsolva.",
"members/member_list_toggled_enabled": "A {{list}} lista sikeresen bekapcsolva.",
"members/view_all": "Összes megtekintése",
"members/find_member": "Tag keresése",
"members/name": "Név...",
"members/view_group": "Csoport megtekintése",
"members/group": "Csoport...",
"members/viewable_groups": "Megtekinthető csoportok",
"members/no_results_header": "Nincs találat",
"members/no_results_text": "A keresésed nem eredményezett találatot",
"members/no_overview_lists_enabled": "Nincsenek áttekintő listák engedélyezve."
}
1 change: 1 addition & 0 deletions modules/Members/language/id_ID.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
18 changes: 18 additions & 0 deletions modules/Members/language/it_IT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"members/member_list_toggled_enabled": "Abilitata la lista {{list}} con successo.",
"members/no_results_text": "La tua ricerca ha riportato nessun risultato",
"members/members": "Membri",
"members/new_members": "Nuovi Membri",
"members/no_members": "Nessun membro trovato.",
"members/member_lists": "Lista Membri",
"members/member_list_hide_banned_users": "Nascondi utenti banditi?",
"members/member_list_toggled_disabled": "Disabilitata la lista {{list}} con successo.",
"members/find_member": "Cerca utente",
"members/name": "Nome..",
"members/group": "Gruppo..",
"members/viewable_groups": "Gruppi visualizzabili",
"members/no_results_header": "Nessun risultato trovato",
"members/settings_updated_successfully": "Impostazioni aggiornate con successo.",
"members/view_group": "Visualizza Gruppo",
"members/view_all": "Visualizza tutto"
}
1 change: 1 addition & 0 deletions modules/Members/language/ja_JP.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions modules/Members/language/ko_KR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions modules/Members/language/lt_LT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions modules/Members/language/lv_LV.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
19 changes: 19 additions & 0 deletions modules/Members/language/nl_NL.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"members/members": "Leden",
"members/no_members": "Geen leden gevonden.",
"members/member_list_toggled_disabled": "{{list}} lijst met succes uitgeschakeld.",
"members/new_members": "Nieuwe leden",
"members/member_lists": "Ledenlijsten",
"members/member_list_hide_banned_users": "Verbannen gebruikers verbergen?",
"members/member_list_toggled_enabled": "{{list}} lijst succesvol ingeschakeld.",
"members/view_all": "Alles weergeven",
"members/find_member": "Vind lid",
"members/name": "Naam...",
"members/view_group": "Toon groep",
"members/group": "Groep...",
"members/viewable_groups": "Zichtbare groepen",
"members/no_results_header": "Geen resultaten gevonden",
"members/no_results_text": "Je zoekopdracht heeft geen resultaten opgeleverd",
"members/no_overview_lists_enabled": "Er zijn geen overzichtslijsten ingeschakeld.",
"members/settings_updated_successfully": "Instellingen bijgewerkt."
}
1 change: 1 addition & 0 deletions modules/Members/language/no_NO.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading

0 comments on commit 3990914

Please sign in to comment.