1.1.4 • Published 7 months ago

javathon v1.1.4

Weekly downloads
1
License
MIT
Repository
-
Last release
7 months ago

Javathon

Javathon is a lightweight, powerful tool that enables developers to seamlessly execute Python and JavaScript code blocks together in a single file. By using a simple .jt file format, Javathon eliminates the need for switching between environments, making it perfect for projects that require the strengths of both languages.

Whether you’re building web applications, analyzing data, or exploring automation, Javathon makes it easier to combine the power of JavaScript and Python effortlessly.


Key Features

  • 🛠 Run Mixed Code: Write and execute Python and JavaScript in a single file.
  • Asynchronous Execution: Smoothly handles mixed-language execution with shared contexts.
  • 📦 Simple CLI Tool: Easy to install, configure, and use from anywhere on your system.

Installation

Prerequisites

  1. Ensure you have Node.js installed on your system.
  2. (Optional) Have Python installed and added to your system's PATH for Python support.

Install Javathon Globally

Use npm to install Javathon globally:

npm install -g javathon  

Getting Started

1. Create a .jt File

Write your code in a .jt file, separating Python and JavaScript code blocks.

example.jt

// JavaScript Section
console.log("Hello from JavaScript!");

<%
// Python Section
print("Hello from Python!")
%>

2. Run the .jt File

Execute your file using the javathon command:

javathon example.jt  

3. View the Output

The example above produces:

Hello from JavaScript!
Hello from Python!

Writing .jt Files

.jt files allow you to switch between Python and JavaScript seamlessly. Use the following syntax:

  • JavaScript Code: Write as plain JavaScript directly in the file.
  • Python Code: Wrap Python code in <% ... %> blocks.

Example:

// JavaScript Block
const name = "Javathon User";
console.log("Hi, " + name + "!");

<%
// Python Block
name = "Javathon User"
print(f"Hello from Python, {name}!")
%>

Advanced Example

Here’s a practical example with loops and variable sharing:

example.jt

// JavaScript Section: Define a shared variable
let numbers = [1, 2, 3];
console.log("Processing numbers in JavaScript:", numbers);

<%
// Python Section: Process the same numbers
print("Processing numbers in Python:")
for number in [1, 2, 3]:
    print(f"  -> {number}")
%>

// Back to JavaScript
console.log("Done processing numbers!");

Output:

Processing numbers in JavaScript: [1, 2, 3]
Processing numbers in Python:
  -> 1
  -> 2
  -> 3
Done processing numbers!

Development

Want to contribute or test Javathon locally? Follow these steps:

  1. Clone the repository:

    git clone https://github.com/Skosanalindo061/Javathon  
    cd javathon  
  2. Install dependencies:

    npm install  
  3. Run the tool locally:

    node src/index.js example.jt  

Troubleshooting

Common Issues

  1. Python Not Found:

  2. File Syntax Errors:

    • Ensure .jt files use valid syntax for both languages.
  3. Dependencies Missing:

    • Reinstall Javathon:
      npm install -g javathon  

Roadmap

Here’s what’s next for Javathon:

  • 🌐 Add support for more languages (e.g., Ruby, PHP).
  • 🛠 Improve error handling and debugging tools.
  • 🚀 Enhance .jt syntax with better context sharing between languages.

Contributing

Contributions are welcome! Submit issues or pull requests on GitHub.


License

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


Author

Created with passion by Lindokuhle Skosana.
Feel free to reach out with feedback, suggestions, or questions.


Quick Example

javathon example.jt  

Output:

Hello from JavaScript!
Hello from Python!

Javathon: Where Python meets JavaScript. Happy coding!

Creator

Javathon was created and is actively maintained by Lindokuhle Skosana.

1.1.1

7 months ago

1.0.2

7 months ago

1.1.0

7 months ago

1.0.1

7 months ago

1.0.9

7 months ago

1.0.8

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.1.4

7 months ago

1.0.5

7 months ago

1.1.3

7 months ago

1.0.4

7 months ago

1.1.2

7 months ago

1.0.3

7 months ago

1.0.0

9 years ago