Skip to content

Commit

Permalink
enh(dev): Migrate from webpack to vite for building the frontend
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Dec 9, 2023
1 parent 793c175 commit 61b345d
Show file tree
Hide file tree
Showing 13 changed files with 2,033 additions and 2,997 deletions.
13 changes: 0 additions & 13 deletions .eslintrc.js

This file was deleted.

13 changes: 13 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"globals": {
"appName": true
},
"extends": [
"@nextcloud"
],
"rules": {
// We are using the @nextcloud/logger
"no-console": "error",
"import/no-unresolved": ["error", { "ignore": ["\\?raw"] }]
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ cypress/snapshots

# Compiled files
js/
css/forms-style.css

# Compile-Cache
v8-compile-cache-0/
Expand Down
3 changes: 0 additions & 3 deletions babel.config.js

This file was deleted.

79 changes: 14 additions & 65 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,74 +54,21 @@
class PageController extends Controller {
private const TEMPLATE_MAIN = 'main';

protected $appName;

/** @var FormMapper */
private $formMapper;

/** @var ShareMapper */
private $shareMapper;

/** @var ConfigService */
private $configService;

/** @var FormsService */
private $formsService;

/** @var IAccountManager */
protected $accountManager;

/** @var IInitialState */
private $initialState;

/** @var IL10N */
private $l10n;

/** @var LoggerInterface */
private $logger;

/** @var IRequest */
protected $request;

/** @var IUrlGenerator */
private $urlGenerator;

/** @var IUserManager */
private $userManager;

/** @var IUserSession */
private $userSession;

public function __construct(string $appName,
IRequest $request,
FormMapper $formMapper,
ShareMapper $shareMapper,
ConfigService $configService,
FormsService $formsService,
IAccountManager $accountManager,
IInitialState $initialState,
IL10N $l10n,
LoggerInterface $logger,
IUrlGenerator $urlGenerator,
IUserManager $userManager,
IUserSession $userSession) {
private FormMapper $formMapper,
private ShareMapper $shareMapper,
private ConfigService $configService,
private FormsService $formsService,
private IAccountManager $accountManager,
private IInitialState $initialState,
private IL10N $l10n,
private LoggerInterface $logger,
private IUrlGenerator $urlGenerator,
private IUserManager $userManager,
private IUserSession $userSession,
) {
parent::__construct($appName, $request);

$this->appName = $appName;

$this->formMapper = $formMapper;
$this->shareMapper = $shareMapper;
$this->configService = $configService;
$this->formsService = $formsService;

$this->accountManager = $accountManager;
$this->initialState = $initialState;
$this->l10n = $l10n;
$this->logger = $logger;
$this->request = $request;
$this->urlGenerator = $urlGenerator;
$this->userManager = $userManager;
$this->userSession = $userSession;
}

/**
Expand All @@ -133,6 +80,7 @@ public function __construct(string $appName,
public function index(): TemplateResponse {
Util::addScript($this->appName, 'forms-main');
Util::addStyle($this->appName, 'forms');
Util::addStyle($this->appName, 'forms-style');
$this->insertHeaderOnIos();
$this->initialState->provideInitialState('maxStringLengths', Constants::MAX_STRING_LENGTHS);
$this->initialState->provideInitialState('appConfig', $this->configService->getAppConfig());
Expand Down Expand Up @@ -244,6 +192,7 @@ public function provideEmptyContent(string $renderAs, Form $form = null): Templa
* @return TemplateResponse
*/
public function provideTemplate(string $template, Form $form = null, array $options = []): TemplateResponse {
Util::addStyle($this->appName, 'forms-style');
// If not logged in, use PublicTemplate
if (!$this->userSession->isLoggedIn()) {
Util::addStyle($this->appName, 'public');
Expand Down
Loading

0 comments on commit 61b345d

Please sign in to comment.