ict.ken.be

Delivering solid user friendly software solutions since the dawn of time.

npm

Categories: Nodejs

https://www.npmjs.com/

  • node -v (higher v0.10.32)
  • npm install npm -g
  • npm -v
  • npm root -g
  • npm bin -g
  • npm set init.author.name "ken"
  • npm set init.license "MIT"
  • npm init --yes
  • npm install <package_name> --save-dev
  • npm outdated
  • npm update
  • dir node_modules/.bin
  • npm run
  • npm run-script test
  • npm run test
  • npm t -s
  • npm start
  • npm stop
  • npm restart
  • npm install mocha chai --save-dev
  • npm version patch
  • npm config set mypkgname:myvar myvalue
  • npm install http-server -g  && http-server .
  • npm install -g nodemon && nodemon app.js

package.json

{
    "name": "one-word-preferred-with-dashes-and-lowercase",
    "version": "1.0.0",
    "description" : "Some blabla",
    "keywords" : [
        "npm",
        "blabla"
    ],
    "author": "Ken Van Gilbergen",
    "license": "MIT",
    "scripts": {
        "lint": "jshint *.js **/*.js",
        "watch:lint": "watch 'npm run lint' .",
        "pretest": "npm run lint",
        "test": "mocha test -u bdd -R spec",
        "posttest": "echo 'after test'",
        "watch:test": "npm run test -- -w -R min",
        "start": "node index.js",
        "stop": "echo \"really"\" && echo \"stop"\"",
        "custom": "echo 'custom'; echo 'run independent of custom'",
        "parallel": "npm run first & npm run linux",
        "parallel": "START /b 'npm run first';START /b 'npm run windows'",
        "vars": "foo $npm_package_config_myvar", 
        "varsOnWindows": "foo %npm_package_config_myvar%" 
    },
    "repository": {
        "type": "git",
        "url": "."
    },
    "engines": {
        "node": "~1.1.1",
        "npm": "~1.1.1"     
    },
    "config": {
        "myvar": "whatever"
    }
}