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

packaged-app-reactjs

v0.1.4

Published

Packaged React.js App

Downloads

2

Readme

packaged-app-reactjs

This is a simple React.js-based web application packaged as an NPM module.

Rationale

BEGIN: TRIGGER WARNING

I am not a fan of Meteor.js. While I think that some of the concepts behind it are interesting, I strongly dislike how prescriptive it is and how it aims to build it's own ecosystem rather than taking the best-of-breed things that already exist in JavaScript / Node.js land.

END: TRIGGER WARNING

However, there are some interesting projects built with Meteor, like Rocket.Chat.

Rocket.Chat allows you to extend it with Meteor packages. I wanted to have a loosely coupled way to write web applications that can be embedded (client-side) into Rocket.Chat. That is to say that I wanted to essentially "deploy" a client-side web app using React.js into Rocket.Chat.

Since Meteor packages allow you to use NPM dependencies my idea was to try and create a React.js application as an NPM module. That way, I could develop the app independently of Meteor and Rocket.Chat, but deploy it inside Rocket.Chat. This repository is my best-effort at creating a React.js app to prove out that concept.

See also (the associated Meteor package): rocketchat-flyin-packaged-app-reactjs

How it works

If you import or require this package once you install it, you'll see two objects exported by default:

  • class HelloWorld: (the React.js component)
  • function render(String elementId): a function that will look for a node in the DOM called elementId and will render the React.js app inside of it. If you're not in a DOM-environment (i.e., there is no document object in the global namespace), render will simply render the app to a string and return that string.

Otherwise, this is a pretty "standard" client-side React.js application, with a few things of note:

  1. While it pulls-in support for running the app in a standalone development environment (via devDependencies), it's not really meant to be deployed except as an NPM package.
  2. It is written in ES2015 and uses babel for compatibility.
  3. It uses webpack-hot-middleware and react-transform-hmr for hot-module reloading (in development).
  4. The main JavaScript script loaded by the application doesn't run any code to render the app. Instead, it uses an exported render function that gets invoked after the script is included. See index.html for details. To make this work, webpack was configured with a libraryTarget of this.

Getting Started

Be sure you've read the instructions for contributing.

  1. Clone the repository.

  2. Create your .env file for your environment, e.g.:

     $ echo -e "PORT=8083\nNODE_ENV=development"
  3. Run the server:

     $ npm install
     $ npm start
  4. Visit the server in your browser:

     $ open http://localhost:8083

License

See the LICENSE file.