Skip to content
Fueling your scaffolding.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.media
docs
example/scaffolding
src
test
.editorconfig
.gitattributes
.gitignore
CHANGELOG.md
LICENSE
README.md
circle.yml
index.d.ts
package.json
tsconfig.json
yarn.lock

README.md

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, task control, middleware, rename, filter and transform file as well.

BTW, alphaX was named from the Greek initials α and spaceX 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

npm i alphax --save 
# Pay attention to the case, NPM does not support capitals. 😅
# Or yarn add alphax

Usage

import alphax from 'alphax'
// Or cjs: const app = require('alphax')
const app = alphax()
  • Chained Style
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
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.

Projects Using alphaX

  • 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:

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, Released under the MIT License.
Authored and maintained by ulivz with help from contributors (list).

github.com/ulivz · GitHub @ulivz

You can’t perform that action at this time.