Skip to content
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
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Vrij en open source onder de EUPL-licentie.

**Ondersteuning:** Voor ondersteuning, neem contact op via support@conduction.nl. Voor een Service Level Agreement (SLA), neem contact op via sales@conduction.nl.
]]></description>
<version>0.1.140</version>
<version>0.1.141</version>
<licence>agpl</licence>
<author mail="info@conduction.nl" homepage="https://www.conduction.nl/">Conduction</author>
<namespace>SoftwareCatalog</namespace>
Expand Down
4 changes: 4 additions & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

use OCA\SoftwareCatalog\BackgroundJob\OrganizationContactSyncJob;
use OCA\SoftwareCatalog\Controller\ContactpersonenController;
use OCA\SoftwareCatalog\Dashboard\ConceptOrganisatiesWidget;
use OCA\SoftwareCatalog\EventListener\SoftwareCatalogEventListener;
use OCA\SoftwareCatalog\EventListener\TestEventListener;
use OCA\SoftwareCatalog\EventListener\ModuleComplianceSubscriber;
Expand Down Expand Up @@ -428,6 +429,9 @@ function ($container) {
);
}
);

// Dashboard widgets — see lib/Dashboard/*.php and src/*Widget.js.
$context->registerDashboardWidget(ConceptOrganisatiesWidget::class);
}//end register()

/**
Expand Down
10 changes: 7 additions & 3 deletions lib/Dashboard/ConceptOrganisatiesWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,13 @@ public function getUrl(): ?string
*/
public function load(): void
{
$appId = Application::APP_ID;
$scriptName = $appId.'-conceptOrganisatiesWidget';
Util::addScript(application: $appId, file: $scriptName);
$appId = Application::APP_ID;
// Shared chunks emitted by webpack splitChunks + runtimeChunk (see webpack.config.js).
// Order: runtime → vendor → nc-vue → widget.
Util::addScript(application: $appId, file: $appId.'-runtime');
Util::addScript(application: $appId, file: $appId.'-shared-vendor');
Util::addScript(application: $appId, file: $appId.'-shared-nc-vue');
Util::addScript(application: $appId, file: $appId.'-conceptOrganisatiesWidget');
Util::addStyle(application: $appId, file: 'dashboardWidgets');
}//end load()
}//end class
41 changes: 35 additions & 6 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ webpackConfig.entry = {
import: path.join(__dirname, 'src', 'settings.js'),
filename: appId + '-settings.js',
},
conceptOrganisatiesWidget: {
import: path.join(__dirname, 'src', 'conceptOrganisatiesWidget.js'),
filename: appId + '-conceptOrganisatiesWidget.js',
},
}

// Use local source when available (monorepo dev), otherwise fall back to npm package
Expand All @@ -47,12 +51,6 @@ webpackConfig.module = {
test: /\.vue$/,
loader: 'vue-loader',
},
{
test: /\.ts$/,
loader: 'ts-loader',
exclude: /node_modules/,
options: { appendTsSuffixTo: [/\.vue$/] },
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
Expand All @@ -68,4 +66,35 @@ webpackConfig.plugins = [
// preventing the nextcloud-vue submodule's nested deps (Vue 3) from leaking in.
webpackConfig.resolve.alias['@nextcloud/dialogs'] = path.resolve(__dirname, 'node_modules/@nextcloud/dialogs')

// Shared chunks so widgets reuse Vue / Pinia / @nextcloud/vue + @conduction/nextcloud-vue
// instead of bundling them per entry. Slashes \\/ used to match both posix and win paths.
webpackConfig.optimization = {
...(webpackConfig.optimization || {}),
runtimeChunk: { name: 'runtime' },
splitChunks: {
...(webpackConfig.optimization?.splitChunks || {}),
chunks: 'all',
cacheGroups: {
default: false,
defaultVendors: false,
ncVue: {
name: appId + '-shared-nc-vue',
test: /[\\/]node_modules[\\/](@nextcloud[\\/]vue|@conduction[\\/]nextcloud-vue)[\\/]|[\\/]nextcloud-vue[\\/]src[\\/]/,
priority: 30,
reuseExistingChunk: true,
enforce: true,
filename: appId + '-shared-nc-vue.js',
},
vendor: {
name: appId + '-shared-vendor',
test: /[\\/]node_modules[\\/](vue|pinia|vue-material-design-icons|@vueuse|core-js)[\\/]/,
priority: 20,
reuseExistingChunk: true,
enforce: true,
filename: appId + '-shared-vendor.js',
},
},
},
}

module.exports = webpackConfig
Loading