Read: Class 01( Node Ecosystem, TDD, CI CD) - Goorob-401-advanced-javascript/amman-javascript-401d1 GitHub Wiki

  • Node.js : is an open source framework for writing Javascript on your operating system.

Node was developed to enable developers to easily write code with asynchronous input and output (I/O).

  • package.json : file is used to describe and configure a Node.js package.

    • name and version are two fields required by a package.json

    • init or npm init -y : automate the creation of package.json file .

    • dependencies : includes package external dependencies listed by name and version .

    • devDependencies : the external package that only needed in development .

    • scripts field : where keys can be associated with unix commands .

    • CLI : command line utility .

  • Semantic Versioning "semver" : describes how to manage version changes to a software product

    • formats the version number using a MAJOR.MINOR.PATCH construct.

       * MAJOR :  we should change it version when you make incompatible API changes
      
       * MINOR :  when we add functionality in a backwards-compatible manner, or a PATCH version when we make backwards-compatible bug fixes.
      
  • CommonJS modules :

    • These modules enables developers with the ability to organize their code into small files that define specific functionality that help to built large and scalable application

    • module.exports :anything that is assigned to module.exports can be accessible to another module through invoking the require function

    • require : function expects a relative or absolute path to the module being imported .

  • Test Driven Development (TDD) : methodology for writing code,expects developers to create small and testable features

    • advantages : speed up development time ,validate the integrity of new code , help developers understand their goals.

    • TDD is broken down into three steps :

      • Red : Write tests that will run your code and check for expected behaviors. At this point, if you run your tests, they should fail (red).

      • Green : Write code to pass the specifications of your tests, without making it perfect. If you succeed, when you run your tests, they should pass (green).

      • Refactor : Refactor your code for speed, memory optimization, and most importantly readability. Your tests should still pass after this step.

      • Running Tests :

        • Install jest and eslint as dependencies
        • Install a valid .eslintrc.json file in your project
        • Edit your package.json to include test commands (see below)
        • Run npm test in your project to run your test suite
        • Run npm run test-watch in your project to continually test your code as you develop.
  • Continuous Integration (CI) : process of regularly merging individually developed features of code into a shared repository as frequently as they are made

  • Continuous Delivery(CD) : the process of deploying software in short cycles by ensuring that software can be deployed at any time

CD pairs very will with advanced CI setups that help ensure the core product is always a stable code base.

  • Github Actions : hosted and distributed continuous integration service (CI) that is most often used to build and test software projects hosted on GitHub