diff options
author | Richard Steinmetz <steinmetz.richard@googlemail.com> | 2020-12-23 20:37:35 +0300 |
---|---|---|
committer | Richard Steinmetz <steinmetz.richard@googlemail.com> | 2020-12-23 20:59:19 +0300 |
commit | ac1a2c3b15ec69e1750fc07c5b23e1e9171d3f6a (patch) | |
tree | d8b3700aae2f322dfcc3e04bb733a7fb9b9b8f9d /lib | |
parent | 332d45fa530ae716ae130db8fb88fb45bb2127b3 (diff) |
Update frontend code
Introduce webpack to bundle required dependencies instead of relying on global libraries. Those global libraries are deprecated and will be removed soon.
I tried to change the existing code as little as possible. However, the diff is huge because I fixed the indentation (tabs and spaces were mixed). Additionally, I tried to keep package.json and webpack.common.js as minimal as possible and took some inspiration from other official nextcloud apps.
Npm scripts:
- Production build: `npm run build`
- Development build: `npm run dev`
- Build and watch for changes: `npm run watch`
The build script should be run before pushing a release. The source files (inside src/), installed packages (inside node_modules/) and various js configs (webpack.*.js, package*.json and babel.config.json) can be omitted from a release. Webpack will output the generated code to js/.
Signed-off-by: Richard Steinmetz <steinmetz.richard@googlemail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AppInfo/Application.php | 8 | ||||
-rw-r--r-- | lib/Listener/LoadSidebarListener.php (renamed from lib/Listener/LoadAdditionalScriptsListener.php) | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 9feaf47..89c9a5e 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -23,8 +23,8 @@ declare(strict_types=1); namespace OCA\Checksum\AppInfo; -use OCA\Checksum\Listener\LoadAdditionalScriptsListener; -use OCA\Files\Event\LoadAdditionalScriptsEvent; +use OCA\Checksum\Listener\LoadSidebarListener; +use OCA\Files\Event\LoadSidebar; use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; @@ -40,8 +40,8 @@ class Application extends App implements IBootstrap { public function register(IRegistrationContext $context): void { // Load scripts for sidebar. $context->registerEventListener( - LoadAdditionalScriptsEvent::class, - LoadAdditionalScriptsListener::class + LoadSidebar::class, + LoadSidebarListener::class ); } diff --git a/lib/Listener/LoadAdditionalScriptsListener.php b/lib/Listener/LoadSidebarListener.php index 9a28498..381d735 100644 --- a/lib/Listener/LoadAdditionalScriptsListener.php +++ b/lib/Listener/LoadSidebarListener.php @@ -23,19 +23,19 @@ declare(strict_types=1); namespace OCA\Checksum\Listener; -use OCA\Files\Event\LoadAdditionalScriptsEvent; +use OCA\Checksum\AppInfo\Application; +use OCA\Files\Event\LoadSidebar; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; use OCP\Util; -class LoadAdditionalScriptsListener implements IEventListener { +class LoadSidebarListener implements IEventListener { public function handle(Event $event): void { - if (!($event instanceof LoadAdditionalScriptsEvent)) { + if (!($event instanceof LoadSidebar)) { return; } - Util::addScript('checksum', 'checksum.tabview'); - Util::addScript('checksum', 'checksum.plugin'); + Util::addScript(Application::APP_ID, 'checksum.main'); } } |