Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

billy peng ui extract #822

Merged
merged 40 commits into from
Jun 26, 2018
Merged

billy peng ui extract #822

merged 40 commits into from
Jun 26, 2018

Conversation

okwme
Copy link
Contributor

@okwme okwme commented Jun 13, 2018

Closes #820

Description: Replaces Ni components w Tm

@okwme
Copy link
Contributor Author

okwme commented Jun 14, 2018

ok so i got voyager to run w the component library by going into node_modules/vue-loader and running yarn. This shouldn't be necessary of course, but might have something to do with this:
vuejs/vue-loader#678
also as can be seen in the circle ci test it's a babel issue not understanding "import". I found a similar babel issue here:
babel/babel-loader#149

@okwme
Copy link
Contributor Author

okwme commented Jun 14, 2018

wait now this branch it's working as expected after rm -r node_modules && yarn
might have been the naming corrections i made on tendermint/ui

circle is still failing of course : \

@faboweb
Copy link
Collaborator

faboweb commented Jun 18, 2018

I guess that Babel is not correctly applied to the imported components.

@nylira
Copy link
Contributor

nylira commented Jun 19, 2018

@faboweb On second thought: it would be nice if our unit tests supported ES6 Modules -- it's a far better development cycle with yarn link. Instead of having to build the components package after every edit, we can just save the component and wait for live reload.

@nylira
Copy link
Contributor

nylira commented Jun 19, 2018

I spent time trying to fix the tests here and on tendermint/ui, without much progress. The fact that Babel is transitioning to version 7, Vue is transitioning to version 3, and Jest is falling behind [1] is making this extra difficult. There's a complex dependency chain filled with incompatibilities, and CircleCI throws another wrench into the gears.

An option we can look into in the near future is dropping Babel. We can start using ES modules in Electron already, with things like this [2][3]

[1] jestjs/jest#4842
[2] https://gist.github.com/smotaal/f1e6dbb5c0420bfd585874bd29f11c43
[3] https://cli.vuejs.org/guide/browser-compatibility.html#modern-mode

@nylira
Copy link
Contributor

nylira commented Jun 19, 2018

I'm getting errors like this with yarn testnet:

         ERROR in ../ui/src/components/TmPageHeader/TmPageHeader.vue
         Module not found: Error: Can't resolve 'vue-loader/node_modules/vue-style-loader' in '/Users/pz/Projects/ui/src/components/TmPageHeader'
          @ ../ui/src/components/TmPageHeader/TmPageHeader.vue 4:2-326
          @ ../ui/src/index.js
          @ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./app/src/renderer/components/wallet/PageWallet.vue
          @ ./app/src/renderer/components/wallet/PageWallet.vue
          @ ./app/src/renderer/components ^\.\/.*$
          @ ./app/src/renderer/routes.js
          @ ./app/src/renderer/main.js
          @ multi (webpack)-dev-server/client?http://localhost:9080 webpack/hot/dev-server ./app/src/renderer/main.js

         ERROR in ../ui/src/components/TmPart/TmPart.vue
         Module not found: Error: Can't resolve 'vue-loader/node_modules/vue-style-loader' in '/Users/pz/Projects/ui/src/components/TmPart'
          @ ../ui/src/components/TmPart/TmPart.vue 4:2-320
          @ ../ui/src/index.js
          @ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./app/src/renderer/components/wallet/PageWallet.vue
          @ ./app/src/renderer/components/wallet/PageWallet.vue
          @ ./app/src/renderer/components ^\.\/.*$
          @ ./app/src/renderer/routes.js
          @ ./app/src/renderer/main.js
          @ multi (webpack)-dev-server/client?http://localhost:9080 webpack/hot/dev-server ./app/src/renderer/main.js

UPDATE: These errors because webpack doesn't work properly for yarn link or symlinked modules webpack/webpack#811

@nylira
Copy link
Contributor

nylira commented Jun 19, 2018

I used module.exports in the index.js of https://github.com/nylira/vue-field and we've been using vue-field without problems for a long time. I wonder if we can solve a lot of these issues by not ES6 modules in https://github.com/tendermint/ui/blob/develop/src/index.js

@@ -118,7 +118,7 @@ export default {
}
</script>
<style lang="stylus">
.ni-form-group
.tm-tm-form-group
Copy link
Collaborator

Choose a reason for hiding this comment

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

tm-tm?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice catch! 😄

@@ -0,0 +1,31 @@
<template lang="pug">
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the VrToolBar?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Vr = Voyager got it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🚀

