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

x0v5

v1.0.0-0

Published

This is a proposal for for the next major version of x0, which is a complete rewrite and would include some breaking changes. **Nothing is final**, this is meant to start a discussion around what set of features makes most sense for x0 when compared to ot

Downloads

4

Readme

RFC: x0 v5

This is a proposal for for the next major version of x0, which is a complete rewrite and would include some breaking changes. Nothing is final, this is meant to start a discussion around what set of features makes most sense for x0 when compared to other options for developing and building small, static React applications.

This alpha version can be installed with the following tag:

npm i @compositor/x0@alpha

Changes from v4

  • Now accepts a folder of components as the entry argument
  • Automatic routing based on filename
  • Dev server uses webpack-serve under the hood
  • Uses mini-html-webpack-plugin
  • Default HTML head contents for UTF-8 charset and viewport meta tag
  • Minimal base CSS styling
  • Rendering the <head> in the component is no longer supported
  • Webpack used both for the client and static rendering, enabling webpack features in getInitialProps
  • Support for babel-plugin-macros
  • Default props can no longer be passed through the package.json config
  • The routes array in package.json is no longer supported
  • Adding react-router is no longer necessary
  • Removes react-loadable support
  • Proxy option is no longer supported, but can be configured with a custom webpack config
  • Automatically looks for a webpack.config.js file in the directory
  • The --config flag has been renamed to --webpack
  • Automatic support for styled-components
  • custom HTML template option

Usage

x0 components

Build to static site

x0 build components

Data fetching

class Page extends React.Component {
  static getInitialProps = async () => {
    return {
      // ...someProps
    }
  }

  render () {
    return (
      <h1>Page</h1>
    )
  }
}

Options

  --webpack       Path to webpack config file

Dev Server

  -o --open       Open dev server in default browser
  -p --port       Port for dev server

Build

  -d --out-dir    Output directory (default dist)
  -s --static     Output static HTML without JS bundle
  -t --template   Path to custom HTML template

Options can be passed via the x0 field in package.json

"x0": {
  "outDir": "site",
  "template": "./html.js"
}

Head Content

Head content can be configured in the package.json field

"x0": {
  "title": "Hello",
  "meta": [
    {
      "name": "twitter:card",
      "content": "summary"
    }
  ],
  "links": [
    {
      "rel": "stylesheet",
      "href": "https://fonts.googleapis.com/css?family=Roboto"
    }
  ]
}

Custom HTML Templates

module.exports = ({
  html,
  css,
  scripts,
  title,
  meta = [],
  links = [],
}) => `<!DOCTYPE html>
<head>
  <title>Custom Template</title>
  ${css}
</head>
<body>
  <div id=root>${html}</div>
  ${scripts}
</body>