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

react-cordova-boilerplate

v2.0.1

Published

TodoMVC example for react with development tools to build a cordova application

Downloads

9

Readme

Build Status Dependency Status devDependency Status npm version

Redux DevTools TodoMVC example

Demo - click the image to try it

Notice

This is a prerelease version (2.0.0) of the boilerplate supporting some new features and webpack 2.

As of right now some testing features are missing , please be patient and help out :smile:. You can always use latest version here (1.3.0).

Why cordova and React

Cordova is really simple to build cross platform mobile applications for any of your needs, this boilerplate provides a great starting point for your next react project, and can be used to maintain a website and mobile application from same source code (any maybe transitioning later to react-native)

Features

  • eslint
  • Smart build using Webpack 2
    • ES6
    • React (jsx)
    • Server rendering for initial page
    • Style: Redium + SASS
  • React router
  • Testing
    • Mocha
    • jsdom (blazing fast testing on nodeJs)
    • Sinon
    • Chai
    • Coverage using nyc

Installing

  1. Install dependencies: npm i or yarn install
  2. Install global tools: npm install -g cordova
  3. Add your cordova platform by running cordova platform add %PLATFORM% (android and more)

Usage

  • npm run lint[:report] - runs linting against src folder and fix some of the issues, report option to generate html report to ./report.html.
  • npm run start[:prod] - starts a server, with react model replacement and devtools on localhost:8080, prod option to minify the build (same build eventually integrated with the cordova app).
  • npm run build[:prod][:watch] - builds the project (single html file and single js file) as it does for development.
  • npm run test[:watch][:coverage] - runs Mocha testing, outputs result to console, watch options to watch files and test again after file modification, coverage option to generate coverage reports to ./alternative folder (index.html is a usuful one!).

Build and run as application

As you do with any cordova application, cordova build android, cordova run android and more.

cordova runs npm run build:prod before any cordova command (using hooks).

Style practice

To style your html, simply inline style your DOM (here is why).

You can use Radium (which is included) to easily add 'css like' event listeners to your components (like hover).

Sass/CSS is included to complete some of the missing features or already written style you want to use. To use Sass/CSS simply import that file!

custom-font.scss

@font-face {
	font-family: 'custom-font';
	src:url('./custom-font.eot') format('embedded-opentype'),
		url('./custom-font.ttf') format('truetype'),
		url('./custom-font.woff') format('woff'),
		url('./custom-font.svg') format('svg');
	font-weight: normal;
	font-style: normal;
}
.customFont {
  font-family: 'custom-font';  
  &.customFontIcon {
    content: "\e600";
    &:hover {
      color: blue;
    }
  }
}

ExampleComponent.jsx

import React, { Component } from 'react';
import customFont from './custom-font.scss'

export default class ExampleComponent extends Component {
  render() {
    return (
      <div style={{backgroundColor: 'red'}}>
        Hello world!
        <span className={customFont.customFont + ' ' + customFont.customFontIcon}></span>
      </div>
      );
  }
}

Advantages:

  • Complete styling ability to go with inline style.
  • Easily use third party styles.
  • No globals - import style files and use the class (minifies signature - example .a instead of .customFont)

Sass style will be minified, bundled and included to the server rendered file.