Have ideas to improve npm?Join in the discussion! Β»

    @wangkaixuan/intro-npm

    1.4.0Β β€’Β PublicΒ β€’Β Published

    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

    1. local test: npm install path(absolutly)
    2. publish: npm publish --access public

    usage

    1. npm install @wangkaixuan/intro-npm

    2. const myadd = require('@wangkaixuan/intro-npm');
      console.log('myadd:', myadd.add(1, 1));
    3. 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 use-intro-npm1@1.0.0 No description
    npm WARN use-intro-npm1@1.0.0 No repository field.
    
    + @wangkaixuan/intro-npm@1.3.0
    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

    refer

    1. Creating and publishing scoped public packages

    Install

    npm i @wangkaixuan/intro-npm

    DownloadsWeekly Downloads

    1

    Version

    1.4.0

    License

    MIT

    Unpacked Size

    3.78 kB

    Total Files

    5

    Last publish

    Collaborators

    • avatar