lirantal / nodejs-cli-apps-best-practices Goto Github PK
View Code? Open in Web Editor NEWThe largest Node.js CLI Apps best practices list ✨
License: Creative Commons Attribution Share Alike 4.0 International
The largest Node.js CLI Apps best practices list ✨
License: Creative Commons Attribution Share Alike 4.0 International
I was about to open a PR that adds notes specific to distinguishing STDOUT from STDERR. However, the concept would have been dispersed among many other items:
As the topic of stdout vs stderr is big enough, I think it probably warrants its own line-item.
Key point: STDERR is for more than just error output. It's for all diagnostic output.
I want to translate the Chinese version.
Would be nice if someone would like to contribute a section on CLIs supporting help.
My points to make would be:
-h
and --help
to provide helpThis all should be embodied in one item about supporting help.
Document other resources like:
as additional educational material
10 Appendix: CLI educational resources
It is recommended to use Crowdin to improve the efficiency of project internationalization.
What are your thoughts around organizing the layouts a bit differently?
Some feedback I received is around:
This could be a new topic. The CLI application should remove it's internal configuration files (if there are any) when uninstalling the package. We can use NPM's pre
or post
uninstall script for this purpose.
As written in https://docs.npmjs.com/cli/v8/using-npm/scripts#a-note-on-a-lack-of-npm-uninstall-scripts the uninstall lifecycle scripts are not implemented and will not function since v7. Due to that chapter 2.3 Cleanup configuration files
chapter should be removed as it does not work since npm v7
According to https://nodejs.org/en/about/releases/
Hello, I am someone who found this post very appealing. Thank you for sharing such a wonderful piece.
I am interested in translating this content into Korean and wanted to inquire about it.
Thank you.
up-to-date Node.js runtime features that should be addressed throughout this guide are:
import { styleText } from 'node:util'
I think this is an important practice to keep the published package size small. Sometimes package authors accidentally include their development configuration, spec files, etc. part of the published package. I've done it once 🙆♂️
For more details on this topic - https://medium.com/@nodejs/publishing-npm-packages-c4c615a0fc6b
Hi everyone,
GitLocalize is giving me some trouble after a few weeks of inactivity in Spanish translations. It seems it isn´t maintaining the structure of the .md file.
Has anyone had this problem? How have they solved it?
My idea to solve it would be in this case not to work via GitLocalize and create a PR.
What do you think about change the import type of the modules from "require" to "import"? The new versions of NodeJS we can already work like this.
For example: https://github.com/lirantal/nodejs-cli-apps-best-practices#31-accept-input-as-stdin
import readline from "readline";
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question("What do you think of Node.js? ", answer => {
// TODO: Log the answer in a database
console.log(`Thank you for your valuable feedback: ${answer}`);
rl.close();
});
As a counterpoint to the suggestion with 'empathetic CLIs', having a CLI that may suddenly block for STDIN is not friendly or empathetic. It does not account for an invocation that be run un-attended (ie on a build server, or scheduled cron job). Indeed, I would go so far as to say that any single CLI command should always be interactive or never be interactive; not sometimes.
It's also worth noting that an invocation that has STDOUT piped to its STDIN will start consuming that STDIN as if from the user if it attempts to switch to interactive mode based on some ambiguity. That is almost certainly not what the author nor user wants.
VHS - helpful CLI automation that is useful for demos or screen recording of the terminal https://github.com/charmbracelet/vhs
Looking for someone who would be interesting to contribute a new item on proper version usage.
My take on it would be around:
Further info that can be elaborated in details: A program may choose to show its version when being run in order to easily surface the version to users. Example of this is Yarn.
Add the following badge to the repository which refers to the Crowdin translation service this repository uses:
[![Crowdin](https://badges.crowdin.net/nodejs-cli-apps-best-practices/localized.svg)](https://crowdin.com/project/nodejs-cli-apps-best-practices)
Feature a new section to include popular tools to build CLIs, such as:
9 Appendix: CLI Frameworks
[EDIT] Removing the storage aspect of this issue, as it's been already addressed, so the focus will only be on authentication.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.