Skip to content

Commit b94cb90

Browse files
Changes to typescript generation CLI (#1736)
* remove --file and add warning for --out-dir * update docs to match new usage * change schema file to types folder * Update docusaurus/docs/dev-docs/cli.md --------- Co-authored-by: Pierre Wizla <[email protected]>
1 parent cb62419 commit b94cb90

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

docusaurus/docs/dev-docs/cli.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -356,14 +356,17 @@ Generate [TypeScript](/dev-docs/typescript.md) typings for the project schemas.
356356
strapi ts:generate-types
357357
```
358358

359-
* **strapi ts:generate-types --verbose**<br/>
360-
Generate typings with the verbose mode enabled, displaying a detailed table of the generated schemas.
361-
* **strapi ts:generate-types --silent** or **strapi ts:generate-types -s**<br/>
362-
Generate typings with the silent mode enabled, completely removing all the logs in the terminal.
363-
* **strapi ts:generate-types --out-dir &#60;path&#62;** or **strapi ts:generate-types -o &#60;path&#62;**<br/>
359+
- **strapi ts:generate-types --debug**<br />
360+
[DEPRECATED] **strapi ts:generate-types --verbose**<br/>
361+
Generate typings with the debug mode enabled, displaying a detailed table of the generated schemas.
362+
- **strapi ts:generate-types --silent** or **strapi ts:generate-types -s**<br/>
363+
Generate typings with the silent mode enabled, completely removing all the logs in the terminal. Cannot be combined with `verbose` or `debug`
364+
- **strapi ts:generate-types --out-dir &#60;path&#62;** or **strapi ts:generate-types -o &#60;path&#62;**<br/>
364365
Generate typings specifying the output directory in which the file will be created.
365-
* **strapi ts:generate-types --file &#60;filename&#62;** or **strapi ts:generate-types -f &#60;filename&#62;**<br/>
366-
Generate typings specifying the name of the file to contain the types declarations.
366+
367+
:::caution
368+
Strapi requires the project types to be generated in the `types` directory for them to work. The `--out-dir` option should not be used for most cases. However, it can be useful for cases such as generating a second copy to compare the difference between your existing and updated types after changing your content structure.
369+
:::
367370

368371
## strapi routes:list
369372

docusaurus/docs/dev-docs/typescript.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,23 @@ To experience TypeScript-based autocomplete while developing Strapi applications
6565

6666
## Generate typings for project schemas
6767

68-
To generate typings for your project schemas use the [`ts:generate-types` CLI command](/dev-docs/cli#strapi-ts-generate-types). The `ts:generate-types` command creates the file `schemas.d.ts`, at the project root, which stores the schema typings. The optional `--verbose` flag returns a detailed table of the generated schemas.
68+
To generate typings for your project schemas use the [`ts:generate-types` CLI command](/dev-docs/cli#strapi-ts-generate-types). The `ts:generate-types` command creates the a folder `types`, at the project root, which stores the typings for your project. The optional `--debug` flag returns a detailed table of the generated schemas.
6969

7070
To use `ts:generate-types`run the following code in a terminal at the project root:
7171

7272
<Tabs groupId="yarn-npm">
7373
<TabItem value="npm">
7474

7575
```sh
76-
npm run strapi ts:generate-types --verbose #optional flag
76+
npm run strapi ts:generate-types --debug #optional flag to display additional logging
7777
```
7878

7979
</TabItem>
8080

8181
<TabItem value="yarn">
8282

8383
```sh
84-
yarn strapi ts:generate-types --verbose #optional flag
84+
yarn strapi ts:generate-types --debug #optional flag to display additional logging
8585
```
8686

8787
</TabItem>

0 commit comments

Comments
 (0)