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

v4 #1647

Merged
merged 22 commits into from
Oct 10, 2023
Merged

v4 #1647

merged 22 commits into from
Oct 10, 2023

Conversation

rschristian
Copy link
Member

@rschristian rschristian commented Jan 31, 2022

Summary

Closes #1551, #1579, #1643, #1747

Tracking for eventual major version increase

Any review should probably been done by stepping through individual commits / their PRs. Each PR should contain the justification for the change and whatnot. A lot of things build off each other, so I've been merging them in here to continue with work.

Lotta rebasing went into this, hopefully the changes are all quite clean because of it.

Does this PR introduce a breaking change?

Yes, see changesets (some still need to be fleshed out a bit though) for details

@changeset-bot
Copy link

changeset-bot bot commented Jan 31, 2022

🦋 Changeset detected

Latest commit: 78e7e9d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@preact/async-loader Major
preact-cli Major
@preact/prerender-data-provider Major
create-preact-cli Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@rschristian
Copy link
Member Author

rschristian commented Feb 9, 2022

Changes that I've thought of, maybe should be considered:

  • Switching to automatic JSX runtime
    • Seems to be the way the community is going these days
    • Not sure if this is actually relevant or anyone cares though. I suppose it's nicer for TS users, as the TS language server will yell about h not being imported (even though ProvidePlugin will do that automatically on build)
  • Switching CSS module support to depend on file name, rather than directory
    • Some users get tripped up by CSS acting differently in different locations and I do agree that this is unintuitive. I'd therefore like to follow what WMR and Microbundle do and use .module.css to determine whether or not CSS should be treated as a module.
  • --json flag
    • Is this in use? Do people want to use alternative bundle analyzers that often?
    • Should rename (or alias) to --stats, --json doesn't make much sense (IMO)
      • Went for removal instead (can revert if desired, not too opinionated either way)
  • --brotli flag
    • I think it's fair to leave this up to users, it's a bit niche (though not hard to support if we do want to keep it)
  • --inline-css -> --inlineCss
    • Can keep both with an alias, but should be consistent on camelCased or kebab-cased flags in the docs. This is the only kebab at the moment.
  • Separate out create functionality
    • npx makes this quite slow, which is unfortunate. All dependencies (~1060 of them) will need to be installed for minimal (create) functionality. Could make new project init quite a bit faster by extracting this out, though that might be annoying tooling-wise.
    • Opinion, but I think we can really cut this down. I don't think a full interactive CLI app is necessary here. It's just a couple options really.
  • Faster prerender
  • Separate CLI-config from env we pass to users in their preact.config.js
    • We load up env with all CLI flags as well as the user's manifests and package files. This info is likely of little to no use, and only buries things like isDev or isServer which is what they're probably looking for.
    • At the very least we should strip the manifest and pkg data out, users can do a fs.readFile if they really need those.
  • Move head-end.ejs & body-end.ejs into template
    • There's a lack of transparency due to the way we're replacing <% preact.headEnd %> and <% preact.bodyEnd %> with EJS snippets on build, which is a shame. With the move to html-webpack-plugin v4, both became considerably simpler and so I think it's time to move them into the template, and rename it to template.ejs (but continue to support template.html as a fallback). I'd like it to be plain and obvious that this is something for users to configure any which way they need.

Templates:

  • Kill off widgets, simple, and netlify
    • The widgets have never fit in well. I think they're working fine for now, but preact-cli is only utilized as a dev server / testing area. It doesn't make much sense to initialize widgets through CLI, IMO.
    • A couple users have gotten tripped up from simple not showing off important concepts, like route splitting, css modules, and testing.
    • I have no capacity to debug netlify issues if any come up

* feat: webpack-v5

* test: Update tests

* docs: Updating docs to reflect changes

* chore: Removing optimize-plugin local patch
* refactor: Determine CSS module by filename, not directory

* docs: Adding changeset

* refactor: Project creation pull from templates 'main' branch

* test: Updating tests

* revert: Accidentally removed log message
* refactor: Extracting out project creation to own package

* docs: Adding changeset

* refactor: Misc edits to common deps & workspace helper scripts

* test: Fixing 'create' test suite

* ci: Increase minimum Node version

* chore: Fix typos

* docs: Update ReadMe instructions

* chore: Better (and untaken) package name

* docs: Update changeset

* test: Update 'create' test suite & build output hashes

* docs: Expounding upon changeset
* refactor: Drops support for Preact v8

* docs: Adding changeset
* refactor: Switch over to automatic runtime transform for JSX

* test: Removing `h` imports from test suite

* docs: Adding changeset
* docs: Adding readme for create-cli

* feat: Initial publish

* fix: Correcting broken readme links
* refactor: Disable hashing ssr-build's css

* docs: Adding changeset

* test: Fix unrelated change from altered template
* refactor: Removes `--preload` flag & functionality

* docs: Adding changeset

* docs: Updating readme for removal of preload
* refactor: Separate internal concepts of config and env

* docs: Adding changeset
* refactor: Enables HMR via Prefresh by default

* docs: Adding changeset

* test: Updating tests to reflect changes to templates
@rschristian rschristian marked this pull request as ready for review October 10, 2023 20:18
@rschristian rschristian requested a review from a team as a code owner October 10, 2023 20:18
@rschristian rschristian merged commit 03b8f9d into master Oct 10, 2023
4 checks passed
@rschristian rschristian deleted the next branch October 10, 2023 20:20
@preact-bot preact-bot mentioned this pull request Oct 10, 2023
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.

Can't use with storybook due to html-webpack-plugin issues
1 participant