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

makepwa

v0.1.8

Published

A tool to make PWAs

Downloads

12

Readme

Introduction

makepwa is a CLI tool to make PWAs. You can install it globally with

npm install makepwa -g

and then use

makepwa new NAME [TEMPLATE]

to create a directory named NAME and a new PWA project inside of it. For example, makepwa new pwa0.

Optionally, you can also pass a TEMPLATE. For example, makepwa new pwa0 tags will create a project with web tags. Without a TEMPLATE, it will create a bare project without additional dependencies.

After entering the directory with cd pwa0, you can use npm start and npm run build.

npm start

is for starting a development session. This command will:

  • create the ./dist.dev directory with a distribution optimized for development;
  • watch for changes to the sources(in the ./src directory) and update the distribution continuously;
  • run Browsersync at 3000 port on all available network interfaces;

npm run build

is a one-off command which creates the ./dist directory with a distribution optimized for production.

Service workers

The default service worker implements a race between Cache and Network(it tries to get response from both and returns the earliest response). Also, if the request to Network was successful, Cache gets updated.

This behavior would intervene with development(we would have to reload our browser twice to see every change). Because of this, by default, the service worker gets built only for production.

If you would like to make it available during development(for example, to implement a different strategy), you can run makepwa sw extract. This will add ./src/workers/sw.coffee and ./src/scripts/register_sw.coffee to your project.

Icons

If you add a square SVG icon to ./src/icons/icon.svg, all the necessary icons will be generated from it. Otherwise, a default SVG icon will be used for that.

Bundle splitting

By default, if you import as usual

import 'web.tags'
import { PerspectiveCamera } from 'three/src/cameras/PerspectiveCamera.js'
import { WebGLRenderer } from 'three/src/renderers/WebGLRenderer.js'
import { Scene } from 'three/src/scenes/Scene.js'
import { MeshNormalMaterial } from 'three/src/materials/MeshNormalMaterial.js'
import { BoxGeometry } from 'three/src/geometries/BoxGeometry.js'
import { Mesh } from 'three/src/objects/Mesh.js'

, it will bundle everything into one file(scripts/main.js).

To split dependencies(scripts/deps.js) and application code(scripts/main.js), you can use window.FROM:

FROM 'web.tags'
{
  PerspectiveCamera
  WebGLRenderer
  Scene
  MeshNormalMaterial
  BoxGeometry
  Mesh
} = FROM 'three/src'

This will bundle to scripts/deps.js only necessary files from three/src.

window.FROM

takes a String literal. It can be:

  • a package name;

    For example: { Scene } = FROM 'three'

    This will bundle the entire package.

  • a path to a file;

    For example: { Scene } = FROM 'three/src/scenes/Scene.js'

  • a path to a directory;

    For example: { Scene } = FROM 'three/src'

    This will guess in which file Scene might be and bundle only this specific file.