
Product
Introducing Pull Request Stories to Help Security Teams Track Supply Chain Risks
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
requirejs-module-build
Advanced tools
Tool for configuring and building non-CommonJS requirejs modules
A system to make it easier to configure and build a lot of non-CommonJS RequireJS modules.
via npm (node package manager)
$ npm install requirejs-module-build
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
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.
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"]
}
}
}
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"]
}
}
}
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.
A module configuration can add all the generated include
files for other modules to the exclude
array by using the excludeModules
option. See example.
MIT
FAQs
Tool for configuring and building non-CommonJS requirejs modules
We found that requirejs-module-build demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.