Skip to content

Conversation

@ShGKme
Copy link
Contributor

@ShGKme ShGKme commented Jun 23, 2025

Resolves

  • Intermediate solution for [RFC] export of vue components #1809
  • Currently @nextcloud/uploads has uploading logic and ui mixed
  • Also, it has some circular dependencies
  • This PR includes:
    • Refactoring modules structure:
      • core - pure uploading logic
      • ui - UI related functions (dialogs) that use Vue only internally
      • components - exported Vue component (that can only be used in a specific Vue version)
    • Providing core, components and ui as npm package exports
    • Defining vue and @nextcloud/vue as direct dependencies to allow installation in Vue 3 environment
// Works in both Vue 2 and Vue 3 (doesn't rely on Vue at all)
import { getUploader } from '@nextcloud/upload/core'

// Only works in Vue 2 (only in Vue 3 after migration)
import { UploadPicker } from '@nextcloud/upload/ui'

// Old import still works
// But also only in Vue 2
import { getUploader, UploadPicker } from '@nextcloud/upload'

Detailed explanation

Details

image

image

image

image

image

image

@ShGKme ShGKme requested review from Antreesy, skjnldsv and susnux June 23, 2025 13:36
@ShGKme ShGKme self-assigned this Jun 23, 2025
@ShGKme ShGKme added enhancement New feature or request 2. developing Work in progress labels Jun 23, 2025
@ShGKme

This comment was marked as outdated.

@ShGKme ShGKme requested a review from DorraJaouad June 23, 2025 14:39
ShGKme added 6 commits June 23, 2025 16:48
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
@ShGKme ShGKme force-pushed the feat/cheap-monorepo branch from ab24d1a to e3135f1 Compare June 23, 2025 15:02
@ShGKme ShGKme marked this pull request as ready for review June 23, 2025 15:10
Copy link
Contributor

@Antreesy Antreesy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested against Talk / Vue 3

@susnux
Copy link
Contributor

susnux commented Jun 23, 2025

As this is a breaking change, its still the question if we want to keep this package to depend on vue in general.
Or just move the dialog to the dialogs package and the Uploader to the vue package to keep it API only.

I would prefer that, but this is also a nice solution :)

@ShGKme
Copy link
Contributor Author

ShGKme commented Jun 23, 2025

As this is a breaking change

There are no breaking changes. There is still the root export with everything.

@ShGKme
Copy link
Contributor Author

ShGKme commented Jun 23, 2025

This PR is feat.

It adds 2 new exports:

  1. @nextcloud/upload/core with uploading related logic and functions
  2. @nextcloud/upload/ui with Vue components and dialogs

The existing @nextcloud/upload with index.ts stays in place

@ShGKme

This comment was marked as outdated.

@ShGKme
Copy link
Contributor Author

ShGKme commented Jun 23, 2025

@susnux Please, have a look at the last image in the PR : )

@ShGKme

This comment was marked as outdated.

@susnux
Copy link
Contributor

susnux commented Jun 23, 2025

There are no breaking changes. There is still the root export with everything.

But then I still do not see how this solves the problem aslong as this exports a vue component its not universal.
Meaning we still need two version for vue 3 and vue 2.

Then we also could just migrate the library as is?

@Antreesy
Copy link
Contributor

Antreesy commented Jun 23, 2025

Then we also could just migrate the library as is?

If time allows, that would be nice.
Otherwise we can unlock apps, that do not use Vue components, with a minor release, and invest more efforts, then it will be actually required

@ShGKme
Copy link
Contributor Author

ShGKme commented Jun 23, 2025

But then I still do not see how this solves the problem aslong as this exports a vue component its not universal.

This library has Vue component UploadPicker and many functions, including pure JS functions with uploading logic.

This UploadPicker is the only part that actually depends on Vue version.

But when everything is exported together from a single index.ts, you cannot use even getUploader with a different vue version. Because Vue is also imported.

This changes separates these parts.

It allows importing getUploader without importing Vue, and use it in any app (both Vue 2 and Vue 3).

If we continue as shown on the new image, then all the other functions can also be used with shipped Vue.

@ShGKme
Copy link
Contributor Author

ShGKme commented Jun 23, 2025

Meaning we still need two version for vue 3 and vue 2.

Only for a one thing - UploadPicker

@ShGKme
Copy link
Contributor Author

ShGKme commented Jun 23, 2025

Then we also could just migrate the library as is?

Yes, but it is independent.

And you still need to use library in Vue 2 apps.

ShGKme added 2 commits June 24, 2025 20:16
Unlike UI functions that uses Vue internaly, this component is exported
as a Vue component and must be used in a specific Vue version.

Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
This allows installing package in Vue 3 environment.

Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
@ShGKme ShGKme force-pushed the feat/cheap-monorepo branch from e3135f1 to 7a366ef Compare June 24, 2025 18:20
@ShGKme

This comment was marked as outdated.

@ShGKme
Copy link
Contributor Author

ShGKme commented Jun 24, 2025

I can also separate this PR to pure refactoring (I believe it helps to separate the library anyway + removes cycles) and to adding exports (to make the library 2/3 Vue 3 compatible).

@susnux @skjnldsv What do you think?

This is the last library to make Nextcloud ecosystem Vue 3 ready 👀

@ShGKme
Copy link
Contributor Author

ShGKme commented Jun 26, 2025

@ShGKme ShGKme closed this Jun 26, 2025
@susnux susnux deleted the feat/cheap-monorepo branch June 26, 2025 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants