Git Product home page Git Product logo

md-links's Introduction

md-links

School project that develop a Command line tool used to extract links from texts in markdown format and checks whether each link is alive (200 OK) or dead.

Installation

To add the module to your project, run:

npm install CitlalliDMG/md-links

To install the command line tool globally, run:

npm install -g CitlalliDMG/md-links

If you get a permission error please try using sudo (you may need admin permissions depending on your node installation).

# using `sudo` (only if the previous step failed)
sudo npm i -g CitlalliDMG/md-links

Also if you want, you can install using a local clone.

# clone from your own fork
git clone [email protected]:<your-username>/md-links.git
cd md-links
npm install
npm link

If the above command fails, try using sudo:

sudo npm link

Uninstalling

To remove the module globally, run:

npm uninstall -g CitlalliDMG/md-links

API

mdLinks(path, options)

Given a string path containing markdown formatted text extract all of the http links and check if they're alive or dead.

Parameters:

  • path string containing the Absolute or relative path to the file or directory.
  • options optional options object containing any of the following optional fields:
    • validate value that determines if you want to validate the links found in the file (boolean type, in CLI false by default).
    • stats value that determines if you want to calculate the stats of the links found in the file (boolean type, in CLI false by default).

Command Line Tool

The command line tool by default expects one argument the file name (will soon accept directories) or either of the options --version or --help.

If a file name is supplied, the command line optionally takes 1 or 2 extra arguments (--validate or --stats)

If neither of the arguments is supplied, the tool displays the usage information.

Examples

Check links from a local markdown file

mdLinks + path

Check links from a local markdown file and validate

mdLinks + path

Check links from a local markdown file and stats

mdLinks + path

Check links from a local markdown folder (recursive)

Soon

Usage


  Usage: mdLinks <path-to-file> [options]

  Options:

    --version           display version number of the package

    --validate          makes an HTTP request to find out if the link works or not,
                        showing in the output the path to the md file, the URL tested,
                        the response of the request and the status

    --stats             display basic statistics of the links found in the file (total and number of unique links)

    --help              output usage information

Module

Available soon

Testing

npm test

Checklist

General

That is installable directly from the Github repository

  • npm install --global <github-user>/md-links

README.md

  • A board (project) with the backlog for the implementation of the library.
  • Technical documentation of the library.
  • Library use and installation guide.

API mdLinks(path, opts)

  • The module exports a function with the expected interface (API).
  • Implement support for individual file
  • Implement support for directories
  • Implement options.validate

CLI

  • It exposes executable md-links in the path (configured in package.json)
  • Runs without errors / expected output
  • Implement --validate
  • Implement --stats
  • Implement --validate --stats

Tests

  • Unit tests cover a minimum of 70% of statements, functions, lines, and branches.
  • Pass tests (and linters) (npm test).

md-links's People

Contributors

citlallidmg avatar developervilchez avatar danielalab avatar diegovelezg avatar fabianbravoa avatar nerdale avatar

Watchers

James Cloos avatar

md-links's Issues

Configurar TDD

  • Decidir que testear
  • Establecer que es lo que se espera
  • Redactar test con Jest

Comentarios Md finales

@CitlalliDMG.
Hola Citlalli, espero que estés muy bien.
Te dejaré unos comentarios sobre tu proyecto:

  • Tu Readme está bien documentado, solo creo que si lo pondrás en inglés tus commits y código debe estar por completo en ese idioma.
  • El código en ingles, comentado en el mismo iioma, muy bien por eso!
  • Al darle el comando "npm install CitlalliDMG/md-links" se queda pensando y no pasa de ahí.
  • Lo hice con "sudo npm install CitlalliDMG/md-links" y tampoco. Me interesa verlo en acción. Si pudiéramos checarlo sería genial.
  • La estructura y limpieza de tu código es muy buena.

Citlalli, si hay algo en lo que te podamos apoyar, no dudes en avisarnos. Recuerda que el equipo de formación estamos para ustedes. Sigue con esa gran actitud y compromiso! 😃

CLI

  • Crea funcionalidad que permite correr mdLinks como comando desde la línea de comandos
  • Crea funcionalidad que permita mostrar en consola los argumentos y opciones requeridas para ejecutar mdLinks
  • Crea funcionalidad que analiza los argumentos y opciones ingresadas por el usuario y verifica su validez

Función llamadas

Hacer una función que haga una llamada a cada uno de los links encontrados con la función extractor y guarde la respuesta obtenida

  • Nota: Es necesario entender promesas y asincronía para poder retornar información del fetch

Feedback Markdown

Buen proyecto implementando linea de comandos,tu feedback es:

  • Muy chido el ecmascript 7 en cuanto a las condiciones sin el if.

  • Se pudiera aún acortar tmás tus lineas de código como en tus funciones checkPathToAbsolute, checkIfPathExist, readMarkdownFile, etc en donde sólo retornas inmediatamente.

  • Muy bien tu solución del markdown, ya te faltaba poquito, ya que falta implementar promises o async

-Cómo buena práctica sería bueno mandar a llamar tu función de mdLinks en el cli.js con sus argumentos correspondientes.

  • Muy buen readme, claro y conciso para instalar la librería ^^

Todo lo demás de manera particular está muy bien.

Felicidades por tu proyecto! 🥇

Investigar temas relevantes para el proyecto

  • Volver a leer el README.md
  • ¿Qué es un módulo en npm?
  • ¿Qué es una librería?
  • ¿Es lo mismo librería que módulo?
  • ¿Qué es un archivo CLI?
  • ¿Cómo funciona el require?
  • ¿Cómo se crea un paquete para npm?
  • ¿Qué es la sincronía en Js?
  • ¿Qué son las rutas relativas y absolutas?

Función archivo

  • Hacer una función que verifique si en el directorio especificado hay archivos .md
  • Hacer que regrese las rutas a cada uno de los archivos .md encontrados

Función ruta

  • Hacer funcionalidad que verifique si el string recibido como path es una ruta absoluta
  • Hacer funcionalidad que convierta un path en absoluto si se recibe como relativo
  • Hacer una función que verifique si el string recibido es una ruta existente

Función extractor

Hacer una función que a partir de un archivo .md recibido cree una lista de los links encontrados dentro del mismo

Feedback markdown Q

Lo primero que resalta en tu proyecto es el README:

La documentación de tu proyecto está completa y no deja dudas en cuanto a la instalación o descripción de tu producto lo que creo que le da un plus (aún más).

Ahora en cuanto a código:

No encuentro necesario comentar cada línea de tu código. Es más que suficiente tener nombres descriptivos. Como nos dijo el vato de Google (que no recuerdo su nombre), es mejor y más productivo tener los nombres de tus variables bastante descriptivos y reservar los comentarios para documentar el Por Qué -optaste por seguir ese camino, usar ese método etc- y no el Para Qué.
La modularización de tu código mediante las funciones es genial y demuestra un gran avance en cuanto a la abstracción de los conceptos además de que se nota una clara intención de querer mantenerlas puras.

En general puedo decir que es uno de los proyectos más completos además de que no fue -tan- difícil poder comprender tu lógica, eso sí, lo único que hizo falta fue hacer uso de promesas, pero estoy segura que en tu próximo proyecto tendrás ese alcance! :D

Función verificador

  • Hacer una función que con base en la respuesta a las llamadas hechas imprima en consola si fue valida o no la llamada.
  • En caso de ser una llamada valida, mostrar los primeros 50 caracteres del link

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.