@faboweb
Copy link
Collaborator

faboweb commented Jun 22, 2018

This looks pretty decent. Awesome work @okwme and @nylira . What is the status of this PR? What is missing?

@okwme
Copy link
Contributor Author

okwme commented Jun 22, 2018

@faboweb still need to improve code coverage, although there's not really any new code besides VrToolBar. Actually maybe removing code damaged the coverage report as the missing governance tests now have a larger effect?

I think we need to figure out a system for deciding what goes into the ui library. There are a lot more common components but they're not being used outside of voyager atm. Should they be included in the library? in the PR? if they stay in voyager should we rename them all to Tm prefix? Vr? I did a search and replace on ni- -> tm- to fix inherited style changes, not sure if there are other implications that need to be considered.

Also still need to get them published on npmjs.com, i'm not sure how that permission works. @nylira you have access right? will future updates always need to go through you or should we automate it somehow? I hate seeing npm packages that are behind their project repos...

@nylira
Copy link
Contributor

nylira commented Jun 22, 2018

99% of this PR was due to @okwme awesome efforts. Great job.

I'd suggest renaming Vr modules to Tm just to keep everything under the same namespace. We can keep single-use Tm components in Voyager for now, but as we continue to build front end projects we'll likely reuse them--and that's when we can move them out from this repo.

If it's simple, I propose removing governance components from the coverage report. We're not working on governance yet. (We will be soon, as first version of governance is coming into the SDK).

I have access to deploying new modules to the tendermint npm organization. I can give you access too, @okwme. But you need to enable 2FA on your NPM account first. Let me know. I don't know if we can automate publishing because every publish requires you to enter your OTP. How do we give our CI the OTP without compromising security?

@okwme
Copy link
Contributor Author

okwme commented Jun 25, 2018

  • renamed Vr as well as the remaining Ni prefixed components
  • removed governance from the coverage report
  • merged/resolved everything from develop

@nylira I've added 2FA to my npmjs.com account, my username is okwme. Happy to publish tendermint/tm and edit this pr to pull directly from the npm repo.

As for automating w CI I think you're probably right and it's not worth it for the security concern. Maybe instead we just add a git hook to check for the version number and give a reminder to npm version patch and npm publish?

@okwme okwme changed the title WIP: billy peng ui extract billy peng ui extract Jun 26, 2018
@@ -0,0 +1,1459 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is there this genesis.json now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not entirely sure where that came from. I replaced my genesis.json with the one you sent me last week. Does this one not match that one?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The location is odd, as genesis.json usually belongs in a folder for a network.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

aha, maybe i had some sloppy drag and drop happening! * removing *

TmToolBar
},
mounted() {
// console.log(TmToolBar)
Copy link
Collaborator

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This used to be called VrToolBar and it extended @tendermint/ui/TmToolBar because all voyager pages have those three slots in common. After the last review from @peng he suggested we name all the components Tm but made the names different withiin the component (tm-tool-bar versus vm-tool-bar) so that they would render without recursion.

it("has the expected html structure", async () => {
await wrapper.vm.$nextTick()
wrapper.update()
// console.log(wrapper.vm.$el)
Copy link
Collaborator

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

$nextTick is added for the scrollbar plugin

@@ -17,7 +17,9 @@ describe("PagePreferences", () => {
})
})

it("has the expected html structure if connected", () => {
it("has the expected html structure if connected", async () => {
await wrapper.vm.$nextTick()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need this here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

$nextTick is added for the scrollbar plugin

@@ -40,7 +40,9 @@ describe("PageBlock", () => {
wrapper.update()
})

it("has the expected html structure", () => {
it("has the expected html structure", async () => {
await wrapper.vm.$nextTick()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need this here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

$nextTick is added for the scrollbar plugin

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you maybe add comments describing this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In general the timing of component rendering, and the need for a lot of wrapper.updates() occurred after moving the components into an external library that had to be explicitly included into babel during the jest tests.

@faboweb
Copy link
Collaborator

faboweb commented Jun 26, 2018

Awesome! :)

@okwme
Copy link
Contributor Author

okwme commented Jun 26, 2018

e2e tests failed but pass for me locally 😢
trying again...

@okwme okwme merged commit be57bde into develop Jun 26, 2018
@okwme okwme deleted the billy-peng/820-ui-extract branch June 26, 2018 14:52
faboweb pushed a commit that referenced this pull request Jun 2, 2020
* quick fix for governance fees

* changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants