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

@jackfranklin/demopack

v0.2.0

Published

Easily build front end projects.

Downloads

1

Readme

Demopack

Fire up a pre-configured, live reloading Webpack server that supports React, (S)CSS and files for quick demos and tutorials.

Like create-react-app, but without needing to create a new project and npm install all the things.

Catch this quick demo on Youtube to learn more :).

But why?

I love Webpack, and I love tools like create-react-app, but they come with some set up cost.

  • For Webpack, it takes a reasonable amount of time to configure and set it up. I love this for full projects, but for quick experiments/demos, it's pretty slow.
  • Similarly create-react-app is great but the setup time in generating a new project can be relatively slow, especially on slow networks when you have to install all the dependencies!

The idea behind demopack is that it's a pre-packaged Webpack. It includes and configures everything you need, so all you have to do is install demopack once, and then when you run it there's no more setup.

Demopack is not designed for fully featured projects, but for small demos or one off projects where you need no extra configuration. For "proper" projects I recommend either Webpack from scratch or a tool like create-react-app.

Installation

You should install demopack globally so you can easily run it in a directory.

Unfortunately demopack is taken on npm, so you need to install the scoped version:

npm install --global @jackfranklin/demopack
yarn global add @jackfranklin/demopack

You'll need to be running Node 8 or higher.

Usage

Given a folder with the following file in it:

// index.js
console.log('Hello World!');

Running demopack in that directory will:

  • Fire up a Webpack server on port 8080 (or another free port).
  • Generate an index.html file that loads your JavaScript.
  • Parses any JavaScript (including JSX support) and SCSS for you.

What Demopack supports

Demopack has the following Webpack loaders configured out of the box:

  • babel-loader which parses .js and .jsx files. It runs using babel-preset-env, babel-preset-react and babel-preset-stage-0. This should mean any fancy JS you want to write should be supported :)
  • sass-loader, css-loader and style-loader to load your CSS and SASS (but regular CSS works just fine). If you pass --css-modules CSS Modules will be supported.
  • file-loader to load gif, png, jpg and svg files.

Demopack will run a small local server and will refresh automatically when you change files. Any errors are shown in the terminal and in the page.

If there's anything you think should be supported out of the box, feel free to open an issue and we can discuss it.

Production build

The primary goal of demopack is to be used for development, but you can generate a production build if you like with the --build flag.

This will run all the same plugins, with some extras (CSS is pulled into a separate file, JS & CSS is minified).

The build will output into ./demopack-built and will contain an index.html file alongside any assets.

Configuration

The goal of demopack is to be preconfigured out of the box, but there are some options you can configure. Running demopack --help will show you these:

Options:
  --help          Show help                                            [boolean]

  --version       Show version number                                  [boolean]

  --open-browser  Automatically open the browser when you run demopack. [default: true]

  --css-modules   Enable CSS Modules support.                   [default: false]

  --entry         The JavaScript file that demopack should build from. [default: "index.js"]

  --build         Output static files into a directory. JS and CSS will be minified [default: false]

Changelog

0.2.0

  • Initial release :)

Prior art / credit

  • Thanks to Eduard and his work on create-elm-app which I took a bunch of Webpack code from to make the Demopack terminal output super tidy.
  • Thanks also to everyone behind create-react-app which was the inspiration behind Demopack initially.