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

Update preact-cli, clean up client build #133

Merged
merged 6 commits into from
Mar 28, 2020
Merged

Conversation

ethanwu10
Copy link
Member

@ethanwu10 ethanwu10 commented Mar 28, 2020

Update preact-cli to 3.0.0-rc.10 (since the RC versions are being used by the default template) and update the HTML template to match.

Build changes
client/build.sh has been removed, with the build now being done entirely by preact-cli. The static build output is no longer being served under /static, and is now served directly at the root. preact watch now also proxies API requests; it is no longer necessary to change config/client.js to have API endpoints point to localhost:3000.

Source structure changes
Move client/src/pages to client/src/routes to enable route splitting, move icons to within the client/src tree, and move contents of public directory to the appropriate places within the client/src tree.

Misc
PurgeCSS has been updated to the latest version.

Prerendering is still disabled due to build failures from sourcemap resolution (we might want to look into this in a separate issue).

This PR also contains small bugfixes in components and routes that were discovered in the process of migration:

  • /profile now will load data on initial mount instead of only on a state change
  • The scoreboard no longer passes false as a ref (which crashes the app)
  • Modals now use portals

Will close #131
Still TODO:

Update preact-cli to 3.0.0-rc.10 (the RC versions are being used by the
default template).

Also move `client/src/pages` to `client/src/routes` to enable route
splitting, move icons to within the `client/src` tree, and move contents
of `public` directory to the appropriate places within the `client/src`
tree.
Update HTML template to latest from preact-cli. Also disable
prerendering, which now breaks on build (attempting to read sourcemaps).

This change injects inline scripts into the built HTML.
Since updating preact-cli fixed the import resolution issues causing
unmounting portals to crash, we can now use portals in the Modal
component.
Explicitly check to fetch data for profile page on component mount as
well as update.
Preact will crash if `false` is passed as a ref, so ensure we pass
either a valid ref or `null`.
@ethanwu10 ethanwu10 added the refactoring Improve code quality label Mar 28, 2020
@ethanwu10 ethanwu10 added this to in-progress in Frontend via automation Mar 28, 2020
We no longer have any shell scripts in client/, so don't try to
shellcheck them.
Copy link
Member

@ginkoid ginkoid left a comment

Choose a reason for hiding this comment

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

lgtm

client/src/routes/profile.js Show resolved Hide resolved
@chen-robert chen-robert marked this pull request as ready for review March 28, 2020 08:26
@chen-robert
Copy link
Member

@ethanwu10 Are we ready to merge this?

@ethanwu10
Copy link
Member Author

We can merge this now and make the sprite sheet a separate issue / PR.

@ethanwu10 ethanwu10 merged commit 9f563e4 into master Mar 28, 2020
Frontend automation moved this from in-progress to done Mar 28, 2020
@ethanwu10 ethanwu10 deleted the refactor/client-build branch March 28, 2020 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Improve code quality
Projects
Frontend
  
done
Development

Successfully merging this pull request may close these issues.

Rewire client build and use preact-cli@3.0.0-rc.*
3 participants