| sidebar_label | CLI |
|---|---|
| displayed_sidebar | configSyncSidebar |
| slug | /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:
Command:
importAlias:iCommand:
exportAlias: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
:::
Use this flag to skip the confirm prompt and go straight to syncing the config.
[command] --yesUse this flag to specify the type of config you want to sync.
[command] --type user-roleUse 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.enIf 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] --forceCommand:
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 ```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 ```