简体   繁体   English

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

[英]Open ended peer version dependency for package.json?

Summary 摘要

I'm presuming all major versions of @angular/core will work for this. 我想@angular/core所有主要版本都可以使用。 Should I specify the package peer dependency as: 我是否应该将软件包对等项依赖项指定为:

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

Context 上下文

I'm creating a package for an angular service that will be published on NPM. 我正在为角度服务创建一个程序包,该程序包将在NPM上发布。 The module just contains a set of easing functions that should work with any version of angular. 该模块仅包含一组应与任何版本的angular一起使用的缓动函数。 Brief snippet included below for reference. 以下是简短的摘要,以供参考。 As you can see the service imports Injectable from @angular/core . 如您所见,服务从@angular/core导入Injectable I'm assuming it will be just as valid for major version 5, 6, 7 and so on. 我假设它对于主要版本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;
  };
}

If you want an open ended range you use the asterisk (*) 如果您想要一个开放式范围,请使用星号(*)

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM