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

Replace CRA with Vite; COUNTRY=cambodia #1210

Merged
merged 74 commits into from
Jul 12, 2024
Merged

Replace CRA with Vite; COUNTRY=cambodia #1210

merged 74 commits into from
Jul 12, 2024

Conversation

echaidemenos
Copy link
Collaborator

@echaidemenos echaidemenos commented Apr 29, 2024

Description

Replaces CRA with Vite.
Aims to speed up development.

Important note: mui/material-ui#32685 (comment) and #1302

Things to QA

  • print config
  • map interactions
  • windows compatibility (cross-env)
  • + everything 😅

Checklist - did you ...

Test your changes with

  • REACT_APP_COUNTRY=rbd yarn start
  • REACT_APP_COUNTRY=cambodia yarn start
  • REACT_APP_COUNTRY=mozambique yarn start
  • Add / update necessary tests?
  • Add / update outdated documentation?

Screenshot/video of feature:

@ericboucher ericboucher changed the title Replace CRA with Vite Replace CRA with Vite; COUNTRY=rbd Jul 3, 2024
frontend/.eslintrc.cjs Outdated Show resolved Hide resolved
@wadhwamatic
Copy link
Member

@wadhwamatic maybe a temporary network error? I was not able to reproduce. Was the main branch working at that time?

@ericboucher - I am consistently hitting the same error on this branch, but not on main. I made a surge deploy and am seeing the same issue there: https://tan-stickz.surge.sh/

@ericboucher
Copy link
Collaborator

ericboucher commented Jul 11, 2024

@wadhwamatic looking at the error you're getting in your deployed branch I think you need to run yarn setup:common in your frontend folder to update the common library.

See https://gruesome-trees.surge.sh/

@wadhwamatic
Copy link
Member

@wadhwamatic looking at the error you're getting in your deployed branch I think you need to run yarn setup:common in your frontend folder to update the common library.

See https://gruesome-trees.surge.sh/

Thanks @ericboucher. I was just doing a clean yarn install, not setup common. This addressed the issue I was seeing.

I do get an error when I run setup:common, but it seems to not affect the app.

error /Users/amit/dev/PRISM-Main/prism-app/frontend/node_modules/canvas: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build --update-binary
Arguments: 
Directory: /Users/amit/dev/PRISM-Main/prism-app/frontend/node_modules/canvas
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | darwin | arm64
node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v115-darwin-unknown-arm64.tar.gz
node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v115-darwin-unknown-arm64.tar.gz 
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v115 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v115-darwin-unknown-arm64.tar.gz 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info find Python using Python version 3.7.4 found at "/Applications/anaconda3/bin/python3"

gyp info spawn /Applications/anaconda3/bin/python3
gyp info spawn args [
gyp info spawn args '/Users/amit/.nvm/versions/node/v20.15.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/amit/dev/PRISM-Main/prism-app/frontend/node_modules/canvas/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/amit/.nvm/versions/node/v20.15.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/amit/Library/Caches/node-gyp/20.15.1/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Users/amit/Library/Caches/node-gyp/20.15.1',
gyp info spawn args '-Dnode_gyp_dir=/Users/amit/.nvm/versions/node/v20.15.1/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/amit/Library/Caches/node-gyp/20.15.1/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/amit/dev/PRISM-Main/prism-app/frontend/node_modules/canvas',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
Package pangocairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `pangocairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pangocairo' found
gyp: Call to 'pkg-config pangocairo --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.<anonymous> (/Users/amit/.nvm/versions/node/v20.15.1/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:297:18)
gyp ERR! stack at ChildProcess.emit (node:events:519:28)
gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
gyp ERR! System Darwin 23.3.0
gyp ERR! command "/Users/amit/.nvm/versions/node/v20.15.1/bin/node" "/Users/amit/.nvm/versions/node/v20.15.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--update-binary" "--module=/Users/amit/dev/PRISM-Main/prism-app/frontend/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/Users/amit/dev/PRISM-Main/prism-app/frontend/node_modules/canvas/build/Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v115"
gyp ERR! cwd /Users/amit/dev/PRISM-Main/prism-app/frontend/node_modules/canvas
gyp ERR! node -v v20.15.1
gyp ERR! node-gyp -v v10.1.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/Users/amit/.nvm/versions/node/v20.15.1/bin/node /Users/amit/.nvm/versions/node/v20.15.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/Users/amit/dev/PRISM-Main/prism-app/frontend/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/amit/dev/PRISM-Main/prism-app/frontend/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v115' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/amit/dev/PRISM-Main/prism-app/frontend/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:519:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1105:16)
node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
node-pre-gyp ERR! System Darwin 23.3.0
node-pre-gyp ERR! command "/Users/amit/.nvm/versions/node/v20.15.1/bin/node" "/Users/amit/dev/PRISM-Main/prism-app/frontend/node_modules/canvas/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
node-pre-gyp ERR! cwd /Users/amit/dev/PRISM-Main/prism-app/frontend/node_modules/canvas
node-pre-gyp ERR! node -v v20.15.1
node-pre-gyp ERR! node-pre-gyp -v v1.0.11
node-pre-gyp ERR! not ok 

@gislawill
Copy link
Collaborator

I ran into the same issue @wadhwamatic described above in node-pre-gyp. I believe it stems from react-pdf Automattic/node-canvas#2186

@gislawill
Copy link
Collaborator

Heads up, @ericboucher and @echaidemenos, the canvas package is a dependency to react-pdf but has caused a lot of folks issues during installs (see: https://www.google.com/search?q=canvas+node-pre-gyp).

Because we're not making use of this package in our usage of react-pdf, I removed the dependency by overwriting it in package.json. Amit and I have confirmed that pdf print outs are still functioning as expected after removing this dependency. Let me know if you see any issues with this solution

cc: @wadhwamatic

@ericboucher
Copy link
Collaborator

Works for me @gislawill.

Does this PR look good to go otherwise?

Copy link
Collaborator

@gislawill gislawill 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 to me. Really excited for this one

@ericboucher ericboucher merged commit 3a69a24 into master Jul 12, 2024
6 checks passed
@ericboucher ericboucher deleted the vite-migration branch July 12, 2024 17:26
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