What's New in Bit? December 07, 2023

ed
eden-e4 months ago

Weekly release notes v1.5.13

Run bvm upgrade to get the latest stable version of Bit. See Install experimental releases to try out the latest experimental features.

Component patterns extended to support component states and attributes

Bit commands support selecting a group of components using a glob pattern or multiple glob patterns separated by a comma. For example: bit tag "ecma.blog/**" will tag all components in the workspace that belong to the ecma.blog scope.

We've now introduced support for component selection using component states and attributes.

Components can be selected by the following states: new, modified, deprecated, deleted, snappedOnMain, softTagged, and codeModified. A component can also be selected by its env: $env:bitdev.react/react.

You can also use the AND operator to combine a state and a pattern. For example, to select all deleted components that belong to the ecma.blog scope, you can use the following pattern: "$deleted AND ecma.blog/**".

Use the bit pattern command to check which components are selected by a given pattern.

For example, the following will select all new components (i.e, components that were never versioned):

$bit
Copiedcopy
See command synopsis

The output lists the components that would have been selected by the pattern if it was used by another Bit commands (e.g, bit tag). This allows you to test the pattern before using it in other commands.

found 1 components matching the pattern

my-org.my-scope/my-component
#8188

Locally test your components' snap and tag pipelines

The bit build command allows you to locally test your components' build pipeline. However, this command only tests the build pipeline, and not the tag and snap pipelines. To include the tag and snap pipelines in your local build, you can use the --include-tag and --include-snap flags.

For example:

$bit
Copiedcopy
See command synopsis

The output should be similar to the following:

Running build pipeline using 1 environment(s), total 10 tasks

✔ (1/10) [Aspect: CoreExporter] Completed successfully in 222μs
✔ (2/10) [Compiler: TypescriptCompile] Completed successfully in 1s
...

Running tag pipeline using 1 environment(s), total 4 tasks

✔ (1/4) [Typescript: RemoveTypesProp] Completed successfully in 2ms
✔ (2/4) [Application: deploy_application] Completed successfully in 711μs
...

Running tag pipeline using 1 environment(s), total 4 tasks. Succeeded in 1s

build output can be found in path: path/to/capsule

The build artifacts can be found in the corresponding capsule (and no new version was created).

Use with caution

The --include-tag and --include-snap flags should be used with caution as these pipelines may include package publishing or deployment tasks.

#8224

Fork selected components from a scope

The bit scope fork command allows you to fork an entire scope. Now, you can also fork a selection of components from a scope, using a glob pattern.

For example, the following command will fork every component with the constants namespace from the teambit.community. It will set the newly forked components with a new scope my-org.my-scope:

$bit
Copiedcopy
See command synopsis
#8187

Component generators (templates) can auto install dependencies

When using Bit's out-of-the-box component generators, any missing dependencies will be automatically installed.

When creating your own custom component generators, you can can turn on auto-install by setting the generator's installMissingDependenciesß option to true.

/**
 * @filename: my-generator/component-template.ts
 */

import {
  ComponentContext,
  ComponentFile,
  ComponentTemplate,
} from '@teambit/generator';

export class MyTemplate implements ComponentTemplate {
  constructor(
    readonly name = 'my-template',
    readonly description = 'create a component using my-template',
    /* set the auto-installation of missing dependencies to true */
    readonly installMissingDependencies = true
    /* you can also manually set the packages to be installed (not recommended for most cases) */
    readonly packages = [
      'package-to-be-installed-1@1.0.0',
      'package-to-be-installed-2@1.0.0',
    ]
    /**
     * if the generator creates an env or an app, set the isEnv or isApp flags to true
     * this will automatically install the missing dependencies for the env or app
     */
    readonly isEnv = false,
    readonly isApp = false, 
  ) {}

  // ...
}
CopiedCopy
#8160
Read more about internal changes, bug fixes, and performance improvements

Read the release logs for v1.4.0, v1.5.9, and v1.5.12

Bit has been upgraded to Node v20

Bit has been upgraded to Node v20.

#8211 #8215 #8199 #8201

Video tutorials and podcasts

Next.js and Bit

Discover how to kickstart your journey by seamlessly integrating Bit into your Next.js projects. Learn how to create a custom workspace, explore the latest Next.js features, and unleash the full potential of component-driven development. Whether you're a newbie or a pro, this step-by-step guide will have you crafting powerful applications in no time.

Paving the way for component management: Jabber podcast

Listen to Bit's OSS leader, Gilad Shoham, discuss the challenges of component management and how Bit is paving the way for composable software and component-driven development.

Listen to the Podcast in your favorite platform: