Skip to content

Commit 0b66384

Browse files
authored
ci: disable caching on travis (#87)
* ci: disable caching on travis * stop testing on node 8 - it is deprecated. support will officially be dropped when it reaches EOL or when we release 1.0, whichever happens first * docs: add a deprecation notice for node v8 to the code and readme
1 parent 8a55fa0 commit 0b66384

File tree

5 files changed

+38
-17
lines changed

5 files changed

+38
-17
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
language: node_js
22
node_js:
3-
- 8
43
- 10
54
- 12
5+
cache:
6+
npm: false
67
script:
78
- npm run test-travis
89
after_success:
@@ -13,3 +14,4 @@ deploy:
1314
script: npx semantic-release
1415
on:
1516
node: 12
17+
repo: IBM/openapi-validator

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
# OpenAPI Validator
1010
This command line tool lets you validate OpenAPI documents according to their specification, either [2.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md) or [3.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md), as well as [custom IBM-defined best practices](http://watson-developer-cloud.github.io/api-guidelines/swagger-coding-style).
11+
12+
#### Notice
13+
Support for Node v8 is deprecated. Support will be officially dropped when it reaches end of life (31 December 2019) or when v1.0 of this package is released, whichever happens first.
14+
1115
#### Prerequisites
1216
- Node 8.9.x
1317
- NPM 5.x

src/cli-validator/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// this module enforces that the user is running a supported version
44
// of Node by exiting the process if the version is less than
55
// the passed in argument (currently 8.9.x)
6-
require('./utils/enforceVersion')('8.9.0');
6+
require('./utils/checkVersion')('8.9.0');
77
require('./utils/updateNotifier');
88

99
const program = require('commander');
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const semver = require('semver');
2+
const chalk = require('chalk');
3+
4+
// this module can be used to handle any version-specific functionality
5+
// it will be called immediately when the program is run
6+
7+
module.exports = function(requiredVersion) {
8+
// this is called since the code uses features that require `requiredVersion`
9+
const isSupportedVersion = semver.gte(process.version, requiredVersion);
10+
if (!isSupportedVersion) {
11+
console.log(
12+
'\n' +
13+
chalk.red('[Error]') +
14+
` Node version must be ${requiredVersion} or above.` +
15+
` Your current version is ${process.version}\n`
16+
);
17+
process.exit(2);
18+
}
19+
20+
// print deprecation warnings for specific node versions that will no longer be supported
21+
const isNodeEight = semver.satisfies(process.version, '8.x');
22+
if (isNodeEight) {
23+
console.log(
24+
'\n' +
25+
chalk.yellow('[Warning]') +
26+
` Support for Node v8 is deprecated. Support will be officially dropped when it reaches end of life` +
27+
` (31 December 2019) or when v1.0 of this package is released, whichever happens first.\n`
28+
);
29+
}
30+
};

src/cli-validator/utils/enforceVersion.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)