# jshelf

> react project format tool

Latest version **0.1.5** (published 2017-12-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install jshelf
pnpm add jshelf
yarn add jshelf
bun add jshelf
```

Provides the command `jshelf`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2017-12-15 |
| First published | 2017-11-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | doubaozia |
| Maintainers | doubaozia |
| Keywords | react, project, format, tool |

## Links

- npm: https://www.npmjs.com/package/jshelf
- Repository: https://github.com/doubaozia/jshelf
- Homepage: https://github.com/doubaozia/prodou#readme
- Issues: https://github.com/doubaozia/prodou/issues
- npm.io page: https://npm.io/package/jshelf

## Dependencies (6)

- [glob](https://npm.io/package/glob.md) ^7.1.2
- [babylon](https://npm.io/package/babylon.md) ^6.18.0
- [commander](https://npm.io/package/commander.md) ^2.11.0
- [babel-types](https://npm.io/package/babel-types.md) ^6.26.0
- [babel-traverse](https://npm.io/package/babel-traverse.md) ^6.26.0
- [babel-generator](https://npm.io/package/babel-generator.md) ^6.26.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.5 (latest) — 2017-12-15
- 0.1.4 — 2017-11-20
- 0.1.3 — 2017-11-16
- 0.1.2 — 2017-11-15
- 0.1.1 — 2017-11-13
- 0.1.0 — 2017-11-13

## README

# JShelf

JShelf is a react project auto format tool, you can use it to format your react project structure easily.

[![npm](https://img.shields.io/badge/npm-v0.1.5-blue.svg)](https://www.npmjs.com/package/jshelf)

![alt text](https://github.com/doubaozia/jshelf/blob/master/jshelf-icon.png "")

features:
- configurable
- format directory and file names
- auto modify the module import and export
- parse module require to import

## Installation
you can install jshelf by the npm recommend:
```
$ npm install jshelf --save-dev
```
## Usage

1. create a config file ```jshelf.json``` for your project, for example:

```json
{
  "root": "./src",
  "ignore": ["./src/app/", "./src/lib/", "./src/util/"],
  "rules": {
    "directory": {
      "case": "kebab"
    },
    "files": [
      {
        "test": "\\.js$|\\.jsx$",
        "case": "camel",
        "ignore": [
          "index",
          "logic",
          "store",
          "actions",
          "util"
        ]
      },
      {
        "test": "\\.less$",
        "case": "mix",
        "ignore": []
      }
    ],
    "default": {
      "case": "mix",
      "ignore": []
    }
  },
  "words": [
    "these",
    "are",
    "words",
    "used",
    "in",
    "your",
    "file",
    "names",
  ]
}
```
2. run the command in your project's root directory
```
$ jshelf
```

## Config options
|field name|type|required|comment|
|---|---|---|---|
|root|string|true|the root directory to be formated|
|ignore|array|false|the directorys you don't want to be formated but included in the root|
|rules|object|true|the rules according to which to format|
|rules.directory|object|false|directory rules\<rule item\>|
|rules.files|array|false|files rules\<rule item\>|
|rules.default|object|true|default rules\<rule item\>|
|words|array|true|the words appeard in your file or directory name|

### Rule item configs:
|field name|type|required|comment|
|---|---|---|---|
|case|string|true|format case selectable: camel, kebab, mix, snack|
|test|string|true|only file rules has this option, regular expression string to match the file|
|ignore|array|false|the file's name you don't want to format|

### Cases
now you can format your file or directory name use one of the following cases:

|case|example|words|formated|
|---|---|---|---|
|kebab|'kebabcase'|['kebab', 'case']|kebab-case|
|snake|'snakecase'|['snake', 'case']|snake_case|
|camel|'camelcase'|['camel', 'case']|CamelCase|
|mix|'mixcase'|['mix', 'case']|mixCase|

### Words
the words maintain a dictionary to format your project file and directory names, jshelf will spit your file or directory name according these words. before use jshelf, you must scan your project and find all the words you used in your directory and files, exclude ignored files.

for example, now you have a file named ```jshelfformatfile.js```, if you want to formated it to ```jshelfFormatFile.js```, your words config should be ```['jshelf', 'format', 'file']``` and the case is ```mix```.

---
_Source: https://npm.io/package/jshelf · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
