Skip to content

Commit

Permalink
Respect ignore engines flag. (#647)
Browse files Browse the repository at this point in the history
Fixes #638
  • Loading branch information
samccone authored and Sebastian McKenzie committed Oct 11, 2016
1 parent aea9e24 commit b880d40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cli/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export class Install {

this.resolver = new PackageResolver(config, lockfile);
this.fetcher = new PackageFetcher(config, this.resolver);
this.compatibility = new PackageCompatibility(config, this.resolver);
this.compatibility = new PackageCompatibility(config, this.resolver, this.flags.ignoreEngines);
this.linker = new PackageLinker(config, this.resolver, this.flags.ignoreOptional);
this.scripts = new PackageInstallScripts(config, this.resolver, this.flags.force);
}
Expand Down
6 changes: 4 additions & 2 deletions src/package-compatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,17 @@ export function testEngine(name: string, range: string, versions: Versions, loos
}

export default class PackageCompatibility {
constructor(config: Config, resolver: PackageResolver) {
constructor(config: Config, resolver: PackageResolver, ignoreEngines: boolean) {
this.reporter = config.reporter;
this.resolver = resolver;
this.config = config;
this.ignoreEngines = ignoreEngines;
}

resolver: PackageResolver;
reporter: Reporter;
config: Config;
ignoreEngines: boolean;

static isValidArch(archs: Array<string>): boolean {
return isValid(archs, process.arch);
Expand Down Expand Up @@ -148,7 +150,7 @@ export default class PackageCompatibility {
}
}

if (!this.config.ignoreEngines && typeof info.engines === 'object') {
if (!this.ignoreEngines && typeof info.engines === 'object') {
for (const entry of entries(info.engines)) {
let name = entry[0];
const range = entry[1];
Expand Down

0 comments on commit b880d40

Please sign in to comment.