Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/loreanvictor/rxline
RxJS-based task pipelines
https://github.com/loreanvictor/rxline
build-tool files pipeline rxjs task-pipeline
Last synced: 3 months ago
JSON representation
RxJS-based task pipelines
- Host: GitHub
- URL: https://github.com/loreanvictor/rxline
- Owner: loreanvictor
- License: mit
- Created: 2020-02-08T15:17:53.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T16:25:28.000Z (almost 2 years ago)
- Last Synced: 2024-10-23T01:26:18.419Z (3 months ago)
- Topics: build-tool, files, pipeline, rxjs, task-pipeline
- Language: TypeScript
- Homepage: https://loreanvictor.github.io/rxline/
- Size: 1.46 MB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RxLine
[![Build Status](https://badgen.net/travis/loreanvictor/rxline?label=build&cache=300&icon=travis)](https://travis-ci.org/loreanvictor/rxline)
[![Code Coverage](https://badgen.net/codecov/c/github/loreanvictor/rxline?cache=300&icon=codecov)](https://codecov.io/gh/loreanvictor/rxline)
[![NPM Version](https://badgen.net/npm/v/rxline?cache=300&icon=npm)](https://www.npmjs.com/package/rxline)
[![License](https://badgen.net/github/license/loreanvictor/rxline?icon=github)](LICENSE)A Javascript task pipeline library built on top of [RxJS](https://github.com/ReactiveX/rxjs). It helps you manage complex (possibly async) operations on collections (or streams) of entities. A common example is performing a series of tasks on a list of files (compiling sass to css or markdown to html).
```
npm i rxline
```## Usage
Super basic example:
```javascript
import { line } from 'rxline';line([1, 2, 3, 4])
.pipe(x => x * 2)
.pick(x => x > 3)
.collect(console.log);
```More real-life example:
```javascript
import { concurrently } from 'rxline';
import { files, pathMatch,
readFile, writeFile,
mapExt, mapContent, mapRoot } from 'rxline/fs';files('.') // --> all files in current directory (and sub-directories)
.pick(pathMatch(/\.js$/)) // --> pick javascript files
.peek(f => console.log('-->' + f.path)) // --> log each file path
.pipe(readFile(), // --> read contents of the file
mapContent(c => ({ lines: c.split('\n').length })), // --> map its content to an object with number of lines in it
mapContent(c => JSON.stringify(c, null, 2)), // --> also stringify the json object
mapExt(() => '.json'), // --> change extension to `.json`
mapRoot(() => '.meta'), // --> change root directory to `.meta`
writeFile()) // --> write the files
.process(concurrently); // --> all in parallel.
```👉[Checkout the Wiki for more details.](https://loreanvictor.github.io/rxline/)
## Why?
Because Gulp felt too opaque for me. I needed to be more in control.