Package Exports
- @roots/bud
- @roots/bud/bud
- @roots/bud/cli
- @roots/bud/cli/commands/base
- @roots/bud/cli/commands/build
- @roots/bud/cli/commands/clean
- @roots/bud/cli/commands/dev
- @roots/bud/cli/commands/doctor
- @roots/bud/cli/commands/install
- @roots/bud/cli/commands/watch
- @roots/bud/context
- @roots/bud/context/application
- @roots/bud/context/context
- @roots/bud/context/dir
- @roots/bud/context/disk
- @roots/bud/context/env
- @roots/bud/context/index
- @roots/bud/context/manifest
- @roots/bud/extensions
- @roots/bud/extensions/bud-cdn
- @roots/bud/extensions/bud-esm
- @roots/bud/extensions/clean-webpack-plugin
- @roots/bud/extensions/copy-webpack-plugin
- @roots/bud/extensions/mini-css-extract-plugin
- @roots/bud/extensions/webpack-define-plugin
- @roots/bud/extensions/webpack-hot-module-replacement-plugin
- @roots/bud/extensions/webpack-manifest-plugin
- @roots/bud/extensions/webpack-provide-plugin
- @roots/bud/extensions/webpack-remove-empty-scripts
- @roots/bud/factory
- @roots/bud/services
Readme
@roots/bud
Frontend build tools combining the best parts of Symfony Encore and Laravel Mix
Installation
Install @roots/bud to your project.
Yarn:
yarn add @roots/bud --dev
npm:
npm install @roots/bud --save-dev
Usage
Getting Started
For more detailed usage information consult the Getting Started guide on bud.js.org
Cli
bud.js is invoked with the bud
command.
Call bud --help
for usage information.
TypeScript
If your configuration is authored in TypeScript, you will use the ts-bud
command instead of the bud
command.
Node
A simple way to instantiate bud is using the factory
export:
import { factory } from "@roots/bud/factory";
await factory().then((bud) => {
// use bud
});
factory
accepts an optional Bud.Options
argument:
interface Options {
/**
* Context
*/
context?: {
cwd: string;
projectDir: string;
manifest: Record<string, any>;
application: {
name: string;
label: string;
version: string;
dir: string;
};
args: Record<
string,
string | boolean | undefined | number | Array<string | boolean | number>
>;
disk: {
config: Record<string, any>;
};
env: Record<string, string | undefined>;
stdin: Readable;
stdout: Writable;
stderr: Writable;
colorDepth: number;
};
/**
* Name
*
* @defaultValue `bud`
*/
name?: string;
/**
* Build mode
*
* @remarks
* One of: `production` | `development`
*
* @defaultValue `production`
*/
mode?: Mode;
/**
* Seed values
*/
seed?: Partial<Bud["hooks"]["store"]>;
/**
* Services
*/
services?: Record<string, new (...params: Array<any>) => Service>;
/**
* Extensions to be registered
*/
extensions?: Array<Extension | Extension.Constructor>;
}
Arguments are merged with the defaults up to a depth of 1. So, if you want to add an extension using Bud.Options
you only need to include the single extension in the passed array.
Example: exporting for webpack-cli
From a file titled webpack.config.cjs
:
module.exports = async (env) => {
const bud = await import("@roots/bud/factory").then(
async (factory) => await factory()
);
bud.entry({ app: ["@src/app.js"] });
return await bud.build.make();
};
Contributing
Contributions are welcome from everyone.
We have contribution guidelines to help you get started.
License
@roots/bud is licensed under MIT.
Community
Keep track of development and community news.
- Join us on Roots Slack by becoming a GitHub sponsor
- Participate on the Roots Discourse
- Follow @rootswp on Twitter
- Read and subscribe to the Roots Blog
- Subscribe to the Roots Newsletter
Sponsors
Help support our open-source development efforts by becoming a patron.