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

Migrate to vite and vitest #862

Merged
merged 11 commits into from
Jan 27, 2023

Conversation

vkozio
Copy link
Contributor

@vkozio vkozio commented Jan 18, 2023

Part of #836

Build: vite build implemented for

  • examples/advanced
  • modules/*

Testing: jest migrated to vitest
Coverage by @vitest/coverage-c8

React 17, added related peerdeps

Feedback is welcome

@vkozio vkozio changed the title 13709-migrate-nebula-to-vite-and-vitest Migrate to vite and vitest Jan 18, 2023
examples/advanced/vite.config.ts Outdated Show resolved Hide resolved
examples/vite.config.local.ts Outdated Show resolved Hide resolved
@@ -1,9 +0,0 @@
require('core-js/stable');

module.exports = {
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 this removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because jest replaced by vitest


exports[`three clicks + pointer move tooltip contains angle 1`] = `
Array [
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 this changing? Some jest version upgrade? Can this be handled in a separate PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Migrated to vitest. It works pretty tight with vite, so it's more productive to test them together

Copy link
Collaborator

@Akiyamka Akiyamka Jan 19, 2023

Choose a reason for hiding this comment

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

vitest it's compatible replacement for jest.
Here is a description of why jest does not work as well with vite as vitest

vitest.config.ts Outdated Show resolved Hide resolved
@vkozio
Copy link
Contributor Author

vkozio commented Jan 18, 2023

@ibgreen thanks a lot for feedback. I've opened draft PR to show basically where we are.
Will be great to hear your opinion concerning what should be implemented in scope of this migration task to move us to release.
Thanks.

@vkozio vkozio marked this pull request as ready for review January 24, 2023 21:36
Copy link
Collaborator

@Akiyamka Akiyamka left a comment

Choose a reason for hiding this comment

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

Error: Failed to resolve entry for package "nebula.gl". The package may have incorrect main/module/exports specified in its package.json

Full log:

╭─akiyamka at fedora in ~/git/temp
╰─○ git clone [email protected]:konturio/nebula.gl.git
Cloning into 'nebula.gl'...
remote: Enumerating objects: 7871, done.
remote: Counting objects: 100% (759/759), done.
remote: Compressing objects: 100% (430/430), done.
remote: Total 7871 (delta 426), reused 584 (delta 325), pack-reused 7112
Receiving objects: 100% (7871/7871), 10.25 MiB | 8.47 MiB/s, done.
Resolving deltas: 100% (5127/5127), done.
╭─akiyamka at fedora in ~/git/temp
╰─○ cd nebula.gl          
╭─akiyamka at fedora in ~/git/temp/nebula.gl on master✔
╰─± git checkout 13709-migrate-nebula-to-vite-and-vitest 
branch '13709-migrate-nebula-to-vite-and-vitest' set up to track 'origin/13709-migrate-nebula-to-vite-and-vitest'.
Switched to a new branch '13709-migrate-nebula-to-vite-and-vitest'
╭─akiyamka at fedora in ~/git/temp/nebula.gl on 13709-migrate-nebula-to-vite-and-vitest✔
╰─± code .
╭─akiyamka at fedora in ~/git/temp/nebula.gl on 13709-migrate-nebula-to-vite-and-vitest✔
╰─± yarn
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > @deck.gl/[email protected]" has unmet peer dependency "@luma.gl/constants@^8.0.0".
warning " > @deck.gl/[email protected]" has unmet peer dependency "@luma.gl/core@^8.0.0".
warning " > @deck.gl/[email protected]" has unmet peer dependency "gl-matrix@^3.0.0".
warning " > @deck.gl/[email protected]" has unmet peer dependency "@loaders.gl/core@^3.0.0".
warning " > @deck.gl/[email protected]" has unmet peer dependency "@luma.gl/core@^8.0.0".
warning "@deck.gl/geo-layers > @loaders.gl/[email protected]" has unmet peer dependency "@loaders.gl/core@^3.2.0".
warning "@deck.gl/geo-layers > @loaders.gl/[email protected]" has unmet peer dependency "@loaders.gl/core@^3.2.0".
warning "@deck.gl/geo-layers > @luma.gl/[email protected]" has unmet peer dependency "@loaders.gl/gltf@^3.0.0".
warning "@deck.gl/geo-layers > @luma.gl/[email protected]" has unmet peer dependency "@loaders.gl/images@^3.0.0".
warning "@deck.gl/geo-layers > @luma.gl/[email protected]" has unmet peer dependency "@luma.gl/engine@^8.4.0".
warning "@deck.gl/geo-layers > @luma.gl/[email protected]" has unmet peer dependency "@luma.gl/gltools@^8.4.0".
warning "@deck.gl/geo-layers > @luma.gl/[email protected]" has unmet peer dependency "@luma.gl/shadertools@^8.4.0".
warning "@deck.gl/geo-layers > @luma.gl/[email protected]" has unmet peer dependency "@luma.gl/webgl@^8.4.0".
warning " > @deck.gl/[email protected]" has unmet peer dependency "@loaders.gl/core@^3.0.0".
warning " > @deck.gl/[email protected]" has unmet peer dependency "@luma.gl/core@^8.0.0".
warning " > @deck.gl/[email protected]" has unmet peer dependency "@luma.gl/core@^8.0.0".
warning " > [email protected]" has unmet peer dependency "webpack@>=5".
warning " > [email protected]" has incorrect peer dependency "eslint@>= 3.0.0 < 5".
warning "eslint-config-uber-es2015 > [email protected]" has incorrect peer dependency "eslint@>= 3.0.0 < 5".
warning " > [email protected]" has incorrect peer dependency "eslint@>= 3.0.0 < 5".
warning "eslint-config-uber-jsx > [email protected]" has incorrect peer dependency "eslint@^2.0.0 || ^3.0.0".
warning " > [email protected]" has unmet peer dependency "webpack@^5.0.0".
warning " > @nebula.gl/[email protected]" has unmet peer dependency "@luma.gl/[email protected]".
warning " > @nebula.gl/[email protected]" has unmet peer dependency "@luma.gl/[email protected]".
warning " > [email protected]" has unmet peer dependency "@luma.gl/constants@^8.5.18".
warning " > [email protected]" has unmet peer dependency "@luma.gl/core@^8.5.18".
warning " > [email protected]" has unmet peer dependency "react-map-gl@^5.x".
warning "workspace-aggregator-56fca823-080a-41c8-8968-58958102948b > @nebula.gl/editor > [email protected]" has incorrect peer dependency "react@^16.4.2".
warning "workspace-aggregator-56fca823-080a-41c8-8968-58958102948b > @nebula.gl/editor > [email protected]" has incorrect peer dependency "react-dom@^16.4.2".
[4/4] Building fresh packages...
$ yarn run build
yarn run v1.22.19
$ lerna run build --stream
lerna notice cli v6.4.1

 >  Lerna (powered by Nx)   Running target build for 7 projects:

    - example-advanced
    - @nebula.gl/edit-modes
    - @nebula.gl/editor
    - @nebula.gl/layers
    - nebula.gl
    - @nebula.gl/overlays
    - react-map-gl-draw

 —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

> @nebula.gl/edit-modes:build


> example-advanced:build


> @nebula.gl/overlays:build

(node:80648) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [WriteStream]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
(node:80648) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [WriteStream]. Use emitter.setMaxListeners() to increase limit
(node:80648) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [WriteStream]. Use emitter.setMaxListeners() to increase limit
(node:80648) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [WriteStream]. Use emitter.setMaxListeners() to increase limit
$ vite build
$ vite build -c ../../vite.config.ts
$ vite build -c ../../vite.config.ts
example-advanced: vite v4.0.4 building for production...
example-advanced: transforming...
example-advanced: ✓ 5 modules transformed.
example-advanced: [commonjs--resolver] Failed to resolve entry for package "nebula.gl". The package may have incorrect main/module/exports specified in its package.json.
example-advanced: error during build:
example-advanced: Error: Failed to resolve entry for package "nebula.gl". The package may have incorrect main/module/exports specified in its package.json.
example-advanced:     at packageEntryFailure (file:///home/akiyamka/git/temp/nebula.gl/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:21837:11)
example-advanced:     at resolvePackageEntry (file:///home/akiyamka/git/temp/nebula.gl/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:21834:5)
example-advanced:     at tryNodeResolve (file:///home/akiyamka/git/temp/nebula.gl/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:21572:20)
example-advanced:     at Object.resolveId (file:///home/akiyamka/git/temp/nebula.gl/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:21336:28)
example-advanced:     at file:///home/akiyamka/git/temp/nebula.gl/node_modules/rollup/dist/es/shared/rollup.js:23704:40
example-advanced:     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
example-advanced:     at async PluginDriver.hookFirstAndGetPlugin (file:///home/akiyamka/git/temp/nebula.gl/node_modules/rollup/dist/es/shared/rollup.js:23604:28)
example-advanced:     at async resolveId (file:///home/akiyamka/git/temp/nebula.gl/node_modules/rollup/dist/es/shared/rollup.js:22547:26)
example-advanced:     at async ModuleLoader.resolveId (file:///home/akiyamka/git/temp/nebula.gl/node_modules/rollup/dist/es/shared/rollup.js:22811:15)
example-advanced:     at async Object.resolveId (file:///home/akiyamka/git/temp/nebula.gl/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:8001:10)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@nebula.gl/overlays: vite v4.0.4 building for production...
@nebula.gl/edit-modes: vite v4.0.4 building for production...
@nebula.gl/overlays: transforming...
@nebula.gl/edit-modes: transforming...
@nebula.gl/overlays: ✓ 19 modules transformed.
@nebula.gl/overlays: rendering chunks...
@nebula.gl/overlays: computing gzip size...
@nebula.gl/overlays: dist/index.mjs  66.98 kB │ gzip: 18.90 kB │ map: 196.06 kB
@nebula.gl/overlays: dist/index.js  41.29 kB │ gzip: 14.86 kB │ map: 190.81 kB
@nebula.gl/overlays: [vite:dts] Start generate declaration files...
@nebula.gl/edit-modes: ✓ 193 modules transformed.
@nebula.gl/edit-modes: rendering chunks...
@nebula.gl/edit-modes: computing gzip size...
@nebula.gl/overlays: [vite:dts] Start rollup declaration files...
@nebula.gl/edit-modes: dist/index.mjs  652.50 kB │ gzip: 136.21 kB │ map: 2,024.25 kB
@nebula.gl/edit-modes: dist/index.js  489.04 kB │ gzip: 118.57 kB │ map: 1,992.07 kB
@nebula.gl/edit-modes: [vite:dts] Start generate declaration files...
@nebula.gl/edit-modes: [vite:dts] Start rollup declaration files...
@nebula.gl/overlays: [vite:dts] Declaration files built in 8220ms.
@nebula.gl/edit-modes: [vite:dts] Declaration files built in 8330ms.

 ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  Lerna (powered by Nx)   Running target build for 7 projects failed

   Tasks not run because their dependencies failed or --nx-bail=true:
   
   - @nebula.gl/editor:build
   - @nebula.gl/layers:build
   - nebula.gl:build
   - react-map-gl-draw:build
   
   Failed tasks:
   
   - example-advanced:build

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

@Akiyamka
Copy link
Collaborator

lgfm

@Akiyamka Akiyamka merged commit b316c63 into uber:master Jan 27, 2023
@Komzpa Komzpa deleted the 13709-migrate-nebula-to-vite-and-vitest branch January 27, 2023 17:56
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.

3 participants