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

wilu

v0.0.48

Published

Wilu generates makefiles without additional dependencies.

Downloads

11

Readme

Wilu

Wilu generates makefiles without additional dependencies.

Features

  • Import native code from npm as if they were node.js modules
  • Build instructions in package.json
  • Incremental build instructions

Generate the makefile

make.js:

const wilu = require('wilu');
const pkg = require('./package.json');

(async function () {
	try {
		pkg.build = pkg.build || {};
		Object.assign(pkg.build, {
			name: pkg.name,
			version: pkg.version
		});
		await wilu(pkg.build);
	} catch(e) {
		console.error(e);
	}
})();
npm i --save-dev wilu
node make.js

Now you have makefile in your current directory.

Build instructions

Goes to package.json under build as an object. See the package.json of this project.

The build targets are defined in build under property + as an object where the key is the target name and the value is an object that has all the same rules the build has in package.json.

Each target in + will inherit the properties of the parent merging with its own properties. The build targets can define more targets under their property +.

Example package.json

{
	"name": "app",
	"version": "0.0.1",
	"build": {
		"sources": {
			"include": ["*.c"]
		},
		"options": {
			"compiler": {
				"all": ["Wall"],
				"c": ["std=c11", "Wstrict-prototypes"]
			}
		}
		"+": {
			"release": {
				"options": {
					"compiler": {
						"all": ["O3"]
					}
				}
			},
			"debug": {
				"options": {
					"compiler": {
						"all": ["O0", "ggdb"]
					}
				}
			}
		}
	}
}

This results to the below structure when using the above make.js. The result is used later to generate the makefile. The make targets are release and debug.

{
	"release": {
		"name": "app",
		"version": "0.0.1",
		"sources": {
			"include": ["*.c"]
		},
		"options": {
			"compiler": {
				"all": ["Wall", "O3"],
				"c": ["std=c11", "Wstrict-prototypes"]
			}
		}
	},
	"debug": {
		"name": "app",
		"version": "0.0.1",
		"sources": {
			"include": ["*.c"]
		},
		"options": {
			"compiler": {
				"all": ["Wall", "O0", "ggdb"],
				"c": ["std=c11", "Wstrict-prototypes"]
			}
		}
	}
}

Properties

  • name: defines the output name
  • version: defines the version
  • sources
    • include: array of glob rules
    • exclude: array of glob rules
    • path: path to the base of source files, the above rules are based on this. Defaults to 'src'.
    • subpath: added to path before finding sources
  • options
    • compiler
      • all: array of flags for all targets
      • c: array of flags for c language targets
      • c++: array of flags for c++ language targets
      • asm: array of flags for assembler language targets
    • linker: array of flags for the linker
    • assembler: array of flags for the assembler
  • machine: array of machine flags
  • definitions: array of defines
  • search
    • includes: array of paths for includes
    • libraries: array of paths for libraries
    • scripts: array of paths for linker scritps
  • libraries
    • static: array of static link libraries
    • shared: array of shared link libraries
  • directories
    • base: output directory. Defaults to 'build'.
    • output: subdirectory in base. Defaults to 'bin'.
    • objects: subdirectory for the objects. Defaults to 'obj'.
  • import: array of modules to be imported with targets prefixed with the module name and an underscore
  • depends: array of targets to build before linking
  • merge: array of targets to inherit properties from. Same as adding under + property, but can be used to interlink targets or continue an imported target.
  • library: a boolean, which turns the target into a static library. The output name is changed into 'libname.a'
  • shared: a boolean, which turns a library target into a shared library. The output name is changed into 'libname.so.version' and symbolic links will be generated.
  • node: a boolean, which turns the target into a node.js native addon
  • variables: object of variables where the keys are the variable names. Each property is turned into 'key= value'. This allows to specify a modifier to the equal sign, e.g. ':' or '?'.
  • commands: array of commands to be executed after linking
  • toolset: prefix the tools. For example 'arm-none-eabi' will produce arm-none-eabi-gcc with the default tools.
  • tools: object of tools where the key is the purpose and the value is the actual tool without prefix. Defaults are: c: gcc, c++: g++ and asm: gcc -x assembler-with-cpp.