0.0.406 • Published 3 years ago

@teambit/flows v0.0.406

Weekly downloads
6,074
License
SEE LICENSE IN LI...
Repository
github
Last release
3 years ago

teambit.pipelines/flows

Run tasks on components and their dependents.

  • Provides a bit run command to execute tasks on components in worksapce.
  • Provides an API to create network of components and execute tasks.
  • Used as a low-level API for other Bit commands like compile, test and watch.

Description

Inside a Bit project all components are linked to each other in a network according to their dependency graph. When you make a change, you can see the downstream effets when running component tasks. This means that all tasks run in the right order and if several components don't directly depend on each other, Flows parallelizes their tasks (and shows live console output in a readable order).

Usage

Command sinopsys

bit run <flow-name> [components...] [-v | --verbose] [--concurrency]

Examples

# runs 'build' flow on all components that have 'build' task defined.
bit run build

# runs 'build' flow for a specific component.
bit run build logo

# same as before with verbose output
bit run build logo --verbose

# setting concurrency
bit run build logo --concurrency 4 --verbose

Configuration

Use bit.jsonc configuration docs to understand how to configure bit.

// workspace configuration with default values for 'concurrency' and 'verbose'

{
  "teambit.pipelines/flows": {
    "concurrency": 4,
    "verbose": false,
    "tasks": {
      // the structure of a module task id: = `\`#${PackageName}:${PathToModule}\``
      "build": ["@bit/bit.evangalist.extensions.react-ts:transpile"],
    }
  }
}

You may also use the variants configuring option to override tasks of a specific component(s). The structure allows only for the task entry in that use case.

{
  "variants": {
    "ui/*":{
      "teambit.pipelines/flows": {
        "tasks": {
          "build": ["some_build_task"]
        }
      }
    }
  }
}

Consult with the docs to learn more about variants.

Flows API

Flows API is document in flows.ts module. Here are two examples:

import {Flows, flattenReplaySubject} from 'teambit.pipelines/flows'

const flows = new Flows(workspace)
const execution = flows.run(seeders)

// rxjs example
flattenReplaySubject(execution)
  .subscribe((result) => console.log('result is:', result))

// promise example
const result = await flows.runToPromise(seeders)
console.log('result is', result)

Recommended WorkFlows

Flows prefers convention over configuration for managing team's workflow to scale their development. It's philosophy is that when teams agree on the kind of actions they support it's easier to onboard developers to various projects in the organization. This is mainly becasue it helps developers avoid the details of each component build and treat it as the "same" action.

For example:

  • build - run all compilation/testing/lint
  • ci - flow to run bit CI system
  • dev - compiling with source map and what not.
  • personal - personal workflow team doesn't know of, to test things.

How to implement a task

A task is a module which exports a default function (or module.exports) with the following signature:

export type Task = () => any | () => Promise<any>
  • Tasks should be tracked and exported as components to a remote Bit scope.
  • Tasks defined as devDependencies for components consuming them.
  • Each task stdout, stderr is reported.
  • Each task should return a value (which is truthy) which will be reported to Bit's main process.

Design

The Flows API solves the problem of reporting the execution of dynamic activities across a graph of isolated components. The problem becomes complex in use cases like TypeScript API where dependent/dependency components build order needs to be respected.

Flows solves this problem by providing:

  • Unified UX
  • Aggressive caching
  • Topological execution order.

Entities

  • Capsule - Isolated representation of a component in filesystem.
  • Network - A graph of component capsules.
  • Flow - A collection of tasks to execute in a capsule.
  • Task - a runnable activity in a capsule defined by bash or javascript task.

For each main term there is a module in the flows implementation.

Additional modules

  • Cache - Caches capsule execution in ~/Library/Caches/Bit/capsules
  • Run - Holds run command as a component.
  • util - fake-capsule creation, rxjs helper etc.
0.0.403

3 years ago

0.0.406

3 years ago

0.0.405

3 years ago

0.0.404

3 years ago

0.0.402

3 years ago

0.0.401

3 years ago

0.0.400

3 years ago

0.0.399

3 years ago

0.0.398

3 years ago

0.0.397

3 years ago

0.0.396

3 years ago

0.0.395

3 years ago

0.0.394

3 years ago

0.0.393

3 years ago

0.0.392

3 years ago

0.0.391

3 years ago

0.0.390

3 years ago

0.0.389

3 years ago

0.0.388

3 years ago

0.0.387

3 years ago

0.0.379

3 years ago

0.0.378

3 years ago

0.0.373

4 years ago

0.0.372

4 years ago

0.0.371

4 years ago

0.0.370

4 years ago

0.0.377

3 years ago

0.0.376

4 years ago

0.0.375

4 years ago

0.0.374

4 years ago

0.0.384

3 years ago

0.0.383

3 years ago

0.0.382

3 years ago

0.0.381

3 years ago

0.0.386

3 years ago

0.0.385

3 years ago

0.0.380

3 years ago

0.0.369

4 years ago

0.0.368

4 years ago

0.0.367

4 years ago

0.0.366

4 years ago

0.0.365

4 years ago

0.0.364

