MCPcopy Create free account
hub / github.com/loopbackio/loopback-next / install

Method install

packages/cli/generators/openapi/index.js:495–526  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

493 }
494
495 install() {
496 if (this.shouldExit()) return false;
497 debug('install npm dependencies');
498 const pkgJson = this.packageJson || {};
499 const deps = pkgJson.get('dependencies') || {};
500 const pkgs = [];
501 const connectorVersionRange = deps['loopback-connector-openapi'];
502 if (!connectorVersionRange) {
503 // No dependency found for loopback-connector-openapi
504 pkgs.push('loopback-connector-openapi');
505 } else {
506 // `loopback-connector-openapi` exists - make sure its version range
507 // is >= 6.0.0
508 try {
509 const minVersion = semver.minVersion(connectorVersionRange);
510 if (semver.lt(minVersion, '6.0.0')) {
511 pkgs.push('loopback-connector-openapi@^6.0.0');
512 }
513 } catch (err) {
514 // The version can be a tarball
515 this.log(err);
516 }
517 }
518
519 if (pkgs.length === 0) return;
520
521 this.pkgManagerInstall(pkgs, {
522 npm: {
523 save: true,
524 },
525 });
526 }
527
528 async end() {
529 await super.end();

Callers

nothing calls this directly

Calls 5

shouldExitMethod · 0.80
ltMethod · 0.80
pkgManagerInstallMethod · 0.80
getMethod · 0.65
logMethod · 0.65

Tested by

no test coverage detected