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

feat: Add in option to use Vite #3191

Merged
merged 35 commits into from
Sep 13, 2024

Conversation

nicholas-codecov
Copy link
Contributor

@nicholas-codecov nicholas-codecov commented Sep 12, 2024

Description

This PR adds in Vite to Gazebo, and allows you to use it at the same time as our current CRACO setup. This is so we can continue using CRACO for our production builds, and testing until we have everything fully moved over and feel comfortable with Vite.

To use Vite locally for development you can use the yarn build:vite command. As a workaround to how Vite handles icons differently whenever you run a command that is Vite related it will generate new icon index.jsx files. You can remove these by either running any of the base CRACO commands OR running yarn generate-icons:webpack. Once we have fully transitioned over this requirement will be removed.

Another thing to note down is the way that Vite loads in .env files. We currently use .env.local for private environment variables, however Vite will override these values with the ones located in .env.development to resolve this issue, copy your .env.local and rename it to .env.development.local.

Notable Changes

  • Missing coverage is related to the new icons being added
  • Introduce Vite
  • Tidying up some messed up TS config things (Vite types, and fixing up some global types)
  • Add in scripts to generate icons for Vite and/or Webpack depending on the command you execute
    • Do not commit the Vite icons
  • Couple of optimizations raised by Vite
  • Couple of TS errors that have been fixed that weren't being picked up for some reason
  • Rename a test file from *.test.* to *.spec.*

@nicholas-codecov nicholas-codecov force-pushed the gh-eng-2125-add-in-ability-to-use-vite branch from dbcc580 to 47afd30 Compare September 12, 2024 14:26
@codecov-staging
Copy link

codecov-staging bot commented Sep 12, 2024

Bundle Report

Changes will increase total bundle size by 1.3kB ⬆️

Bundle name Size Change
gazebo-staging-array-push 6.0MB 1.3kB ⬆️

@codecov-qa
Copy link

codecov-qa bot commented Sep 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.11%. Comparing base (2610df1) to head (6e68fb1).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3191      +/-   ##
==========================================
- Coverage   98.14%   98.11%   -0.04%     
==========================================
  Files         935      936       +1     
  Lines       14510    14513       +3     
  Branches     3941     3886      -55     
==========================================
- Hits        14241    14239       -2     
- Misses        264      269       +5     
  Partials        5        5              
Files with missing lines Coverage Δ
src/pages/AccountSettings/tabs/YAML/YAML.jsx 100.00% <100.00%> (ø)
...ndlesTab/BundleContent/AssetsTable/AssetsTable.tsx 100.00% <ø> (ø)
...undlesTab/BundleContent/AssetsTable/EmptyTable.tsx 100.00% <100.00%> (ø)
...epoPage/BundlesTab/BundleContent/BundleContent.tsx 100.00% <ø> (ø)
src/pages/RepoPage/RepoPage.tsx 100.00% <100.00%> (ø)
src/services/toastNotification/context.jsx 100.00% <ø> (ø)
src/ui/Alert/Alert.tsx 100.00% <100.00%> (ø)

... and 8 files with indirect coverage changes

Components Coverage Δ
Assets 53.48% <ø> (ø)
Layouts 98.87% <ø> (ø)
Pages 98.84% <100.00%> (-0.01%) ⬇️
Services 99.41% <ø> (-0.04%) ⬇️
Shared 99.64% <ø> (+0.14%) ⬆️
UI 94.56% <100.00%> (-0.11%) ⬇️

Continue to review full report in Codecov by Sentry.

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

Copy link

codecov-public-qa bot commented Sep 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.11%. Comparing base (2610df1) to head (6e68fb1).

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3191      +/-   ##
==========================================
- Coverage   98.14%   98.11%   -0.04%     
==========================================
  Files         935      936       +1     
  Lines       14510    14513       +3     
  Branches     3886     3973      +87     
==========================================
- Hits        14241    14239       -2     
- Misses        264      269       +5     
  Partials        5        5              
