Skip to content

Commit

Permalink
feat: update scaffold guide md file
Browse files Browse the repository at this point in the history
  • Loading branch information
ipetinate committed Jun 23, 2024
1 parent e6de0f9 commit 4ec0e15
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 23 deletions.
1 change: 1 addition & 0 deletions markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MD046: fenced
73 changes: 50 additions & 23 deletions src/templates/core/SCAFFOLD_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ This documentation describes how to use the `meta.yaml` file to create local res

If you don't know how to create YAML or custom local template files, I recommend that you run the initialization command with the `--examples` flag, which will do all the local configuration necessary for the project to work, in addition to adding some ready-made files. example so you can use it.

```shell
npx clingon init --examples
```
```shell
npx clingon init --examples
```

## Structure of the `meta.yaml` File

Expand All @@ -18,13 +18,40 @@ The `meta.yaml` file contains definitions of resources that the CLI tool uses to

The table below describes the fields used in the resource definitions in the `meta.yaml` file.

| Field | Type | Required | Description |
| ------------------- | ------- | -------- | --------------------------------------------------------------------------------------- |
| `identifier` | string | Yes | Unique identifier for the resource (used on `scaffold` flag `--template` as tag value). |
| `folderWrapper` | boolean | No | Indicates if the resource should be wrapped by a folder. |
| `resources` | object | Yes | List of resources to be created. |
| `resource.path` | string | Yes | Path target directory where the resource will be generated. |
| `resource.template` | string | Yes | Path to the resource template. |
| Field | Type | Required | Description |
| -------------------- | ------------ | -------- | --------------------------------------------------------------------------------------- |
| `identifier` | `string` | Yes | Unique identifier for the resource (used on `scaffold` flag `--template` as tag value). |
| `folderWrapper` | `boolean` | No | Indicates if the resource should be wrapped by a folder. |
| `case` | `Case` | No | Indicates if the resource should be wrapped by a folder. |
| `resources` | `Resource[]` | Yes | List of resources to be created. |
| `resources.path` | `string` | Yes | Path target directory where the resource will be generated. |
| `resources.template` | `string` | Yes | Path to the resource template. |

### Types

> Reference for table types
```ts
type Case =
| 'camelCase'
| 'PascalCase'
| 'snake_case'
| 'kebab-case'
| 'UPPERCASE'
| 'lowercase'

interface Resource {
path: string
template: string
}

interface Meta {
identifier: string
folderWrapper?: boolean
case?: Case
resources: Resource[]
}
```

## Detailed Examples

Expand All @@ -50,35 +77,35 @@ The table below describes the fields used in the resource definitions in the `me
```yaml
- identifier: async-function
resource:
target: src/utils
templatePath: ./Functions/AsyncFunction.ts
test:
target: src/utils
templatePath: ./Functions/AsyncFunction.spec.ts
resources:
- path: src/utils
template: ./Functions/AsyncFunction.ts
- path: src/utils
template: ./Functions/AsyncFunction.spec.ts
```
### Markdown Documentation
```yaml
- identifier: markdown
resource:
target: src/docs
templatePath: ./Docs/ReactHookDoc.md
resources:
- path: src/docs
template: ./Docs/ReactHookDoc.md
```
### `.nvmrc` File

```yaml
- identifier: nvmrc
resource:
target: .
templatePath: ./Core/.nvmrc
resources:
- path: .
template: ./Core/.nvmrc
```

## How to Use

1. Place the `meta.yaml` or `meta.json` (I strongly recommend using YAML, but you can use JSON) file in the `.clingon/templates` folder along with your templates.
1. Place the `meta.yaml` or `meta.json` file in the `.clingon/templates` folder along with your templates.
1. I strongly recommend using YAML, for a better readability but you can also use JSON
2. Run the CLI tool according to your project's instructions to generate the resources defined in the `meta` file.

```shell
Expand Down

0 comments on commit 4ec0e15

Please sign in to comment.