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

Use .node-version for pinning Node.js version #6057

Merged
merged 1 commit into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.14.1
8 changes: 4 additions & 4 deletions app/gui/docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ setup:
[the latest LTS version of node and npm](https://nodejs.org/en/download). Even
minor release changes are known to cause serious issues, thus **we provide
support for the latest LTS version only. Please do not report build issues if
you use other versions.** In case you run macOS or Linux the easiest way to
set up the proper version is by installing the
[Node Version Manager](https://github.com/nvm-sh/nvm) and running
`nvm install --lts && nvm use --lts`.
you use other versions.** The easiest way to set up the proper version is by
installing
[a Node version manager that automatically picks up the correct version](https://github.com/shadowspawn/node-version-usage#supporting-products),
like [fnm](https://github.com/Schniz/fnm).

- **(Optional) FlatBuffer compiler `flatc`**

Expand Down
3 changes: 2 additions & 1 deletion build-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
wasm-size-limit: 15.50 MiB

required-versions:
# NB. The Rust version is pinned in rust-toolchain.toml.
# NB. The Node version is pinned in .node-version.
cargo-watch: ^8.1.1
node: =18.14.1
wasm-pack: ^0.10.2
# TODO [mwu]: Script can install `flatc` later on (if `conda` is present), so this is not required. However it should
# be required, if `conda` is missing.
Expand Down
9 changes: 7 additions & 2 deletions build/build/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ use semver::VersionReq;



pub fn load_yaml(yaml_text: &str) -> Result<Config> {
let raw = serde_yaml::from_str::<ConfigRaw>(yaml_text)?;
/// Load the build configuration, based on the `build-config.yaml` and `.node-version` files in
/// the repo root.
pub fn load() -> Result<Config> {
let yaml_text = include_str!("../../../build-config.yaml");
let node_version = include_str!("../../../.node-version").trim();
Procrat marked this conversation as resolved.
Show resolved Hide resolved
let mut raw = serde_yaml::from_str::<ConfigRaw>(yaml_text)?;
raw.required_versions.insert("node".to_owned(), node_version.to_owned());
raw.try_into()
}

Expand Down
7 changes: 2 additions & 5 deletions build/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@

use enso_build::prelude::*;

use enso_build::config::Config;
use enso_build::config::ConfigRaw;
use enso_build::config;



fn main() -> Result {
setup_logging()?;
trace!("Starting CLI driver, cwd is {}", ide_ci::env::current_dir()?.display());
let build_config_yaml = include_str!("../../../build-config.yaml");
let build_config_raw = serde_yaml::from_str::<ConfigRaw>(build_config_yaml)?;
let build_config = Config::try_from(build_config_raw)?;
let build_config = config::load()?;
enso_build_cli::lib_main(Some(build_config))
}
6 changes: 4 additions & 2 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ arising from unsupported configurations will not be fixed by the core team.

In order to build and run Enso you will need the following tools:

- [NodeJS](https://nodejs.org/) with the latest LTS version. We recommend using
[`nvm`](https://github.com/nvm-sh/nvm) for managing NodeJS installation.
- [NodeJS](https://nodejs.org/) with the latest LTS version. We recommend
installing
[a Node version manager that automatically picks up the correct version](https://github.com/shadowspawn/node-version-usage#supporting-products),
like [fnm](https://github.com/Schniz/fnm).
- [sbt](https://www.scala-sbt.org/) with the same version as specified in
[`project/build.properties`](../project/build.properties).
- [Maven](https://maven.apache.org/) with version at least 3.6.3.
Expand Down