Skip to content

Conversation

@artlowel
Copy link
Member

@artlowel artlowel commented Oct 23, 2025

References

Description

This PR builds on #4629

Here's a compare view

Generated libraries

  • Converted @dspace/core, @dspace/config, and @dspace/utils TypeScript path mappings into Angular libraries using:

    ng generate library @dspace/core
  • Moved the corresponding code into the lib folder of each new library.

Public APIs

  • Integrated barrelsby to generate each library’s public-api.ts, defining what can be imported externally.
  • Configured this to run automatically during both dev and prod builds.
    Eventually we will want it to watch for changes so it adds new files when you create them.

Import and path updates

  • Updated all imports in the main app to use each library’s public API.
    For example, import { Process } from '@dspace/core/processes/process.model' becomes import { Process } from '@dspace/core'.

  • Updated library paths in tsconfig.json to point directly to the public APIs rather than built outputs.
    This ensures that code changes in any library are immediately reflected in development mode.
    This also works for production, though we may later build the libraries separately to speed up prod builds when no library code has changed.

Bugfixes

  • Resolved circular dependencies that became apparent after splitting the code into libraries.
    • Some guards and resolvers originally in the core module were moved to the main app.
  • Fixed several naming conflicts, e.g. if two classes are called Metadata, they can't both be exported from the same public api without renaming one of them.

Building and testing

  • Uses the same build and run commands as DSpace: npm run start, npm run start:dev, and similar.
  • e2e tests run successfully.
    Unit tests currently fail due to imports that moved. I did not spend more time fixing these in case we decide not to proceed with this approach.

Custom lib poc

I added a custom library on top of this PR to test how that would work. You can find that code at atmire:ng-workspace-poc-with-custom-lib

Here's a compare view with this PR

FrancescoMolinaro and others added 30 commits July 22, 2025 15:10
…nvironment import to injection token in core
…ACOM-327

# Conflicts:
#	src/app/core/provide-core.ts
#	src/app/submission/sections/section-coar-notify/submission-coar-notify-workspaceitem.model.ts
atarix83 and others added 22 commits August 5, 2025 21:55
@artlowel artlowel changed the title Ng workspace poc Refactor core, utils and config as libraries using angular's built-in tools Oct 23, 2025
@artlowel artlowel requested review from atarix83 and tdonohue October 23, 2025 16:08
@artlowel artlowel added dependencies Pull requests that update a dependency file high priority new feature merge conflict labels Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file high priority merge conflict new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants