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

create-mithril-app

v2.1.2

Published

Sets up a mithril.js project with webpack

Downloads

16

Readme

create-mithril-app

Sets up a mithril.js project for you, with webpack already configured.

Install with npm i -g create-mithril-app, then type the following:

create-mithril-app <directory>
cd <directory>
npm install
npm run dev

This creates a mithril.js project in the directory specified, install the appopriate modules, and run the skeleton app on port 8020. Open your browser to http://localhost:8020 and you should see a sample mini-app running. It is set up with webpack-dev-server, so when you start editing the code, your browser would reflect the changes instantly.

Table of Contents

Purpose

I feel mithril.js can benefit from a battery-included tool to set up a project. This tool creates a project with the following:

  • webpack-dev-server configured with live reload
  • webpack configured with babel
  • build pipeline already set up
  • a sample Hello World app to kick start

Hopefully this can lower the barrier for new developers to try out mithril, and simplify the mundane task of creating a new project for seasoned developers.

Usage

  • create-mithril-app <directory> - creates a skeleton app with mithril.js and webpack set up in the specified.
  • create-mithril-app api <directory> - creates a sample backend application in the specified. This sample application can serve API for the mithril.js app.
  • create-mithril-app download <sample-mithril-app|sample-mithril-api> <version> - explicitly downloads a sample template into the cache. This is usually not necessary, unless you want to use a specific version of the template
  • create-mithril-app rm <sample-mithril-app|sample-mithril-api> - removes the corresponding sample template from the cache.
  • The cache resides at ~/.create-mithril-app directory

Project structure

The skeleton project created by create-mithril-app has the following structure.

  • client - the directory for source JS files
  • public - the directory for static files (html, css etc.)
  • webpack.dev.js - used by webpack-dev-server when running in dev mode
  • webpack.build.js - used by webpack to build the production files
  • package.json - modify this file to configure the name and license of your app

Configuration

The created project comes with two webpack files, one for development, one for build. They can be configured further to suit your needs. Please be aware we cannot support all these different configurations

Build

npm run build would create the deployable files in the build directory.

Server-side API

create-mithril-app is designed for developing client side applications that access APIs remotely. It can easily integrate with a backend server too. Please see Server setup for the sample API server that comes with this app.

Release Logs

  • 2.1.0 - decouples from sample-mithril-app dependency. User can now fetch the latest sample-mithril-app without needing to update create-mithril-app every time.
  • 2.0.1 - now uses mithril v2
  • 1.0.25 - now supports creating a new app into an empty directory
  • 1.0.24 - updated to webpack 4
  • 1.0.21 - fixed path not found issue under Linux
  • 1.0.14 - now can inject environment variables via .env, .env.development, and .env.production
  • 1.0.11 - fixed async/await bug
  • 1.0.9 - Added create-mithril-server
  • 1.0.6 - Added Babel to dev server, and supports spread operator.
  • 1.0.5 - Fixed breakpoint debugging in dev mode
  • 1.0.3 - Build files are now minified by default, and build pipeline is configurable.
  • 1.0.0 - Bumped to 1.0.0 after going through more field testing.
  • 0.2.4 - Fully working and supporting dev and build pipeline.

Special Thanks

To mithril.js team for building such an interesting framework. To create-react-app for the inspiration.