https://github.com/ulivz/alphax
Fueling your scaffolding.
https://github.com/ulivz/alphax
Last synced: 6 months ago
JSON representation
Fueling your scaffolding.
- Host: GitHub
- URL: https://github.com/ulivz/alphax
- Owner: ulivz
- License: mit
- Created: 2018-01-07T10:26:08.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-05-12T01:01:54.000Z (over 4 years ago)
- Last Synced: 2025-03-28T18:49:36.327Z (7 months ago)
- Language: TypeScript
- Homepage: http://www.v2js.com/alphax
- Size: 618 KB
- Stars: 16
- Watchers: 1
- Forks: 1
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
Fueling your scaffolding.## 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)