Nonchalantly Perusing Magazines

    @roots/bud
    TypeScript icon, indicating that this package has built-in type declarations

    6.2.0 • Public • Published

    bud.js

    MIT License npm Follow Roots

    @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.

    Sponsors

    Help support our open-source development efforts by becoming a patron.

    KM Digital Carrot C21 Redwood Realty WordPress.com Pantheon

    Install

    npm i @roots/bud

    Homepage

    roots.io/bud

    DownloadsWeekly Downloads

    1,775

    Version

    6.2.0

    License

    MIT

    Unpacked Size

    611 kB

    Total Files

    181

    Last publish

    Collaborators

    • qwp6t
    • swalkinshaw
    • retlehs
    • log1x
    • kellymears