An open API service indexing awesome lists of open source software.

https://github.com/ulivz/alphax

Fueling your scaffolding.
https://github.com/ulivz/alphax

Last synced: 6 months ago
JSON representation

Fueling your scaffolding.

Awesome Lists containing this project

README

          




Fueling your scaffolding.


NPM version
NPM downloads
Build Status
donate

## What is alphaX?

alphaX provides very simple _JSON-like_ and _chained_ APIs that allow you to manipulate files freely. Now it supports [**_glob_**](https://github.com/isaacs/node-glob), **_task control_**, **_middleware_**, **_rename_**, **_filter_** and **_transform file_** as well.

BTW, alphaX was named from the Greek initials _**ฮฑ**_ and [spaceX](http://www.spacex.com/) I admire.

## Features

* ๐Ÿš€ Fast, based on stream.
* ๐Ÿ“ฆ Chained API.
* ๐Ÿ’… Using **_middlewares_** to process each file.
* ๐Ÿšจ Asynchronous task control.
* ๐ŸŒˆ Filter or Rename files with a pure function or configuration.
* ๐Ÿ’Ž Support **_Conditional Manipulation_**

## Install

```bash
npm i alphax --save
# Pay attention to the case, NPM does not support capitals. ๐Ÿ˜…
# Or yarn add alphax
```

## Usage

```js
import alphax from 'alphax'
// Or cjs: const app = require('alphax')
const app = alphax()
```

- **_Chained Style_**

```js
alphax()
.src('**')
.task(task1)
.task(task2)
.task(task3)
.use(file => file.content += Date.now())
.rename(filepath => filepath.replace('{name}', name))
.rename(filepath => filepath.replace('{age}', age))
.transform(content => content.replace('{name}', name))
.filter(filepath => filepath.endWith('.js'))
.filter(filepath => !filepath.startWith('test'))
.dest('dist')
.then(files => console.log(files))
.catch(error => console.log(error))
```

- **_Config Style_**

```js
const config = {
tasks: [task1, task3, task3],
use: file => file.content += Date.now(),
rename: {
'{name}': name,
'{age}': age
},
filter: {
'app.js': true,
'test.js': false
},
transform(content) {
return content.replace('{name}', name)
}
}

alphax()
.src('**', config)
.dest('dist')
.then(files => console.log(files))
.catch(error => console.log(error))
```

For detailed usage please head to [**_Documentation_**](http://www.v2js.com/alphax).

## Projects Using alphaX

- [**_poz_**](https://github.com/ulivz/poz): Programmable scaffolding generator. ๐Ÿน
- Feel free to add yours here :)

## Prior art

alphaX wouldn't exist if it wasn't for excellent prior art, alphaX is inspired by these projects:

- [**_vinyl-fs_**](https://github.com/gulpjs/vinyl-fs)
- [**_majo_**](https://github.com/egoist/majo)

## Contributing

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## Author

**alphaX** ยฉ [ulivz](https://github.com/ULIVZ), Released under the [MIT](./LICENSE) License.

Authored and maintained by ulivz with help from contributors ([list](https://github.com/ULIVZ/alphax/contributors)).

> [github.com/ulivz](https://github.com/ulivz) ยท GitHub [@ulivz](https://github.com/ULIVZ)