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

Switch from vue-cli to vite #1026

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Switch from vue-cli to vite #1026

wants to merge 9 commits into from

Conversation

BenjaminCharmes
Copy link
Contributor

@BenjaminCharmes BenjaminCharmes commented Dec 2, 2024

Closes #1005

First attempt to switch from vue-cli to vite and a few things to discuss:

  • I had to use cryptojs instead of crypto (MD5(value).toString(); instead of crypto.createHash("md5").update(value).digest("hex");)

  • I had to use import.meta.env.BASE_URL instead of process.env.BASE_URL

  • I remove .browserslistrc and babel.config.js, not useful with vite ?

  • vite 6.x.x not supported by cypress ? (warning message)

  • In vite.config.js, I use extensions: [".vue", ".js", ".json"] to not rename all the imports in all the files, but it could be better to take the time to do it ? (e.g. import Navbar from "@/components/Navbar"; to import Navbar from "@/components/Navbar.vue";

  • Had to rename env variables from VUE_ to VITE_ to make it work without having to import all of them. Should we keep it that way (and also rename them where ever it's needed, e.g. github?) or just import them in the vite.config.js ?

To do:

  • Rewrite the scripts in package.json ?
  • Need to fix Bokeh.
    Just need to downgrade to Bokeh 2.4.0
  • import "tinymce/plugins/hr"; not working
    Downgrade tinymce to v5
  • Fix docker -> Fix cypress e2e test in github workflow

Copy link

codecov bot commented Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.04%. Comparing base (7e63cdd) to head (d8f1254).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1026   +/-   ##
=======================================
  Coverage   70.04%   70.04%           
=======================================
  Files          62       62           
  Lines        3996     3996           
=======================================
  Hits         2799     2799           
  Misses       1197     1197           

@BenjaminCharmes BenjaminCharmes added enhancement New feature or request webapp For issues/PRs pertaining to the web interface labels Dec 2, 2024
@BenjaminCharmes BenjaminCharmes added the build For issues/PRs pertaining to the build or deployment of the package label Dec 10, 2024
@BenjaminCharmes BenjaminCharmes force-pushed the bc/switch-to-vite branch 2 times, most recently from da60bee to 5a7a0d7 Compare December 16, 2024 10:44
First attempt to switch from vue-cli to vite

Remove a 'process' that I missed

Fix a few thing to make vite work

Fix a few thing to make vite work

Fix a few thing to make vite work

Downgrade Bokeh to 2.4.0

Downgrade tinymce to v5

Temp commit

Update yarn build with vite

Update yarn build with vite

Update yarn build with vite

Update yarn build with vite

Update docker build for vite

Add serve into package.json

Update env variable fron VUE_ to VITE_
Copy link
Member

@ml-evs ml-evs left a comment

Choose a reason for hiding this comment

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

Comments for myself:

  • check docker build version info with vite
  • think about migrating env vars too

Copy link
Member

@ml-evs ml-evs left a comment

Choose a reason for hiding this comment

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

Thanks @BenjaminCharmes, great to remove 4000 lines from our lockfile, though we might need to review some of the deps upgrades carefully to make sure they still work. Some initial comments below

webapp/package.json Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@@ -1,10 +1,10 @@
import { createStore } from "vuex";
import UserBubbleLogin from "@/components/UserBubbleLogin.vue";
import NotificationDot from "@/components/NotificationDot.vue";
import crypto from "crypto";
import MD5 from "crypto-js/md5";
Copy link
Member

Choose a reason for hiding this comment

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

Think we need to be careful here too, I had a lot of fun getting the crypto-browserify stuff to work recently. The crypto-js library itself is deprecated (see README here: https://www.npmjs.com/package/crypto-js) -- we may need another solution

webapp/index.html Outdated Show resolved Hide resolved
"serve": "^14.2.1",
"qrcode-vue3": "^1.7.1",
"redis": "^4.7.0",
"serve": "^14.2.4",
"stream-browserify": "^3.0.0",
Copy link
Member

Choose a reason for hiding this comment

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

We may not need stream-browserify anymore

Comment on lines -37 to -39
args[0].meta = {
x_datalab_api_url: process.env.VUE_APP_API_URL,
};
Copy link
Member

Choose a reason for hiding this comment

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

This is used by the client code quite a lot, we should make sure that the equivalent is done with vite too (I couldn't see it above), should be doable in the same way as the website title

Copy link

cypress bot commented Jan 11, 2025

datalab    Run #2890

Run Properties:  status check errored Errored #2890  •  git commit db47357ce4 ℹ️: Merge d8f1254aad43c50b08118e4365879ba87a4c9433 into 7e63cdd881e18e08c30fff6e1332...
Project datalab
Branch Review bc/switch-to-vite
Run status status check errored Errored #2890
Run duration 02m 01s
Commit git commit db47357ce4 ℹ️: Merge d8f1254aad43c50b08118e4365879ba87a4c9433 into 7e63cdd881e18e08c30fff6e1332...
Committer Ben Charmes
View all properties for this run ↗︎

Test results
Tests that failed  Failures 15
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 0
View all changes introduced in this branch ↗︎

Copy link
Member

@ml-evs ml-evs left a comment

Choose a reason for hiding this comment

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

Two things left:

  • fix whatever is going on with cypress/support/e2e.js (maybe just try removing it)
  • at some point, update our package.json so that it launches the dev server for you before running tests, as vue-cli did

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build For issues/PRs pertaining to the build or deployment of the package enhancement New feature or request webapp For issues/PRs pertaining to the web interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch our webapp build tool from vue-cli to vite
2 participants