These node open source tools are worth having (Part 1)

Time:2021-12-3

These node open source tools are worth having (Part 1)

The inspiration of this article is that a big man in the community shares a GitHub project that takes months to maintainawesome-nodejs。 Maybe you will have a doubt like me. There is actually a similar awesome nodejs library on GitHub, and it is up to 41K ⭐, What is the significance of re maintaining a new? After in-depth comparison, there are differences in essence. One is the finer granularity of the classification system, followed by more friendly translation maintenance for Chinese, including the collection of some excellent open source libraries in China. Finally, I personally think that through my own combing, I can also do a better review and summary

These node open source tools are worth having (Part 1)

By readingawesome-nodejsFor the collection of the library, I extracted some of the categories with more application scenarios, and shared the tools with you through the application scenarios involved in the classification

1.Git

1.1 application scenario 1: to realize the eslint verification and the standard verification of commit information before git submission?

You can use the following tools:

  • husky-Modern local git hooks make operation easier
  • pre-commit-Automatically install the GIT pre commit script in your git repository, which runs your NPM test on pre commit.
  • yorkieIn particular, the rewritten yorkie is actually fork husky, which makes the GIT hook simple (used in Vue cli 3x)

1.2 application scenario 2: how to pull git warehouse through node? (can be used to develop scaffolding)

You can use the following tools:

  • download-git-repo-Download and extract git warehouse (support GitHub, gitlab and bitbucket).

1.3 application scenario 3: how to view the GIT flow chart at the terminal?

You can use the following tools:

  • gitgraph-Draw git flow chart in terminal (support browser and react).

1.4 others

  • git-url-parse-High level git parsing.
  • giturl-Convert git links to Web links.

2. Environment

2.1 application scenario 1: how to write different environment variables according to different environments?

You can use the following tools:

  • cross-env-For the setting of cross platform environment script, you can use a simple command (setting environment variables) without worrying about the platform setting or using environment variables.
  • dotenv-Load the environment variables for the nodejs project from the. Env file.
  • vue-cli --mode-You can override the default mode for the command line by passing the — mode option parameter

3.NPM

3.1 application scenario 1: how to switch between different NPM sources?

You can use the following tools:

  • nrm-Quickly switch to NPM registration service providers, such as NPM, cnpm, NJ, Taobao, etc. you can also switch to the internal NPM source
  • pnpm-Compared with yarn, NPM saves a lot of hard disk space proportional to projects and dependencies

3.2 application scenario 2: how to read package.json information?

You can use the following tools:

  • read-pkg-up -Read the latest package.json file.
  • node-pkginfo -A simple way to read properties from package. JSON.

3.3 application scenario 3: how to view the updated version allowed by the current package.json dependency

You can use the following tools:

  • npm-check-updates -The current package.json depends on the allowed updated version.

These node open source tools are worth having (Part 1)

3.4 application scenario 4: how to run multiple NPM scripts at the same time

Usually we have to run multiple scripts. Maybe sonpm run build:css && npm run build:jsThe setting will be longer&To splice

You can use the following tools:

  • npm-run-all-Command line tool to run multiple NPM scripts at the same time (parallel or serial)

NPM run all provides three commands, namely NPM run all run-s run-p. the latter two are short for NPM run all with parameters, corresponding to serial and parallel respectively. It also supports matching delimiters to simplify script configuration

Or use

  • concurrently-Execute commands in parallel, similar to NPM run watch JS & NPM run watch less, but better. (but it can only be parallel)

3.5 application scenario 5: how to check unused dependencies of NPM module.

You can use the following tools:

  • depcheck-Check your NPM module for unused dependencies.
    These node open source tools are worth having (Part 1)

3.6 others:

  • npminstall-Make NPM install faster and easier. Cnpm is used by default
  • semver-The JavaScript semantic version number parser used by NPM.

For NPM package online query, a sharp weapon is recommendednpm.devtool.tech
These node open source tools are worth having (Part 1)

4. Document generation

4.1 application scenario 1: how to automatically generate API documents?

  • docsify-API document generator.
  • jsdoc -API document generator, similar to Javadoc or phpdoc.

5. Log tool

5.1 application scenario 1: how to implement log classification?

  • log4js-nodey-Different from the logging library of Java log4j.
  • consola -Elegant node.js and browser logging library.
  • winston -Multi transport asynchronous logging library (old)

6. Command line tools

6.1 application scenario 1: how to parse command line input?

Our first impression isprocess.argvSo, is there any other tool to parse?

You can use the following tools:

  • minimist -Command line parameter parsing engine
  • arg-Simple parameter analysis
  • nopt -Node / NPM parameter analysis

6.2 application scenario 2: how to enable users to interact with the command line?

