Package Exports
- @roots/bud
- @roots/bud/cli/app
- @roots/bud/cli/commands/base
- @roots/bud/cli/commands/build.base
- @roots/bud/cli/commands/build.development
- @roots/bud/cli/commands/build.production
- @roots/bud/cli/commands/clean
- @roots/bud/cli/commands/doctor
- @roots/bud/cli/commands/repl
- @roots/bud/cli/commands/upgrade
- @roots/bud/cli/commands/view
- @roots/bud/cli/commands/webpack
- @roots/bud/cli/finder
- @roots/bud/cli/index
- @roots/bud/cli/render
- @roots/bud/context/args
- @roots/bud/context/argv
- @roots/bud/context/bud
- @roots/bud/context/config
- @roots/bud/context/context
- @roots/bud/context/env
- @roots/bud/context/extensions
- @roots/bud/context/get
- @roots/bud/context/index
- @roots/bud/context/manifest
- @roots/bud/context/services
- @roots/bud/factory
- @roots/bud/factory/cache
- @roots/bud/factory/factory
- @roots/bud/factory/index
- @roots/bud/factory/options
- @roots/bud/notifier/ensurePermissions
- @roots/bud/notifier/index
- @roots/bud/notifier/notifier
- @roots/bud/notifier/notifierPath
- @roots/bud/services/env
- @roots/bud/services/project
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
dir: 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.