Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d6ab945
Update core store migration (#801)
pwizla Apr 12, 2022
9a32465
Merge branch 'main' into next
pwizla Apr 12, 2022
8ce5149
Typescript documentation (#835)
stb13579 Apr 15, 2022
4426e88
add ts config to services
stb13579 Apr 26, 2022
8c525c9
Add callout for alpha/beta migration scripts
pwizla May 5, 2022
f7edbb7
Revert "Add callout for alpha/beta migration scripts"
pwizla May 5, 2022
89ee8e5
Add callout for alpha/beta migration scripts (#878)
pwizla May 5, 2022
b35f96b
Typescript phase 2 (#864)
stb13579 May 11, 2022
91c5105
Force node
pwizla May 11, 2022
0b96443
update TypeScript dedicated page (#898)
stb13579 Jun 1, 2022
b5210ec
Merge branch 'main' into next
pwizla Jun 15, 2022
57696ee
Merge branch 'next' of github.com:strapi/documentation into next
pwizla Jun 15, 2022
23b7b13
Release 4.3.0-beta (#934)
pwizla Jun 15, 2022
0d0c8da
Re-add missing --typescript flag in CLI install. guide
pwizla Jun 15, 2022
031e07b
Add link to TypeScript development docs to CLI installation docs
pwizla Jun 15, 2022
cae479a
Add missing word 😅
pwizla Jun 15, 2022
2647e7a
Use production logo
pwizla Jul 25, 2022
d7b496b
Merge branch 'main' into next
pwizla Jul 25, 2022
d9f2553
Restore beta logo
pwizla Jul 26, 2022
f069fc7
typescript programmatic use (#980) (#1010)
pwizla Jul 26, 2022
680d2b9
Mention folders in CM (#1009)
pwizla Jul 26, 2022
2ab2378
Keep official (not beta) logo
pwizla Jul 26, 2022
9163f49
Add missing comma
pwizla Jul 26, 2022
a68c2a3
Update TS (migration) callout title
pwizla Jul 26, 2022
11bfae4
Reword TS callout
pwizla Jul 26, 2022
7253b30
Update FAQ entry for roadmap
pwizla Jul 26, 2022
1e6a1d0
Add missing space
pwizla Jul 26, 2022
ca3ac1b
Delete commented callout 1/4
pwizla Jul 26, 2022
6cf00c1
Delete commented callout 2/4
pwizla Jul 26, 2022
b5a6900
Delete commented callout 3/4
pwizla Jul 26, 2022
208839f
Delete commented callout 4/4
pwizla Jul 26, 2022
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
5 changes: 5 additions & 0 deletions docs/.vuepress/config/sidebar-developer.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ const developer = [
'/developer-docs/latest/setup-deployment-guides/configurations/optional/rbac.md',
'Role-Based Access Control (RBAC)',
],
[
'/developer-docs/latest/setup-deployment-guides/configurations/optional/typescript.md',
'TypeScript',
],
],
},
],
},
Expand Down Expand Up @@ -222,6 +226,7 @@ const developer = [
['/developer-docs/latest/development/admin-customization', 'Admin panel customization'],
['/developer-docs/latest/development/plugins-extension.md', 'Plugins extension'],
['/developer-docs/latest/development/plugins-development.md', 'Plugins development'],
['/developer-docs/latest/development/typescript.md', 'TypeScript'],
['/developer-docs/latest/development/providers.md', 'Providers'],
],
},
Expand Down
24 changes: 23 additions & 1 deletion docs/.vuepress/config/sidebar-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,28 @@ const user = [
],
],
},
{
collapsable: false,
title: 'Media Library',
children: [
[
'/user-docs/latest/media-library/introduction-to-media-library.md',
'Introduction to the Media Library'
],
[
'/user-docs/latest/media-library/adding-assets.md',
'Adding assets'
],
[
'/user-docs/latest/media-library/managing-assets.md',
'Managing individual assets'
],
[
'/user-docs/latest/media-library/organizing-assets-with-folders.md',
'Organizing assets with folders'
],
]
},
{
collapsable: false,
title: 'Users, Roles & Permissions',
Expand Down Expand Up @@ -101,4 +123,4 @@ const user = [
],
],
},
];
];
5 changes: 5 additions & 0 deletions docs/.vuepress/config/theme-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ const themeConfig = {
link:
'/user-docs/latest/users-roles-permissions/introduction-to-users-roles-permissions.html',
},
{
text: 'Media Library',
link:
'/user-docs/latest/media-library/introduction-to-media-library.html',
},
{
text: 'Plugins',
link: '/user-docs/latest/plugins/introduction-to-plugins.html',
Expand Down
23 changes: 20 additions & 3 deletions docs/developer-docs/latest/developer-resources/cli/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ canonicalUrl: https://docs.strapi.io/developer-docs/latest/developer-resources/c

# Command Line Interface (CLI)

Strapi comes with a full featured Command Line Interface (CLI) which lets you scaffold and manage your project in seconds.
Strapi comes with a full featured Command Line Interface (CLI) which lets you scaffold and manage your project in seconds.

::: note
It is recommended to install Strapi locally only, which requires prefixing all of the following `strapi` commands with the package manager used for the project setup (e.g `npm run strapi help` or `yarn strapi help`) or a dedicated node package executor (e.g. `npx strapi help`).
Expand Down Expand Up @@ -222,15 +222,15 @@ strapi admin:reset-user-password --email=chef@strapi.io --password=Gourmet1234

## strapi generate

Run a fully interactive CLI to generate APIs, [controllers](/developer-docs/latest/development/backend-customization/controllers.md), [content-types](/developer-docs/latest/development/backend-customization/models.md), [plugins](/developer-docs/latest/development/plugins-development.md#creating-a-plugin), [policies](/developer-docs/latest/development/backend-customization/policies.md), [middlewares](/developer-docs/latest/development/backend-customization/middlewares.md) and [services](/developer-docs/latest/development/backend-customization/services.md).
Run a fully interactive CLI to generate APIs, [controllers](/developer-docs/latest/development/backend-customization/controllers.md), [content-types](/developer-docs/latest/development/backend-customization/models.md), [plugins](/developer-docs/latest/development/plugins-development.md#create-a-plugin), [policies](/developer-docs/latest/development/backend-customization/policies.md), [middlewares](/developer-docs/latest/development/backend-customization/middlewares.md) and [services](/developer-docs/latest/development/backend-customization/services.md).

```sh
strapi generate
```

## strapi templates:generate

Create a template from the current strapi project
Create a template from the current Strapi project.

```bash
strapi templates:generate <path>
Expand All @@ -241,6 +241,23 @@ strapi templates:generate <path>

Example: `strapi templates:generate ../strapi-template-name` will copy the required files and folders to a `template` directory inside `../strapi-template-name`

## strapi ts:generate-types

Generate [TypeScript](/developer-docs/latest/development/typescript.md) typings for the project schemas.

```sh
strapi ts:generate-types
```

* **strapi ts:generate-types --verbose**<br/>
Generate typings with the verbose mode enabled, displaying a detailed table of the generated schemas.
* **strapi ts:generate-types --silent** or **strapi ts:generate-types -s**<br/>
Generate typings with the silent mode enabled, completely removing all the logs in the terminal.
* **strapi ts:generate-types --out-dir &#60;path&#62;** or **strapi ts:generate-types -o &#60;path&#62;**<br/>
Generate typings specifying the output directory in which the file will be created.
* **strapi ts:generate-types --file &#60;filename&#62;** or **strapi ts:generate-types -f &#60;filename&#62;**<br/>
Generate typings specifiying the name of the file to contain the types declarations.

## strapi routes:list

Display a list of all the available [routes](/developer-docs/latest/development/backend-customization/routes.md).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ Error functions accept 2 parameters that correspond to the `error.message` and `
- the first parameter of the function is the error `message`
- and the second one is the object that will be set as `details` in the response received

<code-group>
<code-block title="JAVASCRIPT">

```js

// path: ./src/api/[api-name]/controllers/my-controller.js
Expand All @@ -86,6 +89,32 @@ module.exports = {

```


</code-block>

<code-block title="TYPESCRIPT">


```js

// path: ./src/api/[api-name]/controllers/my-controller.ts

export default {
renameDog: async (ctx, next) => {
const newName = ctx.request.body.name;
if (!newName) {
return ctx.badRequest('name is missing', { foo: 'bar' })
}
ctx.body = strapi.service('api::dog.dog').rename(newName);
}
}

```

</code-block>
</code-group>


:::note
[Services](/developer-docs/latest/development/backend-customization/services.md) don't have access to the controller's `ctx` object. If services need to throw errors, these need to be caught by the controller, that in turn is in charge of calling the proper error function.
:::
Loading