Skip to content

Commit

Permalink
Use .node-version for pinning Node.js version
Browse files Browse the repository at this point in the history
Implements #6008.
  • Loading branch information
Procrat committed Mar 23, 2023
1 parent de008eb commit 7a250c1
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
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();
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

0 comments on commit 7a250c1

Please sign in to comment.