Skip to content

Commit

Permalink
feat: add doc file
Browse files Browse the repository at this point in the history
  • Loading branch information
ipetinate committed May 22, 2024
1 parent 689d7ee commit 9b43fbb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion doc/SCAFFOLD_COMMAND.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

> Generate resources with local templates
- [Flow and process steps](https://excalidraw.com/#json=7QnY-CZs8abdiDr3QQgBc,8njpSnpcGNRnZxRpaScL-w)
- [Flow and process steps](https://excalidraw.com/#json=Ucl3J2Z61I3fx9JPVEkVV,4Ble4pYYHnbcr1nkK3IOHw)

![Scaffold Code Flow](./img/scaffold-flow.svg)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This documentation describes how to use the `meta.yaml` file to create local res

## Structure of the `meta.yaml` File

The `meta.yaml` file contains definitions of resources that the CLI tool uses to generate components, asynchronous functions, markdown documents, and `.nvmrc` configurations.
The `meta.yaml` file contains definitions of resources that the CLI tool uses to generate components, pages, async functions, or whatever you want.

## Field Details

Expand All @@ -15,7 +15,6 @@ The table below describes the fields used in the resource definitions in the `me
| `identifier` | string | Yes | Unique identifier for the resource. |
| `folderWrapper` | boolean | No | Indicates if the resource should be wrapped by a folder. |
| `resource` | object | Yes | Contains information about the main resource. |
| `resource.index` | boolean | No | Indicates if an `index` file should be created. |
| `resource.target` | string | Yes | Target directory where the resource will be generated. |
| `resource.templatePath` | string | Yes | Path to the resource template. |
| `test` | object | No | Contains information about the resource's test file. |
Expand All @@ -33,7 +32,6 @@ The table below describes the fields used in the resource definitions in the `me
- identifier: component
folderWrapper: true
resource:
index: true
target: src/components
templatePath: ./ReactComponent/Component.tsx
test:
Expand All @@ -47,7 +45,6 @@ The table below describes the fields used in the resource definitions in the `me
- **identifier**: `component`
- **folderWrapper**: `true`
- **resource**:
- **index**: `true`
- **target**: `src/components`
- **templatePath**: `./ReactComponent/Component.tsx`
- **test**:
Expand Down Expand Up @@ -107,7 +104,11 @@ The table below describes the fields used in the resource definitions in the `me

## How to Use

1. Place the `meta.yaml` file in the `.clingon/templates` folder along with your templates.
2. Run the CLI tool according to your project's instructions to generate the resources defined in the `meta.yaml`.
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.
2. Run the CLI tool according to your project's instructions to generate the resources defined in the `meta` file.

```shell
npx clingon scaffold <name> --template <templateName>
```

This structure allows for easy definition and generation of different types of resources in your project, ensuring consistency and organization.
19 changes: 19 additions & 0 deletions src/templates/core/meta_example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
- identifier: component
folderWrapper: true
resource:
path: 'src/components'
template: './ReactComponent/Component.tsx'
test:
path: 'src/components'
template: './ReactComponent/Component.test.tsx'
story:
path: 'src/components'
template: './ReactComponent/Component.stories.tsx'

- identifier: async-function
resource:
path: src/utils
template: './Functions/AsyncFunction.ts'
test:
path: src/utils
template: './Functions/AsyncFunction.spec.ts'

0 comments on commit 9b43fbb

Please sign in to comment.