# quadra

> JavaScript architecture checker

Latest version **0.1.2-rc.2** (published 2019-12-09) · MIT license · 0 weekly downloads

## Install

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

Provides the command `quadra`.

## 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.2-rc.2 |
| Published | 2019-12-09 |
| First published | 2019-12-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 211.4 KB |
| Known vulnerabilities | 0 (+13 in 4 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Raul6469 |
| Maintainers | raul6469 |

## Links

- npm: https://www.npmjs.com/package/quadra
- Repository: https://github.com/Raul6469/quadra
- Issues: https://github.com/Raul6469/quadra/issues
- npm.io page: https://npm.io/package/quadra

## Dependencies (9)

- [glob](https://npm.io/package/glob.md) 7.1.6
- [chalk](https://npm.io/package/chalk.md) 3.0.0
- [lodash](https://npm.io/package/lodash.md) 4.17.15
- [js-yaml](https://npm.io/package/js-yaml.md) 3.13.1
- [@hapi/joi](https://npm.io/package/@hapi/joi.md) 16.1.8
- [@babel/types](https://npm.io/package/@babel/types.md) 7.7.4
- [@babel/parser](https://npm.io/package/@babel/parser.md) 7.7.4
- [vue-sfc-parser](https://npm.io/package/vue-sfc-parser.md) 0.1.2
- [@babel/traverse](https://npm.io/package/@babel/traverse.md) 7.7.4

## Recent versions

- 0.1.2-rc.2 (latest) — 2019-12-09
- 0.1.2-rc.1 — 2019-12-09
- 0.1.1 — 2019-12-09
- 0.1.0 — 2019-12-08

## README

# quadra

[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FRaul6469%2Fquadra%2Fbadge&style=flat)](https://actions-badge.atrox.dev/Raul6469/quadra/goto)

**Quadra is a JavaScript tool that lets you define and enforce architecture rules in your project.**

You define "boxes" that represent units of code, and the dependencies between them in a YAML config file. Quadra will scan files and look at `imports` and `require`, and make sure that they follow your rules.

It supports JavaScript, TypeScript and Vue SFC files :sparkles:

> This is a work in progress project, so expect some breaking changes to come. It is recommendend to specify a fixed version of quadra in your dependencies to avoid them.

## Installation

```bash
npm install --save-dev quadra
```

## Use
Create a `.quadra.yml` file at the root of your project, and define your "boxes" and their inter dependencies :

```yml
boxes:
  # Each key defines a box
  client:
    # 'files' is an array of file
    # globs that define your box
    files:
      - 'src/client/**/*.js'

    rules:
      # Define dependency rules
      boxes:
        # Files in the `client` box
        # can only import files from
        # these boxes, defined in this
        # config file
        only:
          - server
          - client # To allow imports within the 'client' box

  server:
    files:
      - 'src/server/**/*.js'
    rules:
      modules:
        # Specify a list of npm modules
        # banned in a box
        ban:
          - lodash
      boxes:
        only:
          - server
```
Check out the complete config file reference [in the docs](./docs/README.md).

> Please note that files that are not part of any box are always allowed dependencies.

Add quadra in your npm scripts in your `package.json` file:

```json
"scripts": {
  "quadra": "quadra",
},
```

And run checks with:
```bash
npm run quadra
```

## Contribute

All contributions are welcome! Open issues to provide feedback, ask questions or discuss new features, or open pull requests to propose new ones!

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