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

to-build

v1.1.0

Published

Code Builder

Downloads

45

Readme


Name

to-build is a quick build generator

Description

to-build parses an index.html in development and generates a new build from it.

Installation

$> npm install to-build

Usage

Generate builds in the ./out directory with .css and .js minified
Two builds were generated in two different folders:

./out/staging => Contains minified files + sourcemaps

./out/production => Contains minified files with no sourcemaps (partially flattened folder)

$> to-build src/index.html

Options

| Options | Description | Expect | Default | |---------------|-----------------------------------------------------------------------------------------------------------------------------------------------|------------|-----------------------------------------------------------------| | --development | Only launch the server against your development folder | boolean | | | --staging | Do a build for staging | boolean | | | --production | Do a build for production | boolean | | | --all | Do a build for staging and production at once | boolean | | | --noserver | Do not run servers after builds | boolean | | | --output | The folder to hold the build | string | | | --root | Folders the engine will look up to, to resolve extracted uris including the current working directory and the node_modules folder | string[] | [, user defined, <node_modules>] | | --static | Extra Folders the engine will look up to, to resolve extracted uris if not found in the --root ones | string[] | | | --minifyCss | Whether to minify css | boolean | | | --minifyJs | Whether to minify js | boolean | | | --minifyHtml | Whether to minify html | boolean | | | --sourcemaps | Whether to generate sourcemaps | boolean | |

  • Sourcemaps are not generated in production

Servers

By default, the development server runs on port 10000, staging on port 10002 and production on port 10004.

To have a quick report:

$> npx genserve scan --namespace to-build

To edit ports, locate the configuration file with:

# To get the servers configuration path 
$> npx genserve path servers --namespace to-build

To stop servers

$> npx genserve stop all --namespace to-build

Examples

Generate build in a folder called "target"
$> to-build src/index.html --output target
Generate build with no source map
$> to-build src/index.html --sourcemaps false
Generate build with non-minified css
$> to-build src/index.html --minifyCss false
Generate build with non-minified html
$> to-build src/index.html --minifyHtml false
Generate build with non-minified js
$> to-build src/index.html --minifyJs false
Generate build only for production
$> to-build src/index.html --production
Generate build only for staging
$> to-build src/index.html --staging
Generate build only for development
$> to-build src/index.html --development

Changelog

current:
  • Add the directive [to-build remove] to remove code from generated html files
  • Fix generated html
  • Fix files containing special characters in uris not processed
  • Add one second pause after starting a server
  • Remove duplicated log ids
  • Do not start all builds automatically
  • Use AnaLogger module to display logs
  • Add --noserver option to prevent launching servers automatically
  • Run all servers at start
  • Fix generation for production assets
  • Generate build for production
  • Add --static options to add extras static directories
  • Scan css to add more linked files to the build directory
  • Start server after build
  • Add missing library source-finder
  • Fix build missing resource files
  • Fix build generation for script module types
  • Minify module type js with to-esm
  • Minify HTML
  • Generate css files with options from html
  • Fix missing css files processing
  • Run from CLI