]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/man/man7/npm-scope.7
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / man / man7 / npm-scope.7
1 .TH "NPM\-SCOPE" "7" "October 2016" "" ""
2 .SH "NAME"
3 \fBnpm-scope\fR \- Scoped packages
4 .SH DESCRIPTION
5 .P
6 All npm packages have a name\. Some package names also have a scope\. A scope
7 follows the usual rules for package names (url\-safe characters, no leading dots
8 or underscores)\. When used in package names, preceded by an @\-symbol and
9 followed by a slash, e\.g\.
10 .P
11 .RS 2
12 .nf
13 @somescope/somepackagename
14 .fi
15 .RE
16 .P
17 Scopes are a way of grouping related packages together, and also affect a few
18 things about the way npm treats the package\.
19 .P
20 Scoped packages can be published and installed as of \fBnpm@2\fP and are supported
21 by the primary npm registry\. The npm client is backwards\-compatible with
22 un\-scoped registries, so it can be used to work with scoped and un\-scoped
23 registries at the same time\.
24 .SH Installing scoped packages
25 .P
26 Scoped packages are installed to a sub\-folder of the regular installation
27 folder, e\.g\. if your other packages are installed in \fBnode_modules/packagename\fP,
28 scoped modules will be in \fBnode_modules/@myorg/packagename\fP\|\. The scope folder
29 (\fB@myorg\fP) is simply the name of the scope preceded by an @\-symbol, and can
30 contain any number of scoped packages\.
31 .P
32 A scoped package is installed by referencing it by name, preceded by an
33 @\-symbol, in \fBnpm install\fP:
34 .P
35 .RS 2
36 .nf
37 npm install @myorg/mypackage
38 .fi
39 .RE
40 .P
41 Or in \fBpackage\.json\fP:
42 .P
43 .RS 2
44 .nf
45 "dependencies": {
46   "@myorg/mypackage": "^1\.3\.0"
47 }
48 .fi
49 .RE
50 .P
51 Note that if the @\-symbol is omitted in either case npm will instead attempt to
52 install from GitHub; see npm help \fBnpm\-install\fP\|\.
53 .SH Requiring scoped packages
54 .P
55 Because scoped packages are installed into a scope folder, you have to
56 include the name of the scope when requiring them in your code, e\.g\.
57 .P
58 .RS 2
59 .nf
60 require('@myorg/mypackage')
61 .fi
62 .RE
63 .P
64 There is nothing special about the way Node treats scope folders, this is
65 just specifying to require the module \fBmypackage\fP in the folder called \fB@myorg\fP\|\.
66 .SH Publishing scoped packages
67 .P
68 Scoped packages can be published from the CLI as of \fBnpm@2\fP and can be
69 published to any registry that supports them, including the primary npm
70 registry\.
71 .P
72 (As of 2015\-04\-19, and with npm 2\.0 or newer, the primary npm registry \fBdoes\fR
73 support scoped packages)
74 .P
75 If you wish, you may associate a scope with a registry; see below\.
76 .SS Publishing public scoped packages to the primary npm registry
77 .P
78 To publish a public scoped package, you must specify \fB\-\-access public\fP with
79 the initial publication\.  This will publish the package and set access
80 to \fBpublic\fP as if you had run \fBnpm access public\fP after publishing\.
81 .SS Publishing private scoped packages to the npm registry
82 .P
83 To publish a private scoped package to the npm registry, you must have
84 an npm Private Modules \fIhttps://www\.npmjs\.com/private\-modules\fR
85 account\.
86 .P
87 You can then publish the module with \fBnpm publish\fP or \fBnpm publish
88 \-\-access restricted\fP, and it will be present in the npm registry, with
89 restricted access\.  You can then change the access permissions, if
90 desired, with \fBnpm access\fP or on the npmjs\.com website\.
91 .SH Associating a scope with a registry
92 .P
93 Scopes can be associated with a separate registry\. This allows you to
94 seamlessly use a mix of packages from the primary npm registry and one or more
95 private registries, such as npm Enterprise\.
96 .P
97 You can associate a scope with a registry at login, e\.g\.
98 .P
99 .RS 2
100 .nf
101 npm login \-\-registry=http://reg\.example\.com \-\-scope=@myco
102 .fi
103 .RE
104 .P
105 Scopes have a many\-to\-one relationship with registries: one registry can
106 host multiple scopes, but a scope only ever points to one registry\.
107 .P
108 You can also associate a scope with a registry using \fBnpm config\fP:
109 .P
110 .RS 2
111 .nf
112 npm config set @myco:registry http://reg\.example\.com
113 .fi
114 .RE
115 .P
116 Once a scope is associated with a registry, any \fBnpm install\fP for a package
117 with that scope will request packages from that registry instead\. Any
118 \fBnpm publish\fP for a package name that contains the scope will be published to
119 that registry instead\.
120 .SH SEE ALSO
121 .RS 0
122 .IP \(bu 2
123 npm help install
124 .IP \(bu 2
125 npm help publish
126 .IP \(bu 2
127 npm help access
128
129 .RE
130