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

generator-coffee-react

v0.2.1

Published

A simple project using create-react-app, coffeescript, and a custom version of react-hyperscript-helpers.

Downloads

6

Readme

generator-coffee-react NPM version Build Status Dependency Status Coverage percentage

A simple project using create-react-app, coffeescript, and a custom version of react-hyperscript-helpers.

Table of Contents

Installation

Usage

Related Projects

Known Issues

Future Plans / ToDo

Getting To Know Yeoman

License


Installation

First, install Yeoman and generator-coffee-react using npm (we assume you have pre-installed node.js).

This generator also depends on the create-react-app also available on npm.

npm install -g yo create-react-app generator-coffee-react

or

yarn global add yo create-react-app generator-coffee-react

Then generate your new project:

yo coffee-react

This will prompt you for a name for your app. You may also provide a name like this:

yo coffee-react my-app-name

Keep in mind this will be fed to create-react-app and will need to support it's naming conventions (no-caps, etc.).

Because it uses create-react-app a new folder is always created for you (don't let yeoman's warning message fool you.)

Usage

Change directory into your project and run yarn start or npm start. This script will automatically compile all the coffeescript files in the cs folder and place them in the src folder where they are then served up by the react native live server. Press control-C to quit.

To create other component you should use the coffee-react:comp generator like this:

yarn comp

or

npx comp

The benefit of the intermediate compiling being done here is you don't need to include the .coffee extension in your imports (not it isn't done in index.coffee). This is automatically translated when your files are copied into JS.

You can also run this straight from the command line. like so:

yarn comp ComponentName

This will generated the component ComponentName and add it to cs/components by default and create a reference in cs/components/index.coffee so you can simply do this in your App.coffee file.

import { ComponentName } from './components'

If you need to use any library components you can just use the h function from my react-hyperscript-helpers library like so:

NOTE:

This has become the default method of accessing classes as of v0.0.9. It tends to be less error prone as the first line is always the same h componentName,. The former way of wrapping the component in hh is still valid and available. Find out more here.

render: ->
  h 'div',
    '.App'
    h 'header',
      '.App-header'
      h 'img',
        '.App-logo'
        src: logo
        alt: 'logo'
      h 'h1',
        '.App-title'
        'Welcome to React'
    h 'p',
      '.App-intro'
      'To get started, edit '
      h 'code', 'cs/App.coffee'
      ' and save to reload.'
    h LibraryComponent

NEW

I just added the option to generate a scaffolding to include a phaser game in your page! Just do this:

yarn comp Game --phaser

Then you can do this:

import { Game } from './components'

and in your render method:

render: ->
  h Game

You can place it anywhere on your page!

There is also a similar method of adding a controller model with all the same options:

yarn cont myController

This creates myController.coffee in the cs/controllers folder and adds it to cs/controllers/index.coffee for you.

Related projects

Known Issues

  • [x] ~~Currently only works with Yarn. I should be able to work this out shortly.~~
  • [x] ~~You will be prompted to overwrite your package.json file. This is a limitation of Yeoman as there is no way to update the file once create-react-app creates it.~~

    :smile:None?!?:smile::thumbsup:

Future Plans

  • [ ] Adding support for react native with a --native option.
  • [ ] Add generators for linking to my favorite libraries.
  • [ ] Test this thing on windows.

Getting To Know Yeoman

  • Yeoman has a heart of gold.
  • Yeoman is a person with feelings and opinions, but is very easy to work with.
  • Yeoman can be too opinionated at times but is easily convinced not to be.
  • Feel free to learn more about Yeoman.

License

MIT © Jim Hessin