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

trowel-tools

v0.0.3

Published

Helpers for Trowel

Downloads

3

Readme

Trowel tools

Helpers for Trowel

These helpers help you to make React application using:

Here's an example of your App component:

/*--- App.jsx ---*/
import {Component, PropTypes} from 'react';
import {createStore} from 'redux';
import getMyInitialState from '../redux/my-initial-state.js';
import myReducer from '../redux/my-reducer.js';

/*
	it is a very root application component
	NOT NEEDED to be wrapped in react-redux, react-router or react-hot-loader conatiners
*/
export default class App extends Component {
	render(props) {
		return (
			<div>{props.appData.greating}</div>
		);
	}
}

App.propTypes = {
	appData: PropTypes.shapeOf({
		greating: PropTypes.string
	})
};

// REQUIRED: static function creating redux store
App.configureStore = () => createStore(myReducer, getMyInitialState());

trowelTools.bundle

(App: React.Component) => {
	initClient: (
		appState?: any = {},
		appData?: any = {},
		mountElementId?: string = 'mount'
	) => void
}	

Helps you to wrap your App component by:

  • <Provider> from react-redux
  • <BrowserRouter> from react-router-dom
  • <AppContainer> from react-hot-loader
/*--- index.js – entry file for webpack ---*/
import {bundle} from 'trowel-tools';
import getMyInitialState from '../redux/my-initial-state.js';

const appBundle = bundle(App);

// will be passed as appData prop
const appData = {
	greating: 'Hello World!'
};

appBundle.initClient(getMyInitialState(), appData, 'mount');

// if hot-module-replacement is enabled
if (module.hot) {
	module.hot.accept('./App.jsx', () => {
		const NextApp = require('./App.jsx').default;

		// .updateClient method will appear after you called .initClient
		appBundle.updateClient(NextApp);
	});
}

trowelTools.initSSR

(
	App: React.Component,
	params: {
		location: string,
		routerContext: {},
		appState?: any,
		appData?: any
	}
) => React$Element

Helps you to wrap your App component by:

  • <Provider> from react-redux
  • <StaticRouter> from react-router-dom
  • <AppContainer> from react-hot-loader
/*--- ssr.js – Server-Side rendering ---*/
import {renderToString} from 'react-dom/server';
import {initSSR} from 'trowel-tools';
import App from './App.jsx';
import getMyInitialState from '../redux/my-initial-state.js';

export default function (location) {
	const routerContext = {};
	const appState = getMyInitialState();
	const appData = {
		greating: 'Hello World!'
	};

	const app = initSSR(App, {location, routerContext, appState, appData});

	return renderToString(app);
}