4 years ago

0.0.363

4 years ago

0.0.362

4 years ago

0.0.361

4 years ago

0.0.360

4 years ago

0.0.359

4 years ago

0.0.358

4 years ago

0.0.357

4 years ago

0.0.356

4 years ago

0.0.355

4 years ago

0.0.354

4 years ago

0.0.353

4 years ago

0.0.352

4 years ago

0.0.349

4 years ago

0.0.351

4 years ago

0.0.350

4 years ago

0.0.348

4 years ago

0.0.347

4 years ago

0.0.346

4 years ago

0.0.345

4 years ago

0.0.344

4 years ago

0.0.343

4 years ago

0.0.342

4 years ago

0.0.340

4 years ago

0.0.341

4 years ago

0.0.339

4 years ago

0.0.338

4 years ago

0.0.337

4 years ago

0.0.336

4 years ago

0.0.335

4 years ago

0.0.334

4 years ago

0.0.333

4 years ago

0.0.332

4 years ago

0.0.331

4 years ago

0.0.329

4 years ago

0.0.328

4 years ago

0.0.327

4 years ago

0.0.330

4 years ago

0.0.326

4 years ago

0.0.325

4 years ago

0.0.324

4 years ago

0.0.323

4 years ago

0.0.322

4 years ago

0.0.321

4 years ago

0.0.320

4 years ago

0.0.319

4 years ago

0.0.318

4 years ago

0.0.317

4 years ago

0.0.316

4 years ago

0.0.315

4 years ago

0.0.314

4 years ago

0.0.313

4 years ago

0.0.312

4 years ago

0.0.311

4 years ago

0.0.310

4 years ago

0.0.309

4 years ago

0.0.308

4 years ago

0.0.307

4 years ago

0.0.306

4 years ago

0.0.304

4 years ago

0.0.305

4 years ago

0.0.303

4 years ago

0.0.302

4 years ago

0.0.301

4 years ago

0.0.300

4 years ago

0.0.299

4 years ago

0.0.298

4 years ago

0.0.297

4 years ago

0.0.296

4 years ago

0.0.295

4 years ago

0.0.294

4 years ago

0.0.293

4 years ago

0.0.292

4 years ago

0.0.291

4 years ago

0.0.290

4 years ago

0.0.289

4 years ago

0.0.288

4 years ago

0.0.287

4 years ago

0.0.286

4 years ago

0.0.285

4 years ago

0.0.284

4 years ago

0.0.283

4 years ago

0.0.282

4 years ago

0.0.281

4 years ago

0.0.280

4 years ago

0.0.279

4 years ago

0.0.278

4 years ago

0.0.277

4 years ago

0.0.276

4 years ago

0.0.275

4 years ago

0.0.274

4 years ago

0.0.273

4 years ago

0.0.272

4 years ago

0.0.271

4 years ago

0.0.270

4 years ago

0.0.269

4 years ago

0.0.268

4 years ago

0.0.267

4 years ago

0.0.266

4 years ago

0.0.265

4 years ago

0.0.264

4 years ago

0.0.263

4 years ago

0.0.262

4 years ago

0.0.261

4 years ago

0.0.260

4 years ago

0.0.259

4 years ago

0.0.258

4 years ago

0.0.257

4 years ago

0.0.256

4 years ago

0.0.255

4 years ago

0.0.254

4 years ago

0.0.253

4 years ago

0.0.252

4 years ago

0.0.251

4 years ago

0.0.250

4 years ago

0.0.249

4 years ago

0.0.248

4 years ago

0.0.247

4 years ago

0.0.246

4 years ago

0.0.245

4 years ago

0.0.244

4 years ago

0.0.243

4 years ago

0.0.241

4 years ago

0.0.242

4 years ago

0.0.239

4 years ago

0.0.240

4 years ago

0.0.238

4 years ago

0.0.237

4 years ago

0.0.236

4 years ago

0.0.235

4 years ago

0.0.234

4 years ago

0.0.233

4 years ago

0.0.229

4 years ago

0.0.230

4 years ago

0.0.232

4 years ago

0.0.231

4 years ago

0.0.227

4 years ago

0.0.228

4 years ago

0.0.226

4 years ago

0.0.225

4 years ago

0.0.224

4 years ago

0.0.223

4 years ago

0.0.222

4 years ago

0.0.221

4 years ago

0.0.220

4 years ago

0.0.219

4 years ago

0.0.216

4 years ago

0.0.218

4 years ago

0.0.217

4 years ago

0.0.215

4 years ago

0.0.214

4 years ago

0.0.213

4 years ago

0.0.212

4 years ago

0.0.211

4 years ago

0.0.210

4 years ago

0.0.209

4 years ago

0.0.208

4 years ago

0.0.207

4 years ago

0.0.206

4 years ago

0.0.205

4 years ago

0.0.204

4 years ago

0.0.203

4 years ago

0.0.202

4 years ago

0.0.201

4 years ago

0.0.200

4 years ago

0.0.199

4 years ago

0.0.198

4 years ago

0.0.197

4 years ago

0.0.196

4 years ago

0.0.195

4 years ago

