Create a gist now

Instantly share code, notes, and snippets.

Show Notes for live coding in WDU talk at jsconf.asia (26 Nov 2016) and Vienna MegaMeetup (25 Jan 2017)
  • Let's start by creating a project

    • npm help
    • mkdir random-wombat-facts; and cd random-wombat-facts
    • npm init
      • explain each line
    • vim index.js
      • generate basic list of facts (fact1, fact2, etc)
      • console.log one of them
    • search for random array on npmjs.com
      • pick random-item
    • npm info random-item
      • to take a look at the random-item package
    • npm install random-item --save
      • compare with package.json
        • npm i random-item -S
      • compare with package.json
    • use REPL to play with random-item
      • update index.js to use random-item
    • run it on the command line
    • add start script to package.json
      • npm start to use the start script
    • add standard
      • npm install standard --save-dev
      • npm i standard -D
      • add standardize run script
        • standard
        • NOTE: DO NOT HAVE TO INSTALL STANDARD GLOBALLY
      • run npm run standardize
      • run npm run standardize -- --fix
  • Now we want to create a module that will provide a list of wombat facts

    • create new dir wombat-facts
    • run npm init --yes
    • start with fact1, fact2, fact3
    • module.export them
    • npm link
    • go back to project, npm link wombat-facts
    • require("wombat-facts")
    • return to module, replace fact1, fact2, fact3
    • go back to project, run and show it actually works with real wombat facts
    • remove link npm unlink
    • update package.json to make module scoped
    • npm publish @rockbot/wombat-facts --access=public
    • add a README
      • npm version minor -m "adds a README"
    • git push; and git push --tags
    • npm publish
    • npm unpublish
      • talk about versions, how to publish/unpublish
    • discuss semver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment