@bb-cli/bb-bundle

Tools to automate creation of bundles

Stats

StarsIssuesVersionUpdatedCreatedSize
@bb-cli/bb-bundle
2.7.02 years ago5 years agoMinified + gzip package size for @bb-cli/bb-bundle in KB

Readme

NAME

bb-bundle - Tools to automate creation of bundles

SYNOPSIS

bb-bundle [--help] [-v|--version]
bb-bundle create [--help] [-o|--output <output-dir>] [-b|--bundle-module-name <module-name>]
    [-p|--package-path <path>] [--skip-minify] [-f|--force]
    [--no-devmode] [--portal-protocol <protcol>] [--portal-host <host>]
    [--portal-port <port>] [--portal-context <context>] [--portal-username <username>]
    [--portal-password <password>] [--portal-auth-path <path>] [--portal-version <version>]
    [--request-concurrency <concurrency>] [--statics-base-url <base-url>] [definition-paths...]
bb-bundle define [--help] [--bundle-by <target>] [--portal-name <name>]
    [--page-names <names>] [--exclude-pages <names>] [--item-names <names>]
    [--exclude-items <names>] [-o|--output <path>] [--portal-protocol <protcol>]
    [--portal-host <host>] [--portal-port <port>] [--portal-context <context>]
    [--portal-username <username>] [--portal-password <password>] [--portal-auth-path <path>]
    [--portal-version <version>] [--request-concurrency <concurrency>]

DESCRIPTION

A bundle is a javascript file containing multiple dependencies (JS modules).

The purpose of the bundle is to minimize the number of requests from the browser when rendering the widget / page, which leads to improved performance.

OPTIONS

Option Description
-v, --version output the version number
--help Output usage information

COMMANDS

NAME

bb-bundle create - Creates bundles and module loader configuration

SYNOPSIS

bb-bundle create [--help] [-o|--output <output-dir>] [-b|--bundle-module-name <module-name>]
    [-p|--package-path <path>] [--skip-minify] [-f|--force]
    [--no-devmode] [--portal-protocol <protcol>] [--portal-host <host>]
    [--portal-port <port>] [--portal-context <context>] [--portal-username <username>]
    [--portal-password <password>] [--portal-auth-path <path>] [--portal-version <version>]
    [--request-concurrency <concurrency>] [--statics-base-url <base-url>] [definition-paths...]

DESCRIPTION

The bundles are created by concatenating and minifying project dependencies.

Bundle definitions can be created by bb-bundle define command.

The result of creating a bundle will a folder be 2 features:

  • config-bb-module-loader: Configures SystemJs to use the bundle
  • bundle-bb-default: Contains the concatenated and minified bundles

You can use bb-package to package these features. Note that bundle-bb-default is prebuilt. See examples for more details.

OPTIONS

Option Description
-o, --output <output-dir> Path to output directory where modules will be created.
-b, --bundle-module-name <module-name> Name of the bundle module to be created.
-p, --package-path <path> Path of the provisioning package containing modules.
--skip-minify If set, bundles won't be minified.
-f, --force If set, existing directories will be deleted.
--no-devmode If set, will disable the "enable-mocks" and "disable-bundles" flags in the module loader.
--portal-protocol <protcol> Protocol of the URL identifying Backbase server
--portal-host <host> Host name of the URL identifying Backbase server
--portal-port <port> Port of the URL identifying Backbase server
--portal-context <context> Application context of the Backbase server
--portal-username <username> Username
--portal-password <password> Password
--portal-auth-path <path> Authorization path
--portal-version <version> Portal version (5 or 6)
--request-concurrency <concurrency> Maximum concurrent requests to make to portal
--statics-base-url <base-url> Base URL for static files that need to be bundled. Defaults to application context
--help Output usage information

EXAMPLES

Creates bundle-bb-default and config-bb-module-loader modules inside ./bundle directory according to definition from ./bundle/def.json file:

  $ bb-bundle create bundle/def.json --output bundle

Create a bundle from multiple definition files:

  $ bb-bundle create bundle/portal1-bundle.json bundle/portal2-bundle.json --output bundle

