0.2.6 • Published 3 years ago

@yalam/cli v0.2.6

Weekly downloads
156
License
MIT
Repository
github
Last release
3 years ago

Welcome to yalam 👋

Version License: MIT

A Gulp-inspired incremental build system

Feature Comparison

Here is a table comparing some javascript build systems:

FeatureYalamGulpBrunch
opinionated
incremental
pipeline-based

Architecture

Yalam is a Gulp-inspired incremental build system. The aim is to make your build purely incremental, by using a caching strategy and a developper-friendly API.

Yalamfile

Yalam is configured with a Yalamfile.js. This file describes the list of pipelines that can be used to build your packages.

const { pipe, apply } = require('@yalam/core');
const { source, destination , createAsset } = require('@yalam/operators');
const { tsCompiler } = require('@yalam/typescript');

const ts = pipe(
    source({ glob: 'src/**/*' }),
    createAsset(),
    apply(['.ts'])(
        tsCompiler.transpile(),
        tsCompiler.generateTypes()
    ),
    destination({ path: 'dist' })
);

module.exports = {
    default: ts,
};

Here the ts pipeline will create a .js and a .d.ts asset for each .ts source file, using typescript.

Package

Using the CLI provided by @​yalam/cli, you can build packages by providing a list like that:

foo@bar:~$  yalam --watch example-1/ example-2/

Here a package is a folder containing a package.json file with a config.yalam field like for instance:

{
    "name": "@yalam/example-1",
    "version": "1.0.0",
    "main": "dist/index.js",
    "config": {
        "yalam": {
            "build": "default",
            "watch": "default"
        }
    }
}

As you can see, this package.json tells Yalam to use the default pipeline both for build mode and watch mode.

Note that you can mark a package to be skipped by using the value "skip" for the yalam field.

Pipeline

Pipeline, also named task, is how you tell Yalam to do its job.

A pipeline is nothing else but an operator, ie. a function that map an observable to an observable.

So basically you can use all the power of RxJS to construct your piplines.

A pipeline should map an observable of type InputEvent to an observable of type Asset. This is directly inspired by how Gulp works but the interface is a bit different.

Look at the fixtures folder to see examples of pipelines.

Operator

To create your pipeline, you should use meta-operators that create an operator out of operators, and already existing operators.

  • @​yalam/core exports some generic meta-operators: pipe, apply, parallel and series.
  • @​yalam/operators exports some generic operators: source, sink, oneToOne, destination and createAsset.
  • @​yalam/babel exports operator babel.
  • @​yalam/typescript exports operators tsCompiler.transpile, tsCompiler.generateTypes and tsCompiler.checkTypes.

The futur

Yalam current target in mind is a NodeJS mono-repository for backend. But it could be extended to support more compilers and maybe with enough contribution extends to an eco-system.

There is so much to do, create a documentation, create a test suite, create new operators for different compilers, enable built-in support for dependancy graphs, ...

So if you are willing to contribute, don't hesitate to contact-me/open an issue!

Cheers.

PS: Yalam is a reference to Golden Sun .

Author

👤 Paul Le Couteur

0.2.6

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.1

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.1.12

3 years ago

0.1.10

3 years ago

0.1.11

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago