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

@spinacia/create

v1.0.19

Published

a react app creator

Downloads

5

Readme

React app create by @spinacia

Creating an App

npx @spinacia/create

@spinacia will creating an app inside a folder named 'my-app' and propety 'name' in the package.json will also called same, or you can customize those:

npx @spinacia/create [customize-folder-name]

*npx comes with npm 5.2+ and higher, run npm i -g npm to update

Inside that directory, it will generate the initial project structure:

.
├── README.ZH.md
├── README.md
├── app
│   ├── assets
│   │   └── SPINACIA.svg
│   ├── components
│   │   └── ...
│   ├── config
│   │   ├── reducer.js
│   │   ├── route.js
│   │   └── router-core
│   │       └── ...
│   ├── containers
│   │   ├── App
│   │   │   ├── action.js
│   │   │   ├── constant.js
│   │   │   ├── index.js
│   │   │   ├── reducer.js
│   │   │   └── style.less
│   │   └── Main
│   │       ├── actions
│   │       │   └── index.js
│   │       ├── components
│   │       │   └── ...
│   │       ├── connect
│   │       │   └── index.js
│   │       ├── constants
│   │       │   └── index.js
│   │       ├── index.js
│   │       ├── reducers
│   │       │   └── index.js
│   │       ├── style.less
│   │       └── ts.tsx
│   ├── css
│   │   ├── common.less
│   │   └── resets.less
│   └── index.jsx
├── build
│   ├── assets.js
│   ├── config.js
│   ├── index.html
│   ├── index.js
│   └── loading
│       ├── loading.css
│       └── loading.html
├── favicon.ico
└── package.json

20 directories, 40 files

Start develop

npm start @spinacia will open browser automatic, and if port was occupied, @spinacia will instead other free port.

Build production

npm run build Builds the app for production to the dist folder. It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.

Your app is ready to be deployed.

Build config

The app support some custom settings.

In build/config.js:

module.exports = {
  // Default port for webpack dev server.
  port: 3000,
  // Eslint loader switch.
  eslint: true,
  // When this eslintFix is 'true',
  // eslint loader will automatically fix some code.
  eslintFix: true,
  // Same as document.title,
  // but this will write <title>your setting</title> in the 'index.html'.
  documentTitle: '',
  // Set publicPath for all assets,
  // you need this when you gonna use CDN.
  publicPath: '',
  // build output directory.
  outputDir: 'dist'
};

In build/assets.js:

// Show 'loading' icon before 'bundle.js' loaded.
// You can customize loading in loading.html and loading.css.
module.exports = {
  loading: {
    html: './loading/loading.html',
    css: './loading/loading.css'
  },
  // When `window.location.hostname` includes `test`,
  // or you can customize which is matched `window.location.hostname` in the `devPattern`,
  // and app will use dev: {...} configuration,
  // otherwise will use pord: {...} configuration.
  devPattern: 'www.nmhs.test',
  dev: {
    libs: {
      // App will generator script and link tag in html header,
      // for load following links.
      css: [],
      js: [
        'https://cdn.bootcss.com/vConsole/3.2.0/vconsole.min.js',
        'https://unpkg.com/react@16/umd/react.production.min.js',
        'https://unpkg.com/react-dom@16/umd/react-dom.production.min.js',
        'https://cdnjs.cloudflare.com/ajax/libs/redux/3.6.0/redux.min.js',
        'https://cdn.bootcss.com/react-redux/5.0.7/react-redux.min.js',
        'https://cdnjs.cloudflare.com/ajax/libs/redux-thunk/2.1.0/redux-thunk.min.js',
        'https://cdn.bootcss.com/react-router/3.2.1/ReactRouter.min.js',
      ]
    }
  },
  prod: {
    libs: {
      css: [
        ...
      ],
      js: [
        ...
      ]
    }
  }
}

Test

We use enzyme chai istanbul mocha karma sinon. and run *.js files which should in the directory named __test__.

start:

npm test

The coverage report will automatically generate at root path.

Eslint

We use eslint to help specification code, and use @spinacia/eslint-config-app configuration. if you don't need eslint, you can trun off in the build/config.js.

Typescript

Typescript has supported, you can create tsconfig.json customize configuration by yourself.

app/assets directory

This directory is the static pool on the development, when you execute npm start and put something staitc files like *.png, then you can access it by http://localhost:port/*.png. And after build, the static files in app/assets will be move to the ./dist.