Npm (software): Difference between revisions

 
(4 intermediate revisions by the same user not shown)
Line 2: Line 2:


==Usage==
==Usage==
<pre>
# Install packages from package.json
npm install
# Install versioned packages from package-lock.json
npm ci
</pre>


==package.json==
==package.json==
{{hidden | Example package.json |
<pre>
<pre>
{
{
Line 39: Line 46:


</pre>
</pre>
}}


* <code>scripts</code> contains JS commands you can run with <code>npm run</code>
* <code>scripts</code> contains JS commands you can run with <code>npm run</code>
Line 53: Line 61:
#* For publishing the most important are: name, version, description, main, module, author, repository, license, files, homepage.
#* For publishing the most important are: name, version, description, main, module, author, repository, license, files, homepage.
# Test your package.
# Test your package.
#* Run your own tests using `npm run test`.
#* Run your own tests using <code>npm run test</code>.
#* Install to another package using `npm install [dir]`.
#* Install to another package using `npm install [dir]`.
# Upload to npm
# Version and upload to npm
#: <pre>npm publish --access public</pre>
#: <pre>npm version [major|minor|patch]
#:: npm publish --access public</pre>


==Resources==
==Resources==
* [[https://zellwk.com/blog/publish-to-npm/ https://zellwk.com/blog/publish-to-npm/ zellwk publish to npm]
* [https://zellwk.com/blog/publish-to-npm/ https://zellwk.com/blog/publish-to-npm/ zellwk publish to npm]