This question already has an answer here:
这个问题在这里已有答案:
- What is the meaning of the “at” (@) prefix on npm packages? 2 answers
- npm包上“at”(@)前缀的含义是什么? 2个答案
Is there anything different about the dependencies that start with @
?
从@开始的依赖关系有什么不同吗?
Does that mean or imply something? I don't see any info about that. Take a look at my node_modules
folder:
这是意味着还是暗示某些东西?我没有看到任何有关这方面的信息。看看我的node_modules文件夹:
Fortawesome starts with @
and does not contain the typical fortawesome.css
file. So is it the same? Or does the @
indicate something?
Fortawesome以@开头,不包含典型的fortawesome.css文件。那是一样的吗?或者@表示什么?
This is my package.json
:
这是我的package.json:
{
"name": "ng-frontend",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.0",
"@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0",
"@angular/core": "^5.2.0",
"@angular/forms": "^5.2.0",
"@angular/http": "^5.2.0",
"@angular/platform-browser": "^5.2.0",
"@angular/platform-browser-dynamic": "^5.2.0",
"@angular/router": "^5.2.0",
"@fortawesome/fontawesome": "^1.1.4",
"animate.css": "^3.6.1",
"bootstrap": "^4.0.0",
"core-js": "^2.4.1",
"jasny-bootstrap": "^3.1.3",
"jquery": "^3.3.1",
"popper.js": "^1.12.9",
"rxjs": "^5.5.6",
"zone.js": "^0.8.19"
},
"devDependencies": {
"@angular/cli": "~1.7.2",
"@angular/compiler-cli": "^5.2.0",
"@angular/language-service": "^5.2.0",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~2.5.3"
}
}
This question is not about Angular.
这个问题与Angular无关。
3 个解决方案
#1
17
If a package's name begins with @, then it is a scoped package. The scope is everything in between the @ and the slash
如果包的名称以@开头,则它是一个范围包。范围是@和斜杠之间的所有内容
@scope/project-name
How to Initialize a Scoped Package
To create a scoped package, you simply use a package name that starts with your scope.
要创建范围包,只需使用以范围开头的包名称。
{
"name": "@username/project-name"
}
More details, Please visit scoped package
更多细节,请访问范围包
and
和
What does "@" symbol mean in "import { Component } from '@angular/core';" statement?
“@”/“核心”的“import {Component}”中的“@”符号是什么意思;“声明?
#2
7
@ refer to npm scoped packages:
@参考npm范围包:
When used in package names, scopes are preceded by an @ symbol and followed by a slash
在包名称中使用时,作用域前面带有@符号,后跟斜杠
Scopes are a way of grouping related packages together.
范围是一种将相关包分组在一起的方法。
For instance, your package.json contains some @angular/
prefixed dependencies (@angular/animations, @angular/compiler-cli, etc) which means that they are under angular
scope. The code of all those dependencies is under @angular
directory.
例如,你的package.json包含一些@ angular / prefixed依赖项(@ angular / animations,@ angular / compiler-cli等),这意味着它们处于角度范围内。所有这些依赖项的代码都在@angular目录下。
#3
6
packages with @ denotes the organisation. In this case the organisation is Fortawesome. It contains multiple packages (you can see it inside @fortawesome folder).
带有@的包表示组织。在这种情况下,该组织是Fortawesome。它包含多个包(您可以在@fortawesome文件夹中看到它)。
As described on npm page
如npm页面所述
Creating an Organization on npm gives you an Organization scope under which you can have your own namespace for packages.
在npm上创建组织为您提供了一个Organization范围,您可以在该范围内拥有自己的包名称空间。
Scopes are great for many reasons, for example:
范围很广,原因有很多,例如:
- Maintain a fork of a package, e.g. @the-best/request.
- 保持包裹的叉子,例如@的最佳/请求。
- Avoiding name disputes with popular names, e.g. @the-best/cat.
- 避免与流行名称发生名称争议,例如: @的最佳/猫。
- Improving internal discovery of Organization-supported packages (they're all in a single namespace!)
- 改进组织支持的包的内部发现(它们都在一个命名空间中!)
Hope that helps.
希望有所帮助。
#1
17
If a package's name begins with @, then it is a scoped package. The scope is everything in between the @ and the slash
如果包的名称以@开头,则它是一个范围包。范围是@和斜杠之间的所有内容
@scope/project-name
How to Initialize a Scoped Package
To create a scoped package, you simply use a package name that starts with your scope.
要创建范围包,只需使用以范围开头的包名称。
{
"name": "@username/project-name"
}
More details, Please visit scoped package
更多细节,请访问范围包
and
和
What does "@" symbol mean in "import { Component } from '@angular/core';" statement?
“@”/“核心”的“import {Component}”中的“@”符号是什么意思;“声明?
#2
7
@ refer to npm scoped packages:
@参考npm范围包:
When used in package names, scopes are preceded by an @ symbol and followed by a slash
在包名称中使用时,作用域前面带有@符号,后跟斜杠
Scopes are a way of grouping related packages together.
范围是一种将相关包分组在一起的方法。
For instance, your package.json contains some @angular/
prefixed dependencies (@angular/animations, @angular/compiler-cli, etc) which means that they are under angular
scope. The code of all those dependencies is under @angular
directory.
例如,你的package.json包含一些@ angular / prefixed依赖项(@ angular / animations,@ angular / compiler-cli等),这意味着它们处于角度范围内。所有这些依赖项的代码都在@angular目录下。
#3
6
packages with @ denotes the organisation. In this case the organisation is Fortawesome. It contains multiple packages (you can see it inside @fortawesome folder).
带有@的包表示组织。在这种情况下,该组织是Fortawesome。它包含多个包(您可以在@fortawesome文件夹中看到它)。
As described on npm page
如npm页面所述
Creating an Organization on npm gives you an Organization scope under which you can have your own namespace for packages.
在npm上创建组织为您提供了一个Organization范围,您可以在该范围内拥有自己的包名称空间。
Scopes are great for many reasons, for example:
范围很广,原因有很多,例如:
- Maintain a fork of a package, e.g. @the-best/request.
- 保持包裹的叉子,例如@的最佳/请求。
- Avoiding name disputes with popular names, e.g. @the-best/cat.
- 避免与流行名称发生名称争议,例如: @的最佳/猫。
- Improving internal discovery of Organization-supported packages (they're all in a single namespace!)
- 改进组织支持的包的内部发现(它们都在一个命名空间中!)
Hope that helps.
希望有所帮助。