It can be used as a Chrome extension, Firefox extension, command line scanner, Grunt Plugin, etc. It can be installed by using the following command:
$ npm install -g retire
Two-factor Authentication is used to ensure security for new repositories. It ensures that work is done on the latest version by reinstalling dependencies. The latest version is pushed to npm. It can be installed using the following command:
$ npm install --global np
Its various features include publishing code from any branch, creating subdirectories for publishing, skipping cleaning up code and testing, etc. Configuration of np can be done globally and locally by CLI flags in the config files of np like np-config.js and no-config.json.
$ npm init @eslint/config
After installing it using the above command, a .eslintrc file is generated with a set of rules with error definitions and their respective conditions. ESLint allows all the dependencies to be defined in the .lock file of the user and doesn’t use a .lock file of its own. It is also highly secure.
Shelljs is an environment where UNIX commands can be executed on any operating system over the Node.js API. Shelljs is portable, and it supports third-party plugins too. The various commands that can be used are echo, exec, chmod, pushd, popd, cd, cat, etc. The following command can be used to install Shelljs.
$ npm install [-g] shelljs
It has been tested in various projects like Firefox, JSHint, ESLint, Zepto, etc. Local import of Shelljs packages is preferred over global imports. It can also be configured as silent, fatal, verbose, etc.
Omelette provides a template for auto-completion of code for Node and Deno projects. It uses super easy API and supports Async API and Tree API too. A sample code snippet for implementing Omelette is shown below:
After importing Omelette, an Omelette object has to be created. Then, various functions for auto-completion of code like, setupShellInitFile() for setup, cleanupShellInitFile() for cleanup can be called on the omelette object for code auto-completion. It also supports the use of Lambda functions for creating complex template literal APIs.
Prettier is used for formatting code. It helps in giving tab spaces, keeps track of the maximum content in one line, and ensures proper indentation within conditional and loop statements. It converts code into a neat and readable format. For example:
It can run in CI environments, Integrated Development Environments (IDEs), etc.
jscpd/core has the ability to detect code duplication in various environments, and jspd/tokenizer is used for tokenizing the program source code. Apart from these, many other packages like html-reporter, badge-reporter, leveldb-store, etc. The command for installing jscpd is:
$ npm install -g jscpd
jscpd is used by GitHub Super Linter, Code-Inspector, Mega-Linter, Codacy, etc. Each of them use jscpd for a different purpose. They use it for natural language processing, line aggregators, code analysis, etc.
$ npm install -g vtop
Various themes and color codes can be used to make the GUI more attractive as per the requirements. Various keyboard shortcuts like “u” for an update, “g” to go to the top process of the list, “G” to move to the end of the list, “dd” to kill processes belonging to a particular grp, etc. can be used.
$ npm install standard --global
After installing it, you can run it over a file/ code snippet using the “standard” command in the command line interface. All the dependencies of Standardjs can be added by defining “standard: “*” in the dependency object of the package.json file.
It can also be installed as a plugin for various text editors like Visual Studio Code, Sublime Text, Atom, Vim, Brackets, etc. Node.js, Expressjs, npm, Brave, and GoDaddy use Standardjs to satisfy their business requirements.
NodeJsScan is a Static Security code Scanner for Node.js applications. It informs about an application’s security status via an interactive UI. It can be integrated with various applications like Slack for alerts/notifications, Email alerts by configuring SMTP settings in the settings.py file of NodeJsScan, CI/CD pipeline, etc. It also helps in building docker images.
It logs errors, information, and warning messages. A detailed description of the error, like the reason for its occurrence, its severity, the line numbers where the errors occurred, the number of files scanned and issues found, etc. Graphs and charts are also plotted for better readability and analysis.
$ npm install trash
Trash is an API that takes input and options as function parameters when the trash() function is invoked. The input could be a string or a string array. Options could be an object. The trash function returns a promise. Different commands are used in different operating systems. macOS-trash is used in MacOs, XDG Spec in Linux, and recycle-bin in Windows.
$ npm install xo --save-dev
Issues can be fixed automatically using the $xo –fix command. Xo can be configured by using the xo property in the package.json file. It can be installed as a plugin for various editors like Vim, Visual Studio Code, Atom, Sublime Text, Emacs, etc.
diff2html stands for “diff parser and pretty HTML generator”. It highlights the changes in the code of the current version as compared to the previous version. It helps developers easily identify and understand what changes have been made. It does this using color codes.
It does this by highlighting line-by-line and side-by-side changes. It highlights the code syntax changes and groups similar lines together to easily track code changes. The command to install diff2html is as below:
$ npm install diff2html
It is also integrated with the command line. Some projects using diff2html are Jenkins, Codacy, Ungit, git-explorer, code-annotation, etc.
Chalk is a Node.js module that helps in formatting and styling code. It also helps in creating and adding color themes to text. It is an expressive API, and its performance is excellent. It nests styles and has no dependencies. The usage of Chalk can be seen in the code snippet below:
import chalk from 'chalk';
chalk.level defines the colors that are supported at each level. ‘0’ indicates that all colors are disabled, ‘1’ indicates basic color support, ‘2’ indicates 256 color support, and ‘3’ indicates Truecolor support. The various style modifiers to format text supported by chalk are inverse, hidden, visible, strike through, bold, reset, italic, underline, overline, dim, etc.
$ npm i -g npkill
All the node modules specified in the path with the npkill command will be deleted. However, one has to be careful while deleting the node modules because it is irreversible. If the modules of any active project get deleted in the process, the files get corrupted, and the node modules have to be installed again.
fkill-cli is an open-source and interactive command line tool that kills Linux processes and ports. It was developed using Node.js. It is simple, free, secure, and cross-platform compatible. It works on Windows, Linux, and macOS. The command used to install fkill-cli is:
$ npm install --global fkill-cli
The process name and ID are required to kill the process. “-f” forces the operation to execute while the “-v” command displays process arguments. The fkill API takes inputs and options as its arguments and returns a promise object. Some options are force, silent, ignoreCase, tree, and forceAfterTimeout.
Localtunnel is a platform that enables sharing web services from an external environment with a computer’s local environment without altering the system’s DNS and firewall settings.
The requests are proxied by Localtunnel and are passed to the locally deployed server after assigning it with a publicly accessible URL. The command used to install Localtunnel is as follows:
$ npm install -g localtunnel
It is secure and uses HTTPS requests. These APIs can be used to test webhooks. UI can be tested in cloud browsers using Localtunnel.
Inquirer.js is an interactive command line user interface for Node.js applications. It eases the process of finding errors, parsing input, validating answers, and managing hierarchical prompts. It uses native ESM modules for the implementation of its functionalities. The command used to install Inquirer.js is:
$ npm install --save inquirer
Various methods used include prompt, registerPrompt, createPromptModule, etc. prompt() is a function that takes question and answer as inputs and returns a promise when invoked.
Question is an object which is a hashed version of question-related values like type, message, default, choices, filter, etc. The answer key-value object pair contains the hashed version of client responses. The key is the question property, while the value can contain confirm, input, number, rawlist, etc.
http-server is a command line static http-server. It is simple and doesn’t require any configurations. It consists of 2 files: namely, index.html and 404.html. index.html is the default file that would be rendered on requests. 404.html is rendered when a file is not found. The command used to install http-server is as shown below:
$ npm install --global http-server
Node.js packages like Retire.js, Localtunnel, Xo, Inquirer.js, Shelljs, fpkill, NodeJsScan, Prettier, etc. can be used for formatting code, ensuring security, highlighting code changes, deleting heavy and unwanted node modules, etc. This helps developers debug, write and manage their code efficiently.
Python is a very versatile language, and Python developers often have to work with a variety of files and get information stored in them for processing. One popular file format you’re bound to encounter as a Python developer is the Portable Document Format popularly known as PDF