Add .nvmrc file (#17145) (#17174)

* Add .nvmrc file

* Update contributing docs

* Fix typo in `nvm use`

* Update "install node" text

* Add test to ensure .nvmrc and .node-version are identical

* Use async/await instead of promise

* Feedback
This commit is contained in:
Søren Louv-Jansen 2018-03-15 16:57:01 +01:00 committed by GitHub
parent f7eed88df5
commit 7b79d3aff5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 2 deletions

1
.nvmrc Normal file
View file

@ -0,0 +1 @@
8.9.4

View file

@ -152,10 +152,10 @@ git clone https://github.com/[YOUR_USERNAME]/kibana.git kibana
cd kibana
```
Install the version of node.js listed in the `.node-version` file _(this can be easily automated with tools such as [nvm](https://github.com/creationix/nvm) and [avn](https://github.com/wbyoung/avn))_
Install the version of Node.js listed in the `.node-version` file. This can be automated with tools such as [nvm](https://github.com/creationix/nvm), [nvm-windows](https://github.com/coreybutler/nvm-windows) or [avn](https://github.com/wbyoung/avn). As we also include a `.nvmrc` file you can switch to the correct version when using nvm by running:
```bash
nvm install "$(cat .node-version)"
nvm use
```
Install the latest version of [yarn](https://yarnpkg.com).

View file

@ -0,0 +1,23 @@
import fs from 'fs';
import { engines } from '../../../package.json';
import { promisify } from 'util';
const readFile = promisify(fs.readFile);
import expect from 'expect.js';
describe('All configs should use a single version of Node', () => {
it('should compare .node-version and .nvmrc', async () => {
const [nodeVersion, nvmrc] = await Promise.all([
readFile('./.node-version', { encoding: 'utf-8' }),
readFile('./.nvmrc', { encoding: 'utf-8' }),
]);
expect(nodeVersion.trim()).to.be(nvmrc.trim());
});
it('should compare .node-version and engines.node from package.json', async () => {
const nodeVersion = await readFile('./.node-version', {
encoding: 'utf-8',
});
expect(nodeVersion.trim()).to.be(engines.node);
});
});