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

arco

v0.1.3

Published

A React+Redux framework with standards, conventions, and far less boilerplate

Downloads

18

Readme

arco

A React+Redux framework with standards, conventions, and far less boilerplate

Documentation

Installation

$ npm i arco --save

Summary

arco is a framework designed to streamline a lot of the architectural configuration of a React application by providing several web-standard packages built-in, as well as an API that is built to keep boilerplate minimal.

The following packages are all included as part of arco:

Additionally, the following concepts are applied through convention:

  • ducks for encapsulated functionality modules of actions / reducer
  • flux-standard-action for formatting of actions in a standard way

arco provides a layer of abstraction over the use of these so that you can focus on implementation, but with the same sort of flexibility you would expect from each of these packages directly. Think of it as convention with configuration. Additionally, keeping in line with redux, arco focuses on immutability and pure functions to eliminate side effects and make testing easier.

Building an app

You can find tutorials on how to create each aspect of an arco app in the "Tutorials" section, or select from below:

  • Actions: actions consumed by your redux store (based on redux-actions)
  • Ajax: make async calls, such as to an API (based on axios)
  • Components: react components that are connected to your store and enhanced by the use of pure functions
  • History: history used with react-router for the single-page application
  • Modules: encapsulated modules that contain redux actions and a reducer to manage them (based on )
  • Reducers: reducer that contains state of a specific topic in your redux store
  • Rendering: rendering your react views into the DOM
  • Router: render your react views active in the route (based on react-router)
  • Selectors: memoized selectors for computed data to keep your stored state small (based on reselect)
  • Store: your redux store which encompasses the state of your entire application

Hello World example

// import from one application
import createComponent, { createModule, render } from 'arco';

// create a module for a piece of functionality in your state
const app = createModule('app');

// create actions for that module
const sayHello = app.createAction('SAY_HELLO');

// create a reducer for that module
app.createReducer({hasSaidHello: false}, {
	[sayHello](state) {
		return {
			...state,
			hasSaidHello: true
		};
	}
});

// create your store from an array of modules (or the module's reducers)
const store = createStore([app]);

// build your components as functional components
const App = ({hasSaidHello, sayHello}) => {
	return (
		<div>			
			<button onClick={sayHello} type="button">
				Say hello
			</button>
			
			{hasSaidHello && <h1>Hello World!</h1>}
		</div>
	);
};

// create the component with options that allow connecting to lifecycle methods and the redux store=
const ConnectedApp = createComponent(App, {
	mapStateToProps({app}) {
		return app;
	},
	mapDispatchToProps: {
		sayHello
	}
});

// render in browser, pre-wired with the store
render(<ConnectedApp/>, document.body, store);

Setup

There are a couple things to be aware of when setting up arco for your application.

React global

arco expects there to be a global React object for it to render components, and if you don't provide it then you will receive a React is not defined error when attempting to render. There are two ways to fix this error:

  • Create a React global
    • With webpack you can use ProviderPlugin
    • With browserify you can use something like browserify-global-shim
    • With <script> you just make sure to put the tag for React first
  • Import React from the arco package whenever creating a component

ImmutableJS is not included

While it is a common paradigm to pair React applications with the library ImmutableJS, it is not included in arco but is rather considered "opt-in". There are integration options related to your application's History and Store included in arco, however the package itself is not included in the bundle like react and others are. As such, if you choose to make use of it, you will need to install it yourself.

That said, Immutable is installed as a dependency to allow for those integration options, so if you are using a bundler like webpack and are not using immutable, it is recommended to set immutable to be an external in your configuration options.

Contributing

This project is in its infancy, and many more expansion capabilities are there:

  • Universal app setup
  • Predefined webpack / ESLint / Babel config
  • CLI interface to automate creation of app scaffold

I welcome any and all ideas, but especially pull requests.

Development

Standard stuff, clone the repo and npm install dependencies. The npm scripts available:

  • build => run webpack to build crio.js with NODE_ENV=development
  • build:minifed => run webpack to build crio.min.js with NODE_ENV=production
  • dev => run webpack dev server to run example app (playground!)
  • dist => runs build and build-minified
  • docs => builds the docs via jsdoc
  • lint => run ESLint against all files in the src folder
  • prepublish => runs compile-for-publish
  • prepublish:compile => run lint, test, transpile, dist
  • test => run AVA test functions with NODE_ENV=test
  • test:watch => same as test, but runs persistent watcher
  • transpile => run babel against all files in src to create files in lib