Skip to content

Commit

Permalink
docs: fix paths and provide defaults into schematics (#2081)
Browse files Browse the repository at this point in the history
  • Loading branch information
profanis authored Nov 23, 2023
1 parent 744e67c commit f7ec3a6
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 28 deletions.
12 changes: 7 additions & 5 deletions docs/concepts/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ You have the option to enter the options yourself
ng generate @ngxs/store:actions --name NAME_OF_YOUR_ACTION
```

| Option | Description | Required |
| :----- | :----------------------------------- | :------: |
| --name | The name of the actions | Yes |
| --path | The path to create the actions | No |
| --flat | Flag to indicate if a dir is created | No |
| Option | Description | Required | Default Value |
| :----- | :------------------------------------------- | :------: | :------------------- |
| --name | The name of the actions | Yes | |
| --path | The path to create the actions | No | App's root directory |
| --flat | Boolean flag to indicate if a dir is created | No | `false` |

🪄 **This command will**:

- Create an action with the given options

> Note: If the --flat option is false, the generated files will be organized into a directory named using the kebab case of the --name option. For instance, 'MyActions' will be transformed into 'my-actions'.
## Internal Actions

There are two actions that get triggered in the internals of the library:
Expand Down
14 changes: 8 additions & 6 deletions docs/concepts/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ You have the option to enter the options yourself
ng generate @ngxs/store:state --name NAME_OF_YOUR_STATE
```

| Option | Description | Required |
| :----- | :----------------------------------------------------- | :------: |
| --name | The name of the state | Yes |
| --path | The path to create the state | No |
| --spec | Flag to indicate if a unit test file should be created | No |
| --flat | Flag to indicate if a dir is created | No |
| Option | Description | Required | Default Value |
| :----- | :------------------------------------------------------------- | :------: | :------------------- |
| --name | The name of the state | Yes | |
| --path | The path to create the state | No | App's root directory |
| --spec | Boolean flag to indicate if a unit test file should be created | No | `true` |
| --flat | Boolean flag to indicate if a dir is created | No | `false` |

🪄 **This command will**:

- Create a state with the given options

> Note: If the --flat option is false, the generated files will be organized into a directory named using the kebab case of the --name option. For instance, 'MyState' will be transformed into 'my-state'.
## Defining a State

States are classes along with decorators to describe metadata
Expand Down
14 changes: 7 additions & 7 deletions docs/concepts/store.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ You have the option to enter the options yourself
ng generate @ngxs/store:store --name NAME_OF_YOUR_STORE
```

| Option | Description | Required |
| :----- | :----------------------------------------------------- | :------: |
| --name | The name of the store | Yes |
| --path | The path to create the store | No |
| --spec | Flag to indicate if a unit test file should be created | No |
| --flat | Flag to indicate if a dir is created | No |
| Option | Description | Required | Default Value |
| :----- | :------------------------------------------------------------- | :------: | :------------------- |
| --name | The name of the store | Yes | |
| --path | The path to create the store | No | App's root directory |
| --spec | Boolean flag to indicate if a unit test file should be created | No | `true` |
| --flat | Boolean flag to indicate if a dir is created | No | `false` |

🪄 **This command will**:

- Generate a `{name}.actions.ts`
- Generate a `{name}.state.spec.ts`
- Generate a `{name}.state.ts`. The state file also includes an action handler for the generated action.

> Note: The generated files will be placed in the selected `path`, or the root of your application if no `path` is selected
> Note: If the --flat option is false, the generated files will be organized into a directory named using the kebab case of the --name option. For instance, 'MyStore' will be transformed into 'my-store'.
### Creating actions

Expand Down
6 changes: 3 additions & 3 deletions docs/introduction/schematics.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ See the [Starter Kit Page](starter-kit.md) to learn more.

The store is a global state manager that dispatches actions your state containers listen to and provides a way to select data slices out from the global state.

See the [Store Page](concepts/store.md) to learn more.
See the [Store Page](../concepts/store.md) to learn more.

## Actions

Actions can either be thought of as a command which should trigger something to happen, or as the resulting event of something that has already happened.

See the [Actions Page](concepts/actions.md) to learn more.
See the [Actions Page](../concepts/actions.md) to learn more.

## State

States are classes that define a state container.

See the [State Page](concepts/state.md) to learn more.
See the [State Page](../concepts/state.md) to learn more.
16 changes: 9 additions & 7 deletions docs/introduction/starter-kit.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ You have the option to enter the options yourself
ng generate @ngxs/store:starter-kit --path YOUR_PATH
```

| Option | Description | Required |
| :----- | :----------------------------------------------------- | :------: |
| --path | The path to create the starter kit | Yes |
| --spec | Flag to indicate if a unit test file should be created | No |
| Option | Description | Required | Default Value |
| :----- | :------------------------------------------------------------- | :------: | :------------ |
| --path | The path to create the starter kit | Yes | |
| --spec | Boolean flag to indicate if a unit test file should be created | No | `true` |

🪄 **This command will**:

- Create Auth State, Actions and Selectors
- Create Dictionary State, Actions and Selectors
- Create User State, Actions and Selectors
- Create Auth State, Actions, Selectors and Unit Tests, organized into an 'auth' directory
- Create Dictionary State, Actions, Selectors and Unit Tests, organized into a 'dashboard/states/dictionary' directory
- Create User State, Actions, Selectors and Unit Tests, organized into a 'dashboard/states/user' directory
- Create a Store and Configure the Auth, Dictionary and User states

> Note: The generated files will be organized into a 'store' directory.

0 comments on commit f7ec3a6

Please sign in to comment.