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

relient-cli

v3.2.3

Published

Relient CLI is a cli wrapper of react-starter-kit. It also provides configuration and API mock tools.

Downloads

103

Readme

Relient-CLI

Relient CLI is a cli wrapper of react-starter-kit. It also provides API mock.

Install

$ npm install relient-cli --save-dev

Basic usage

Make sure you have below project structure:

  • mocker/ API mock config
  • public/ static public files, for example: robots.txt, favicon.ico
  • src/
    • client/ client side code
      • index.js client side entry file
    • server/ server side code
      • index.js server side entry file
    • shared/ code shared with client and server

And add below scripts into package.json:

"scripts": {
	"clean": "relient clean",
	"copy": "relient copy",
	"bundle": "relient bundle",
	"build": "relient build",
	"build-stats": "relient build --analyse",
	"serve": "relient runServer",
	"start": "relient start",
	"mocker": "relient mocker"
}

Then npm run start will give you a working isomorphic web application in dev environment.

Scripts

relient clean

Clear build folder.

relient copy

Copy all files from public folder and yarn.lock to build. If you run with --watch, files will be copy when changed automatically.

relient bundle

Create application bundles (both client and server side) with webpack compilation.

relient build

Run clean, copy, bundle in sequence. When you want to release your app to prod, please run this script.

relient build --analyse

This will show a build stats with BundleAnalyzerPlugin

relient start

Start the application in dev enironment.

relient mocker

Run mock server.

Config

Add relient.config.js in the root of your project to config relient. The default config will be:

{
  mockerPort: 9001,
  clientConfigs: [],
  babelPlugins: [],
  proxy: {
    from: ['/api'],
    target: 'http://localhost:9001',
    changeOrigin: true,
  },
  baseUrl: '/admin', // This will be used to webpack public path and browserSync startPath
}

You can add your custom config in relient.config.js to overwrite the default value or add a new config value.

Mock

The mock is built based on express. For example, we can create a mocker for account:

mocker/account.js

export default (router) => {
  router.post('/account', ({ body }, response) => {
    response.status(200).send(body);
  });

  router.get('/account/all', (request, response) => {
    response.status(200).send([{ id: 1, name: 'A' }, { id: 2, name: 'B' }]);
  });
}