Simple email application for Android. Original source code: https://framagit.org/dystopia-project/simple-email
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
7.6 KiB

  1. <!doctype html>
  2. <html>
  3. <title>npm-scope</title>
  4. <meta charset="utf-8">
  5. <link rel="stylesheet" type="text/css" href="../../static/style.css">
  6. <link rel="canonical" href="https://www.npmjs.org/doc/misc/npm-scope.html">
  7. <script async=true src="../../static/toc.js"></script>
  8. <body>
  9. <div id="wrapper">
  10. <h1><a href="../misc/npm-scope.html">npm-scope</a></h1> <p>Scoped packages</p>
  11. <h2 id="description">DESCRIPTION</h2>
  12. <p>All npm packages have a name. Some package names also have a scope. A scope
  13. follows the usual rules for package names (URL-safe characters, no leading dots
  14. or underscores). When used in package names, scopes are preceded by an <code>@</code> symbol
  15. and followed by a slash, e.g.</p>
  16. <pre><code>@somescope/somepackagename</code></pre><p>Scopes are a way of grouping related packages together, and also affect a few
  17. things about the way npm treats the package.</p>
  18. <p>Each npm user/organization has their own scope, and only you can add packages
  19. in your scope. This means you don&#39;t have to worry about someone taking your
  20. package name ahead of you. Thus it is also a good way to signal official packages
  21. for organizations.</p>
  22. <p>Scoped packages can be published and installed as of <code>npm@2</code> and are supported
  23. by the primary npm registry. Unscoped packages can depend on scoped packages and
  24. vice versa. The npm client is backwards-compatible with unscoped registries,
  25. so it can be used to work with scoped and unscoped registries at the same time.</p>
  26. <h2 id="installing-scoped-packages">Installing scoped packages</h2>
  27. <p>Scoped packages are installed to a sub-folder of the regular installation
  28. folder, e.g. if your other packages are installed in <code>node_modules/packagename</code>,
  29. scoped modules will be installed in <code>node_modules/@myorg/packagename</code>. The scope
  30. folder (<code>@myorg</code>) is simply the name of the scope preceded by an <code>@</code> symbol, and can
  31. contain any number of scoped packages.</p>
  32. <p>A scoped package is installed by referencing it by name, preceded by an
  33. <code>@</code> symbol, in <code>npm install</code>:</p>
  34. <pre><code>npm install @myorg/mypackage</code></pre><p>Or in <code>package.json</code>:</p>
  35. <pre><code>&quot;dependencies&quot;: {
  36. &quot;@myorg/mypackage&quot;: &quot;^1.3.0&quot;
  37. }</code></pre><p>Note that if the <code>@</code> symbol is omitted, in either case, npm will instead attempt to
  38. install from GitHub; see <code><a href="../cli/npm-install.html">npm-install(1)</a></code>.</p>
  39. <h2 id="requiring-scoped-packages">Requiring scoped packages</h2>
  40. <p>Because scoped packages are installed into a scope folder, you have to
  41. include the name of the scope when requiring them in your code, e.g.</p>
  42. <pre><code>require(&#39;@myorg/mypackage&#39;)</code></pre><p>There is nothing special about the way Node treats scope folders. This
  43. simply requires the <code>mypackage</code> module in the folder named <code>@myorg</code>.</p>
  44. <h2 id="publishing-scoped-packages">Publishing scoped packages</h2>
  45. <p>Scoped packages can be published from the CLI as of <code>npm@2</code> and can be
  46. published to any registry that supports them, including the primary npm
  47. registry.</p>
  48. <p>(As of 2015-04-19, and with npm 2.0 or better, the primary npm registry
  49. <strong>does</strong> support scoped packages.)</p>
  50. <p>If you wish, you may associate a scope with a registry; see below.</p>
  51. <h3 id="publishing-public-scoped-packages-to-the-primary-npm-registry">Publishing public scoped packages to the primary npm registry</h3>
  52. <p>To publish a public scoped package, you must specify <code>--access public</code> with
  53. the initial publication. This will publish the package and set access
  54. to <code>public</code> as if you had run <code>npm access public</code> after publishing.</p>
  55. <h3 id="publishing-private-scoped-packages-to-the-npm-registry">Publishing private scoped packages to the npm registry</h3>
  56. <p>To publish a private scoped package to the npm registry, you must have
  57. an <a href="https://docs.npmjs.com/private-modules/intro">npm Private Modules</a>
  58. account.</p>
  59. <p>You can then publish the module with <code>npm publish</code> or <code>npm publish
  60. --access restricted</code>, and it will be present in the npm registry, with
  61. restricted access. You can then change the access permissions, if
  62. desired, with <code>npm access</code> or on the npmjs.com website.</p>
  63. <h2 id="associating-a-scope-with-a-registry">Associating a scope with a registry</h2>
  64. <p>Scopes can be associated with a separate registry. This allows you to
  65. seamlessly use a mix of packages from the primary npm registry and one or more
  66. private registries, such as npm Enterprise.</p>
  67. <p>You can associate a scope with a registry at login, e.g.</p>
  68. <pre><code>npm login --registry=http://reg.example.com --scope=@myco</code></pre><p>Scopes have a many-to-one relationship with registries: one registry can
  69. host multiple scopes, but a scope only ever points to one registry.</p>
  70. <p>You can also associate a scope with a registry using <code>npm config</code>:</p>
  71. <pre><code>npm config set @myco:registry http://reg.example.com</code></pre><p>Once a scope is associated with a registry, any <code>npm install</code> for a package
  72. with that scope will request packages from that registry instead. Any
  73. <code>npm publish</code> for a package name that contains the scope will be published to
  74. that registry instead.</p>
  75. <h2 id="see-also">SEE ALSO</h2>
  76. <ul>
  77. <li><a href="../cli/npm-install.html">npm-install(1)</a></li>
  78. <li><a href="../cli/npm-publish.html">npm-publish(1)</a></li>
  79. <li><a href="../cli/npm-access.html">npm-access(1)</a></li>
  80. <li><a href="../misc/npm-registry.html">npm-registry(7)</a></li>
  81. </ul>
  82. </div>
  83. <table border=0 cellspacing=0 cellpadding=0 id=npmlogo>
  84. <tr><td style="width:180px;height:10px;background:rgb(237,127,127)" colspan=18>&nbsp;</td></tr>
  85. <tr><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)">&nbsp;</td><td style="width:40px;height:10px;background:#fff" colspan=4>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4>&nbsp;</td><td style="width:40px;height:10px;background:#fff" colspan=4>&nbsp;</td><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)">&nbsp;</td><td colspan=6 style="width:60px;height:10px;background:#fff">&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4>&nbsp;</td></tr>
  86. <tr><td colspan=2 style="width:20px;height:30px;background:#fff" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:#fff" rowspan=3>&nbsp;</td><td style="width:20px;height:10px;background:#fff" rowspan=4 colspan=2>&nbsp;</td><td style="width:10px;height:20px;background:rgb(237,127,127)" rowspan=2>&nbsp;</td><td style="width:10px;height:10px;background:#fff" rowspan=3>&nbsp;</td><td style="width:20px;height:10px;background:#fff" rowspan=3 colspan=2>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:#fff" rowspan=3>&nbsp;</td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3>&nbsp;</td></tr>
  87. <tr><td style="width:10px;height:10px;background:#fff" rowspan=2>&nbsp;</td></tr>
  88. <tr><td style="width:10px;height:10px;background:#fff">&nbsp;</td></tr>
  89. <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6>&nbsp;</td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)">&nbsp;</td></tr>
  90. <tr><td colspan=5 style="width:50px;height:10px;background:#fff">&nbsp;</td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4>&nbsp;</td><td style="width:90px;height:10px;background:#fff" colspan=9>&nbsp;</td></tr>
  91. </table>
  92. <p id="footer">npm-scope &mdash; npm@6.4.1</p>