npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

martimunoz-mdl

v0.1.3

Published

<br><img src="https://github.com/martinaemunoz/DEV007-md-links/raw/main/img/banner-md.png" style= width:80%>

Downloads

2

Readme

Markdown Links

Index


1. About the Library

Markdown stands out as a lightweight markup language highly favored within the developer community. It finds widespread use across various platforms that handle plain text, including GitHub, forums, and blogs. This format has become a staple in repositories, with the quintessential README.md file often starting the collection. In the realm of these Markdown files, hyperlinks play a crucial role. However, these links frequently encounter issues, ranging from being broken to no longer functioning. This situation significantly diminishes the value of the shared information.

In response to this challenge within the open-source community, a proposal emerged to develop a Node.js tool. This tool aims to read and interpret Markdown-formatted files, systematically verifying the links they contain and generating informative statistics.

md-links

2. Summary

This project is a command-line tool (CLI) as well as a .js library that runs using Node.js.

Node.js serves as a runtime environment for JavaScript, leveraging the power of Chrome's V8 JavaScript engine. This unique foundation empowers us to execute JavaScript code directly within the operating system's context, whether on a personal computer or a server. This flexibility unlocks a realm of possibilities, enabling seamless interaction with system resources, files, networks, and more.

Both the library and its accompanying CLI rely on external dependencies, including modules like 'path', 'FS', 'Axios' for HTTP client functionality, and 'Chalk' for terminal string styling. These components were crafted using JavaScript, specifically designed to operate seamlessly within the Node.js environment. The development and testing phases were facilitated by tools such as Babel, Eslint, and Jest.

3. Flowchart

Flowchart that was used for project development.

4. User guide

1) As a JavaScript API

Installation

In order to use the library as an API, follow these steps:

  1. Fork the GitHub Repository.

  2. Open your terminal and use the cd command to go to the folder where you want to save the project.

  3. Run the following command:

    git clone https://github.com/martinaemunoz/DEV007-md-links.git
  4. Open the folder you chose on your code editor software.

  5. Open the terminal and you can start using the API.

How to use

Run the following command in your terminal:

 node cli.js <path> [options]
  

The 'path' parameter represents the location of the file or directory, and it can be specified as either an absolute or relative path. Additionally, you have the option to include supplementary actions through the 'options' parameter. It's important to note that specifying options is not obligatory, and the application will function properly even if only the path is given. Possible options include '--validate' (or '--v'), '--stats' (or '--s'), or a combination of both.

2) As a CLI (Command Line Interface)

Installation

To use as a command line interface, open your terminal and run the following command:

npm i martimunoz-mdl

Once installed, the command-line interface (CLI) is executed within the terminal using the following command:

npx martimunoz-mdl <path> [options]

The path represents the file or directory's route (which can be either an absolute or relative path), and options refer to the extra actions you wish to execute. While options are not obligatory, the application remains functional with only a path supplied. Potential options include: --validate, --stats, or a combination of both.

5. Output showcase

Retrieves links without options:

Validates links:

Shows stats:

Shows validation and stats:

Shows error if path is invalid:

Shows error if no links were found:

6. Unit testing

Tests cover 89.36% of statements, 83.33% of branches, 81.25% of functions and 92.1% of lines. Jest was employed for conducting the tests. For more information on the results you can check the image below:

7. Checklist

General

  • [x] Can be installed with npm install --global <github-user>/md-links

README.md

  • [x] Backlog board for the implementation.
  • [x] Technical documentation.
  • [x] Installation and usage guide.

API mdLinks(path, opts)

  • [x] The module exports a function with the expected API.
  • [x] Individual file support implementation
  • [x] Folder support implementation
  • [x] Implementation of options.validate

CLI

  • [x] Displays excutable md-links in the path (added in package.json)
  • [x] It runs without errors / with the expected output
  • [x] Implementation of --validate
  • [x] Implementation of --stats

Tests

  • [x] Unit test coverage of at least 70% of statements, functions, lines and branches.
  • [x] Tests passed (including linters) (npm test).