Skip to content

Conversation

@kinow
Copy link
Member

@kinow kinow commented Jan 14, 2023

GitHub issue resolved #1719

Pull request Description:

Moving from webpack to Vite for faster build, simpler configuration, faster dev server, and build.

Good refs:

Time on main:

build: 35 seconds
test:unit 9 seconds 
test:e2e 57 seconds
coverage:unit 9 seconds
coverage:e2e 60 seconds
lint 4 seconds
serve (same as dev in vite branch) 18 seconds
mvn clean test in the UI project: 01:41 min
mvn -Pdev clean install  06:23 min (shortest of 2 runs)

Time after this change:

build 15-20 seconds
test:unit 4-5 seconds
test:e2e 40-45 seconds
coverage:unit 7 seconds
coverage:e2e 42-55 seconds
lint 2 seconds
dev 1 second
mvn clean test in the UI project: 01:16 min
mvn -Pdev clean install  05:52 min (shortest of 2 runs)

No extra tests to include. I did some manual testing from Eclipse with the code generated with Vite, and ran several times the commands. Cypress has been updated from 10 to 12. Maybe that brittle test has been fixed too 🤞


  • Tests are included.
  • Documentation change and updates are provided for the Apache Jena website
  • Commits have been squashed to remove intermediate development commit messages.
  • Key commit messages start with the issue number (GH-xxxx or JENA-xxxx)

By submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the Contributor's Agreement.


See the Apache Jena "Contributing" guide.

"@vue/cli-plugin-eslint": "~5.0.8",
"@vue/cli-plugin-unit-mocha": "~5.0.8",
"@vue/cli-service": "~5.0.8",
"@vitejs/plugin-vue": "^4.0.0",
Copy link
Member Author

Choose a reason for hiding this comment

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