Creates bundle modules inside ./bundle directory according to definition from ./bundle/def.json file and by using dependencies from provisioning package target/package.zip:

  $ bb-bundle create bundle/def.json --output bundle --package-path target/package.zip

Creates my-bundles and config-bb-module-loader modules inside ./project-bundle directory according to definition from ./def.json file:

  $ bb-bundle create def.json --output project-bundle --bundle-module-name my-bundles

Package and import the bundle features with bb-package and bb-import:

  $ bb-package bundle/ --prebuilt bundle/bundle-bb-default --exclude-defaults
  $ bb-import package package.zip

NAME

bb-bundle define - Outputs bundle definition from the Backbase server for the given item

SYNOPSIS

bb-bundle define [--help] [--bundle-by <target>] [--portal-name <name>]
    [--page-names <names>] [--exclude-pages <names>] [--item-names <names>]
    [--exclude-items <names>] [-o|--output <path>] [--portal-protocol <protcol>]
    [--portal-host <host>] [--portal-port <port>] [--portal-context <context>]
    [--portal-username <username>] [--portal-password <password>] [--portal-auth-path <path>]
    [--portal-version <version>] [--request-concurrency <concurrency>]

DESCRIPTION

THe bundle definition can be used as input for bb-bundle create command.

Defining your bundles can be a complicated process. There are many different ways to optimize your bundling depending on how your portal/pages/widgets are constructed.

Once you have created your bundle definition file/s, you can use "bb-bundle create" to create the actual bundles.

OPTIONS

Option Description
--bundle-by <target> How specific the bundle should be. One of portal, page, or item.
--portal-name <name> Name of the portal to create bundle for
--page-names <names> When bundling by page, only define bundles for these pages
--exclude-pages <names> When bundling by portal, exclude these pages
--item-names <names> When bundling by item, only bundles these items
--exclude-items <names> When bundling by portal or page, exclude these items
-o, --output <path> Path to the bundle definition file to create
--portal-protocol <protcol> Protocol of the URL identifying Backbase server
--portal-host <host> Host name of the URL identifying Backbase server
--portal-port <port> Port of the URL identifying Backbase server
--portal-context <context> Application context of the Backbase server
--portal-username <username> Username
--portal-password <password> Password
--portal-auth-path <path> Authorization path
--portal-version <version> Portal version (5 or 6)
--request-concurrency <concurrency> Maximum concurrent requests to make to portal
--help Output usage information

EXAMPLES

These examples show some common use-cases for bundling your project:

Scenario 1: Create bundles for each entire portal:

  $ bb-bundle define --bundle-by portal --portal-name portal-a --output portal-a.json

Scenario 2: Create a bundle for every portal page:

  $ bb-bundle define --bundle-by page --portal-name portal-a --output pages-bundles.json

Scenario 3: Create a bundle for specific pages:

First create the page bundles:

  $ bb-bundle define --bundle-by page --portal-name portal-a --page-names page-1,page-2 --output pages-bundles.json

Then create a fallback bundle for the rest of the portal:

  $ bb-bundle define --bundle-by portal --portal-name portal-a --exclude-pages page-1,page-2 --output portal-a.json

Scenario 4: Bundle per portal page, plus a common bundle for common widgets/features:

First create a common bundle for the commonly used widgets/features:

  $ bb-bundle define --bundle-by item --item-nameswidget-a,widget-b,feature-b --output common-bundle.json

Then create bundles for portal pages, excluding what's in the common-bundle.json:

  $ bb-bundle define --bundle-by page --portal-name portal-a --page-names page-1,page-2 \
      --exclude-items widget-a,widget-b,feature-b \
      --output pages-bundle.json

Then create a fallback bundle for the rest of the portal:

  $ bb-bundle define --bundle-by portal --portal-name portal-a --exclude-pages page-1,page-2 \
      --exclude-items widget-a,widget-b,feature-b \
      --output portal-a.json

ENVIRONMENT VARIABLES

Set the amount of log output

LOG_LEVEL=silly|verbose|info|warn|error

Set whether or not to use colors in output

COLOR=false|true

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.