Commit Graph

22 Commits

Author SHA1 Message Date
Matt Blenkinsop 133946e50c
Bug 26355: Add a Vue island for the self-renewal modal
Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:00 -06:00
Martin Renvoize bb4407a0ff
Bug 41587: (follow-up) Clean Cypress plugin dist on rebuild to prevent stale sourcemaps
Add output.clean: true to the Cypress plugin rspack build config.

Before Bug 36674 (Nov 2025), this build emitted .map files into
t/cypress/plugins/dist/. After devtool: false was added, the map files
were no longer generated but stale ones persisted on developer machines
(dist/ is gitignored).

When the rspack update in Bug 41587 rebuilt api-client.cjs.js with
dynamic chunk loading, Cypress's webpack created a context module for
the require() expression and matched the stale .map files (webpack's
context regex matches substrings, so *.js.map matches *.js). Webpack
then failed trying to parse JSON sourcemaps as JavaScript.

output.clean: true ensures the dist directory is wiped on every build,
so stale files from previous configurations can never accumulate.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 15:16:28 +00:00
David Cook 8b17f6158d
Bug 38365: Set __webpack_nonce__ for style-loader plugin and fix fontawesome imports
By setting __webpack_nonce__ webpack/rspack will add the nonce to styles
added using style-loader plugin.

Also, stop fontawesome from auto injecting CSS elements, and instead
manually import them so that they can be picked up by style-loader

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2026-03-16 11:57:39 +01:00
Paul Derscheid 87fb6f273a
Bug 36674: (follow-up) Stop emitting Cypress API client source maps
- Use devtool: false to prevent emitting source maps for cypress.
- Add package script to clean built assets, artifacts.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-12-02 10:07:13 -07:00
Pedro Amorim 38fe4442d2
Bug 37893: SIP2 VueJS module scaffolding
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-11-18 11:20:45 -07:00
Jonathan Druart 70b7bb0f33
Bug 38201: Move cypress components under t/cypress
(cherry picked from commit 5cf8a60eb99e37abc365639d05e9da9ca931f7d6)
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-02 09:40:23 -06:00
Matt Blenkinsop 7d5bd4b9ae
Bug 38201: Rename the '@k' alias to koha-vue
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-02 09:39:59 -06:00
Jonathan Druart d80916696f
Bug 38201: Do not export $__ from the base resource
We had this following warning in the console:
[Vue warn]: setup() return property "$__" should not start with "$" or "_" which are reserved prefixes for Vue internals.

Trying to fix this and realized we could do better in our handling of
the i18n functions.

This patch suggests to:
1. Have "@k" available as the Koha Vue root path so that we can easily
   import without relative paths
   TODO - Should be applied to all other imports
2. Import the i18n functions from the components when we need it
3. Do not have them available in the i18n object exported by the
   base resource
4. Remove direct use of __() from scripts and always use $__()

(cherry picked from commit 247675939ef28a90d21be863c6a57382cf3de966)
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-10-02 09:39:58 -06:00
Jonathan Druart 0985c64a54
Bug 40173: Make http-client reusable from Cypress tests
We will need to call REST API endpoints from Cypress tests, and more
specifically from Cypress's tasks.

It will be useful to reuse what has been done in http-client.js instead
of using the low-level fetch JS function.

1. Add missing get and getAll functions
2. Allow overwrite of return_response and mark_submitting
3. Add a "default" client that will bring flexibility (can call any
   routes)
4. Add rspack config to generate
   t/cypress/plugins/dist/api-client.cjs.js that will make it reusable
   from Cypress's tasks

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-07-21 14:01:07 -06:00
Matt Blenkinsop 30606d2373
Bug 38010: (QA follow-up) Rebase on main
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-05-02 17:19:15 +02:00
Matt Blenkinsop 5b07a872f3
Bug 38010: Rename routes to acquisitions
This patch renames the app from vendors to acquisitions to allow further acquisitions pages to be migrated

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-05-02 17:18:30 +02:00
Matt Blenkinsop b71b62059a
Bug 38010: Add vue app and list component
This patch adds the base vue app as well as the component to list vendors

