0.0.1 • Published 2 years ago

with-recording v0.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

lesson-4

npm

Create an npm package with our super test helper!

Workflow

  1. To initialize package type npm init and follow the commands.
  2. Create an index.js file exporting an example function:
export function example() {
  return 5;
}
  1. Try to run code with node index.js. What's wrong?
  2. Convert export to old syntax. (New one is still not fully supported across packages).
function example() { // don't use the export keyword. It's not supported in node.
  return 5;
}

module.exports = { // to export function use module.exports rather than export keyword
  example
};
  1. Publicate the package.