Less dependencies as Vite does many of what these other tools do (and has been adopted by devs doing Vue, React, Angular, ThreeJS, so now it's stable and future-prone too 🤞 )

import Menu from '@/components/dataset/Menu.vue'
import FileUpload from 'vue-upload-component'
import JenaTable from '@/components/dataset/JenaTable'
import JenaTable from '@/components/dataset/JenaTable.vue'
Copy link
Member Author

@kinow kinow Jan 15, 2023

Choose a reason for hiding this comment

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

Vite does not handle the extension of imports. So we need to specify it.

"sass-loader": "^13.0.2",
"sinon": "^14.0.0",
"vite": "^4.0.4",
"vitest": "^0.27.1",
Copy link
Member Author

Choose a reason for hiding this comment

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

"express": "^4.18.1",
"istanbul-instrumenter-loader": "^3.0.1",
"istanbul-lib-coverage": "^3.2.0",
"jsdom": "^21.0.0",
Copy link
Member Author

Choose a reason for hiding this comment

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

For vitest/tests.

"@vue/eslint-config-standard": "^8.0.1",
"@vue/test-utils": "^2.0.2",
"babel-plugin-istanbul": "^6.1.1",
"chai": "^4.3.6",
Copy link
Member Author

Choose a reason for hiding this comment

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

Vitest has assertions. No need for chai anymore.

},
"devDependencies": {
"@babel/eslint-parser": "^7.19.1",
"@babel/register": "^7.18.9",
Copy link
Member Author

@kinow kinow Jan 15, 2023

Choose a reason for hiding this comment

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

I think it should be fine dropping support to older browsers (IE, older Ffox, Chrome... Ffox and Chrome have supported newer JS for years now, nobody should be using IE... this reduces our build time & size - makes UI/JS development a lot easier too).

@kinow
Copy link
Member Author

kinow commented Jan 15, 2023

#TIL Vitest includes coverage, and it appears to be a lot faster than vue-test-utils+chai+nyc:

image

The coverage metrics also appear to be more useful as it includes more levels of coverage (not sure if we needed to configure that in nyc).

@kinow kinow force-pushed the use-vite branch 2 times, most recently from 27169ec to d250c0f Compare January 15, 2023 18:31
@afs
Copy link
Member

afs commented Jan 15, 2023

Do you want to create an issue for this? (which can be auto-closed by the PR).

An issue is a little more findable and can pull together several work items if necessary.

@kinow
Copy link
Member Author

kinow commented Jan 15, 2023

Do you want to create an issue for this? (which can be auto-closed by the PR).

An issue is a little more findable and can pull together several work items if necessary.

Sure thing. Consider it done. What about jena-site? Should we have an issue for each PR there too?

@kinow kinow force-pushed the use-vite branch 2 times, most recently from 4deac5e to a1482e3 Compare January 15, 2023 21:54
@afs
Copy link
Member

afs commented Jan 15, 2023

We haven't been using issues for the site. They aren't enabled. This lighter weight process has been OK for contributions as far as I can see.

The code issues for the release description.

@kinow
Copy link
Member Author

kinow commented Jan 15, 2023

Work is all done, and apparently Fuseki UI is running with no major problems. I'm having a problem to dynamically control the coverage in e2e tests, but no other issues. Just pending to do some tests with Fuseki servlets, and get the numbers from main with webpack to compare 👍 should be ready for review in the next day(s).

@kinow kinow marked this pull request as ready for review January 16, 2023 22:54
@kinow kinow changed the title Move from webpack to Vite [GH-1719]: Move from webpack to Vite Jan 16, 2023
@kinow
Copy link
Member Author

kinow commented Jan 16, 2023

Done. Build should be a bit faster now 👍

@kinow kinow mentioned this pull request Jan 16, 2023
26 tasks
@kinow kinow requested a review from afs January 22, 2023 14:25
@afs
Copy link
Member

afs commented Jan 23, 2023

It's faster!

I get the old error after 2 clean runs - with more information about where:

First:

[INFO] [TESTS]   0 passing (31s)
[INFO] [TESTS]   4 failing
[INFO] [TESTS] 
[INFO] [TESTS]   1) datasets
[INFO] [TESTS]        Visits datasets page, also the application landing-page:
[INFO] [TESTS]      CypressError: `cy.visit()` failed trying to load:
[INFO] [TESTS] 
[INFO] [TESTS] http://localhost:8080/
[INFO] [TESTS] 
[INFO] [TESTS] We attempted to make an http request to this URL but the request failed without a response.
[INFO] [TESTS] 
[INFO] [TESTS] We received this error at the network level:
[INFO] [TESTS] 
[INFO] [TESTS]   > Error: ESOCKETTIMEDOUT
[INFO] [TESTS] 
[INFO] [TESTS] Common situations why this would fail:
[INFO] [TESTS]   - you don't have internet access
[INFO] [TESTS]   - you forgot to run / boot your web server
[INFO] [TESTS]   - your web server isn't accessible
[INFO] [TESTS]   - you have weird network configuration settings on your computer
...
[INFO] [TESTS]        Spec                                              Tests  Passing  Failing  Pending  Skipped  
[INFO] [TESTS]   ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
[INFO] [TESTS]   │ ✖  datasets.cy.js                           00:30        9        -        3        -        6 │
[INFO] [TESTS]   ├────────────────────────────────────────────────────────────────────────────────────────────────┤
[INFO] [TESTS]   │ ✖  query.cy.js                              00:15        2        -        1        -        1 │
[INFO] [TESTS]   └────────────────────────────────────────────────────────────────────────────────────────────────┘
[INFO] [TESTS]     ✖  2 of 2 failed (100%)                     00:45       11        -        4        -        7  

@kinow
Copy link
Member Author

kinow commented Jan 23, 2023

It's faster!

Hooray! And we will have less direct dependencies to worry (not sure about number of transitive deps).

I get the old error after 2 clean runs - with more information about where:

Hmmmm... I wonder if the tests are running before the fake Fuseki is up and serving. I think I can simulate a very slow startup to confirm if the Cypress process is waiting on the fake Fuseki (json-server) to start up. A good result of updating the version of Cypress, I guess.

Thanks @afs!

Merging.

@kinow kinow merged commit b1fc7bf into apache:main Jan 23, 2023
@kinow kinow deleted the use-vite branch January 23, 2023 22:27
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.

Migrate UI from Webpack to Vite

2 participants