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

requirejs-module-build

v0.2.1

Published

Tool for configuring and building non-CommonJS requirejs modules

Downloads

3

Readme

requirejs-module-build

A system to make it easier to configure and build a lot of non-CommonJS RequireJS modules.

build-status Dependency Status devDependency Status

installation

via npm (node package manager)

$ npm install requirejs-module-build

running

The binary is named requirejs-build.

Usage: requirejs-build module [options]

Arguments:
  module        Name of the module to build or "all" for all modules including
                all filters

Options:
  -f, --filter <name>           Filter/submodule name
  -c, --config <path>           Path to config file
  -o, --optimizer <name>        Override RequireJS optimizer
  -p, --parallel <number>	    Number of parallel builds to run. Defaults is 5
  --placeholder                 Build placeholder
  -v, --verbose                 Be verbose
  -h, --help                    Print this

configuration

The binary will by default look for a file named requirejs-build.json in the directory you are standing in and up the directory tree. You can specify the path to the configuration file using the --config option.

All paths in the config will be relative from the configuration file's directory.

example

Lets imagine that you have a web page with an Instagram and Twitter module. The Instagram module has some files that are only needed for mobiles. All the modules use a set of shared libraries and a set of shared templates and javascript files. An example of a configuration for this could look something like this:

{
  "default": {
    "mainConfigFile": "public/js/setup.js",
    "baseUrl": "public/js/",
    "output": "public/js/compiled/",
    "optimize": "uglify2",
    "binary": "/usr/local/bin/r.js",
    "exclude": ["text"]
  },
  "modules": {
    "libs": {
      "include": [
        "jquery",
        "lodash",
        "backbone"
      ]
    },
    "shared": {
      "include": [
        "utils",
        "utils/auth",
        "text!shared/list.html"
      ],
      "excludeModules": ["libs"]
    },
    "instagram": {
      "directory": "modules/instagram",
      "filters": {
        "desktop": "!(*.mobile.*)",
        "mobile": "*.mobile.*"
      },
      "excludeModules": ["libs", "shared"]
    },
    "twitter": {
      "directory": "modules/twitter",
      "excludeModules": ["libs", "shared"]
    }
  }
}

inheritance

All the modules will inherit the options under the default key in the root of the configuration. The modules can also inherit from from other root nodes using the inherit option.

{
  "default": {
    "mainConfigFile": "public/js/setup.js",
    "baseUrl": "public/js/",
    "output": "public/js/compiled/",
    "binary": "/usr/local/bin/r.js",
  },
  "food": {
    "output": "public/js/compiled/food",
    "exclude": ["celery"]
  },
  "modules": {
    "taco": {
      "inherit": "food",
      "include": ["tortilla"]
    }
  }
}

filters

If the filters option is set on a module the module will generate n "submodules" with the given glob filter. Only the "submodules" will be generated, so if you want to have a version with all the files you have to create a filter for that. See example.

excludeModules

A module configuration can add all the generated include files for other modules to the exclude array by using the excludeModules option. See example.

license

MIT