KarlaMacedo / md-links

Proyecto 5 - En este proyecto el usuario puede encontrar una librería disponible en npm con la cual puede buscar archivos .md, buscar links que se encuentren dentro de éstos, validarlos por HTTP request y obtener estadísticas sobre éstos.
https://www.npmjs.com/package/karlamacedo-md-links
1 stars 0 forks source link
axios babel chalk circle-ci eslint-airbnb fs github-projects issues jest js jsdom marked nodejs npm path

Markdown Links

Index


1. Introduction

Markdown is a lightweight markup language widely used among developers. It is used in many platforms that handle plain text (such as GitHub, forums, blogs, etc.), and it is common to find multiple files in that format in any type of repository (starting with the traditional README.md file).

These Markdown files often contain links that are sometimes broken or no longer valid, which greatly diminishes the value of the shared information.

Within an open-source community, we have been tasked with creating a tool using Node.js that reads and analyzes Markdown files, verifies the links they contain, and reports some statistics.

2. Project Summary

This project is a command-line tool (CLI) / JavaScript library that is executed using Node.js.

Node.js is a runtime environment for JavaScript built on the Chrome V8 JavaScript engine. It allows running JavaScript in the operating system environment, either on a machine or a server, opening the doors to interact with the system itself, files, networks, etc.

3. General Considerations

4. Usage Instructions

Installation

To install the library, run the following command in the terminal:

npm install karlamacedo-md-links

Usage in the Terminal

To use the library through the terminal, use the following command:

npx karlamacedo-md-links <path-to-file> [options]

Replace <path-to-file> with the path (absolute or relative) of the file or directory you want to process. Replace [options] with the action you want to perform:

Options

If no options are provided (npx karlamacedo-md-links <path-to-file>), it will return the .md files found and the links contained within each file. If no links or files are found, a notification will be displayed.

response

If only the --valid option is provided (npx karlamacedo-md-links <path-to-file> --valid), it will return the .md files found, the links contained within each file, and validate them through an HTTP request. It will also return their status codes, displaying an "OK ✔" notification for successful requests and a "Fail ✘" notification otherwise. If no links or files are found, a notification will be displayed.

response

If only the --stats option is provided (npx karlamacedo-md-links <path-to-file> --stats), it will return the .md files found and the links contained within each file. If no links or files are found, a notification will be displayed. Additionally, it will display a statistics section showing the total number of links found in the search and how many of them are unique.

response

If the --valid and --stats options are provided (npx karlamacedo-md-links <path-to-file> --valid --stats), it will return the .md files found, the links contained within each file, validate them through an HTTP request, and display their status codes with an "OK ✔" notification for successful requests and a "Fail ✘" notification otherwise. If no links or files are found, a notification will be displayed. Additionally, it will display a statistics section showing the total number of links found in the search, how many of them are unique, how many were successful in the HTTP request, and how many were not.

response

Usage as an API

To use the library as an API (Application Programming Interface), follow these steps:

Opciones

If no options are provided (node cli.js <path-to-file>), it will return the .md files found and the links contained within each file. If no links or files are found, a notification will be displayed.

response

If only the --valid option is provided (node cli.js <path-to-file> --valid), it will return the .md files found, the links contained within each file, and validate them through an HTTP request. It will also return their status codes, displaying an "OK ✔" notification for successful requests and a "Fail ✘" notification otherwise. If no links or files are found, a notification will be displayed.

response

If only the --stats option is provided (node cli.js <path-to-file> --stats), it will return the .md files found and the links contained within each file. If no links or files are found, a notification will be displayed. Additionally, it will display a statistics section showing the total number of links found in the search and how many of them are unique.

response

If the --valid and --stats options are provided (node cli.js <path-to-file> --valid --stats), it will return the .md files found, the links contained within each file, validate them through an HTTP request, and display their status codes with an "OK ✔" notification for successful requests and a "Fail ✘" notification otherwise. If no links or files are found, a notification will be displayed. Additionally, it will display a statistics section showing the total number of links found in the search, how many of them are unique, how many had successful HTTP requests, and how many had failed requests.

response

5. Project Planning

This project was planned using GitHub Projects, creating issues, labels, and milestones.

planning

A flowchart was also previously created as a guide for the development of the logic of the project.

diagrama

6. Learning Objectives

JavaScript

Node.js

Version Control (Git y GitHub)

HTTP