Skip to content

Commit

Permalink
fix: coerce node version so pre, nightly, alpha, and beta versions of…
Browse files Browse the repository at this point in the history
… node can be used with profiler. (#223)

* fix: make version restrictions a warning instead of an error

* coerce version
  • Loading branch information
nolanmar511 committed Jun 20, 2018
1 parent 26d1708 commit e038d69
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ts/src/index.ts
Expand Up @@ -127,7 +127,10 @@ async function initConfigMetadata(config: ProfilerConfig):
* rejected promise.
*/
export async function createProfiler(config: Config): Promise<Profiler> {
if (!semver.satisfies(process.version, pjson.engines.node)) {
// Coerce version if possible, to remove any pre-release, alpha, beta, etc
// tags.
const version = semver.coerce(process.version) || process.version;
if (!semver.satisfies(version, pjson.engines.node)) {
throw new Error(
`Could not start profiler: node version ${process.version}` +
` does not satisfies "${pjson.engines.node}"`);
Expand Down Expand Up @@ -177,7 +180,6 @@ function logError(msg: string, config: Config) {
logger.error(msg);
}


/**
* For debugging purposes. Collects profiles and discards the collected
* profiles.
Expand Down

0 comments on commit e038d69

Please sign in to comment.