Skip to content

v4.0.0 #2085

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

Open
wants to merge 62 commits into
base: main
Choose a base branch
from
Open

v4.0.0 #2085

wants to merge 62 commits into from

Conversation

joelhawksley
Copy link
Member

@joelhawksley joelhawksley commented Sep 3, 2024

This PR will contain the breaking changes to ship for v4.0.0. We're still likely a long way's off, but I wanted to start to collect changes we know we'll want to land here. Until decided otherwise, we plan to release v4 on or after April 1, 2025,

Tasks

Potentially breaking:

  • Migrate to local configuration, review all config options for possible removal
  • Re-work slots, potentially remove Slot wrapper? (enables .with_slot.with_content)

Cleanups:

  • Reference ViewComponent fragment caching gem to see if anything should be upstreamed (https://github.com/patrickarnett/view_component-fragment_caching)
  • Add layout attribute to Rails' render: Add layout attribute POC #2232
  • Revisit docs generation
  • Resolve PVC test suite warnings
  • Revisit symlink used for RSPec tests to avoid duplicated test files in development searches
  • audit for optimal usage of object shapes: Enable warning on shape too complex #2258
  • Add docs for all public methods
  • Make any experimental features included by default
  • API docs should not be on main source control
  • Revisit and document or remove nocovs
  • Consider making RequestDetails in Rails public
  • Revisit benchmarks to see if the VC benchmark is being done in dev mode
  • Add trusted publishing
  • Extract dotcom VC compiler from GitHub.com (sorbet/tapioca/compilers/view_component.rb / lib/tasks/sorbet.rake)
  • Revisit skipped tests
  • Use mutant gem to find bugs
  • Add rubycritic gem
  • Consider using something like changesets for changelogs, or at least add better guidelines for writing changelogs
  • Bundle audit / brakeman
  • Set up RubyGems org for ViewComponent
  • auto-generate contributor list?
  • Add check for test changes for all functional PRs
  • audit rubocop exceptions
  • Audit/close open issues on repo

Done:

  • Include SlotableDefault by default
  • Stop inheriting from ActionView::Base?
  • Use single ActionView::Base instead of inheritance?
  • Always enable capture patch? - test at GitHub, enable by default before v4, remove toggle in v4, could we do it locally in PVC instead? (use refinements?)
  • Add inline template option to generator #1792
  • Add note about v4 being a LTS release
  • See about making internal constants private
  • Follow up on Allow implicit locale in component file names #2118 with more robust solution
  • Revisit view_component-contrib items
  • Further restrict access to internal APIs: Underscore internal methods that are public #2100
  • Migrate ViewComponent::Base.format to return a format instead of the variant #1973
  • Should we remove RedefinedSlotError?
  • consolidate ADRs into History
  • Drop method_source / assets from previews and direct folks to Lookbook
  • Search for “rails” and “6.1” etc to make sure we've removed all deprecatable paths
  • Remove use of ruby2 keywords
  • Revisit all dependencies to see if we still need them
  • Update rspec-rails to v7
  • Update turbo-rails to v2
  • Set up CI for whatever release series we support (one previous major for security? document this, dropping security support for v2 in v4 release)
  • Breaking change to compiler to simplify render path collisions
  • Verify all respond_to? checks are still necessary

* Minimum Ruby version is non-EOL per https://www.ruby-lang.org/en/downloads/branches/ (#2086)

* Only support current Rails and Ruby

In further review of the end-of-life dates for Ruby and Rails,
I propose that we target Ruby >= 3.2 and Rails >= 7.1 which will
be the lowest actively supported versions on April 1, 2025. We can
ship v4 on that date.

* remove backwards compat carve-out

* docs update

* merge cleanup

* update CI config

* remove rails version warning

* grammar
joelhawksley and others added 3 commits September 26, 2024 15:32
* remove appraisals for unsupported rails versions

* remove accommodations for Rails < 6.1 in PreviewHelper

* remove support for Rails < 6.1 in Preview layout

* remove old gemfiles

* remove known issue docs for version of rails no longer supported

* remove old rails support in test suite

* simplify render_inline to only support modern Rails

* always include collection_renderer

* remove ruby and rails deprecation warnings in engine.rb

* remove render_monkey_patch

* remove render monkey patch

* update rendering test for rails and ruby deprecations

* remove duplicate components
joelhawksley and others added 4 commits November 4, 2024 13:53
* add .DS_Store to gitignore

* Add Template subclasses to improve compiler polymorphism

* Move template type-specific logic to constructors

* Inline source into templates that require it

* Flatten inline_call conditional in compile_to_component

* Remove defined_on_self param from non-inline-call templates

* Use ActionView logic for parsing template names

Removes support for variant names containing `.`.

* Delegate template format and variant to TemplateDetails

---------

Co-authored-by: Joel Hawksley <[email protected]>
@joelhawksley joelhawksley mentioned this pull request Jan 6, 2025
7 tasks
@tiagomenegaz tiagomenegaz mentioned this pull request Feb 12, 2025
joelhawksley and others added 6 commits March 5, 2025 14:36
* Move generators into ViewComponent namespace

* Update tests

* Update changelog

* Update docs with new generator namespace
* BREAKING: Use Nokogiri::HTML5 instead of Nokogiri::HTML4 for test helpers

Co-authored-by: Noah Silvera <[email protected]>

* update allocation counts

* allocation counts

---------

Co-authored-by: Noah Silvera <[email protected]>
* do not use respond_to in gemspec

* do not use respond_to in PreviewActions

* remove unnecessary respond_to check

* remove unnecessary respond_to check in template annotations helper

Co-authored-by: Tiago Menegaz <[email protected]>

---------

Co-authored-by: Tiago Menegaz <[email protected]>
* Remove unnecessary usage of ruby2_keywords

* Remove unnecessary usage of ruby2_keywords

* Remove unnecessary usage of ruby2_keywords

* Remove unnecessary usage of ruby2_keywords

* Remove unnecessary usage of ruby2_keywords

* Remove unnecessary usage of ruby2_keywords.

* Remove unnecessary usage of ruby2_keywords.

* Remove unnecessary usage of ruby2_keywords.

* add changelog

* bump rubocop ruby version

* what about this?

* fix bug found by PVC suite?

* allocations

* fix lint

* allocations
joelhawksley and others added 30 commits March 26, 2025 13:59
* fix missing generator api change

* remove reference to rails 6.1

* remove unnecessary comments

* use Rails 8 in lint action

* reference Rails 8 in example command

* use class attribute default arg since we don't need to support Rails 5

* remove unnecessary newline
* BREAKING: Remove `preview_source` functionality

It was awkward to vendor and serve static assets to render preview
source code and Lookbook does a fantastic job at providing a
storybook-like environment for working with previews. Let's remove
the complexity of rendering preview source code ourselves.

* fix allocations

* allocations
* remove unncessary nocov

* remove unused code not caught due to nocov

* fix allocations

* remove nocov

* remove untested, undocumented DEBUG flag

* remove unnecessary nocovs

* add test coverage for preview helper logic

* remove unnecessary nocov

* remove last nocovs

* add nocovs for now

* add changelog

* allocations
* remove enable_reloading flag

* add changelog
* confirm nocov is needed

* turn on instrumentation in tests

* allocations

* remove instrumentation option, update allocations

* allocations

* allocations

* allocations

* revert changes

* allocations

* try using include?

* use prepend

* turn of instrumentation for allocations test

* allocations

* does this fix coverage

* add changelog

* improve test coverage
…public API (#2257)

* clean up constants

* more private constants

* make .compiled? private

* make .compile name private

* make compiler method private

* make more private methods

* i18n_backend is internal-only

* i18n_backend should be internal-only

* i18n_scope is internal-only

* i18n_key is internal_only

* use class_attribute default

* compiler mode is an internal flag

* Collection#components can be private

* remove unused ComponentError class

* inline template lang is internal

* load_previews is internal

* __vc_registered_slots is private

* register_polymorphic_slot can be private

* add changelog

* lint

* fix typo

* undo registered_slots change for now

* vale

* Update docs/CHANGELOG.md

* Update docs/CHANGELOG.md
* add notes about LTS status of v4 release

* Update docs/CHANGELOG.md

* Update docs/history.md
* --inline generator option now generates inline template. Use --call to generate #call method.

* lints

* vale

* vale

* interpolate template engine into heredoc
* update deprecation horizon to be 5.0.0

* update version to 4.0.0.alpha1
* ViewComponentsSystemTestController should always create a class

Resolves #2269 by returning an empty class outside test environments.

* alternative approach

---------

Co-authored-by: Stephen Nelson <[email protected]>
Prior to the compiler changes in v4, we set @current_template
to be the current instance of the component. Now, we set it to the
current ViewComponent::Template. In the GitHub monolith, we
reference @current_template when doing certain diagnostic
operations. I added an accessor to make this less messy to use
(and test) and exposed #path on template, which now allows for
such diagnostic operations to reference the specific component
template being rendered.
* run against ruby head on v4 branch

* loosen allocations check
…re compatibility patch. (#2287)

* Remove dependency on ActionView::Base, eliminating the need for capture compatibility patch.

Co-authored-by: Cameron Dutro <[email protected]>

* Use later version of Rails 7.1 for PVC integration tests

* docs updates

---------

Co-authored-by: Cameron Dutro <[email protected]>
With @camertron's change to remove the render compat patch,
we were able to simplify our CI matrix to the point of no
longer needing this conditional branching.
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