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

enh(dev): Migrate from webpack to vite for building the frontend #1827

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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 index(): TemplateResponse {
Util::addScript($this->appName, 'forms-main');
Util::addStyle($this->appName, 'forms');
Util::addStyle($this->appName, 'forms-style');

Check warning on line 83 in lib/Controller/PageController.php

View check run for this annotation

Codecov / codecov/patch

lib/Controller/PageController.php#L83

Added line #L83 was not covered by tests
$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 @@
* @return TemplateResponse
*/
public function provideTemplate(string $template, Form $form = null, array $options = []): TemplateResponse {
Util::addStyle($this->appName, 'forms-style');

Check warning on line 195 in lib/Controller/PageController.php

View check run for this annotation

Codecov / codecov/patch

lib/Controller/PageController.php#L195

Added line #L195 was not covered by tests
// If not logged in, use PublicTemplate
if (!$this->userSession->isLoggedIn()) {
Util::addStyle($this->appName, 'public');
Expand Down
Loading