Skip to content

Commit

Permalink
feat: rewrite in typescript
Browse files Browse the repository at this point in the history
BREAKING:

default export is now removed, use named export `majo` instead:

```js
const { majo } = require('majo')
// or
import { majo } from 'majo'
```
  • Loading branch information
egoist committed Nov 14, 2019
1 parent e491d23 commit d07511e
Show file tree
Hide file tree
Showing 15 changed files with 2,362 additions and 5,080 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
dist/
output
examples/*/yarn.lock
typedoc
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"semi": false
}
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<img src="https://ooo.0o0.ooo/2017/04/27/59016709425c9.jpg" width="300" />
</a>

*Art by [でんでんCOMIC1・こ24b](https://www.pixiv.net/member.php?id=12192)*
_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)
[![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.
You can use _majo_ to manipulate files like a pro, with a simple API whose core is only ≈ 150 SLOC.

## Install

Expand All @@ -21,7 +21,7 @@ yarn add majo
## Usage

```js
const majo = require('majo')
const { majo } = require('majo')

const stream = majo()

Expand All @@ -45,14 +45,13 @@ function ignoreSomeFiles(stream) {
}
```

## Support
## Documentation

[API docs](/docs/api.md)<br>
[Middleware](/docs/middleware.md)
https://majo.egoist.sh

## Used By

- [SAO](https://github.com/egoist/sao): ⚔️ Futuristic scaffolding tool.
- [SAO](https://github.com/egoist/sao): ⚔️ Futuristic scaffolding tool.

## Contributing

Expand All @@ -62,10 +61,9 @@ function ignoreSomeFiles(stream) {
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.<br>
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)
> [egoist.moe](https://egoist.moe) · GitHub [@egoist](https://github.com/egoist) · Twitter [@\_egoistlily](https://twitter.com/_egoistlily)
3 changes: 0 additions & 3 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@ jobs:
- run:
name: test
command: yarn test
- run:
name: release
command: npx semantic-release
171 changes: 0 additions & 171 deletions docs/api.md

This file was deleted.

14 changes: 0 additions & 14 deletions docs/middleware.md

This file was deleted.

9 changes: 9 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
testEnvironment: 'node',
transform: {
'^.+\\.tsx?$': 'ts-jest'
},
testRegex: '(/__test__/.*|(\\.|/)(test|spec))\\.tsx?$',
testPathIgnorePatterns: ['/node_modules/', '/dist/', '/types/'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node']
}
62 changes: 29 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,47 @@
"url": "egoist/majo",
"type": "git"
},
"main": "dist/majo.cjs.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"test": "npm run lint && jest",
"test": "jest",
"prepublishOnly": "npm run build",
"lint": "xo",
"build": "bili"
"build": "rollup -c",
"format": "prettier *.{js,md,json,ts} --write",
"typedoc": "typedoc src --out typedoc --theme minimal --mode file --excludeExternals --excludePrivate --excludeProtected"
},
"author": "egoist <[email protected]>",
"license": "MIT",
"jest": {
"testEnvironment": "node",
"testPathIgnorePatterns": [
"/examples/"
"lint-staged": {
"*.{js,md,json,ts}": [
"prettier --write",
"git add"
]
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^22.4.3",
"bili": "^3.3.0",
"buble": "^0.15.2",
"eslint-config-rem": "^3.0.0",
"jest-cli": "^22.4.3",
"xo": "^0.18.0"
},
"xo": {
"extends": "rem",
"envs": [
"jest"
],
"ignores": [
"test/fixture/**",
"test/output/**",
"examples/**"
],
"rules": {
"guard-for-in": 0
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"devDependencies": {
"@types/fs-extra": "^8.0.1",
"@types/jest": "^24.0.23",
"@types/node": "^12.12.7",
"husky": "^3.0.9",
"jest": "^24.9.0",
"lint-staged": "^9.4.3",
"prettier": "^1.19.1",
"rollup": "^1.27.0",
"rollup-plugin-typescript2": "^0.25.2",
"ts-jest": "^24.1.0",
"typedoc": "^0.15.1",
"typescript": "^3.7.2"
},
"dependencies": {
"fast-glob": "^2.2.3",
"fs-extra": "^7.0.0"
"fast-glob": "^3.1.0",
"fs-extra": "^8.1.0"
}
}
18 changes: 18 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export default {
input: 'src/index.ts',
output: {
dir: 'dist',
format: 'cjs'
},
plugins: [
require('rollup-plugin-typescript2')({
tsconfigOverride: {
compilerOptions: {
module: 'esnext',
declaration: true
},
include: ['src']
}
})
]
}
Loading

0 comments on commit d07511e

Please sign in to comment.