{"_id":"@aamirkhanchanna/simple-calculater","name":"@aamirkhanchanna/simple-calculater","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@aamirkhanchanna/simple-calculater","version":"1.0.0","description":"A simple calculater with Typescripts. Node.js and Inquirer","main":"index.js","type":"module","publishConfig":{"access":"public"},"bin":{"simple-calculater":"index.js"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"MIT","dependencies":{"inquirer":"^9.2.16"},"devDependencies":{"@types/inquirer":"^9.0.7"},"_id":"@aamirkhanchanna/simple-calculater@1.0.0","_nodeVersion":"20.11.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-N/heYg9vx/bKkMGkHfQHxabfm2n4/Io2Nk6ENzmw5U1MFo+lKPrE8X8zaEH4J13nE8Nqw9FCWSgGZmDTZaeXWA==","shasum":"4994eaf90cddef586ce03b1fa4fc8b968b7e8d29","tarball":"https://registry.npmjs.org/@aamirkhanchanna/simple-calculater/-/simple-calculater-1.0.0.tgz","fileCount":5,"unpackedSize":17637,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCJ6OmE3RJYK1gc8ruxi6Eixj7lPbyn/yex3wcs6BilVAIgbVEWQZcAyNzvCoWqx/hwltEFLFWiaS/Guz5xQyposwM="}]},"_npmUser":{"name":"aamirkhanchanna","email":"aamirkhanchanna@yahoo.com"},"directories":{},"maintainers":[{"name":"aamirkhanchanna","email":"aamirkhanchanna@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/simple-calculater_1.0.0_1711530404617_0.6412143523091414"},"_hasShrinkwrap":false}},"time":{"created":"2024-03-27T09:06:44.516Z","1.0.0":"2024-03-27T09:06:44.776Z","modified":"2024-03-27T09:06:45.511Z"},"maintainers":[{"name":"aamirkhanchanna","email":"aamirkhanchanna@yahoo.com"}],"description":"A simple calculater with Typescripts. Node.js and Inquirer","license":"MIT","readme":"### **Calculator Practice**\n\nThis 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.\n\n#### **Prerequisites**\n\n- Node.js installed on your system\n- Basic understanding of TypeScript and npm\n\n#### **Steps to Set Up the Project**\n\n1. **Initialize a New npm Project**\n   - Run the following command to create a new npm project:\n     ```\n     npm init -y\n     ```\n\n2. **Generate a TypeScript Configuration File**\n   - Initialize TypeScript in your project:\n     ```\n     tsc --init\n     ```\n\n3. **Install the Inquirer Library**\n   - Add `inquirer` to your project for collecting user input:\n     ```\n     npm i inquirer\n     ```\n\n4. **Install Types for Inquirer**\n   - Since we are using TypeScript, install the types for `inquirer`:\n     ```\n     npm i --save-dev @types/inquirer\n     ```\n\n5. **Configure TypeScript (tsconfig.json)**\n   - Edit your `tsconfig.json` to include the following configurations:\n     ```json\n     {\n       \"compilerOptions\": {\n         \"target\": \"ES2022\",\n         \"module\": \"NodeNext\",\n         \"moduleResolution\": \"NodeNext\"\n       }\n     }\n     ```\n\n6. **Update package.json Configuration**\n   - Modify these lines of code in your `package.json`:\n     ```json\n     {\n      \"name\": \"@your-npm-usernmae/calculator\", \n       \"main\": \"index.js\",\n       \"type\": \"module\",\n       \"publishConfig\": {\n        \"access\": \"public\"\n      },\n       \"bin\": {\n        \"calculator\": \"./index.js\"\n      },\n     }\n     ```\n\n7. **Implement the CLI Calculator**\n   - Start your calculator code in `index.ts`. At the top of this file, include the shebang:\n  ```\n   #! /usr/bin/env node\n  ```\n\n1. **Compile TypeScript to JavaScript**\n   - Compile your TypeScript file (`index.ts`) to JavaScript using:\n     ```\n     tsc\n     ```\n\n2. **Run Your Project**\n   - Execute your CLI calculator with:\n     ```\n     node index.js\n     ```\n\n#### **Publishing Your Project on npm**\n\nTo make your CLI calculator accessible to others, follow these steps to publish your project on npm:\n\n1. **Log in to npm**\n   - If you haven't already, you will need to create an npm account [npmjs.com](npmjs.com). Once you have your account set up, log in to npm from your command line:\n     ```\n     npm login\n     ```\n   - Enter your username, password, and email address as prompted.\n\n2. **Publish Your Package**\n   - Publish your package to npm, ensuring it is available publicly:\n     ```\n     npm publish\n     ```\n\n#### **Conclusion**\n\nBy 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.\n","readmeFilename":"README.md"}