Files Coverage Δ
src/pages/AccountSettings/tabs/YAML/YAML.jsx 100.00% <100.00%> (ø)
...ndlesTab/BundleContent/AssetsTable/AssetsTable.tsx 100.00% <ø> (ø)
...undlesTab/BundleContent/AssetsTable/EmptyTable.tsx 100.00% <100.00%> (ø)
...epoPage/BundlesTab/BundleContent/BundleContent.tsx 100.00% <ø> (ø)
src/pages/RepoPage/RepoPage.tsx 100.00% <100.00%> (ø)
src/services/toastNotification/context.jsx 100.00% <ø> (ø)
src/ui/Alert/Alert.tsx 100.00% <100.00%> (ø)

... and 8 files with indirect coverage changes

Components Coverage Δ
Assets 53.48% <ø> (ø)
Layouts 98.87% <ø> (ø)
Pages 98.84% <100.00%> (-0.01%) ⬇️
Services 99.41% <ø> (-0.04%) ⬇️
Shared 99.64% <ø> (+0.14%) ⬆️
UI 94.56% <100.00%> (-0.11%) ⬇️

Continue to review full report in Codecov by Sentry.

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

@codecov-notifications
Copy link

codecov-notifications bot commented Sep 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3191      +/-   ##
==========================================
- Coverage   98.14%   98.11%   -0.04%     
==========================================
  Files         935      936       +1     
  Lines       14510    14513       +3     
  Branches     3968     3886      -82     
==========================================
- Hits        14241    14239       -2     
- Misses        264      269       +5     
  Partials        5        5              
Files Coverage Δ
src/pages/AccountSettings/tabs/YAML/YAML.jsx 100.00% <100.00%> (ø)
...ndlesTab/BundleContent/AssetsTable/AssetsTable.tsx 100.00% <ø> (ø)
...undlesTab/BundleContent/AssetsTable/EmptyTable.tsx 100.00% <100.00%> (ø)
...epoPage/BundlesTab/BundleContent/BundleContent.tsx 100.00% <ø> (ø)
src/pages/RepoPage/RepoPage.tsx 100.00% <100.00%> (ø)
src/services/toastNotification/context.jsx 100.00% <ø> (ø)
src/ui/Alert/Alert.tsx 100.00% <100.00%> (ø)

... and 8 files with indirect coverage changes

Components Coverage Δ
Assets 53.48% <ø> (ø)
Layouts 98.87% <ø> (ø)
Pages 98.84% <100.00%> (-0.01%) ⬇️
Services 99.41% <ø> (-0.04%) ⬇️
Shared 99.64% <ø> (+0.14%) ⬆️
UI 94.56% <100.00%> (-0.11%) ⬇️

Continue to review full report in Codecov by Sentry.

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

Copy link

codecov bot commented Sep 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.11%. Comparing base (2610df1) to head (6e68fb1).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff                @@
##               main      #3191        +/-   ##
================================================
- Coverage   98.14000   98.11000   -0.03000     
================================================
  Files           935        936         +1     
  Lines         14510      14513         +3     
  Branches       3968       3941        -27     
================================================
- Hits          14241      14239         -2     
- Misses          264        269         +5     
  Partials          5          5                
Files with missing lines Coverage Δ
src/pages/AccountSettings/tabs/YAML/YAML.jsx 100.00% <100.00%> (ø)
...ndlesTab/BundleContent/AssetsTable/AssetsTable.tsx 100.00% <ø> (ø)
...undlesTab/BundleContent/AssetsTable/EmptyTable.tsx 100.00% <100.00%> (ø)
...epoPage/BundlesTab/BundleContent/BundleContent.tsx 100.00% <ø> (ø)
src/pages/RepoPage/RepoPage.tsx 100.00% <100.00%> (ø)
src/services/toastNotification/context.jsx 100.00% <ø> (ø)
src/ui/Alert/Alert.tsx 100.00% <100.00%> (ø)

... and 8 files with indirect coverage changes

