# komp

> Creates file components with boilerplate content

Latest version **1.0.9** (published 2019-10-07) · MIT license · 0 weekly downloads

## Install

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

Provides the command `komp`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2019-10-07 |
| First published | 2017-10-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 353.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Francis Vega |
| Maintainers | hisco |
| Keywords | fractal, component, cli, patternlibrary, designsystem, design, system |

## Links

- npm: https://www.npmjs.com/package/komp
- Repository: https://github.com/FrancisVega/komp
- Homepage: https://github.com/FrancisVega/komp#readme
- Issues: https://github.com/FrancisVega/komp/issues
- npm.io page: https://npm.io/package/komp

## Dependencies (4)

- [colors](https://npm.io/package/colors.md) ^1.1.2
- [fs-extra](https://npm.io/package/fs-extra.md) ^4.0.2
- [commander](https://npm.io/package/commander.md) ^2.11.0
- [find-root](https://npm.io/package/find-root.md) ^1.1.0

## Alternatives

- [@progress/kendo-ooxml](https://npm.io/package/@progress/kendo-ooxml.md) — 152.1K weekly downloads
- [@progress/kendo-react-ripple](https://npm.io/package/@progress/kendo-react-ripple.md) — 8.0K weekly downloads
- [@progress/kendo-react-orgchart](https://npm.io/package/@progress/kendo-react-orgchart.md) — 4.3K weekly downloads
- [@praxisui/dynamic-fields](https://npm.io/package/@praxisui/dynamic-fields.md) — 2.4K weekly downloads
- [@progress/kendo-vue-listbox](https://npm.io/package/@progress/kendo-vue-listbox.md) — 932 weekly downloads

## Recent versions

- 1.0.9 (latest) — 2019-10-07
- 1.0.8 — 2017-11-15
- 1.0.7 — 2017-11-01
- 1.0.6 — 2017-10-31
- 1.0.5 — 2017-10-31
- 1.0.3 — 2017-10-31
- 1.0.1 — 2017-10-31
- 1.0.0 — 2017-10-31

## README

# Komp

Create files with boilerplate content

### Options

```bash
$komp --help

Usage: komp [options]

Options:
  -T, --template <name> File base template
  -v, --verbose         Verbose mode
  -h, --help            output usage information
  -V, --version         output the version number
  

Commands:
  new|n <name>  Create new boilerplate folder/files
  init|i        Create config file and template folder  
```

### Install

```bash
npm -g install komp
```

### Config defaults

The scripts creates a configuration file (.komp) and a directory (comp-templates) with template(s) at project root folder (same as package.json) called .komp to set defaults values. If you want to create new templates you have to put inside [root]comp-templates folder. Notice how the base template is created at [root]/comp-templates/base

###.komp

Is a JSON format config file with:

- baseName. This name will be replaced by the name the user enter in the command.
- basePath: A default directory where the component folder will be created.
- template. This is the name of the folder with the boilerplate files. This name also will replaced by the name user enter int the command.

```json
{
    "baseName": "component",
    "basePath": ""
    "template": "base",
}
```

With this content in .komp file the komp command will search for this structure:
    
```
comp-templates (komp will create this folder)
└─ base
    ├─ component.html
    ├─ component.twig
    ├─ component.js
    ├─ component.json
    ├─ component.yaml
    ├─ component.md
    ├─ component.css
    └─ component.scss
```

Komp ignore the files that finally don't exist in your HD.

You can have more than one "template" in your HD, for example.

```
comp-templates (komp will create this folder)
├─ base
│  ├─ component.html
│  ├─ component.js
│  ├─ component.json
│  ├─ component.yaml
│  ├─ README.md
│  ├─ component.css
│  └─ component.scss
│
├─ @fractal
│  ├─ component.njk
│  ├─ config.yaml
│  └─ component.css
│
└─ @simple
   └─ component.njk
```

To create a new component using a differente template use --template flag

```bash
komp new button --template fractal
```

This will create a folder and files in your HD like this:

*Note that komp will respect the EXTRA character you put in the template folders and files.
If you call to the fractal template, komp will looking for a folder that containt fractal in the name, and then let the extra char ( in this case the @ ). This way you can boilerplate the names too.*

```
button
└─ @button
   ├─ button.njk
   ├─ config.yaml
   └─ button.scss
```

### Examples

```bash
# Create .komp config file
komp init
```

```bash
# Create button component with default template
komp new button
```

```bash
# Create myCard component using the card template
komp new myCard --template card
```

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