npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

electron-jsx

v0.0.5

Published

Real Time transpiler for Electron Apps file-based

Downloads

15

Readme

Electron-jsx

Real time Transpiler for Electron Apps file-based

Code in React, use Node modules

Quick Test That's not looks pretty?

New Features!

Hot Loading

Quick Test

Error handling

Quick Test

✋ Before continuing, read this:

This is a BETA version, recently is more stable, but you may can found bugs, if you found any bug and/or you want to say how to fix something, you can go to https://github.com/mdjfs/electron-jsx/issues to contribute me and community! (:

How electron-jsx works

  • Watch all files in specified directory (react sources)
  • Detect changes in files for transpile with Babel (and more things) to reload the App
  • File Based, no server, no web pack. Just babel transpiler
  • The imports ES6 are transpiled to require functions

Then, how can I use it? (Quick Start)

You need work with .jsx files and tell to package where is the folder with all sources to be transpiled, something like that:

Structure

^ ^ ^ Example of the structure of your app

In your electron.js file you have a basic Electron Application:

./src/electron.js :

const { app, BrowserWindow } = require("electron");
const path = require("path");
let win;

function createWindow() {
  win = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      nodeIntegration: true, // very important !!
    },
  });
  win.loadFile(path.join(__dirname, "./index.html"));
  win.on("close", (_) => (win = null));
}

app.on("ready", createWindow);
app.on("activate", !win ? createWindow : undefined);
app.on("window-all-closed", app.quit);

That will create a window and shows the html file, but it's very important if the window can use node integration

Then, in your HTML file specify where are the app files (in the example is "./react-app"), Also you need tell about where is your entry point file

<script>
require("electron-jsx")(__dirname, {
    reactDir: "./react-app",
})
</script>
<script react-src="./react-app/index.jsx">

Install the packages:

npm init
npm install --global electron
npm install react react-dom electron-jsx

Then, run the command:

electron ./src/electron.js

You should automatically see a react-builds folder with all your files transpiled inside And if all its ok, you can see the react app in the electron window... (Be patient, things don't always work out the first time)

Features (v0.0.5)

  • Hot Loading
  • Error handling
  • Fixed bugs in listeners of directories
  • Fixed bugs about imports more than one stylesheet
  • Fixed other bugs

Issues Detected

  • I not recommend use stylesheet files, instead of that stylesheets with libraries like Material-UI is prefered. You can use your own stylesheets, but may you will see any bugs with the transpiler/stylesheet

If you detect more issues, please tell about that in the github repository !

I hope I have helped someone 😊