package.json的开放式对等版本依赖?

时间:2018-03-16 00:11:32

标签: javascript node.js angular npm semantic-versioning

摘要

我假设@angular/core的所有主要版本都适用于此。我应该将包对等依赖项指定为:

"peerDependencies": {
  "@angular/core": "x.x"
}

上下文

我正在为NPM上发布的角度服务创建一个包。该模块只包含一组缓动函数,可以使用任何版本的角度。以下简要摘要以供参考。如您所见,服务从Injectable导入@angular/core。我假设它对主要版本5,6,7等有效。

import {Injectable} from '@angular/core';

@Injectable()
export class RoundProgressEase {
  // t: current time (or position) of the neonate. This can be seconds or frames, steps,
  // seconds, ms, whatever – as long as the unit is the same as is used for the total time.
  // b: beginning value of the property.
  // c: change between the beginning and destination value of the property.
  // d: total time of the neonate.

  linearEase(t: number, b: number, c: number, d: number): number {
    return c * t / d + b;
  };

  easeInQuad(t: number, b: number, c: number, d: number): number {
    return c * (t /= d) * t + b;
  };
}

1 个答案:

答案 0 :(得分:2)

如果您想要一个开放式范围,请使用星号(*)

"peerDependencies": {
  "@angular/core": "*"
}