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

Prerequisites: Raise if Node version unsupported #1202

Merged
merged 3 commits into from
May 8, 2024

Conversation

stevepolitodesign
Copy link
Contributor

Follow-up to #1201

It's not enough to ensure Node is installed. We also need to ensure the consumer has the supported minimum version installed. Otherwise, subsequent generators will raise errors like so:

error [email protected]: The engine "node" is incompatible with this module. Expected version ">=18.12.0". Got "18.0.0"
error Found incompatible module.

We select v20.0.0 as our minimum supported version because it is slated for Active LTS, but is not bleeding edge at this time

We also raise when calling the template to avoid unnecessarily generating a new Rails application.

Follow-up to #1201

It's not enough to ensure Node is installed. We also need to ensure the
consumer has the supported minimum version installed. Otherwise,
subsequent generators will raise errors like so:

```
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=18.12.0". Got "18.0.0"
error Found incompatible module.
```

We select `v20.0.0` as our minimum supported version because it is
slated for Active LTS, but is not bleeding edge at [this time][]

We also raise when calling the template to avoid unnecessarily
generating a new Rails application.

[this time]: https://nodejs.org/en/about/previous-releases
The template won't have access to Suspenders, since it's called in
isolation.
Comment on lines +1 to +11
def node_version
ENV["NODE_VERSION"] || `node --version`[/\d+\.\d+\.\d+/]
end

def node_not_installed?
!node_version.present?
end

def node_version_unsupported?
node_version < "20.0.0"
end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I needed to re-declare these since this template will be treated as a static file when invoked. I can't import Suspenders.

@stevepolitodesign stevepolitodesign merged commit 69e5fd7 into suspenders-3-0-0 May 8, 2024
2 checks passed
@stevepolitodesign stevepolitodesign deleted the suspenders-3-0-0-node-lts branch May 8, 2024 10:19
stevepolitodesign added a commit that referenced this pull request May 8, 2024
After requiring a minimum Node version #1202, we list this, and other
system requirements` in an effort to improve the developer experience.
stevepolitodesign added a commit that referenced this pull request May 8, 2024
After requiring a minimum Node version #1202, we list this, and other
system requirements` in an effort to improve the developer experience.
stevepolitodesign added a commit that referenced this pull request May 10, 2024
Follow-up to #1201

It's not enough to ensure Node is installed. We also need to ensure the
consumer has the supported minimum version installed. Otherwise,
subsequent generators will raise errors like so:

```
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=18.12.0". Got "18.0.0"
error Found incompatible module.
```

We select `v20.0.0` as our minimum supported version because it is
slated for Active LTS, but is not bleeding edge at [this time][]

We also raise when calling the template to avoid unnecessarily
generating a new Rails application.

[this time]: https://nodejs.org/en/about/previous-releases
stevepolitodesign added a commit that referenced this pull request May 10, 2024
After requiring a minimum Node version #1202, we list this, and other
system requirements` in an effort to improve the developer experience.
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.

1 participant