A command-line tool to learn more about me directly in your terminal ;)
To run the script, fire up your preferred terminal and use the following command: (Make sure you have node installed first)
npx hello-arvind-cli
Creating your own npx introduction command can be a fun and creative way to share information about yourself. Here's a guide on how to make your own npx introduction command:
- What's npx? The npx command allows you to run Node.js-based packages without having to globally install them. So you guessed it right, we'll be creating and hosting your own package on the npm registry.
Start by creating a new project directory for your npx command. Use a meaningful name for your project:
mkdir npx-intro-command
cd npx-intro-command
Initialize your project with a package.json file
. You can do this by running:
npm init -y
Create a new file, let's say index.js
, and write the script that displays your introduction. You can include details such as your name, interests, skills, and links:
#!/usr/bin/env node
console.log(`
π Hello there! I'm [Your Name].
π [A brief description of yourself and your interests.]
π» Skills: [List some of your skills or technologies you're familiar with.]
Let's connect:
π GitHub: https://github.com/[YourGitHubUsername]
π¦ Twitter: https://twitter.com/[YourTwitterHandle]
π LinkedIn: https://linkedin.com/in/[YourLinkedInProfile]
Happy coding!
`);
Make sure your script is executable by running:
chmod +x index.js
Also, include bin
in your package.json
:
"bin": {
"npx-intro-command": "./index.js"
},
- Run
npm link
(A command that allows you to create a symbolic link between a local package and a global installation. This is particularly useful during development when you want to test a package before publishing it.) - Try running it using
npx package-name
- If it works, unlink the package using
npm unlink
If everything looks good, you can publish your script to npm. Make sure you have an npm account and are logged in:
- Login to npm from your terminal using
npm login
- Publish your package to registry using the command
npm publish
And that's it, you're done! I'd love to see the intros you come up with. Feel free to share them on Twitter @ArvindParekh_21.