Skip to content

Conversation

@tucker-m
Copy link
Contributor

@tucker-m tucker-m commented Jul 3, 2021

Also adds related parts for compiling Vue components into the existing Javascript bundle.

This is a cleaned-up version of PR #1246, which was only meant to be an experiment and generate discussion. That PR had a lot of extra commits in it for testing things; this PR has only what is necessary.

Also adds related parts for compiling Vue components
into the existing Javascript bundle.

Signed-off-by: Tucker McKnight <[email protected]>
tucker-m added 2 commits July 3, 2021 17:45
Signed-off-by: Tucker McKnight <[email protected]>
Signed-off-by: Tucker McKnight <[email protected]>
@JonathanTreffler
Copy link

Once this is merged, I can create Pull Requests that implements the stuff from #748. 👍

Copy link
Contributor

@anoymouserver anoymouserver left a comment

Choose a reason for hiding this comment

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

Not sure whether this PR is considered finished, but to my unexperienced eye it seems like the VueComponents.js and *.vue files (for the vue-component occurences) are still missing.

news-scroll-enabled-mark-read="Content.markReadEnabled()"
news-scroll-auto-page="Content.autoPage()"
news-scroll-mark-read="Content.scrollRead(itemIds)"></div>

Copy link
Contributor

Choose a reason for hiding this comment

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

This file seems to be changed accidentally.

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

@SMillerDev
Copy link
Contributor

App build fails with

 [23:52:09] Error in plugin "webpack-stream"
Message:
    Entry module not found: Error: Can't resolve './app/VueComponents' in '/home/runner/work/news/news/js'
resolve './app/VueComponents' in '/home/runner/work/news/news/js'
  using description file: /home/runner/work/news/news/js/package.json (relative path: .)
    Field 'browser' doesn't contain a valid alias configuration
    using description file: /home/runner/work/news/news/js/package.json (relative path: ./app/VueComponents)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /home/runner/work/news/news/js/app/VueComponents doesn't exist
      .wasm
        Field 'browser' doesn't contain a valid alias configuration
        /home/runner/work/news/news/js/app/VueComponents.wasm doesn't exist
      .mjs
        Field 'browser' doesn't contain a valid alias configuration
        /home/runner/work/news/news/js/app/VueComponents.mjs doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /home/runner/work/news/news/js/app/VueComponents.js doesn't exist
      .json
        Field 'browser' doesn't contain a valid alias configuration
        /home/runner/work/news/news/js/app/VueComponents.json doesn't exist
      as directory
        /home/runner/work/news/news/js/app/VueComponents doesn't exist
Details:
    domainEmitter: [object Object]
    domainThrown: false

Fixes the problem of the vue components directory not
existing. Also removed the demo components that were
not meant to be committed.

Signed-off-by: Tucker McKnight <[email protected]>
PHP is not parsing the Vue components, so use Nextcloud's
t() Javascript function instead. This commit adds t() as a
global variable on the AppController so that it can be
passed into components.

Also move vue-loader and vue-template-compiler to devDependencies
in package.json.

Signed-off-by: Tucker McKnight <[email protected]>
@codecov-commenter
Copy link

Codecov Report

Merging #1421 (1f74993) into master (5232f1c) will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1421      +/-   ##
============================================
+ Coverage     91.93%   91.94%   +0.01%     
  Complexity      759      759              
============================================
  Files            64       64              
  Lines          2776     2769       -7     
============================================
- Hits           2552     2546       -6     
+ Misses          224      223       -1     
Impacted Files Coverage Δ
lib/Service/FeedServiceV2.php 100.00% <0.00%> (ø)
lib/Command/Debug/ItemList.php 100.00% <0.00%> (ø)
lib/Command/Debug/FeedItemList.php 100.00% <0.00%> (ø)
lib/Command/Debug/FolderItemList.php 100.00% <0.00%> (ø)
lib/Fetcher/FeedFetcher.php 89.11% <0.00%> (+0.44%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5232f1c...1f74993. Read the comment docs.

Copy link
Contributor

@SMillerDev SMillerDev left a comment

Choose a reason for hiding this comment

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

Looks fine to me now, build works and no PHP code.

@Grotax Grotax requested a review from JonathanTreffler July 12, 2021 09:47
@Grotax Grotax added frontend impact Javascript/Frontend code enhancement labels Jul 12, 2021
@tucker-m
Copy link
Contributor Author

Thanks for looking at it, @SMillerDev and @anoymouserver! I should have marked this as a draft, as I pushed it up before I really tested it thoroughly. But it's ready to go now, unless someone has any other concerns. Thanks for catching the PHP code in the Vue template. I added Nextcloud's t function for client-side translations as a global variable in the AppController, so it can be passed into any Vue components that need it.

I'm writing up a Vue component readme that describes how to add more Vue components now. I'm also documenting how to write and run Vue component tests. I'll submit that in a separate PR so that this one can be merged sooner.

@Grotax Grotax merged commit 36d304e into nextcloud:master Jul 19, 2021
@tucker-m tucker-m deleted the ng-vue branch July 22, 2021 04:48
Grotax added a commit that referenced this pull request Jul 24, 2021
Changed
- Added vue and ng-vue packages (#1421)
- Reimplemented relative time formatting as a filter (#1450)
- Added new `news:updater:update-user` command to update the feeds of a single user (#1360).

Signed-off-by: Benjamin Brahmer <[email protected]>
@Grotax Grotax mentioned this pull request Jul 24, 2021
@Grotax
Copy link
Member

Grotax commented Aug 16, 2021

@tucker-m would you be able take a look into this to get it into a working state?

I checked it myself but don't understand much, if you don't have time anymore I would start to revert the changes.

@tucker-m
Copy link
Contributor Author

Hi @Grotax, @SMillerDev, and @JonathanTreffler, sorry for my absence on this issue. I was away for a while, and then managed to lose my two-factor authentication device, locking myself out of my Github account 🤦 so I didn't see the conversation here. Just got back into my account, and am looking over things now.

I think I managed to reproduce the error that was happening earlier. It seems to be because of mismatched versions between the vue loader and template compiler. I'll get back to this with a fix.

@tucker-m
Copy link
Contributor Author

Just posting an update. I'm still thinking that this is something that dependabot broke. I don't get any errors if I lock the version numbers to what they originally were. I have a new commit here: tucker-m@169936e. I'll keep testing to make sure that there are no compilation problems or runtime errors.

@anoymouserver
Copy link
Contributor

Maybe #1456 which was the only one updating one of the dependencies to its next major version.

@SMillerDev
Copy link
Contributor

It might be that dependabot broke it, but we don't want to stay on old unsupported versions of software so we'll have to find a way to work with never versions too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement frontend impact Javascript/Frontend code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants