@wangkaixuan/intro-npm
v1.4.0
Published
My first public npm package project. Simplest NPM package (no dependencies on third-party packages)
Downloads
1
Maintainers
Readme
My first public npm package project. Simplest NPM package (no dependencies on third-party packages.
project structure:
➜ intro-npm git:(main) ✗ tree
.
├── LICENSE
├── README.md
├── index.js // source code
├── index.test.js // test file
└── package.json // used by npm or yarn
0 directories, 5 files
dev
- local test:
npm install path(absolutly)
- publish:
npm publish --access public
usage
npm install @wangkaixuan/intro-npm
const myadd = require('@wangkaixuan/intro-npm'); console.log('myadd:', myadd.add(1, 1));
simple usage
➜ use-intro-npm1 npm init --yes
Wrote to /Users/wangkaixuan/playground/use-intro-npm1/package.json:
{
"name": "use-intro-npm1",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
➜ use-intro-npm1 npm install @wangkaixuan/intro-npm
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
+ @wangkaixuan/[email protected]
added 1 package from 1 contributor and audited 1 package in 2.471s
found 0 vulnerabilities
➜ use-intro-npm1 touch index.js
➜ use-intro-npm1 ls
index.js node_modules package-lock.json package.json
➜ use-intro-npm1 cat index.js
const myadd = require('@wangkaixuan/intro-npm');
console.log('myadd:', myadd.add(1, 1));
➜ use-intro-npm1 node index.js
myadd: 2