Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/egoist/majo
A minimal module to manipulate files.
https://github.com/egoist/majo
Last synced: about 1 month ago
JSON representation
A minimal module to manipulate files.
- Host: GitHub
- URL: https://github.com/egoist/majo
- Owner: egoist
- License: mit
- Created: 2017-04-26T14:22:56.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T21:47:56.000Z (almost 2 years ago)
- Last Synced: 2024-10-10T12:18:06.977Z (2 months ago)
- Language: TypeScript
- Homepage: https://majo.egoist.sh
- Size: 1.81 MB
- Stars: 54
- Watchers: 3
- Forks: 5
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-star - majo
README
# majo
_Art by [でんでん COMIC1・こ 24b](https://www.pixiv.net/member.php?id=12192)_
[![NPM version](https://img.shields.io/npm/v/majo.svg?style=flat)](https://npmjs.com/package/majo) [![NPM downloads](https://img.shields.io/npm/dm/majo.svg?style=flat)](https://npmjs.com/package/majo) [![CircleCI](https://circleci.com/gh/egoist/majo/tree/master.svg?style=shield&circle-token=560404744e167900959a512d617a05ec5240616f)](https://circleci.com/gh/egoist/majo/tree/master) [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat)](https://github.com/egoist/donate)
## Introduction
You can use _majo_ to manipulate files like a pro, with a simple API whose core is only ≈ 150 SLOC.
## Install
```bash
yarn add majo
```## Usage
```js
const { majo } = require('majo')const stream = majo()
// Given that you have js/app.js js/index.js
stream
.source('js/**')
.use(ignoreSomeFiles)
.dest('dist')
.then(() => {
// Now you got filtered files
})function ignoreSomeFiles(stream) {
for (const filename in stream.files) {
const content = stream.fileContents(filename)
// Remove it if content has specific string
if (/some-string/.test(content)) {
delete stream.files[filename]
}
}
}
```## Documentation
https://majo.egoist.sh
## Used By
- [SAO](https://github.com/egoist/sao): ⚔️ Futuristic scaffolding tool.
## 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
**majo** © [egoist](https://github.com/egoist), Released under the [MIT](./LICENSE) License.
Authored and maintained by egoist with help from contributors ([list](https://github.com/egoist/majo/contributors)).> [egoist.moe](https://egoist.moe) · GitHub [@egoist](https://github.com/egoist) · Twitter [@\_egoistlily](https://twitter.com/_egoistlily)