
Security News
Insecure Agents Podcast: Certified Patches, Supply Chain Security, and AI Agents
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.
component-build
Advanced tools
This is a separate repo for the primary logic behind the component-build command.
Feel free to fork this or use it as a baseline to create your own builder.
This is a thin wrapper around component-builder2.
Some features included by default:
Scripts
Styles
Files
var resolve = require('component-resolver');
var Build = require('component-build');
var write = fs.writeFileSync;
var options = {
development: true,
install: true,
}
resolve(process.cwd(), options, function (err, tree) {
if (err) throw err;
var build = Build(tree, options);
build.scripts(function (err, string) {
if (err) throw err;
if (!string) return;
write('build.js', string);
})
build.styles(function (err, string) {
if (err) throw err;
if (!string) return;
write('build.css', string);
})
build.files(function (err) {
if (err) throw err;
})
})
options are passed to all builders and plugins.
Options other than those supported by component-resolver and component-builder2 are:
prefix <''> - for rewriting URLs in CSSbrowsers <''> - autoprefixer browser supportumd - wrap the build in a UMD build with name umdautorequire - automatically require the entry point of the buildSet or change an option after initialization.
build.set('development', false);
Builds the JS.
Returns function (err, js) {} where js is the build string.
If nothing was built, js === ''.
Builds the CSS.
Returns function (err, css) {} where css is the build string.
If nothing was built, css === ''.
Builds the files.
Returns function (err) {}.
Optionally override the default plugins used for .js builds.
build is a builder instance, and options are the options passed to Build.
You may overwrite this entirely if you'd like:
var build = Build(tree, options);
build.scriptPlugins = function (build, options) {
build
.use('scripts',
es6modules(options),
plugins.js(options))
.use('json',
plugins.json(options))
.use('templates',
plugins.string(options));
};
build.scripts(function (err, js) {
});
You may also append or prepend plugins like so:
var defaults = build.scriptPlugins;
build.scriptPlugins = function (build, options) {
build.use('templates', jade(options));
defaults(build, options);
build.use('jade', jade(options));
}
returning anything is NOT necessary.
Do NOT call .end().
This method is available on both the constructor and the prototype:
var Build = require('component-build');
Build.scriptPlugins === Build.prototype.scriptPlugins;
Same as build.scriptPlugins(), but with .css.
Same as build.scriptPlugins(), but with the files.
(The MIT License)
Copyright (c) 2014 segmentio <team@segment.io>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
main logic for component's build command
We found that component-build demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 14 open source maintainers 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.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.

Security News
The planned feature introduces a review step before releases go live, following the Shai-Hulud attacks and a rocky migration off classic tokens that disrupted maintainer workflows.