hinjs-cli

0.3.0 • Public • Published

HinJS CLI 🇮🇳 ↔️ 📝

Write JavaScript using simple Hindi keywords!

HinJS is an experimental programming language concept that acts as a superset of JavaScript. It allows developers to write code using Hindi keywords (rakho, kaam, agar, likho, etc.) in .hjs files, which are then transpiled into standard, executable JavaScript (.js) files.

The goal is to make coding feel more intuitive and accessible for Hindi speakers, especially those new to programming, or just for fun!

🤔 Why HinJS?

Accessibility: Lowers the initial barrier for Hindi speakers learning to code.

Fun: Provides a novel and potentially entertaining way to write familiar JavaScript logic.

Experimentation: Explores the idea of culturally adapted programming language syntax.

Disclaimer: HinJS is currently experimental. While it covers many basic JavaScript keywords, complex JS features or edge cases might not be fully supported or behave exactly as expected. It relies on a preprocessing step and Babel transformations.

✨ Features

Transpiles .hjs source files to standard .js.

Replaces core JavaScript keywords with simple Hindi equivalents.

Supports single file compilation (hinjs input.hjs).

Supports directory compilation (hinjs src -d dist).

Generates JavaScript source maps (.js.map) for easier debugging.

Installable via npm.

🚀 Installation

You can install HinJS CLI globally or locally in your project.

Global Installation (recommended for trying it out):

npm install -g hinjs-cli

Now you can use the hinjs command anywhere.

Local Installation (recommended for projects):

cd your-project/ npm install --save-dev hinjs-cli

Or using Yarn:

cd your-project/ yarn add --dev hinjs-cli

When installed locally, you can run it via npx hinjs or add it to your package.json scripts.

💻 Usage

The hinjs command transpiles .hjs files or directories into .js.

  1. Compile a Single File:

hinjs path/to/your/file.hjs

Example: hinjs app.hjs creates app.js and app.js.map.

  1. Compile Single File to Specific Output:

hinjs input.hjs -o output/bundle.js

OR

hinjs input.hjs --out-file output/bundle.js

  1. Compile an Entire Directory:

hinjs ./src -d ./dist

OR

hinjs ./path/to/source --out-dir ./path/to/output

This will find all .hjs files in the source directory, transpile them, and recreate the same directory structure in the output directory with .js files.

  1. Get Help:

hinjs --help

Example package.json Script:

{ "name": "my-hinjs-project", "version": "1.0.0", "scripts": { "build": "hinjs ./src -d ./dist", "start": "npm run build && node ./dist/main.js" }, "devDependencies": { "hinjs-cli": "^0.1.0" } }

Now you can run npm run build to compile your project.

📝 Example HinJS Code

Input (example.hjs):

// example.hjs using simple Hindi words sthir greeting = "Namaste Duniya"; rakho score = 80;

kaam calculateGrade(s) { agar (s > 90) { lautao "A"; } warna agar (s > 75) { lautao "B"; } warna { lautao "C"; } }

likho(greeting); likho("Grade:", calculateGrade(score));

rakho count = 0; dohrao (count < 3) { // Translates to while loop likho("Ginti:", count); count = count + 1; }

koshish { likho("Sab theek hai."); } pakdo (error) { likho("Gadbad:", error.message); }

Command:

hinjs example.hjs

Output (example.js):

const greeting = "Namaste Duniya"; let score = 80;

function calculateGrade(s) { if (s > 90) { return "A"; } else if (s > 75) { return "B"; } else { return "C"; } }

console.log(greeting); console.log("Grade:", calculateGrade(score));

let count = 0; while (count < 3) { console.log("Ginti:", count); count = count + 1; }

try { console.log("Sab theek hai."); } catch (error) { console.log("Gadbad:", error.message); }

🔑 Keyword Mapping

HinJS replaces standard JavaScript keywords with Hindi equivalents:

🤝 Contributing

This is an experimental project! Contributions, bug reports, and suggestions are welcome. Please feel free to open an issue or submit a pull request on the GitHub Repository.

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.


Before Saving:

  1. Replace Placeholders: Update npm badge links and GitHub repository details.

  2. Create a LICENSE file: If using MIT, include a license file.

  3. Commit: Add README.md and LICENSE to your repository.

This README provides a solid foundation for explaining your project to others.

Package Sidebar

Install

npm i hinjs-cli

Weekly Downloads

3

Version

0.3.0

License

MIT

Unpacked Size

19.6 kB

Total Files

5

Last publish

Collaborators

  • waitominute