Skip to content

Commit

Permalink
Merge pull request #170 from AthennaIO/develop
Browse files Browse the repository at this point in the history
feat(helpers): add more docs about new generator methods
  • Loading branch information
jlenon7 authored Jan 15, 2024
2 parents bfbe8a1 + 4205819 commit 5d7dde1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
40 changes: 34 additions & 6 deletions docs/cli-application/commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1060,11 +1060,39 @@ that is exactly what we do internally with other

:::

#### `this.generator.fileName()`

Set the name of the file and also the name that will
be used used as reference to create the custom properties
to be used in the template:

```ts
this.generator.fileName('UserRepository.ts')
```

#### `this.generator.destination()`

Set the destination where the file should be created:

```ts
this.generator.destination(Path.repositories())
```

#### `this.generator.extension()`

Set the extension of your file:

```ts
this.generator.extension('ts')
```

#### `this.generator.path()`

Set the file path where the file will be generated.
Remember that the file name in the path will be used
to define the name properties:
The `fileName()`, `destination()` and `extension()`
will be ignored if a full path is set, meaning that
when you set a path, the file name in the path will
be used to define the name properties:

```typescript
this.generator.path(Path.repositories('UserRepository.ts'))
Expand All @@ -1078,7 +1106,7 @@ the `templates` property of `.athennarc.json`
to find the path to your template file:

```typescript
this.generator.path('repository')
this.generator.template('repository')
```

#### `this.generator.properties()`
Expand All @@ -1087,11 +1115,11 @@ Set custom properties names to be replaceble inside
the template, check the example:

```typescript
console.log('Hello {{ name }}')
this.generator.properties({ name: 'Lenon' })
```

```typescript
this.generator.properties({ name: 'Lenon' })
```edge
console.log('Hello {{ name }}')
```

#### `this.generator.setNameProperties()`
Expand Down
4 changes: 3 additions & 1 deletion docs/the-basics/helpers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ import { Exception } from '@athenna/common'
const exception = new Exception({
status: 500,
details: [],
otherInfos: {},
name: 'ErrorName',
code: 'ERROR_CODE',
message: 'Some exception has ocurred.',
Expand All @@ -250,7 +251,8 @@ import { Exception } from '@athenna/common'

const exception = new Exception({
status: 500,
details: []
details: [],
otherInfos: {},
name: 'ErrorName',
code: 'ERROR_CODE',
message: 'Some exception has ocurred.',
Expand Down

0 comments on commit 5d7dde1

Please sign in to comment.