Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/strapi/documentation into u…
Browse files Browse the repository at this point in the history
…ser/new-intro
  • Loading branch information
MbonuJennifer committed Feb 23, 2024
2 parents c3b9af5 + c0e5f65 commit 2f4a97f
Show file tree
Hide file tree
Showing 12 changed files with 377 additions and 45 deletions.
34 changes: 29 additions & 5 deletions docusaurus/docs/cloud/projects/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,40 @@ The *General* tab enables you to check and update the following options for the
}}
/>

### Modifying git repository branch
### Modifying git repository & branch

The GitHub or Gitlab repository branch and base directory for a Strapi Cloud project are by default chosen at the creation of the project (see [Creating a project](/cloud/getting-started/deployment)). Both can afterwards be edited via the project's settings.
The GitHub or Gitlab repository, branch and base directory for a Strapi Cloud project are by default chosen at the creation of the project (see [Creating a project](/cloud/getting-started/deployment)). After the project's creation, via the project's settings, it is possible to:

1. In the *Connected git repository* section of the *General* tab, click on the **Edit** button.
2. In the *Edit Git settings* dialog, edit the available options of your choice:
- update the project's repository or switch to another git provider (see [Updating repository](#updating-repository)),
- edit the project's branch, base directory and deploy on push setting (see [Editing branch](#editing-branch)).

:::caution
Updating the git repository could result in the loss of the project and its data, for instance if the wrong repository is selected or if the data schema between the old and new repository doesn't match.
:::

#### Updating repository

1. In the *Connected git repository* section of the *General* tab, click on the **Update repository** button.
2. (optional) If you wish to not only update the repository but switch to another git provider, click on the **Switch to GitHub/GitLab** button at the bottom of the *Update repository* dialog. You will be redirected to the chosen git provider's authorization settings before getting back to the *Update repository dialog*.
3. In the *Update repository* dialog, fill in the 3 available settings:

| Setting name | Instructions |
| --------------- | ------------------------------------------------------------------------ |
| Account | Choose an account from the drop-down list. |
| Repository | Choose a repository from the drop-down list. |
| Git branch | Choose a branch from the drop-down list. |

4. Click on the **Save** button.
5. In the confirmation dialog, confirm your changes by clicking on the **Relink repository** button.

#### Editing branch

1. In the *Connected git repository* section of the *General* tab, click on the **Edit branch** button.
2. In the *Edit branch* dialog, edit the settings below:

| Setting name | Instructions |
| --------------- | ------------------------------------------------------------------------ |
| Selected branch | Choose a branch from the drop-down list. |
| Git branch | Choose a branch from the drop-down list. |
| Base directory | Write the path of the base directory in the textbox. |
| Deploy the project on every commit pushed to this branch | Tick the box to automatically trigger a new deployment whenever a new commit is pushed to the selected branch. Untick it to disable the option. |