0.0.194

4 years ago

0.0.193

4 years ago

0.0.192

4 years ago

0.0.191

4 years ago

0.0.190

4 years ago

0.0.189

4 years ago

0.0.188

4 years ago

0.0.187

4 years ago

0.0.186

4 years ago

0.0.185

4 years ago

0.0.184

4 years ago

0.0.183

4 years ago

0.0.182

4 years ago

0.0.181

4 years ago

0.0.180

4 years ago

0.0.179

4 years ago

0.0.178

4 years ago

0.0.177

4 years ago

0.0.176

4 years ago

0.0.175

4 years ago

0.0.174

4 years ago

0.0.173

4 years ago

0.0.172

4 years ago

0.0.171

4 years ago

0.0.170

4 years ago

0.0.169

4 years ago

0.0.168

4 years ago

0.0.167

4 years ago

0.0.166

4 years ago

0.0.165

4 years ago

0.0.164

4 years ago

0.0.163

4 years ago

0.0.162

4 years ago

0.0.161

4 years ago

0.0.160

4 years ago

0.0.159

4 years ago

0.0.158

4 years ago

0.0.157

4 years ago

0.0.156

4 years ago

0.0.155

4 years ago

0.0.154

4 years ago

0.0.153

4 years ago

0.0.152

4 years ago

0.0.151

4 years ago

0.0.150

4 years ago

0.0.149

4 years ago

0.0.148

4 years ago

0.0.147

4 years ago

0.0.146

4 years ago

0.0.142

4 years ago

0.0.145

4 years ago

0.0.144

4 years ago

0.0.143

4 years ago

0.0.139

4 years ago

0.0.141

4 years ago

0.0.140

4 years ago

0.0.138

4 years ago

0.0.137

4 years ago

0.0.136

4 years ago

0.0.135

4 years ago

0.0.134

4 years ago

0.0.133

4 years ago

0.0.132

4 years ago

0.0.131

4 years ago

0.0.129

4 years ago

0.0.130

4 years ago

0.0.128

4 years ago

0.0.127

4 years ago

0.0.126

4 years ago

0.0.125

4 years ago

0.0.124

4 years ago

0.0.123

4 years ago

0.0.122

4 years ago

0.0.121

4 years ago

0.0.119

4 years ago

0.0.120

4 years ago

0.0.118

4 years ago

0.0.117

4 years ago

0.0.116

4 years ago

0.0.115

4 years ago

0.0.114

4 years ago

0.0.113

4 years ago

0.0.112

4 years ago

0.0.111

4 years ago

0.0.110

4 years ago

0.0.109

4 years ago

0.0.108

4 years ago

0.0.106

4 years ago

0.0.105

4 years ago

0.0.104

4 years ago

0.0.103

4 years ago

0.0.107

4 years ago

0.0.102

4 years ago

0.0.101

4 years ago

0.0.100

4 years ago

0.0.97

4 years ago

0.0.98

4 years ago

0.0.99

4 years ago

0.0.96

4 years ago

0.0.95

4 years ago

0.0.93

4 years ago

0.0.94

4 years ago

0.0.91

4 years ago

0.0.92

4 years ago

0.0.90

4 years ago

0.0.88

4 years ago

0.0.89

4 years ago

0.0.87

4 years ago

0.0.86

4 years ago

0.0.85

4 years ago

0.0.84

4 years ago

0.0.82

4 years ago

0.0.83

4 years ago

0.0.81

4 years ago

0.0.80

4 years ago

0.0.79

4 years ago

0.0.78

4 years ago

0.0.77

4 years ago

0.0.76

4 years ago

0.0.75

4 years ago

0.0.74

4 years ago

0.0.73

4 years ago

0.0.71

4 years ago

0.0.72

4 years ago

0.0.70

4 years ago

0.0.69

4 years ago

0.0.68

4 years ago

0.0.66

4 years ago

0.0.67

4 years ago

0.0.65

4 years ago

0.0.62

4 years ago

0.0.63

4 years ago

0.0.64

4 years ago

0.0.61

4 years ago

0.0.60

4 years ago

0.0.59

4 years ago

0.0.58

4 years ago

0.0.57

4 years ago

0.0.56

4 years ago

0.0.55

4 years ago

0.0.54

4 years ago

0.0.53

4 years ago

0.0.51

4 years ago

0.0.52

4 years ago

0.0.50

4 years ago

0.0.48

4 years ago

0.0.49

4 years ago

0.0.47

4 years ago

0.0.46

4 years ago

0.0.45

4 years ago

0.0.44

4 years ago

0.0.43

4 years ago

0.0.42

4 years ago

0.0.40

4 years ago

0.0.39

4 years ago

0.0.37

4 years ago

0.0.38

4 years ago

0.0.35

4 years ago

0.0.36

4 years ago

0.0.34

4 years ago

0.0.33

4 years ago

0.0.30

4 years ago

0.0.29

4 years ago

0.0.28

4 years ago

0.0.23

4 years ago

0.0.24

4 years ago

0.0.25

4 years ago

0.0.26

4 years ago

0.0.27

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.12

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago