-
-
Notifications
You must be signed in to change notification settings - Fork 530
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a major upgrade that aims to make it so generated Rails applications with suspenders are running on Rails version 7 and Ruby version 3. We took the approach of making the least amount of changes possible. We were unable to support the latest version of Ruby because of a [failing build][]. A future commit could explore how to solve for this, but for now, we decided to just stick with version `3.0.5`. We settled on `3.0.5` and not `3.0.0` in an effort to suppress parser warnings. The biggest change is that we drop support for deprecated CSS tooling by removing [Bourbon][] and introduce [PostCSS][] and [cssbundling-rails][]. We also drop [Bitters][] as a runtime dependency. Add PostCSS Normalize --------------------- In order to use [normalize][], we need to use [PostCSS Normalize][] since we are using [cssbundling-rails][]. We need to move the invocation of the `suspenders:stylesheet_base` to the `leftovers` method because this method is invoked _after_ `finish_template` is called. We do this because we were running into issues where the call to `rails css:install:postcss` had not yet run, but our generator assumes that command has already run. The method must be named `leftovers` since that's what the [finish_template][] method expects. Additionally, we only call this generator if the caller has not passed anything to the `--css` option when generating a new app. This is because Rails handles other css frameworks like `bootstrap` and `tailwind` differently. Finally, we move the invocation of `outro` to the `leftovers` method since it ensures the message will be the last thing to be printed to the console. Add bin/yarn ------------ Now that we have moved off of [Webpacker][], the [bin/yarn][] binstub is no longer generated. Because of this, we need to manually have it added during a new app build. Introduce CalVer ---------------- Because this upgrade was a breaking change, we thought it was a good time to switch to [CalVer][]. Since this project is composed of other projects, every release is a potential breaking change. Using the date as the `major` version encodes this risk. Improve console output ---------------------- Ensures the invocation of all generator methods happens _before_ we print the outro. This is because a generator invokes all methods in the class in the order they are declared. Specifically, this meant invoking `generate_views` in the `suspenders_customization` method. Prior to this, `generate_views` was invoked after the `outro` was printed. [Webpacker]: https://github.com/rails/webpacker [failing build]: https://github.com/thoughtbot/suspenders/actions/runs/3418310707 [Bourbon]: https://github.com/thoughtbot/bourbon [PostCSS]: https://postcss.org [cssbundling-rails]: https://github.com/rails/cssbundling-rails [Bitters]: https://github.com/thoughtbot/bitters [normalize]: https://necolas.github.io/normalize.css/ [PostCSS Normalize]: https://github.com/csstools/postcss-normalize [finish_template]: https://github.com/rails/rails/blob/d5124b2522130785378238ba714029ce8ef9de97/railties/lib/rails/generators/rails/plugin/plugin_generator.rb#L283-L285 [bin/yarn]: https://github.com/rails/webpacker/blob/master/lib/install/bin/yarn [CalVer]: https://calver.org Co-authored-by: Aji Slater <[email protected]> Co-authored-by: Eric Milford <[email protected]> Co-authored-by: Stefanni Brasil <[email protected]>
- Loading branch information
1 parent
5624ca5
commit 1712f3e
Showing
20 changed files
with
138 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.7.4 | ||
3.0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Rails 7 | ||
|
||
To create a new Rails 7 app with Suspenders, you need to have `node >= 14.6`. | ||
|
||
After the app is created, run the server with `bin/dev`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
module Suspenders | ||
RAILS_VERSION = "~> 6.1.6.1".freeze | ||
RAILS_VERSION = "~> 7.0.0".freeze | ||
RUBY_VERSION = IO | ||
.read("#{File.dirname(__FILE__)}/../../.ruby-version") | ||
.strip | ||
.freeze | ||
VERSION = "1.56.1".freeze | ||
VERSION = "20230113.0".freeze | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import "normalize.css" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env ruby | ||
|
||
APP_ROOT = File.expand_path("..", __dir__) | ||
Dir.chdir(APP_ROOT) do | ||
yarn = ENV["PATH"].split(File::PATH_SEPARATOR) | ||
.select { |dir| File.expand_path(dir) != __dir__ } | ||
.product(["yarn", "yarnpkg", "yarn.cmd", "yarn.ps1"]) | ||
.map { |dir, file| File.expand_path(file, dir) } | ||
.find { |file| File.executable?(file) } | ||
|
||
if yarn | ||
exec yarn, *ARGV | ||
else | ||
warn "Yarn executable was not detected in the system." | ||
warn "Download Yarn at https://yarnpkg.com/en/docs/install" | ||
exit 1 | ||
end | ||
end |
Oops, something went wrong.