Amended-by: Jonathan Druart
chmod 755 acqui/vendors.pl

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-05-02 17:18:27 +02:00
Paul Derscheid b724ffc16c
Bug 37911: (follow-up) Use style-, css-loader to preserve compatiblity with Koha's Vue components, e.g. Dialog.vue
- For now let's not rely on rspack's native css loader to parse and
  bundle styles as we need to preserve compatibility.
- Reintroduce configuration block for style-, css-loader for islands.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-04-25 18:35:01 +02:00
Paul Derscheid c7f5e2740c
Bug 37911: (follow-up) Let style-, css-loader handle styles in Koha's Vue apps
- Remove 'experiments: css' for the first config block since it seems to do 2 passes when building the css.
- Remove style-, css-loader configuration for islands as I assume it is unneeded in this case.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-04-25 18:35:00 +02:00
Paul Derscheid e3d3224f6f
Bug 37911: (follow-up) Tidy and remove leftover entry point for islands in first config block
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-04-25 18:35:00 +02:00
Paul Derscheid bd15b1829e
Bug 37911: (follow-up) Allow for initialisation of islands on demand
- Split the rspack config into a umd and an esm section.
- Don't hydrate by default.
    - Instead check the "init" attribute for the currentScript when using the umd.
    - Allow for manual import and call when using the esm.
    - Add examples for both in intranet-main.tt (to be removed).
- Add a DialogIsland wrapper for the shared Dialog component (to map props to stored refs).
- Move DialogIsland as well as Demo components into an Islands directory under components.
- Add i18n initialisation to hydrate's idle callback.

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-04-25 18:34:57 +02:00
Paul Derscheid aa5283dd62
Bug 37911: (follow-up) Prevent resolution failure of dynamic imports when building in mode --production
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-04-25 18:34:56 +02:00
Paul Derscheid 4c40cf8f9f
Bug 37911: (follow-up) Update to vue ^3.5.4, use vue's web component implementation instead
- This would require us to update vue to a new minor version.
	- We could then use the defineCustomElement function with the shadowRoot option set to false (this is important).
- The current implementation in islands.ts is naive and would result in an intolerable bundle size.
	- The right way to do code splitting here is to use dynamic imports.

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-04-25 18:34:53 +02:00
Paul Derscheid cdd5194183
Bug 37911: Prototype vue islands within static pages
This is pretty bare bones, but might still be interesting to take a look at.

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-04-25 18:34:52 +02:00
Paul Derscheid 27524f87e3
Bug 38993: (follow-up) Add 'fetch' alias to rspack config
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-03-17 11:59:52 +01:00
Paul Derscheid db4f151be5
Bug 37824: (QA follow-up) Fix improper handling of jQuery and DataTables libraries by marking them as externals
This commit addresses an issue where jQuery and DataTables libraries (datatables.net and related extensions) were not functioning correctly when bundled with rspack. These libraries expect to be loaded in the global scope rather than as bundled modules, leading to initialization issues.

To resolve this, jQuery and all related DataTables libraries (datatables.net, datatables.net-buttons, datatables.net-buttons/js/buttons.html5, etc.) are marked as externals in the rspack configuration. This ensures they are treated as global dependencies, preventing conflicts and allowing proper initialization.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-16 18:41:17 +02:00
Paul Derscheid 28b6294461
Bug 37824: Replace webpack with rspack for fun and profit
I left the webpack.config.js as well as the devDependencies in place for now.
We can remove them in a follow-up patch on this bug after testing it out.

To test:
1) Run js:build and js:build:prod
2) Note the build time
3) Apply patch
4) Run yarn install
5) Run js:build and js:build:prod again
6) Note the much faster build time
7) Extra credit: take a look at the ERM or preservations module and make sure everything works as expected.
8) Extra credit: run the cypress tests.
9) Sign off or give your opinion

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Looks faster to me. Where webpack failed for me (Killed, error 137), this passed.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-09-16 13:47:06 +02:00