Homebrew RELEASE Brew.js - Make homebrew apps with JavaScript!

  • Thread starter Thread starter XorTroll
  • Start date Start date
  • Views Views 46,599
  • Replies Replies 109
  • Likes Likes 43
Brew.js - Make homebrew apps with JavaScript!

39009792


Hello everybody!
(for those who came here from the 3dJS project, this is that project's evolution)

- About this project

Brew.js consists on a number of interpreters (and I also plan to develop app makers) to develop and run JS apps, supporting plain JS and also supporting native platform functions, to develop real homebrew apps.

- API and JS source

I'm trying to add everything I can from libnx libraries. For the moment, these is the support the API has:
Switch: console printing, input detecting, graphics support (great, but a bit poor in some areas), accessing Switch's data (only a few things for the moment)...

- Support info

For the moment, only Switch is supported.
Support is planned for GBA, NDS, 3DS, GameCube, Wii and Switch.

- Using the interpreter

A project is a folder containing JS files.
The sources are loaded in alphabetical order, no matter the name they have.

Switch:
Simply download latest release and copy the "switch" folder in your SD card. Now, you can create and save your projects.
Save projects here: "sdmc:/switch/Brew.js/<yourproject>".

(no more platforms for the moment)

- Documentation and examples

You have the documentation and the examples in GitHub, or the release rar.
Switch: https://github.com/BrewJS/Switch/blob/master/README.md

- Download and repository

Current release version: 0.3
This project is open-source, hosted at a GitHub organisation: https://github.com/BrewJS
Switch: https://github.com/BrewJS/Switch/releases

Enjoy scripting!
Copyright © 2018, by XorTroll

Dude, awesome. While i am a generalist dev and can code in pretty much anything i can do more in Js than anything else as it is my everyday work tool. Just awesome. I guess this time around i will actually (finally) get involved in homebrew lol.
 
Dude, awesome. While i am a generalist dev and can code in pretty much anything i can do more in Js than anything else as it is my everyday work tool. Just awesome. I guess this time around i will actually (finally) get involved in homebrew lol.
Thank you.
In fact, my plan for the next release (beta 4) is mainly to add as many Node.js functions and elements as I can.
I'm also thinking of some extra things I could add... (maybe TypeScript or Haxe support, or C# as @exelix11 done with his project)
 
  • Like
Reactions: exelix11
Do you mind sharing how did you manage to get js running on it? Did you port a js core written in c for example?
 
Do you mind sharing how did you manage to get js running on it? Did you port a js core written in c for example?
GitHub source of Brew.js: https://github.com/BrewJS/Switch/tree/master/Interpreter/Sources/Brew.js

Duktape engine parses the JS and allows me to add C/C++ functions (and more things) to JS, so I use both things to make Brew.js API.

Here you have an example of this one: fs.pathSDMC(Path)
This is the C++ function, I store them in the same namespaces as in JS to keep it ordered:
Code:
namespace fs
{
    duk_ret_t CFUNC_pathSDMC(duk_context)
    {
        <...>
    }
}

Then, I add it to JS like this, named like that because it's an "internal" function:
Code:
__CFUNC__fs_pathSDMC(Path)

Fiinally, I store it inside the "module":
Code:
fs.pathSDMC = function(Path)
{
    return __CFUNC__fs_pathSDMC(Path);
};
 
Last edited by XorTroll,
I've tested a few times, and I'm glad to say that you can use Brew.js with TypeScript.
You have to convert TS to JS first, you can use the files I'm uploading.
The JS file can be used from any system which has Node.js, while the executable is for Windows (I think you don't need Node with it?)
Anyway, this way you can use TypeScript.
 

Attachments

  • Like
Reactions: lordelan
For the next version I'm going to remake the whole API, adding as many things as I can from some Node modules (fs, os, path, process...)

I've succeeded at adding the famous "require" function.
You can load basic modules, but the thing I'm most proud of is that importing other file's data is also possible.
It works the same way as Node does. Every element added into "module.exports" variable will be accessible from the module that "require" function returns.

I think that this version won't be just a beta release. More than 0.4, I plan to make the first stable version: 1.0
Obviously, I've just started working on it. I think it'll take me some weeks to finish it.
 
Hi everybody, i've been messing up with other projects (https://github.com/XorTroll/eNXhop), but now i'm going to focus on finishing the following release the following days.
Yay, 1.0, the first stable version, is almost ready!

Here you have some of the new (or improved) features:
- I'm making a new, easy to use documentation, hosted at a new project's website (https://brewjs.github.io, still not available)
- The module system has been remade, supporting some native and Node.js modules: fs, os, path and process from Node; stdlib and stdio from C/C++...
- I've optimized the C++ core of Brew.js, so anyone who wants to use those libs with their project. (more info soon)
- Now you use modules like Node does, using require function, and you can also import other js files like that.
- Now projects need to have a package.json file to be detected as projects. You can set this properties: name, description, author
- I've completely remade the graphics of the interpreter and the library itself, using now SDL2. The gfx module now it's named as sdl (more info soon)
- [PD] I forgot, I've added some extra examples: Title icon dumper, Music player, Simple notepad...
- [PD] I almost forgot again, I've also added audio support with the sdl module: mp3, wav, ogg and flac audio files are supported! (more info soon)

And more, more news...
I'm planning to add even more modules (there are 10 modules right now, expecting up to 15), and i'm also planning to add a pegaswitch module for the next release.
I hope I release this release any day of the following week.
Remember that Brew.js is not only planned for Switch!

After I publish some Switch releases I'll start working with a 3DS version!
 
Last edited by XorTroll,
Hi everybody, i've been messing up with other projects (https://github.com/XorTroll/eNXhop), but now i'm going to focus on finishing the following release the following days.
Yay, 1.0, the first stable version, is almost ready!

Here you have some of the new (or improved) features:
- I'm making a new, easy to use documentation, hosted at a new project's website (https://brewjs.github.io, still not available)
- The module system has been remade, supporting some native and Node.js modules: fs, os, path and process from Node; stdlib and stdio from C/C++...
- I've optimized the C++ core of Brew.js, so anyone who wants to use those libs with their project. (more info soon)
- Now you use modules like Node does, using require function, and you can also import other js files like that.
- Now projects need to have a package.json file to be detected as projects. You can set this properties: name, description, author
- I've completely remade the graphics of the interpreter and the library itself, using now SDL2. The gfx module now it's named as sdl (more info soon)
- [PD] I forgot, I've added some extra examples: Title icon dumper, Music player, Simple notepad...
- [PD] I almost forgot again, I've also added audio support with the sdl module: mp3, wav, ogg and flac audio files are supported! (more info soon)

And more, more news...
I'm planning to add even more modules (there are 10 modules right now, expecting up to 15), and i'm also planning to add a pegaswitch module for the next release.
I hope I release this release any day of the following week.
Remember that Brew.js is not only planned for Switch!

After I publish some Switch releases I'll start working with a 3DS version!

Question; would any code written using 0.3, possibly break in 1.0?

Looking forward to new release, thanks
 
Question; would any code written using 0.3, possibly break in 1.0?

Looking forward to new release, thanks
If you mean using examples from current version on the version i'm now working on, of course, because the module system now works differently, plus graphics and many other modules have been completely remade. I'll remake the examples and also add new ones, but i'm almost sure it wouldn't work

--------------------- MERGED ---------------------------

Especially the jump from 0.3 to 1.0 is the longest one, this is the biggest release for the moment
 
Last edited by XorTroll, , Reason: Add Discord info
Brew.js 1.0 is ready to use! Enjoy scripting! https://github.com/BrewJS/Switch/releases/1.0
You have the changelog there, with examples and binaries!

I really recommend you joining our Discord server (https://discord.gg/eP9MrVP), because I'm everyday on Discord posting doubts or ideas about Brew.js!
Since this isn't as much recognized here as it should be maybe you should write down some very dummy like steps on how to do simple stuff (hello world or image dia show) with this from the very beginning to the homebrew that's being pushed to the SD.
 
After running the .nro via hbmenu... Black screen shows for 3 seconds, then crashes with error asking to press Power button and restart

Tested on Switch 5.1.0 Firmware;
SDFiles 4.1 - Firmware tested, CFW and LayeredFS
SDFiles 5.0 - Firmware tested, CFW and LayeredFS

Payload tested:
Payload-LayeredHekate.bin
hekate-ctcaer_3.0.bin

Other .nros work like NX Shell and Edizon with no crashes
 
After running the .nro via hbmenu... Black screen shows for 3 seconds, then crashes with error asking to press Power button and restart

Tested on Switch 5.1.0 Firmware;
SDFiles 4.1 - Firmware tested, CFW and LayeredFS
SDFiles 5.0 - Firmware tested, CFW and LayeredFS

Payload tested:
Payload-LayeredHekate.bin
hekate-ctcaer_3.0.bin

Other .nros work like NX Shell and Edizon with no crashes
Anyone who has the same error? It could be some special case, so anyone who has this error please quote this!
 
Brew.js - Make homebrew apps with JavaScript!

39009792


Check out Brew.js's website for documentation and info: https://brewjs.github.io
I really recommend you joining our Discord server (https://discord.gg/eP9MrVP), because I'm everyday on Discord posting doubts or ideas about Brew.js


- About this project

Brew.js consists on a number of interpreters (and I also plan to develop app makers) to develop and run JavaScript apps, supporting plain JavaScript and also supporting native platform functions, to develop real homebrew apps.

- API and JavaScript source

For support and info, check the ChangeLog of the latest version ()
- Support info

IMPORTANT - AFAIK, Brew.js doesn't work on Yuzu.
(for those who care, the reason is that Yuzu fails when accessing RomFS items of the ROM)

For the moment, only Switch is supported.
Support is planned for GBA, NDS, 3DS, GameCube, Wii and Switch.

- Using the interpreter

A project is a folder containing JavaScript files, plus a package.json package file. (This file is required!)
The sources are loaded in alphabetical order, no matter the name they have.

Switch:
Simply download latest release and copy the "switch" folder in your SD card. Now, you can create and save your projects.
Save projects here: sdmc:/switch/Brew.js/<yourproject>

(no more platforms for the moment)

- Documentation and examples

You have the documentation on Brew.js's website. (see above)
You have JavaScript examples at GitHub, attached to the latest release!

- Download and repository

Current release version: 1.0
This project is open-source, hosted at a GitHub organisation: https://github.com/BrewJS
Switch: https://github.com/BrewJS/Switch/releases/latest

Enjoy scripting!

Copyright © 2018, by XorTroll
Minecraft k thx
 
Good news, I'll try again porting v8 to use it instead of duktape. V8 is Google's JS engine, and the one Chrome and Node use. This means porting Node itself would be even easier, and more likely. (Can you imagine it? npm and node running on our switch...)
I'll start working on it tomorrow.
 
  • Like
Reactions: DBA and lordelan

Site & Scene News

Popular threads in this forum