These node open source tools are worth having (Part 1)

You can use the following tools:

  • Inquirer.js -A collection of general-purpose interactive command-line tools.
  • prompts -Lightweight, beautiful, user-friendly interactive command line prompts.
  • Enquirer -Stylish cli tips that are user-friendly, intuitive, and easy to create.

6.3 application scenario 3: how to display the progress bar in the command line?

These node open source tools are worth having (Part 1)
You can use the following tools:

  • progress-Flexible ASCII progress bar for node.js.
  • progress-estimator -Record the progress bar and estimate the time required to complete the commitment.

6.4 application scenario 4: how to execute multitasking on the command line?

These node open source tools are worth having (Part 1)

You can use the following tools:

  • listr-Command line task list.

6.5 application scenario 5: how to “add icing on the cake” to the command line?

These node open source tools are worth having (Part 1)

You can use the following tools:

  • chalk-Command line string style beautification tool.
  • ora -Elegant command line loading effect.
  • colors.js-Gets the color of the node.js console.
  • qrcode-terminal-Displays the QR code on the command line.
  • treeify-Print the JavaScript object beautifully as a tree.
  • kleur-The fastest node.js library that formats command-line text using ANSI colors.

7. Encryption and decryption

Generally, for the sake of project security, we usually encrypt the account password through MD5, AES, SHA1 and SM. What libraries are available in the open source community for our convenience?

You can use the following tools:

  • crypto-js-JavaScript encryption standard library. Most algorithms supported
  • node-rsa-Bcrypt in node.js.
  • node-md5-A JavaScript function for hashing messages using MD5.
  • aes-js -Pure JavaScript implementation of AES.
  • sm-crypto-JavaScript implementation of state secret SM2, SM3 and SM4.
  • sha.js -Use streaming Sha hashes in pure JavaScript.

8. Static website generation & blog

Isn’t one click website delicious ~ quickly build your own blog website based on the node system, which is worth owning and can also be displayed as a component library document

These node open source tools are worth having (Part 1)

You can use the following tools:

  • hexo -A fast, simple and powerful blog framework using node.js.
  • vuepress -A minimalist Vue static website generation tool. (based on nuxt SSR)
  • netlify-cms-Git based static website generation tool.
  • vitepress -Vite & vue.js static website generation tool.

9. Data verification tool

Data verification, the closest thing to us is the verification of form data. In the component libraries we usually use, such as element and iView, we will see that an open-source verification tool is usedasync-validator , is there anything else?

You can use the following tools:

  • validator.js -String check library.
  • joi-Object schema description language and verifier based on JavaScript objects.
  • async-validator -Asynchronous verification.
  • ajv -Fastest JSON schema validator
  • superstruct -Validate data in JavaScript and typescript in a simple and composable way.

10. Parsing tools

10.1 application scenario 1: how to parse markdown?

You can use the following tools:

  • marked -Markdown parser and compiler, designed to improve speed.
  • remark-Markdown processing tool.
  • markdown-it -Extension & syntax plug-in that supports 100% universal markdown tag parsing.

10.2 application scenario 2: how to parse CSV?

You can use the following tools:

  • PapaParse -The fast and powerful CSV (separated text) parser can handle large files and malformed input gracefully.
  • node-csv-A full-featured CSV parser with a simple API is tested for large data sets.
  • csv-parser-A streaming CSV parser designed to be faster than anyone else.

10.3 application scenario 3: how to parse XML?

You can use the following tools:

  • xml2js -A converter that converts XML to JavaScript objects.
  • fast-xml-parser-With validation & parsing XML.

last

If you like this library, give it to the authorhuaize2020A star warehouse address: awesome nodejs
I saw a paragraph yesterday and wanted to share it with you

For a R & D test routine:

  • 1. The first thing to start work is to plan today’s work content arrangement (it is recommended to have a clear todolist and sort it according to priority)
  • 2. Confirm the workload and upstream and downstream related risks (if you rely on others, can you provide them on time); If there is any risk, expose it as soon as possible
  • 3. Pay attention to the time cost. Not everything is worth doing with all your time, and distinguish the primary and secondary relationship
  • 4. Coordinate the task, clarify the boundary responsibility, don’t ignore anyone, and timely synchronize it to relevant people after completing the task
  • 5. Summarize experience in time, precipitate technical output, realize capacity reuse, and do not start from scratch for the same type of tasks to avoid repeated work

Hello, I’m tree sauce. Please have a drink. Remember three times in a row

1. After reading, remember to praise it. It’s motivated

2., pay attention to the interesting things at the front of the official account, and talk with you about the interesting things at the front end.

3. The article is included in GitHub frontendthings. Thank star ✨