From 7573a07d768e00071dd1eaea1fb8c51f48f256af Mon Sep 17 00:00:00 2001 From: Boaz Poolman Date: Wed, 16 Mar 2022 22:10:24 +0100 Subject: [PATCH] chore: Prep stable release --- README.md | 14 ++++++++++++-- package.json | 12 ++++++------ playground/package.json | 6 +++--- server/cli.js | 13 ++++++++++++- yarn.lock | 34 ++++++++++++++++++---------------- 5 files changed, 51 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 89030f2..f4e8e23 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,17 @@ npm run build npm run develop ``` -The **Config Sync** plugin should appear in the **Plugins** section of Strapi sidebar after you run app again. +The **Config Sync** plugin should now appear in the **Settings** section of your Strapi app. + +To start tracking your config changes you have to make the first export. This will dump all your configuration data to the `/config/sync` directory. To export, run: + +```bash +# using yarn +yarn config-sync export + +# using npm +npm run config-sync export +``` Enjoy 🎉 @@ -76,7 +86,7 @@ Complete installation requirements are the exact same as for Strapi itself and c **Supported Strapi versions**: -- Strapi 4.0.7 (recently tested) +- Strapi 4.1.5 (recently tested) - Strapi ^4.x (use `strapi-plugin-config-sync@^1.0.0`) - Strapi ^3.4.x (use `strapi-plugin-config-sync@0.1.6`) diff --git a/package.json b/package.json index ae9d3d9..03f7b08 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "strapi-plugin-config-sync", "version": "1.0.0-beta.8", - "description": "CLI & GUI for syncing config data across environments.", + "description": "Migrate your config data across environments using the CLI or Strapi admin panel.", "strapi": { "displayName": "Config Sync", "name": "config-sync", "icon": "sync", - "description": "CLI & GUI for syncing config data across environments.", + "description": "Migrate your config data across environments using the CLI or Strapi admin panel.", "required": false, "kind": "plugin" }, @@ -57,10 +57,10 @@ }, "devDependencies": { "@fortawesome/react-fontawesome": "^0.1.16", - "@strapi/design-system": "^0.0.1-alpha.75", - "@strapi/helper-plugin": "^4.0.7", - "@strapi/icons": "^0.0.1-alpha.75", - "@strapi/utils": "^4.0.7", + "@strapi/design-system": "^0.0.1-alpha.79", + "@strapi/helper-plugin": "^4.1.5", + "@strapi/icons": "^0.0.1-alpha.79", + "@strapi/utils": "^4.1.5", "babel-eslint": "9.0.0", "eslint": "^7.32.0", "eslint-config-airbnb": "^18.2.1", diff --git a/playground/package.json b/playground/package.json index b144973..90e35ce 100644 --- a/playground/package.json +++ b/playground/package.json @@ -15,9 +15,9 @@ "jest-cli": "^26.0.1" }, "dependencies": { - "@strapi/plugin-i18n": "^4.0.2", - "@strapi/plugin-users-permissions": "^4.0.2", - "@strapi/strapi": "^4.0.2", + "@strapi/plugin-i18n": "^4.0.0", + "@strapi/plugin-users-permissions": "^4.0.0", + "@strapi/strapi": "^4.0.0", "sqlite3": "5.0.2", "strapi-plugin-config-sync": "boazpoolman/strapi-plugin-config-sync" }, diff --git a/server/cli.js b/server/cli.js index 53128ba..b93e567 100644 --- a/server/cli.js +++ b/server/cli.js @@ -1,5 +1,6 @@ #!/usr/bin/env node +const fs = require('fs'); const { Command } = require('commander'); const Table = require('cli-table'); const chalk = require('chalk'); @@ -68,6 +69,14 @@ const getConfigState = (diff, configName, syncType) => { const handleAction = async (syncType, skipConfirm, configType, partials) => { const app = await strapi().load(); + const hasSyncDir = fs.existsSync(app.config.get('plugin.config-sync.syncDir')); + + // No import with empty sync dir. + if (!hasSyncDir && syncType === 'import') { + console.log(`${chalk.yellow.bold('[warning]')} You can't import an empty sync directory. Please export before continuing.`); + process.exit(0); + } + const diff = await app.plugin('config-sync').service('main').getFormattedDiff(); // No changes. @@ -109,7 +118,9 @@ const handleAction = async (syncType, skipConfirm, configType, partials) => { }); // Print table. - console.log(table.toString(), '\n'); + if (hasSyncDir) { + console.log(table.toString(), '\n'); + } // Prompt to confirm. let answer = {}; diff --git a/yarn.lock b/yarn.lock index 1412705..d0a02ed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -814,19 +814,19 @@ dependencies: "@sinonjs/commons" "^1.7.0" -"@strapi/design-system@^0.0.1-alpha.75": - version "0.0.1-alpha.75" - resolved "https://registry.yarnpkg.com/@strapi/design-system/-/design-system-0.0.1-alpha.75.tgz#8a06eb07a0d25791a93537578387e401dff116d2" - integrity sha512-JSIRFCiAOtTbjMDIa/KULSkfyPP/mphBhJDdeBx8bLNDKhU0SX3/zSXghjMWQ48aHvmyWTfwm8SVdw6EolzpIQ== +"@strapi/design-system@^0.0.1-alpha.79": + version "0.0.1-alpha.79" + resolved "https://registry.yarnpkg.com/@strapi/design-system/-/design-system-0.0.1-alpha.79.tgz#23e6a7f73383b72148c926fa74ed0ba1acc32f0a" + integrity sha512-o/F55Qjwao1HkqKcL8ovQ280QijJH8dLfzP+t3XMNL5Ihh3HBD2wcMS6dOsrnNDGdDE0LWQfG8bDbLPmWHmk1A== dependencies: "@internationalized/number" "^3.0.2" compute-scroll-into-view "^1.0.17" prop-types "^15.7.2" -"@strapi/helper-plugin@^4.0.7": - version "4.0.7" - resolved "https://registry.yarnpkg.com/@strapi/helper-plugin/-/helper-plugin-4.0.7.tgz#5eb91e0faf4496769ad5a2bd90a06be58f1840d2" - integrity sha512-0rFjdr7ZBi7P//dD56eL3LEaA2bQ9+ooqqYz9v9hMm9NCWJm8j7ybKUghLpoIUca48DKGItb9ap2BDt0CYKSAw== +"@strapi/helper-plugin@^4.1.5": + version "4.1.5" + resolved "https://registry.yarnpkg.com/@strapi/helper-plugin/-/helper-plugin-4.1.5.tgz#f6032b38af88a02d64552cbb48ca382bc48c5288" + integrity sha512-Pog53h0W+dgA+QjZpcrPgtt+hkBcRx9LYJ/CAW+BMCtqnqP0qcqQFtP5xPPxSJCkkmPX4GJT3XRWJUnjdPEq/A== dependencies: "@fortawesome/fontawesome-free" "^5.15.2" "@fortawesome/fontawesome-svg-core" "^1.2.35" @@ -850,15 +850,17 @@ styled-components "^5.2.3" whatwg-fetch "^3.6.2" -"@strapi/icons@^0.0.1-alpha.75": - version "0.0.1-alpha.75" - resolved "https://registry.yarnpkg.com/@strapi/icons/-/icons-0.0.1-alpha.75.tgz#12a38c2c921cedc26f5bd8c3aa91c5b82246c066" - integrity sha512-h9ZlIPVg95+WaBsXEthKSw9eZQ/VsuuZE5aad/4Cx0NBEUyQl+0h5Z/JqIUSNMX4KMyJJjo9Ad4FGUyOLNHLmw== +"@strapi/icons@^0.0.1-alpha.79": + version "0.0.1-alpha.79" + resolved "https://registry.yarnpkg.com/@strapi/icons/-/icons-0.0.1-alpha.79.tgz#eff8790ea3897419489a61cbfd72a436661d1420" + integrity sha512-mIPzpwOir92939rSRuRS22GLWFpLfQDyoK0vMZUsGD7uujNnRon//TUa9DJTjTHjdEjRwWO60JbJOePgJ+2cvg== + dependencies: + rimraf "^3.0.2" -"@strapi/utils@^4.0.7": - version "4.0.7" - resolved "https://registry.yarnpkg.com/@strapi/utils/-/utils-4.0.7.tgz#718823fcf23c028a65ce8c317a36cc6d7321eb0c" - integrity sha512-coGjVudsnlXvb20mobyeoguCfXKnLjXnKhYiMoS6wqy4ozazu12+5MsCh7Hs9UAkvK4Fzhf7+urvyoj/UpSkaQ== +"@strapi/utils@^4.1.5": + version "4.1.5" + resolved "https://registry.yarnpkg.com/@strapi/utils/-/utils-4.1.5.tgz#3e80f59476cab470ba0fdb42a075b5ae47e998f2" + integrity sha512-Oz7ur7TsoqA4IOPdk6H3YwsVZ+FOi9wp+iRReKao8yfo4YKJjSYlHQlNXUaAqOOlFnT0ol7G3KF+uF8jLcfxDA== dependencies: "@sindresorhus/slugify" "1.1.0" date-fns "2.24.0"