Expand Down
2 changes: 1 addition & 1 deletion docusaurus/docs/dev-docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ strapi develop
| `--bundler` | string | Specifies the bundler to use, either `webpack` or `vite`x | `webpack` |
| `-d, --debug` | - | Enable debugging mode with verbose logs | false |
| `--ignore-prompts` | - | Ignore all prompts | false |
| `--open` | - | Open the admin in your browser (default: true) | false |
| `--open` | - | Open the admin in your browser | true |
| `--polling` | - | Watch for file changes in network directories | false |
| `--silent` | - | Don't log anything | false |
| `--watch-admin` | - | Watch the admin panel for hot changes | false |
Expand Down
2 changes: 1 addition & 1 deletion docusaurus/docs/dev-docs/custom-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,5 +371,5 @@ export default {
<!-- TODO: replace these tip and links by proper documentation of all the possible shapes and parameters for `options` -->

:::tip
The Strapi codebase gives an example of how settings objects can be described: check the [`baseForm.js`](https://github.com/strapi/strapi/blob/main/packages/core/content-type-builder/admin/src/components/FormModal/attributes/baseForm.js) file for the `base` settings and the [`advancedForm.js`](https://github.com/strapi/strapi/blob/main/packages/core/content-type-builder/admin/src/components/FormModal/attributes/advancedForm.js) file for the `advanced` settings. The base form lists the settings items inline but the advanced form gets the items from an [`attributeOptions.js`](https://github.com/strapi/strapi/blob/main/packages/core/content-type-builder/admin/src/components/FormModal/attributes/attributeOptions.js) file.
The Strapi codebase gives an example of how settings objects can be described: check the [`baseForm.ts`](https://github.com/strapi/strapi/blob/main/packages/core/content-type-builder/admin/src/components/FormModal/attributes/baseForm.ts) file for the `base` settings and the [`advancedForm.ts`](https://github.com/strapi/strapi/blob/main/packages/core/content-type-builder/admin/src/components/FormModal/attributes/advancedForm.ts) file for the `advanced` settings. The base form lists the settings items inline but the advanced form gets the items from an [`attributeOptions.ts`](https://github.com/strapi/strapi/blob/main/packages/core/content-type-builder/admin/src/components/FormModal/attributes/attributeOptions.ts) file.
:::
16 changes: 7 additions & 9 deletions docusaurus/docs/dev-docs/deployment/azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,18 +337,16 @@ sudo apt install libpng-dev build-essential -y
For Node.js it is recommended you use the [official source](https://github.com/nodesource/distributions/blob/master/README.md#debinstall), per the instructions we will use the following commands:

```bash
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt install nodejs -y
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - &&\
sudo apt-get install -y nodejs
```

Likewise for Yarn we will use the instructions from the [Yarn documentation](https://classic.yarnpkg.com/en/docs/install/#debian-stable):
Likewise for Yarn we will use the instructions from the [Yarn documentation](https://yarnpkg.com/getting-started/install):

```bash
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt update
sudo apt install yarn -y
corepack enable
yarn set version stable
yarn install
```

To verify you have everything installed properly you can run the following:
Expand Down Expand Up @@ -699,4 +697,4 @@ There are many different types of proxy services you could use, anything from lo

#### 3. File upload providers

There are many options for storing files outside of your virtual machine, Strapi have built a few and the community is constantly building new ones. See the [following guide](/dev-docs/providers) on searching for options as well as installing them.
There are many options for storing files outside of your virtual machine, Strapi have built a few and the community is constantly building new ones. See the [following guide](/dev-docs/providers) on searching for options as well as installing them.
36 changes: 35 additions & 1 deletion docusaurus/docs/dev-docs/installation/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Strapi does not build any official container images. The following instructions
:::

:::danger
Strapi applications are not meant to be connected to a pre-existing database, not created by a Strapi application, nor connected to a Strapi v3 database. The Strapi team will not support such attempts. Attempting to connect to an unsupported database may, and most likely will, result in lost data such as dropped tables.
Strapi applications are not meant to be connected to a pre-existing database, not created by a Strapi application, nor connected to a Strapi v3 database. The Strapi team will not support such attempts. Attempting to connect to an unsupported database may, and most likely will, result in lost data such as dropped tables.
:::

The following documentation will guide you through building a custom [Docker](https://www.docker.com/) container with an existing Strapi project.
Expand Down Expand Up @@ -322,6 +322,40 @@ networks:
</Tabs>
### (Optional) .dockerignore
When building Docker images, it's essential to include only the files necessary for running the application inside the container. This is where the `.dockerignore` file comes into play. Similar to how `.gitignore` works for Git, specifying files and directories that should not be tracked or uploaded, `.dockerignore` tells Docker which files and directories to ignore when building an image.

Sample `.dockerignore`:

```bash
.tmp/
.cache/
.git/
.env
build/
node_modules/
# Ingoring folders that might be used in starter templates
data/
backup/
```

#### Why Use .dockerignore?

Including unnecessary files in a Docker build context can significantly slow down the build process. By excluding files and directories like .tmp, .cache, .git, build, node_modules, and .env through .dockerignore, the amount of data sent to the Docker daemon is reduced. This leads to faster build times since Docker has fewer files to process and include in the image.

#### Security

Excluding files and directories can also enhance the security of the Docker image. Sensitive files, such as `.env`, which might contain environment-specific secrets or credentials, should not be included in Docker images. This prevents accidental exposure of sensitive information.

#### Cleaner Images

A Docker image cluttered with unnecessary files can lead to potential confusion and issues, especially when the image is shared across teams or used in production. By keeping the image clean and focused only on the essentials, it becomes easier to maintain and troubleshoot.

#### Reduced Image Size

Smaller Docker images are more efficient to store, transfer, and launch. By excluding non-essential files, the final image size can be significantly reduced, leading to quicker pull and start times, especially in distributed and cloud environments.

## Production Environments

The Docker image in production is different from the one used in development/staging environments because of the differences in the admin build process in addition to the command used to run the application. Typical production environments will use a reverse proxy to serve the application and the admin panel. The Docker image is built with the production build of the admin panel and the command used to run the application is `strapi start`.
Expand Down
1 change: 1 addition & 0 deletions docusaurus/docs/dev-docs/plugins/developing-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Plugins can also be used to add [custom fields](/dev-docs/custom-fields) to Stra

<CustomDocCard small emoji="💁" title="How to store and access data from a Strapi plugin" description="" link="/dev-docs/plugins/guides/store-and-access-data" />
<CustomDocCard small emoji="💁" title="How to pass data from the backend server to the admin panel with a plugin" description="" link="/dev-docs/plugins/guides/pass-data-from-server-to-admin" />
<CustomDocCard small emoji="💁" title="How to use the experimental Plugin CLI to create and publish a Strapi plugin" description="" link="/dev-docs/plugins/guides/use-the-plugin-cli" />

<br />

Expand Down
57 changes: 30 additions & 27 deletions docusaurus/docs/dev-docs/plugins/development/create-a-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ To start developing a Strapi plugin, you need to:

:::prerequisites
You created a Strapi project.

<details>
<summary>Use the CLI to create a project:</summary>

Expand All @@ -40,6 +41,7 @@ npx create-strapi-app@latest my-project --quickstart
</Tabs>

More details can be found in the [CLI installation guide](/dev-docs/installation/cli).

</details>
:::

Expand All @@ -51,25 +53,29 @@ The fastest way to create a Strapi plugin is to use the CLI generator. To do so:
2. Run the following command in a terminal window to start the interactive CLI:

<Tabs groupId="yarn-npm">
<TabItem value="yarn" label="Yarn">
<TabItem value="yarn" label="Yarn">

```sh
yarn strapi generate plugin
yarn strapi generate plugin
```

</TabItem>
</TabItem>

<TabItem value="npm" label="NPM">
<TabItem value="npm" label="NPM">

```sh
npm run strapi generate plugin
```

</TabItem>
</TabItem>
</Tabs>

4. Choose either `JavaScript` or `TypeScript` for the plugin language.

:::callout 🚧 Experimental plugin CLI
Strapi now also offers a [plugin CLI](/dev-docs/plugins/development/plugin-cli), but use it at your own risk as it's still experimental.
:::

## Enable the plugin

Once the `strapi generate plugin` CLI script has finished running, the minimum required code for the plugin to work is created for you, but the plugin is not enabled yet.
Expand All @@ -80,22 +86,23 @@ To enable a plugin:
2. Enable the plugin by adding the following code to the plugins configuration file:

<Tabs>
<TabItem value="js" label="JavaScript">
<TabItem value="js" label="JavaScript">

```js title="./config/plugins.js"
module.exports = {
// ...
"my-plugin": { // name of your plugin, kebab-cased
enabled: true,
resolve: "./src/plugins/my-plugin", // path to the plugin folder
},
// ...
};
```
```js title="./config/plugins.js"
module.exports = {
// ...
"my-plugin": {
// name of your plugin, kebab-cased
enabled: true,
resolve: "./src/plugins/my-plugin", // path to the plugin folder
},
// ...
};
```

</TabItem>
</TabItem>

<TabItem value="ts" label="TypeScript">
<TabItem value="ts" label="TypeScript">

```js title=./config/plugins.ts
export default {
Expand All @@ -108,7 +115,7 @@ To enable a plugin:
};
```

</TabItem>
</TabItem>
</Tabs>

:::tip
Expand Down Expand Up @@ -146,18 +153,18 @@ Once the plugin code has been generated and the plugin is enabled, the next step
</Tabs>

3. Navigate back to the Strapi project root with `cd ../../..` and run the following command to build the admin panel and start the server(s):

<Tabs groupId="yarn-npm">
<TabItem value="yarn" label="Yarn">

```sh
yarn develop
```

</TabItem>

<TabItem value="npm" label="NPM">

```sh
npm run develop
```
Expand Down Expand Up @@ -225,7 +232,7 @@ Once the plugin code has been generated and the plugin is enabled, the next step
</TabItem>

<TabItem value="npm" label="NPM">

```sh
npm run develop
```
Expand All @@ -242,10 +249,6 @@ You should now be ready to start developing your plugin.
You can either jump to the [plugin structure](/dev-docs/plugins/development/plugin-structure) documentation or read the [servers and hot reloading](#servers-and-hot-reloading) section to learn more about different ways to start the server.
:::

:::info Did you know?
The admin panel needs to be rebuilt after its code has been modified. Rebuilding the admin panel is done by running the `build` command. The `strapi generate plugin` generates code that injects some plugin components (menu link, plugin homepage) into the admin panel. That's why we run the `build` command after the plugin code has been generated and before starting the server.
:::

### Servers and hot reloading

Strapi itself is **headless** <HeadlessCms />. The admin panel is completely separate from the server.
Expand Down
87 changes: 87 additions & 0 deletions docusaurus/docs/dev-docs/plugins/development/plugin-cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
title: Plugin CLI
description: Reference documentation for Strapi's Plugin CLI commands
displayed_sidebar: devDocsSidebar
---

# Plugin CLI reference

:::caution
The Plugin CLI is currently experimental.
:::

The Plugin CLI is set of commands orientated around developing plugins to use them as local plugins or to publish them on NPM and/or submit them to the Marketplace.

The present documentation lists the available Plugin CLI commands. The [associated guide](/dev-docs/plugins/guides/use-the-plugin-cli) illustrates how to use these commands to create a plugin from scratch, link it to an existing project, and publish it.

## strapi plugin:init

Create a new plugin at a given path.

```bash
strapi plugin:init <path>
```

| Arguments | Type | Description | Default |
| --------- | :----: | --------------------| ------------------------- |
| `path` | string | Path to the plugin | `./src/plugins/my-plugin` |

| Option | Type | Description | Default |
| ------------- | :--: | ---------------------------------------- |---------|
| `-d, --debug` | - | Enable debugging mode with verbose logs | false |
| `--silent` | - | Do not log anything | false |

## strapi plugin:build

Bundle the strapi plugin for publishing.

```bash
strapi plugin:build
```

| Option | Type | Description | Default |
| -------------- | :----: | ----------------------------------------------------------------------------------------------------------------- | --------|
| `--force` | string | Automatically answer "yes" to all prompts, including potentially destructive requests, and run non-interactively. | - |
| `-d, --debug` | - | Enable debugging mode with verbose logs | false |
| `--silent` | - | Do not log anything | false |
| `--minify` | - | Minify the output | true |
| `--sourcemaps` | - | Produce sourcemaps | false |

## strapi plugin:link-watch

Recompiles the plugin automatically on changes and runs `yalc push --publish`.

```bash
strapi plugin:link-watch
```

| Option | Type | Description | Default |
| ------------- | :--: | -------------------------------------------------------- | --------|
| `-d, --debug` | - | Enable debugging mode with verbose logs | false |
| `--silent` | - | Do not log anything | false |

## strapi plugin:watch

Watch and compile the Strapi plugin for local development.

```bash
strapi plugin:watch
```

| Option | Type | Description | Default |
| ------------- | :--: | -------------------------------------------------------- |---------|
| `-d, --debug` | - | Enable debugging mode with verbose logs | false |
| `--silent` | - | Do not log anything | false |

## strapi plugin:verify

Verify the output of the plugin before publishing it.

```bash
strapi plugin:verify
```

| Option | Type | Description | Default |
| ------------- | :--: | -------------------------------------------------------- | --------|
| `-d, --debug` | - | Enable debugging mode with verbose logs | false |
| `--silent` | - | Do not log anything | false |
Loading

0 comments on commit 2f4a97f

Please sign in to comment.