Skip to content

Latest commit

 

History

History
138 lines (105 loc) · 2.73 KB

File metadata and controls

138 lines (105 loc) · 2.73 KB
sidebar_label CLI
displayed_sidebar configSyncSidebar
slug /cli

🔌 Command line interface (CLI)

Add the config-sync command as a script to the package.json of your Strapi project:

"scripts": {
  // ...
  "cs": "config-sync"
},

You can now run all the config-sync commands like this:

``` yarn cs --help ``` ``` npm run cs -- --help ```

⬆️ Import ⬇️ Export

Command: import Alias: i

Command: export Alias: e

These commands are used to sync the config in your Strapi project.

Example:

``` yarn cs import yarn cs export ``` ``` npm run cs import npm run cs export ```

:::info When you're using npm to run these commands, please note that you need an extra -- to forward the flags to the script. More information about this topic can be found on the NPM documentation.

Example:

npm run cs import -- --yes

:::

Flag: -y, --yes

Use this flag to skip the confirm prompt and go straight to syncing the config.

[command] --yes

Flag: -t, --type

Use this flag to specify the type of config you want to sync.

[command] --type user-role

Flag: -p, --partial

Use this flag to sync a specific set of configs by giving the CLI a comma-separated string of config names.

[command] --partial user-role.public,i18n-locale.en

Flag: -f, --force

If you're using the soft setting to gracefully import config, you can use this flag to ignore the setting for the current command and forcefully import all changes anyway.

[command] --force

↔️ Diff

Command: diff | Alias: d

This command is used to see the difference between the config as found in the sync directory, and the config as found in the database.

Example:

``` yarn cs diff ``` ``` npm run cs diff ```

Argument: <single>

Add a single config name as the argument of the diff command to see the difference of that single file in a git-style diff viewer.

Example:

``` yarn cs diff user-role.public ``` ``` npm run cs diff user-role.public ```