mirror of
https://github.com/chenasraf/nextcloud-autocurrency.git
synced 2026-05-17 17:28:06 +00:00
- Add GitHub Actions workflows for PHPUnit testing (MySQL and PostgreSQL) - Add issue templates (bug reports, feature requests) for better issue management - Enhance Makefile with Docker test support and improved build targets - Update lint-staged configuration with better PHP and JSON handling - Add comprehensive PHPUnit test infrastructure with Docker support - Update dependencies and add lock files for composer and vendor-bin tools - Improve code scaffolding templates (command, component, view generators) - Update build configuration (Vite, package.json, pnpm-lock.yaml) - Refactor Application.php settings initialization - Update AdminSettings and UserSettings implementations - Rename test file for consistency (ApiTest → ApiControllerTest) - Update .gitignore (track composer.lock, ignore stats.html)
63 lines
1.5 KiB
PHP
63 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
// SPDX-FileCopyrightText: Chen Asraf <contact@casraf.dev>
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
namespace OCA\AutoCurrency\AppInfo;
|
|
|
|
use OCP\AppFramework\App;
|
|
use OCP\AppFramework\Bootstrap\IBootContext;
|
|
use OCP\AppFramework\Bootstrap\IBootstrap;
|
|
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
|
|
|
class Application extends App implements IBootstrap {
|
|
public const APP_ID = 'autocurrency';
|
|
public const DIST_DIR = '../dist';
|
|
public const JS_DIR = self::DIST_DIR . '/js';
|
|
public const CSS_DIR = self::DIST_DIR . '/css';
|
|
|
|
/** @psalm-suppress PossiblyUnusedMethod */
|
|
public function __construct() {
|
|
parent::__construct(self::APP_ID);
|
|
}
|
|
|
|
public function register(IRegistrationContext $context): void {
|
|
}
|
|
|
|
public function boot(IBootContext $context): void {
|
|
}
|
|
|
|
/**
|
|
* Helper to parse Vite Manifest
|
|
*/
|
|
public static function getViteEntryScript(string $entryName): string {
|
|
$jsDir = realpath(__DIR__ . '/../' . Application::JS_DIR);
|
|
$manifestPath = dirname($jsDir) . '/.vite/manifest.json';
|
|
|
|
if (!file_exists($manifestPath)) {
|
|
return '';
|
|
}
|
|
|
|
$manifest = json_decode(file_get_contents($manifestPath), true);
|
|
|
|
if (isset($manifest[$entryName]['file'])) {
|
|
$manifestFile = $manifest[$entryName]['file'];
|
|
$fullPath = dirname($jsDir) . '/' . $manifestFile;
|
|
|
|
if (!file_exists($fullPath)) {
|
|
return '';
|
|
}
|
|
|
|
return pathinfo($manifestFile, PATHINFO_FILENAME);
|
|
}
|
|
|
|
return '';
|
|
}
|
|
|
|
public static function tableName(string $table): string {
|
|
return self::APP_ID . '_' . $table;
|
|
}
|
|
}
|