Loading topic
wcl, a small tool that counts lines and words in a file.2 min readasync/await. You also need Node.js, npm, and a terminal. The project will use Node.js ESM, which is Node's modern module system.2 min readasync/await, and how to run Node.js commands in a terminal. You also need a TypeScript project with a tsconfig.json that compiles src into dist.2 min readasync and await, and how to run an npm script. It also assumes Node.js and TypeScript are installed. The goal is to turn raw command-line input into values your program can use safely.2 min readasync/await. You should also be comfortable running Node.js commands from a terminal and reading a basic package.json.2 min readasync/await, and how node:util parseArgs produces option values and positional arguments. This chapter focuses on turning that loosely shaped input into a small, safe command model.2 min readasync and await, Node.js, npm, and how to run commands in a terminal. This chapter focuses on output from a command-line program. You will use the same ideas when the program later reads files or reports errors.2 min readasync and await, Node.js modules, and how a command-line program receives arguments. The previous chapter established the entry point and argument parsing. Here, you will connect a file argument to asynchronous file reading.2 min readasync/await, package.json, and how to run Node.js commands in a terminal. This chapter builds on an entry point that has already parsed command-line arguments.2 min readasync/await, Node.js, and how the earlier chapters configured a TypeScript project for Node.js ESM.2 min readasync/await, and how the project compiles with tsc. This chapter assumes that the command-line project already uses Node.js ESM and has a src directory.2 min readpackage.json, and terminal commands. The project already contains a TypeScript entry point at src/cli.ts, a compiler configuration, and a build script. The goal here is to make the compiled program run as a command named wcl.2 min readasync and await, Node.js streams, and how the earlier chapters’ countText function counts lines and words. This chapter adds standard input to the command-line tool.2 min read