forked from alphagov/govuk-design-system
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request alphagov#135 from alphagov/add-node-version-checking
Add node version checking
- Loading branch information
Showing
5 changed files
with
56 additions
and
5 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
8.9.4 |
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,5 @@ | ||
language: node_js | ||
|
||
node_js: | ||
- 8 | ||
|
||
script: | ||
- npm run lint | ||
- npm run build | ||
|
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,33 @@ | ||
#! /usr/bin/env node | ||
|
||
'use strict' | ||
|
||
var fs = require('fs') | ||
var path = require('path') | ||
|
||
fs.readFile(path.join(__dirname, '../.nvmrc'), 'utf8', function (error, data) { | ||
if (error) throw error | ||
var expectedVersion = data.trim() | ||
var currentVersion = process.version.replace('v', '') | ||
|
||
var versionMatchesExactly = expectedVersion === currentVersion | ||
var versionMatchesMajor = expectedVersion.split('.')[0] === currentVersion.split('.')[0] | ||
|
||
if (versionMatchesExactly) { | ||
process.exit() | ||
} | ||
|
||
if (versionMatchesMajor) { | ||
console.log('' + | ||
'Warning: You are using Node.js version ' + currentVersion + ' which we do not use. ' + | ||
'You may encounter issues, consider installing Node.js version ' + expectedVersion + '.' + | ||
'') | ||
process.exit() | ||
} | ||
|
||
console.log('' + | ||
'You are using Node.js version ' + currentVersion + ' which we do not support. ' + | ||
'Please install Node.js version ' + expectedVersion + ' and try again.' + | ||
'') | ||
process.exit(1) // exit with a failure mode | ||
}) |
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