https://github.com/loreanvictor/rxline
RxJS-based task pipelines
https://github.com/loreanvictor/rxline
build-tool files pipeline rxjs task-pipeline
Last synced: 4 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 (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T16:25:28.000Z (over 2 years ago)
- Last Synced: 2025-03-09T13:34:58.692Z (4 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: 2
- Forks: 1
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#
RxLine
[](https://travis-ci.org/loreanvictor/rxline)
[](https://codecov.io/gh/loreanvictor/rxline)
[](https://www.npmjs.com/package/rxline)
[](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.