Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(helpers): add more docs about new generator methods #170

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading