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

ekam

v0.0.10

Published

Package builder with includes

Downloads

86

Readme

Package builder

Synopsis

Ekam is yet another package builder for node, designed to handle file includes, regardless of the file format, although it is primarily aimed at building javascript, html and css files.

As of version 0.0.0, only javascript is supported, although html and css are planned and easy to add, as well as other formats.

Download

It is published on node package manager (npm). To install, do:

npm install ekam -g

Usage

Ekam takes a json file containing information about what it has to do.

ekam --build src/build.json

A sample build.json file can be produced with the option init

ekam --init
{
	"input": {
		"include": "**/*.js"
	, "exclude": "*.json"
	}
,	"output": {
		"path": "../build"
	, "mode": "0755"
	, "clean": true
	}
,	"uglify": {
		"mangle": {
			"defines": {
				"DEBUG": [ "name", "false" ]
			}
		}
	,	"squeeze": {
			"make_seqs": true
		,	"dead_code": true
		}
	,	"gen": {
		}
	}
}

The following properties are required:

  • input
    • include: list of expressions or files to be processed
    • exclude: list of expressions or files to be excluded
  • output: the properties are the same as the ones defined in the fstream module
    • path: path to the generated files

The following properties are optional:

  • uglify: contains the options object passed to the uglify() method

To run the tool with DEBUG information, set the DEBUG environment variable to a list of comma separated values:

DEBUG=ekam,build,include,file,js-ast ekam --build src/build.json
  • ekam
  • build
  • include
  • file
  • js-ast

Example

Let's say we have to build a single javascript file split up in two files as well as its minified and debug versions. The example is provided in the examples/example1 directory.

The input files are defined under the src/ directory:

  • src/file1.js
  • src/file2.js

The output files are to be defined as (yes they are defined in the input directory!):

  • src/file.js
//include("file1.js", "file2.js")
  • src/file.debug.js
//var DEBUG=true
//include("file1.js", "file2.js")

The files file1.js and file2.js should contain a line like the following one to include some debug traces:

//if(DEBUG)
console.log('DEBUG', ...)
//endif
  • src/file.min.js
//uglify("file.js")

When the ekam command is run, it creates the following files (note that the www/ directory is automatically created if it does not exist already):

  • www/file.js - concatenation of file1.js and file2.js
  • www/file.debug.js - same as file.js but with debug commands
  • www/file.min.js - minified version of file.js