Files
wekan/models/lib/productName.js
T
Lauri Ojansivu 8d1fae4f7d Convert client-reachable models/lib helpers from CommonJS to ES modules (1/2).
The rspack client build treats a `module.exports` file imported into the
client bundle as an ES module and throws
"ES Modules may not assign module.exports" at evaluation time, aborting
the whole client module chain (No such template: swimlane / notifications
/ boardButtons, blank board, missing top bar). This is not an rspack
version regression (the lockfile has pinned ~1.7.x since v8.40); it is
that WeKan added CommonJS helpers to the client bundle.

Convert the 42 client-reachable pure-logic models/lib helpers from
`module.exports = { ... }` to `export { ... }`, and calendarFilter's
internal require('./swimlaneFilter') to an import with a .js extension
(node ESM needs it; rspack/reify tolerate it). Server-only helpers that
use node built-ins (fs/path/child_process) stay CommonJS. The plain-Node
.cjs unit tests for these helpers now use `await import(...js)` (wrapped
in an async IIFE); a source-guard in importVirtualMembers was updated
from module.exports to export. Verified: the full tests/*.test.cjs suite
has the SAME 7 pre-existing failures as before this change and no new
ones.
2026-07-23 18:55:30 +03:00

16 lines
528 B
JavaScript

'use strict';
// Returns the configured Product name (Admin Panel / Settings / Layout /
// Product name, stored as Settings.productName) or the default 'WeKan' brand
// when none is set. Used so migrations and other branded UI show the admin's
// Product name instead of the hard-coded WeKan brand.
function productNameOrDefault(productName) {
if (typeof productName === 'string') {
const trimmed = productName.trim();
if (trimmed.length > 0) return trimmed;
}
return 'WeKan';
}
export { productNameOrDefault };