npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

calculator-4u

v1.1.1

Published

SIMPLE-CALCULATOR Calculator Practice

Downloads

4

Readme

SIMPLE-CALCULATOR Calculator Practice

This project is a Command Line Interface (CLI) calculator implemented in TypeScript, utilizing the inquirer library for handling user input. Follow the steps below to set up and run the project.

Prerequisites

• Node.js installed on your system • Basic understanding of TypeScript and npm

Steps to Set Up the Project

Initialize a New npm Project o Run the following command to create a new npm project: o npm init -y

Generate a TypeScript Configuration File o Initialize TypeScript in your project: o tsc --init

Install the Inquirer Library o Add inquirer to your project for collecting user input: o npm i inquirer

Install Types for Inquirer o Since we are using TypeScript, install the types for inquirer: o npm i --save-dev @types/inquirer

Configure TypeScript (tsconfig.json) o Edit your tsconfig.json to include the following configurations: o { o "compilerOptions": { o "target": "ES2022", o "module": "NodeNext", o "moduleResolution": "NodeNext" o } }

Update package.json Configuration o Modify these lines of code in your package.json: o { o "name": "@your-npm-usernmae/calculator", o "main": "index.js", o "type": "module", o "publishConfig": { o "access": "public" o }, o "bin": { o "calculator": "./index.js" o }, }

Implement the CLI Calculator o Start your calculator code in index.ts. At the top of this file, include the shebang: #! /usr/bin/env node

Compile TypeScript to JavaScript o Compile your TypeScript file (index.ts) to JavaScript using: o tsc

Run Your Project o Execute your CLI calculator with: o node index.js

Publishing Your Project on npm To make your CLI calculator accessible to others, follow these steps to publish your project on npm:

Log in to npm o If you haven't already, you will need to create an npm account npmjs.com. Once you have your account set up, log in to npm from your command line: o npm login o Enter your username, password, and email address as prompted.

Publish Your Package o Publish your package to npm, ensuring it is available publicly: o npm publish

Conclusion By following these steps, you will have set up a simple yet functional CLI calculator using TypeScript and the inquirer library. This project not only demonstrates basic usage of TypeScript and npm but also introduces handling user inputs in a CLI environment.