Components Coverage Δ
Assets 53.48% <ø> (ø)
Layouts 98.87% <ø> (ø)
Pages 98.84% <100.00%> (-0.01%) ⬇️
Services 99.41% <ø> (-0.04%) ⬇️
Shared 99.64% <ø> (+0.14%) ⬆️
UI 94.56% <100.00%> (-0.11%) ⬇️

Continue to review full report in Codecov by Sentry.

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

Copy link

codecov bot commented Sep 12, 2024

Bundle Report

Changes will increase total bundle size by 1.3kB (0.02%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-array-push 6.0MB 1.3kB ⬆️

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Sep 12, 2024

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
47afd30 Thu, 12 Sep 2024 14:35:33 GMT Expired Expired
c59b86f Thu, 12 Sep 2024 16:56:09 GMT Expired Expired
96b8cc4 Thu, 12 Sep 2024 17:42:59 GMT Expired Expired
96b8cc4 Thu, 12 Sep 2024 17:48:29 GMT Expired Expired
c7e6168 Thu, 12 Sep 2024 18:06:34 GMT Expired Expired
6e68fb1 Fri, 13 Sep 2024 10:36:23 GMT Expired Expired
6e68fb1 Fri, 13 Sep 2024 10:41:04 GMT Cloud Enterprise

@nicholas-codecov nicholas-codecov marked this pull request as ready for review September 12, 2024 16:58
README.md Outdated

`.env.local`

```
PROXY_TO=https://stage-api.codecov.dev
REACT_APP_MY_CUSTOM_VAR=foobar
REACT_APP_BASE_URL=http://localhost
REACT_APPMY_CUSTOM_VAR=foobar
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this a thing lol

Copy link
Contributor Author

@nicholas-codecov nicholas-codecov Sep 12, 2024

Choose a reason for hiding this comment

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

whoops typo

@@ -0,0 +1,67 @@
export const enabledIcons = [
'flag',
Copy link
Contributor

Choose a reason for hiding this comment

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

can we alphabetize this list?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank you co-pilot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I spent like 10mins trying to figure out why I had one less line when I used it to alphabetize it, turns out we had two branch's

@@ -86,15 +86,16 @@ describe('Alert', () => {

describe('Custom Icons', () => {
const alert = (
<Alert variant={AlertOptions.INFO} customIconName="sparkles">
<Alert variant={AlertOptions.INFO} customIconName="speakerphone">
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems a little random lol

Copy link
Contributor Author

@nicholas-codecov nicholas-codecov Sep 12, 2024

Choose a reason for hiding this comment

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

TS was failing to build with Vite, sparkles doesn't appear to be a valid icon name, not sure how it was happy before.

const tableRoles = await screen.findAllByRole('row')
expect(tableRoles).toHaveLength(2)

const tableCells = await within(tableRoles[1]!).findAllByRole('cell')
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay I needed within in my life and didn't even know it thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is super useful

import svgr from 'vite-plugin-svgr'

export default defineConfig((config) => {
const env = loadEnv(config.mode, process.cwd(), 'REACT_APP')
Copy link
Contributor

Choose a reason for hiding this comment

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

couldn't we do REACT_APP_ 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.

Either or doesn't matter

Copy link
Contributor

@spalmurray-codecov spalmurray-codecov left a comment

Choose a reason for hiding this comment

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

Looks good! Am excited to try this.

.gitignore Outdated
@@ -55,3 +55,8 @@ codecov
# VSCode
.vscode

# ignore icon index files as they're genreated when executing
src/old_ui/Icon/svg/index.jsx
Copy link
Contributor

@spalmurray-codecov spalmurray-codecov Sep 12, 2024

Choose a reason for hiding this comment

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

Does this have any effect on enabling new icons?

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 didn't actually work, i should take this out

@nicholas-codecov nicholas-codecov added this pull request to the merge queue Sep 13, 2024
Merged via the queue into main with commit 36cb00a Sep 13, 2024
58 of 62 checks passed
@nicholas-codecov nicholas-codecov deleted the gh-eng-2125-add-in-ability-to-use-vite branch September 13, 2024 10:46
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.

4 participants