Repository: boazpoolman/strapi-plugin-config-sync Branch: master Commit: 1d67af1558d4 Files: 212 Total size: 276.3 KB Directory structure: gitextract_zp9qy6l6/ ├── .editorconfig ├── .eslintignore ├── .eslintrc ├── .gitattributes ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.md │ │ └── feature_request.md │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows/ │ ├── deploy-docs.yml │ ├── publish.yml │ └── tests.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── admin/ │ └── src/ │ ├── components/ │ │ ├── .gitkeep │ │ ├── ActionButtons/ │ │ │ └── index.jsx │ │ ├── ConfigDiff/ │ │ │ └── index.jsx │ │ ├── ConfigList/ │ │ │ ├── ConfigListRow/ │ │ │ │ └── index.jsx │ │ │ └── index.jsx │ │ ├── ConfirmModal/ │ │ │ └── index.jsx │ │ ├── FirstExport/ │ │ │ └── index.jsx │ │ ├── Header/ │ │ │ └── index.jsx │ │ └── NoChanges/ │ │ └── index.jsx │ ├── config/ │ │ ├── constants.js │ │ └── logger.js │ ├── containers/ │ │ ├── App/ │ │ │ └── index.jsx │ │ ├── ConfigPage/ │ │ │ └── index.jsx │ │ └── Initializer/ │ │ └── index.jsx │ ├── helpers/ │ │ ├── blob.js │ │ ├── configureStore.js │ │ ├── getTrad.js │ │ ├── pluginId.js │ │ └── prefixPluginTranslations.js │ ├── index.cy.jsx │ ├── index.js │ ├── permissions.js │ ├── state/ │ │ ├── actions/ │ │ │ └── Config.js │ │ └── reducers/ │ │ ├── Config/ │ │ │ └── index.js │ │ └── index.js │ └── translations/ │ ├── ar.json │ ├── cs.json │ ├── de.json │ ├── en.json │ ├── es.json │ ├── fr.json │ ├── id.json │ ├── index.js │ ├── it.json │ ├── ko.json │ ├── ms.json │ ├── nl.json │ ├── pl.json │ ├── pt-BR.json │ ├── pt.json │ ├── ru.json │ ├── sk.json │ ├── th.json │ ├── tr.json │ ├── uk.json │ ├── vi.json │ ├── zh-Hans.json │ └── zh.json ├── bin/ │ └── config-sync ├── codecov.yml ├── cypress/ │ └── support/ │ ├── commands.js │ └── e2e.js ├── cypress.config.js ├── dependabot.yml ├── docs/ │ ├── .github/ │ │ └── workflows/ │ │ └── deploy.yml │ ├── .gitignore │ ├── Dockerfile │ ├── README.md │ ├── babel.config.js │ ├── blog/ │ │ ├── 2019-05-28-first-blog-post.md │ │ ├── 2019-05-29-long-blog-post.md │ │ ├── 2021-08-01-mdx-blog-post.mdx │ │ ├── 2021-08-26-welcome/ │ │ │ └── index.md │ │ ├── authors.yml │ │ └── tags.yml │ ├── docs/ │ │ ├── api/ │ │ │ └── plugin-config-types.md │ │ ├── configuration/ │ │ │ ├── custom-types.md │ │ │ ├── excluded-config.md │ │ │ ├── excluded-types.md │ │ │ ├── import-on-bootstrap.md │ │ │ ├── introduction.md │ │ │ ├── minify.md │ │ │ ├── soft.md │ │ │ └── sync-dir.md │ │ ├── getting-started/ │ │ │ ├── admin-gui.md │ │ │ ├── cli.md │ │ │ ├── config-types.md │ │ │ ├── installation.md │ │ │ ├── motivation.md │ │ │ ├── naming-convention.md │ │ │ └── workflow.md │ │ └── upgrading/ │ │ └── generic-update.md │ ├── docusaurus.config.ts │ ├── package.json │ ├── sidebars.ts │ ├── src/ │ │ ├── components/ │ │ │ ├── ApiCall.js │ │ │ ├── Badge.js │ │ │ ├── Button/ │ │ │ │ ├── Button.jsx │ │ │ │ └── button.module.scss │ │ │ ├── Card/ │ │ │ │ ├── Card.jsx │ │ │ │ └── card.module.scss │ │ │ ├── Container/ │ │ │ │ ├── Container.jsx │ │ │ │ └── container.module.scss │ │ │ ├── CustomDocCard.js │ │ │ ├── CustomDocCardsWrapper.js │ │ │ ├── FeaturesList/ │ │ │ │ ├── FeaturesList.jsx │ │ │ │ └── features-list.module.scss │ │ │ ├── Hero/ │ │ │ │ ├── Hero.jsx │ │ │ │ └── hero.module.scss │ │ │ ├── HomepageFeatures/ │ │ │ │ ├── index.tsx │ │ │ │ └── styles.module.css │ │ │ ├── LinkWithArrow/ │ │ │ │ ├── LinkWithArrow.jsx │ │ │ │ └── link-with-arrow.module.scss │ │ │ ├── Request.js │ │ │ ├── Response.js │ │ │ ├── SubtleCallout.js │ │ │ └── index.js │ │ ├── scss/ │ │ │ ├── __index.scss │ │ │ ├── _base.scss │ │ │ ├── _fonts.scss │ │ │ ├── _mixins.scss │ │ │ ├── _tokens-overrides.scss │ │ │ ├── _tokens.scss │ │ │ ├── admonition.scss │ │ │ ├── api-call.scss │ │ │ ├── badge.scss │ │ │ ├── breadcrumbs.scss │ │ │ ├── card.scss │ │ │ ├── columns.scss │ │ │ ├── container.scss │ │ │ ├── custom-doc-cards.scss │ │ │ ├── details.scss │ │ │ ├── footer.scss │ │ │ ├── grid.scss │ │ │ ├── images.scss │ │ │ ├── markdown.scss │ │ │ ├── medium-zoom.scss │ │ │ ├── navbar.scss │ │ │ ├── pagination-nav.scss │ │ │ ├── scene.scss │ │ │ ├── search.scss │ │ │ ├── sidebar.scss │ │ │ ├── table-of-contents.scss │ │ │ ├── table.scss │ │ │ ├── tabs.scss │ │ │ └── typography.scss │ │ └── theme/ │ │ ├── Admonition/ │ │ │ └── index.js │ │ └── MDXComponents.js │ ├── static/ │ │ └── .nojekyll │ └── tsconfig.json ├── jest.config.js ├── package.json ├── packup.config.ts ├── playground/ │ ├── .editorconfig │ ├── .eslintignore │ ├── .eslintrc │ ├── .gitignore │ ├── README.md │ ├── __tests__/ │ │ ├── cli.test.js │ │ ├── helpers.js │ │ └── import-on-boostrap.test.js │ ├── config/ │ │ ├── admin.ts │ │ ├── api.ts │ │ ├── database.ts │ │ ├── middlewares.ts │ │ ├── plugins.ts │ │ └── server.ts │ ├── database/ │ │ └── migrations/ │ │ └── .gitkeep │ ├── jest.config.js │ ├── package.json │ ├── public/ │ │ ├── robots.txt │ │ └── uploads/ │ │ └── .gitkeep │ ├── src/ │ │ ├── admin/ │ │ │ ├── app.example.tsx │ │ │ ├── tsconfig.json │ │ │ └── webpack.config.example.ts │ │ ├── api/ │ │ │ ├── .gitkeep │ │ │ ├── home/ │ │ │ │ ├── content-types/ │ │ │ │ │ └── home/ │ │ │ │ │ └── schema.json │ │ │ │ ├── controllers/ │ │ │ │ │ └── home.ts │ │ │ │ ├── routes/ │ │ │ │ │ └── home.ts │ │ │ │ └── services/ │ │ │ │ └── home.ts │ │ │ └── page/ │ │ │ ├── content-types/ │ │ │ │ └── page/ │ │ │ │ └── schema.json │ │ │ ├── controllers/ │ │ │ │ └── page.ts │ │ │ ├── routes/ │ │ │ │ └── page.ts │ │ │ └── services/ │ │ │ └── page.ts │ │ ├── extensions/ │ │ │ └── .gitkeep │ │ └── index.ts │ ├── tsconfig.json │ └── types/ │ └── generated/ │ ├── components.d.ts │ └── contentTypes.d.ts └── server/ ├── bootstrap.js ├── cli.js ├── config/ │ ├── type.js │ └── types.js ├── config.js ├── controllers/ │ ├── config.js │ └── index.js ├── index.js ├── register.js ├── routes/ │ ├── admin.js │ └── index.js ├── services/ │ ├── index.js │ └── main.js ├── utils/ │ ├── getArrayDiff.js │ ├── getObjectDiff.js │ ├── index.js │ └── queryFallBack.js └── warnings.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: .editorconfig ================================================ root = true [*] indent_style = space indent_size = 2 end_of_line = LF charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.md] trim_trailing_whitespace = false ================================================ FILE: .eslintignore ================================================ **/node_modules **/public **/build **/dist **/config **/scripts **/docs **/playground ================================================ FILE: .eslintrc ================================================ { "root": true, "extends": ["react-app", "airbnb"], "parser": "babel-eslint", "plugins": [ "babel", "react", "jsx-a11y", "import", "react-hooks" ], "env": { "browser": true, "es6": true, "commonjs": true, "node": true }, "parserOptions": { "ecmaFeatures": { "jsx": true }, "ecmaVersion": 12, "sourceType": "module" }, "globals": { "strapi": true }, "overrides": [ { "files": [ "**/*.cy.*", "./cypress/**/*.*" ], "extends": [ "plugin:cypress/recommended" ], "parserOptions": { "project": "./tsconfig.cypress.json" } } ], "rules": { "import/no-unresolved": [2, { "ignore": [ "@strapi/strapi/admin", "@strapi/icons/symbols", "@strapi/admin/strapi-admin" ] }], "template-curly-spacing" : "off", "indent" : "off", "react/jsx-fragments": "off", "react/jsx-props-no-spreading": "off", "react-hooks/rules-of-hooks": "error", "react-hooks/exhaustive-deps": "off", "react/no-unused-prop-types": "warn", "react/jsx-no-target-blank": "error", "no-invalid-this": "off", "babel/no-invalid-this": "error", "arrow-spacing": "warn", "implicit-arrow-linebreak": "warn", "react/no-unused-state": "warn", "react/boolean-prop-naming": "off", "react/destructuring-assignment": ["warn", "always", { "ignoreClassFields": true }], "react/no-access-state-in-setstate": "warn", "operator-linebreak": "warn", "no-useless-constructor": "warn", "react/no-danger": "off", "react/jsx-indent-props": "warn", "react/jsx-curly-brace-presence": "warn", "react/jsx-key": "error", "react/jsx-boolean-value": "warn", "react/jsx-closing-tag-location": "warn", "import/extensions": "error", "newline-per-chained-call": "warn", "prefer-arrow-callback": "warn", "block-spacing": "warn", "one-var-declaration-per-line": "warn", "prefer-const": "warn", "import/first": "off", "react/jsx-max-props-per-line": 1, "react/jsx-first-prop-new-line": "warn", "react/jsx-equals-spacing": "warn", "react/jsx-indent": "warn", "react/jsx-closing-bracket-location": "off", "import/no-mutable-exports": "error", "import/no-extraneous-dependencies": "off", "object-shorthand": ["off", "never"], "object-curly-newline": "off", "arrow-body-style": "off", "comma-dangle": ["warn", "always-multiline"], "import/prefer-default-export": "off", "no-cond-assign": "warn", "no-confusing-arrow": "off", "no-console": "off", "no-constant-condition": "warn", "no-control-regex": "warn", "no-continue": "warn", "react/forbid-prop-types": "warn", "no-debugger": "warn", "no-dupe-args": "error", "no-dupe-keys": "error", "no-duplicate-case": "error", "no-empty": "warn", "no-empty-character-class": "error", "no-ex-assign": "error", "no-extra-boolean-cast": "warn", "no-extra-semi": "warn", "no-func-assign": "error", "no-inner-declarations": "error", "no-invalid-regexp": "error", "no-mixed-operators": "off", "no-irregular-whitespace": "error", "no-negated-in-lhs": "error", "no-obj-calls": "error", "no-regex-spaces": "warn", "no-sparse-arrays": "error", "no-unreachable": "warn", "use-isnan": "error", "valid-jsdoc": "warn", "valid-typeof": "error", "array-callback-return": "off", "block-scoped-var": "off", "prefer-destructuring": "warn", "complexity": "off", "consistent-return": "off", "curly": "warn", "default-case": "warn", "dot-notation": "off", "eqeqeq": "warn", "guard-for-in": "off", "no-alert": "warn", "no-caller": "error", "no-div-regex": "off", "no-else-return": "off", "no-eq-null": "error", "no-eval": "error", "no-extend-native": "error", "no-extra-bind": "error", "no-fallthrough": "error", "no-floating-decimal": "error", "no-implied-eval": "error", "no-iterator": "error", "no-labels": "off", "no-lone-blocks": "warn", "no-loop-func": "error", "no-multi-spaces": "warn", "no-multi-str": "error", "no-native-reassign": "error", "no-new": "warn", "no-new-func": "error", "no-new-wrappers": "error", "no-octal": "error", "no-octal-escape": "error", "no-param-reassign": "off", "no-process-env": "off", "no-proto": "error", "no-redeclare": "error", "no-return-assign": "off", "arrow-parens": ["warn", "always", { "requireForBlockBody": false }], "no-script-url": "error", "no-self-compare": "error", "no-sequences": "error", "no-throw-literal": "error", "no-unused-expressions": "warn", "no-void": "error", "no-with": "error", "radix": "off", "vars-on-top": "off", "wrap-iife": "error", "yoda": "warn", "strict": "off", "no-catch-shadow": "error", "no-delete-var": "error", "no-label-var": "error", "no-shadow": "warn", "no-shadow-restricted-names": "error", "no-undef": "error", "no-undef-init": "error", "no-multi-assign": "warn", "no-undefined": "error", "no-unused-vars": ["warn", { "args": "none", "ignoreRestSiblings": true }], "no-use-before-define": [ "error", { "functions": false, "classes": true, "variables": true } ], "no-restricted-properties": "warn", "no-restricted-syntax": "warn", "brace-style": "off", "camelcase": "warn", "comma-spacing": ["warn", { "before": false, "after": true }], "comma-style": ["warn", "last"], "consistent-this": ["off", "_this"], "eol-last": "warn", "func-names": "off", "func-style": ["warn", "declaration", { "allowArrowFunctions": true }], "key-spacing": ["warn", { "beforeColon": false, "afterColon": true }], "max-nested-callbacks": ["warn", 5], "new-cap": ["warn", { "newIsCap": true, "capIsNew": false }], "new-parens": "warn", "newline-after-var": "off", "no-array-constructor": "off", "no-inline-comments": "off", "no-lonely-if": "warn", "no-mixed-spaces-and-tabs": "warn", "no-multiple-empty-lines": ["warn", { "max": 2 }], "no-nested-ternary": "warn", "no-new-object": "off", "no-spaced-func": "warn", "no-ternary": "off", "no-trailing-spaces": "warn", "no-underscore-dangle": "off", "no-extra-parens": "off", "padding-line-between-statements": "off", "one-var": ["warn", "never"], "operator-assignment": ["off", "never"], "class-methods-use-this": "off", "padded-blocks": ["off", "never"], "lines-between-class-members": ["warn", "always"], "quote-props": ["warn", "as-needed"], "quotes": ["off", "single"], "semi": ["warn", "always"], "semi-spacing": ["warn", { "before": false, "after": true }], "sort-vars": "off", "keyword-spacing": ["warn", { "before": true, "after": true }], "space-before-blocks": ["warn", "always"], "function-paren-newline": "off", "space-before-function-paren": ["warn", { "anonymous": "never", "named": "never" }], "object-curly-spacing": ["warn", "always"], "array-bracket-spacing": ["warn", "never"], "computed-property-spacing": ["warn", "never"], "space-in-parens": ["warn", "never"], "space-infix-ops": "warn", "space-unary-ops": ["warn", { "words": true, "nonwords": false }], "spaced-comment": ["warn", "always"], "wrap-regex": "off", "no-var": "error", "generator-star-spacing": ["error", "before"], "max-depth": ["warn", 4], "max-len": ["off", 80, 2], "max-params": ["off", 99], "max-statements": "off", "no-bitwise": "off", "no-plusplus": "off", "react/display-name": "off", "react/jsx-tag-spacing": "warn", "jsx-quotes": ["warn", "prefer-double"], "react/jsx-no-undef": "error", "react/jsx-sort-props": "off", "react/jsx-uses-react": "error", "react/prefer-stateless-function": "warn", "react/jsx-uses-vars": "error", "react/jsx-no-bind": "error", "react/no-did-mount-set-state": "warn", "react/no-will-update-set-state": "warn", "react/no-did-update-set-state": "warn", "react/no-multi-comp": "off", "react/no-unknown-property": "warn", "react/prop-types": "off", "react/react-in-jsx-scope": "error", "react/self-closing-comp": "warn", "react/jsx-wrap-multilines": "warn", "react/no-array-index-key": "warn", "react/no-unescaped-entities": "warn", "react/sort-comp": "off", "jsx-a11y/no-static-element-interactions": "off", "jsx-a11y/click-events-have-key-events": "off", "jsx-a11y/no-noninteractive-element-interactions": "off", "react/jsx-one-expression-per-line": "off", "jsx-a11y/anchor-is-valid": "off", "jsx-a11y/alt-text": "warn", "jsx-a11y/label-has-for": [ "warn", { "required": { "some": ["nesting", "id"] } } ], "jsx-a11y/img-redundant-alt": "warn", "jsx-a11y/no-autofocus": "off", "jsx-a11y/iframe-has-title": "warn", "jsx-a11y/anchor-has-content": "off", "jsx-a11y/label-has-associated-control": "warn", "jsx-a11y/mouse-events-have-key-events": "off", "jsx-a11y/interactive-supports-focus": "off", "jsx-a11y/no-distracting-elements": "warn", "jsx-a11y/heading-has-content": "warn", "jsx-a11y/html-has-lang": "warn", "jsx-a11y/href-no-hash": "off", "react/jsx-filename-extension": "off", "jsx-a11y/no-noninteractive-tabindex": "warn", "jsx-a11y/media-has-caption": "off" } } ================================================ FILE: .gitattributes ================================================ # From https://github.com/Danimoth/gitattributes/blob/master/Web.gitattributes # Handle line endings automatically for files detected as text # and leave all files detected as binary untouched. * text=auto # # The above will handle all files NOT found below # # ## These files are text and should be normalized (Convert crlf => lf) # # source code *.php text *.css text *.sass text *.scss text *.less text *.styl text *.js text eol=lf *.coffee text *.json text *.htm text *.html text *.xml text *.svg text *.txt text *.ini text *.inc text *.pl text *.rb text *.py text *.scm text *.sql text *.sh text *.bat text # templates *.ejs text *.hbt text *.jade text *.haml text *.hbs text *.dot text *.tmpl text *.phtml text # git config .gitattributes text .gitignore text .gitconfig text # code analysis config .jshintrc text .jscsrc text .jshintignore text .csslintrc text # misc config *.yaml text *.yml text .editorconfig text # build config *.npmignore text *.bowerrc text # Heroku Procfile text .slugignore text # Documentation *.md text LICENSE text AUTHORS text # ## These files are binary and should be left untouched # # (binary is a macro for -text -diff) *.png binary *.jpg binary *.jpeg binary *.gif binary *.ico binary *.mov binary *.mp4 binary *.mp3 binary *.flv binary *.fla binary *.swf binary *.gz binary *.zip binary *.7z binary *.ttf binary *.eot binary *.woff binary *.pyc binary *.pdf binary ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: 🐛 Bug Report about: Create a report to help improve this plugin --- ## Bug report ### Describe the bug A clear and concise description of what the bug is. ### Steps to reproduce the behavior 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error ### Expected behavior A clear and concise description of what you expected to happen. ### Screenshots If applicable, add screenshots to help explain your problem. ### Code snippets If applicable, add code samples to help explain your problem. ### System - Node.js version: - NPM version: - Strapi version: - Plugin version: - Database: - Operating system: ### Additional context Add any other context about the problem here. ================================================ FILE: .github/ISSUE_TEMPLATE/feature_request.md ================================================ --- name: 🚀 Feature Request about: Suggest an idea to help make this plugin even better! --- ## Feature request ### Summary Quick summary what's this feature request about. ### Why is it needed? A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] ### Suggested solution(s) A clear and concise description of what you want to happen. ### Related issue(s)/PR(s) Let us know if this is related to any issue/pull request. ================================================ FILE: .github/PULL_REQUEST_TEMPLATE.md ================================================ ### What does it do? Describe the technical changes you did. ### Why is it needed? Describe the issue you are solving. ### How to test it? Provide information about the environment and the path to verify the behaviour. ### Related issue(s)/PR(s) Let us know if this is related to any issue/pull request ================================================ FILE: .github/workflows/deploy-docs.yml ================================================ name: Deploy Docs on: workflow_dispatch: release: types: [published] jobs: deploy: name: Deploy runs-on: ubuntu-latest environment: name: docs.pluginpal.io url: https://docs.pluginpal.io/config-sync steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Docker uses: actions/setup-node@v4 with: node-version: '14' - name: Build a Docker image run: | cd docs docker build \ -t docs-config-sync:latest . docker save -o ../docs-config-sync-latest.tar docs-config-sync:latest - name: Transfer the Docker image to the Dokku server uses: appleboy/scp-action@v0.1.3 with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_CI_USERNAME }} password: ${{ secrets.SSH_CI_PASSWORD }} source: docs-config-sync-latest.tar target: /var/lib/dokku/data/storage/docs/docker-images - name: Deploy the Dokku app based on the Docker image uses: appleboy/ssh-action@v0.1.10 with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_CI_USERNAME }} password: ${{ secrets.SSH_CI_PASSWORD }} script_stop: true script: | sudo docker load -i /var/lib/dokku/data/storage/docs/docker-images/docs-config-sync-latest.tar DOCS_CONFIG_SYNC_LATEST_IMAGE=$(sudo docker images --format "{{.ID}}" docs-config-sync:latest) sudo docker tag docs-config-sync:latest docs-config-sync:$DOCS_CONFIG_SYNC_LATEST_IMAGE dokku git:from-image docs-config-sync docs-config-sync:$DOCS_CONFIG_SYNC_LATEST_IMAGE sudo docker system prune --all --force ================================================ FILE: .github/workflows/publish.yml ================================================ name: Publish to NPM permissions: id-token: write contents: write on: release: types: [published] jobs: publish: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: always-auth: true node-version: 24 cache: 'yarn' registry-url: 'https://registry.npmjs.org/' - name: Install dependencies run: yarn install --frozen-lockfile --ignore-engines - name: Build the plugin run: yarn build - name: Get the release tag version id: get_version run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT - name: Extract pre-release tag if any id: extract_tag run: | VERSION="${{ steps.get_version.outputs.VERSION }}" if [[ $VERSION == *-* ]]; then # Extract everything between hyphen and last period (or end of string) PRETAG=$(echo $VERSION | sed -E 's/.*-([^.]+).*/\1/') echo "IS_PRERELEASE=true" >> $GITHUB_OUTPUT echo "NPM_TAG=$PRETAG" >> $GITHUB_OUTPUT else echo "IS_PRERELEASE=false" >> $GITHUB_OUTPUT echo "NPM_TAG=latest" >> $GITHUB_OUTPUT fi - name: Get source branch id: get_branch run: | RELEASE_COMMIT=$(git rev-list -n 1 ${{ steps.get_version.outputs.VERSION }}) SOURCE_BRANCH=$(git branch -r --contains $RELEASE_COMMIT | grep -v HEAD | head -n 1 | sed 's/.*origin\///') echo "SOURCE_BRANCH=$SOURCE_BRANCH" >> $GITHUB_OUTPUT - name: Set package version run: yarn version --new-version "${{ steps.get_version.outputs.VERSION }}" --no-git-tag-version - name: Publish package run: npm publish --provenance --access public --tag ${{ steps.extract_tag.outputs.NPM_TAG }} - name: Push version bump uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: 'chore: Bump version to ${{ steps.get_version.outputs.VERSION }}' file_pattern: 'package.json' branch: master ================================================ FILE: .github/workflows/tests.yml ================================================ name: Tests on: push: branches: - master pull_request: branches: - master - develop - beta jobs: lint: name: 'lint' runs-on: ubuntu-latest strategy: matrix: node: [20, 22] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} cache: 'yarn' - name: Install dependencies run: yarn --frozen-lockfile - name: Run eslint run: yarn run eslint test: name: 'test' needs: [lint] runs-on: ubuntu-latest strategy: matrix: node: [20, 22] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} cache: 'yarn' - name: Install dependencies plugin run: yarn --no-lockfile --unsafe-perm - name: Push the package to yalc run: yarn build - name: Add yalc package to the playground run: yarn playground:yalc-add - name: Install dependencies playground run: cd playground && yarn install --unsafe-perm - name: Build playground run: yarn playground:build # - name: Run unit tests # run: yarn test:unit - name: Run integration tests run: yarn run -s test:integration - name: Run end-to-end tests uses: cypress-io/github-action@v6 with: start: yarn playground:start - uses: actions/upload-artifact@v4 if: failure() with: name: cypress-screenshots path: cypress/screenshots if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn` - uses: actions/upload-artifact@v4 if: failure() with: name: cypress-videos path: cypress/videos if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn` - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV }} flags: unit verbose: true fail_ci_if_error: true ================================================ FILE: .gitignore ================================================ # Don't check auto-generated stuff into git coverage node_modules stats.json package-lock.json files # Cruft .DS_Store npm-debug.log .idea # Production build build dist bundle # Cypress cypress/screenshots/ cypress/videos/ cypress/downloads/ ================================================ FILE: CODE_OF_CONDUCT.md ================================================ # Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: * The use of sexualized language or imagery, and sexual attention or advances of any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or email address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. ## Scope This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [@boazpoolman](https://twitter.com/boazpoolman) on twitter. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within the community. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. ================================================ FILE: CONTRIBUTING.md ================================================ # Contributing We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. ## Development Workflow This plugin provides a local development instance of Strapi to develop it's features. We call this instance `playground` and it can be found in the playground folder in the root of the project. For that reason it is not needed to have your own Strapi instance running to work on this plugin. Just clone the repo and you're ready to go! #### 1. Fork the [repository](https://github.com/pluginpal/strapi-plugin-config-sync) [Go to the repository](https://github.com/pluginpal/strapi-plugin-config-sync) and fork it to your own GitHub account. #### 2. Clone the forked repository ```bash git clone git@github.com:YOUR_USERNAME/strapi-plugin-config-sync.git ``` #### 3. Install the dependencies Go to the folder and install the dependencies ```bash cd strapi-plugin-config-sync && yarn install ``` #### 4. Install the playground dependencies Run this in the root of the repository ```bash yarn playground:install ``` #### 5. Run the compiler of the plugin We use `yalc` to publish the package to a local registry. Run the following command o watch for changes and push to `yalc` every time a change is made: ```bash yarn develop ``` #### 6. Start the playground instance Leave the watcher running, open up a new terminal window and browse back to the root of the plugin repo. Run the following command: ```bash yarn playground:develop ``` This will start the playground instance that will have the plugin installed from the `yalc` registry. Browse to http://localhost:1337 and create a test admin user to log in to the playground. #### 7. Start your contribution! You can now start working on your contribution. If you had trouble setting up this testing environment please feel free to report an issue on Github. ### Commit message convention We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages: - `fix`: bug fixes, e.g. fix crash due to deprecated method. - `feat`: new features, e.g. add new method to the module. - `refactor`: code refactor, e.g. migrate from class components to hooks. - `docs`: changes into documentation, e.g. add usage example for the module.. - `test`: adding or updating tests, eg add integration tests using detox. - `chore`: tooling changes, e.g. change CI config. ### Linting and tests [ESLint](https://eslint.org/) We use [ESLint](https://eslint.org/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing. ### Scripts The `package.json` file contains various scripts for common tasks: - `yarn eslint`: lint files with ESLint. - `yarn eslint:fix`: auto-fix ESLint issues. - `yarn test:integration`: run integration tests with Jest. ### Sending a pull request When you're sending a pull request: - Prefer small pull requests focused on one change. - Verify that linters and tests are passing. - Review the documentation to make sure it looks good. - Follow the pull request template when opening a pull request. - For pull requests that change the API or implementation, discuss with maintainers first by opening an issue. ================================================ FILE: LICENSE.md ================================================ Copyright (c) 2021 Boaz Poolman. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================

Strapi config-sync plugin

This plugin is a multi-purpose tool to manage your Strapi database records through JSON files. Mostly used to version controlconfig data for automated deployment, automated tests and data sharing for collaboration purposes.

Read the documentation

NPM Version Monthly download on NPM CI build status codecov.io

## ✨ Features - **CLI** - `config-sync` CLI for syncing the config from the command line - **GUI** - Settings page for syncing the config in Strapi admin - **Partial sync** - Import or export only specific portions of config - **Custom types** - Include your custom collection types in the sync process - **Import on bootstrap** - Easy automated deployment with `importOnBootstrap` - **Exclusion** - Exclude single config entries or all entries of a given type - **Diff viewer** - A git-style diff viewer to inspect the config changes ## ⏳ Getting started [Read the Getting Started tutorial](https://docs.pluginpal.io/config-sync) or follow the steps below: ```bash # using yarn yarn add strapi-plugin-config-sync # using npm npm install strapi-plugin-config-sync --save ``` Add the export path to the `watchIgnoreFiles` list in the `config/admin.js` file. This way your app won't reload when you export the config in development. ##### `config/admin.js`: ``` module.exports = ({ env }) => ({ // ... watchIgnoreFiles: [ '**/config/sync/**', ], }); ``` After successful installation you have to rebuild the admin UI so it'll include this plugin. To rebuild and restart Strapi run: ```bash # using yarn yarn build yarn develop # using npm npm run build npm run develop ``` 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. You can export either through [the CLI](https://docs.pluginpal.io/config-sync/cli) or [Strapi admin panel](https://docs.pluginpal.io/config-sync/admin-gui) Enjoy 🎉 ## 📓 Documentation See our dedicated [repository](https://github.com/pluginpal/docs) for all of PluginPal's documentation, or view the Config Sync documentation live: - [Config Sync documentation](https://docs.pluginpal.io/config-sync) ## 🤝 Contributing Feel free to fork and make a pull request of this plugin. All the input is welcome! ## ⭐️ Show your support Give a star if this project helped you. ## 🔗 Links - [PluginPal marketplace](https://www.pluginpal.io/plugin/config-sync) - [NPM package](https://www.npmjs.com/package/strapi-plugin-config-sync) - [GitHub repository](https://github.com/boazpoolman/strapi-plugin-config-sync) - [Strapi marketplace](https://market.strapi.io/plugins/strapi-plugin-config-sync) ## 🌎 Community support - For general help using Strapi, please refer to [the official Strapi documentation](https://strapi.io/documentation/). - For support with this plugin you can DM me in the Strapi Discord [channel](https://discord.strapi.io/). ## 📝 Resources - [MIT License](https://github.com/pluginpal/strapi-plugin-config-sync/blob/master/LICENSE.md) ================================================ FILE: admin/src/components/.gitkeep ================================================ ================================================ FILE: admin/src/components/ActionButtons/index.jsx ================================================ import React from 'react'; import styled from 'styled-components'; import { useDispatch, useSelector } from 'react-redux'; import isEmpty from 'lodash/isEmpty'; import { Button, Typography } from '@strapi/design-system'; import { Map } from 'immutable'; import { getFetchClient, useNotification } from '@strapi/strapi/admin'; import { useIntl } from 'react-intl'; import ConfirmModal from '../ConfirmModal'; import { exportAllConfig, importAllConfig, downloadZip } from '../../state/actions/Config'; const ActionButtons = () => { const { post, get } = getFetchClient(); const dispatch = useDispatch(); const { toggleNotification } = useNotification(); const partialDiff = useSelector((state) => state.getIn(['config', 'partialDiff'], Map({}))).toJS(); const { formatMessage } = useIntl(); return ( {formatMessage({ id: 'config-sync.Buttons.Import' })} )} onSubmit={(force) => dispatch(importAllConfig(partialDiff, force, toggleNotification, formatMessage, post, get))} /> {formatMessage({ id: 'config-sync.Buttons.Export' })} )} onSubmit={(force) => dispatch(exportAllConfig(partialDiff, toggleNotification, formatMessage, post, get))} /> {!isEmpty(partialDiff) && ( {Object.keys(partialDiff).length} {Object.keys(partialDiff).length === 1 ? "config change" : "config changes"} )} ); }; const ActionButtonsStyling = styled.div` padding: 10px 0 20px 0; display: flex; align-items: center; > button { margin-right: 10px; } > button:last-of-type { margin-left: auto; } `; export default ActionButtons; ================================================ FILE: admin/src/components/ConfigDiff/index.jsx ================================================ import React from 'react'; import RDV, { DiffMethod } from 'react-diff-viewer-continued'; import { useIntl } from 'react-intl'; /** * An issue with the diff-viewer library causes a difference in the way the library is exported. * Depending on whether the library is loaded through the browser or through the server, the default export may or may not be present. * This causes issues with SSR and the way the library is imported. * * Below a workaround to fix this issue. * * @see https://github.com/Aeolun/react-diff-viewer-continued/issues/43 */ let ReactDiffViewer; if (typeof RDV.default !== 'undefined') { ReactDiffViewer = RDV.default; } else { ReactDiffViewer = RDV; } import { Modal, Grid, Typography, } from '@strapi/design-system'; const ConfigDiff = ({ oldValue, newValue, configName, trigger }) => { const { formatMessage } = useIntl(); return ( {trigger} {formatMessage({ id: 'config-sync.ConfigDiff.Title' })} {configName} {formatMessage({ id: 'config-sync.ConfigDiff.SyncDirectory' })} {formatMessage({ id: 'config-sync.ConfigDiff.Database' })} ); }; export default ConfigDiff; ================================================ FILE: admin/src/components/ConfigList/ConfigListRow/index.jsx ================================================ import React from 'react'; import { Tr, Td, Checkbox, Typography } from '@strapi/design-system'; const CustomRow = ({ row, checked, updateValue, ...props }) => { const { configName, configType, state, onClick } = row; const stateStyle = (stateStr) => { const style = { display: 'inline-flex', padding: '0 10px', borderRadius: '12px', height: '24px', alignItems: 'center', fontWeight: '500', }; if (stateStr === 'Only in DB') { style.backgroundColor = '#cbf2d7'; style.color = '#1b522b'; } if (stateStr === 'Only in sync dir') { style.backgroundColor = '#f0cac7'; style.color = '#3d302f'; } if (stateStr === 'Different') { style.backgroundColor = '#e8e6b7'; style.color = '#4a4934'; } return style; }; return ( { if (e.target.type !== 'checkbox') { onClick(configType, configName); } }} style={{ cursor: 'pointer' }} > props.onClick(e)}> {configName} props.onClick(e)}> {configType} props.onClick(e)}> {state} ); }; export default CustomRow; ================================================ FILE: admin/src/components/ConfigList/index.jsx ================================================ import React, { useState, useEffect } from 'react'; import { useIntl } from 'react-intl'; import { isEmpty } from 'lodash'; import { useDispatch } from 'react-redux'; import { Table, Thead, Tbody, Tr, Th, Typography, Checkbox, Loader, } from '@strapi/design-system'; import ConfigDiff from '../ConfigDiff'; import FirstExport from '../FirstExport'; import NoChanges from '../NoChanges'; import ConfigListRow from './ConfigListRow'; import { setConfigPartialDiffInState } from '../../state/actions/Config'; const ConfigList = ({ diff, isLoading }) => { const [originalConfig, setOriginalConfig] = useState({}); const [newConfig, setNewConfig] = useState({}); const [cName, setCname] = useState(''); const [rows, setRows] = useState([]); const [checkedItems, setCheckedItems] = useState([]); const dispatch = useDispatch(); const { formatMessage } = useIntl(); const getConfigState = (configName) => { if ( diff.fileConfig[configName] && diff.databaseConfig[configName] ) { return formatMessage({ id: 'config-sync.ConfigList.Different' }); } else if ( diff.fileConfig[configName] && !diff.databaseConfig[configName] ) { return formatMessage({ id: 'config-sync.ConfigList.OnlyDir' }); } else if ( !diff.fileConfig[configName] && diff.databaseConfig[configName] ) { return formatMessage({ id: 'config-sync.ConfigList.OnlyDB' }); } }; useEffect(() => { if (isEmpty(diff.diff)) { setRows([]); return; } const formattedRows = []; const newCheckedItems = []; Object.keys(diff.diff).map((name) => { const type = name.split('.')[0]; // Grab the first part of the filename. const formattedName = name.split(/\.(.+)/)[1]; // Grab the rest of the filename minus the file extension. newCheckedItems.push(true); formattedRows.push({ configName: formattedName, configType: type, state: getConfigState(name), onClick: (configType, configName) => { setOriginalConfig(diff.fileConfig[`${configType}.${configName}`]); setNewConfig(diff.databaseConfig[`${configType}.${configName}`]); setCname(`${configType}.${configName}`); }, }); }); setCheckedItems(newCheckedItems); setRows(formattedRows); }, [diff]); useEffect(() => { const newPartialDiff = []; checkedItems.map((item, index) => { if (item && rows[index]) newPartialDiff.push(`${rows[index].configType}.${rows[index].configName}`); }); dispatch(setConfigPartialDiffInState(newPartialDiff)); }, [checkedItems]); if (isLoading) { return (
{formatMessage({ id: 'config-sync.ConfigList.Loading' })}
); } if (!isLoading && !isEmpty(diff.message)) { return ; } if (!isLoading && isEmpty(diff.diff)) { return ; } const allChecked = checkedItems && checkedItems.every(Boolean); const isIndeterminate = checkedItems.some(Boolean) && !allChecked; return (
{rows.map((row, index) => ( { checkedItems[index] = !checkedItems[index]; setCheckedItems([...checkedItems]); }} /> )} /> ))}
setCheckedItems(checkedItems.map(() => value))} /> {formatMessage({ id: 'config-sync.ConfigList.ConfigName' })} {formatMessage({ id: 'config-sync.ConfigList.ConfigType' })} {formatMessage({ id: 'config-sync.ConfigList.State' })}
); }; export default ConfigList; ================================================ FILE: admin/src/components/ConfirmModal/index.jsx ================================================ import React, { useState } from 'react'; import { useIntl } from 'react-intl'; import { useSelector } from 'react-redux'; import { Dialog, Flex, Typography, Button, Checkbox, Divider, Box, Field, } from '@strapi/design-system'; import { WarningCircle } from '@strapi/icons'; const ConfirmModal = ({ onClose, onSubmit, type, trigger }) => { const soft = useSelector((state) => state.getIn(['config', 'appEnv', 'config', 'soft'], false)); const [force, setForce] = useState(false); const { formatMessage } = useIntl(); return ( {trigger} {formatMessage({ id: "config-sync.popUpWarning.Confirmation" })} {formatMessage({ id: `config-sync.popUpWarning.warning.${type}_1` })}
{formatMessage({ id: `config-sync.popUpWarning.warning.${type}_2` })}
{(soft && type === 'import') && ( setForce(value)} value={force} name="force" > {formatMessage({ id: 'config-sync.popUpWarning.force' })} )}
); }; export default ConfirmModal; ================================================ FILE: admin/src/components/FirstExport/index.jsx ================================================ import React from 'react'; import { useIntl } from 'react-intl'; import { useDispatch } from 'react-redux'; import { getFetchClient, useNotification } from '@strapi/strapi/admin'; import { Button, EmptyStateLayout } from '@strapi/design-system'; import { EmptyDocuments } from '@strapi/icons/symbols'; import { exportAllConfig } from '../../state/actions/Config'; import ConfirmModal from '../ConfirmModal'; const FirstExport = () => { const { post, get } = getFetchClient(); const { toggleNotification } = useNotification(); const dispatch = useDispatch(); const { formatMessage } = useIntl(); return (
dispatch(exportAllConfig([], toggleNotification, formatMessage, post, get))} trigger={( )} /> )} icon={} />
); }; export default FirstExport; ================================================ FILE: admin/src/components/Header/index.jsx ================================================ /* * * HeaderComponent * */ import React, { memo } from 'react'; import { useIntl } from 'react-intl'; import { Layouts } from '@strapi/admin/strapi-admin'; import { Box } from '@strapi/design-system'; const HeaderComponent = () => { const { formatMessage } = useIntl(); return ( ); }; export default memo(HeaderComponent); ================================================ FILE: admin/src/components/NoChanges/index.jsx ================================================ import React from 'react'; import { EmptyStateLayout } from '@strapi/design-system'; import { useIntl } from 'react-intl'; import { EmptyDocuments } from '@strapi/icons/symbols'; const NoChanges = () => { const { formatMessage } = useIntl(); return ( } /> ); }; export default NoChanges; ================================================ FILE: admin/src/config/constants.js ================================================ export const __DEBUG__ = true; // TODO: set actual env. ================================================ FILE: admin/src/config/logger.js ================================================ const config = { blacklist: [ 'REDUX_STORAGE_SAVE', 'REDUX_STORAGE_LOAD', ], }; export default config; ================================================ FILE: admin/src/containers/App/index.jsx ================================================ /** * * This component is the skeleton around the actual pages, and should only * contain code that should be seen on all pages. (e.g. navigation bar) * */ import React from 'react'; import { Provider } from 'react-redux'; import { Page } from '@strapi/strapi/admin'; import pluginPermissions from '../../permissions'; import Header from '../../components/Header'; import { store } from "../../helpers/configureStore"; import ConfigPage from '../ConfigPage'; const App = () => { return (
); }; export default App; ================================================ FILE: admin/src/containers/ConfigPage/index.jsx ================================================ import React, { useEffect } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { Map } from 'immutable'; import { Box, Alert, Typography, } from '@strapi/design-system'; import { useNotification } from '@strapi/strapi/admin'; import { getFetchClient, Layouts } from '@strapi/admin/strapi-admin'; import { useIntl } from 'react-intl'; import { getAllConfigDiff, getAppEnv } from '../../state/actions/Config'; import ConfigList from '../../components/ConfigList'; import ActionButtons from '../../components/ActionButtons'; const ConfigPage = () => { const { toggleNotification } = useNotification(); const { get } = getFetchClient(); const { formatMessage } = useIntl(); const dispatch = useDispatch(); const isLoading = useSelector((state) => state.getIn(['config', 'isLoading'], Map({}))); const configDiff = useSelector((state) => state.getIn(['config', 'configDiff'], Map({}))); const appEnv = useSelector((state) => state.getIn(['config', 'appEnv', 'env'])); useEffect(() => { dispatch(getAllConfigDiff(toggleNotification, formatMessage, get)); dispatch(getAppEnv(toggleNotification, formatMessage, get)); }, []); return ( {appEnv === 'production' && ( {formatMessage({ id: 'config-sync.envWarning.production.heading' })}
{formatMessage({ id: 'config-sync.envWarning.production.message_1' })}
{formatMessage({ id: 'config-sync.envWarning.production.message_2' })}
)}
); }; export default ConfigPage; ================================================ FILE: admin/src/containers/Initializer/index.jsx ================================================ /** * * Initializer * */ import { useEffect, useRef } from 'react'; import PropTypes from 'prop-types'; import pluginId from '../../helpers/pluginId'; const Initializer = ({ updatePlugin }) => { const ref = useRef(); ref.current = updatePlugin; useEffect(() => { ref.current(pluginId, 'isReady', true); }, []); return null; }; Initializer.propTypes = { updatePlugin: PropTypes.func.isRequired, }; export default Initializer; ================================================ FILE: admin/src/helpers/blob.js ================================================ export function b64toBlob(dataURI, type) { const byteString = atob(dataURI); const ab = new ArrayBuffer(byteString.length); const ia = new Uint8Array(ab); for (let i = 0; i < byteString.length; i++) { ia[i] = byteString.charCodeAt(i); } return new Blob([ab], { type }); } ================================================ FILE: admin/src/helpers/configureStore.js ================================================ import { createStore, applyMiddleware, compose } from 'redux'; import { thunk } from 'redux-thunk'; import { Map } from 'immutable'; import rootReducer from '../state/reducers'; import { __DEBUG__ } from '../config/constants'; const configureStore = () => { const initialStoreState = Map(); const enhancers = []; const middlewares = [ thunk, ]; let devtools; if (__DEBUG__) { devtools = ( typeof window !== 'undefined' && typeof window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ === 'function' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({ actionsBlacklist: [] }) ); if (devtools) { console.info('[setup] ✓ Enabling Redux DevTools Extension'); } } const composedEnhancers = devtools || compose; const storeEnhancers = composedEnhancers( applyMiddleware(...middlewares), ...enhancers, ); const store = createStore( rootReducer, initialStoreState, storeEnhancers, ); return store; }; export default configureStore; export const store = configureStore(); ================================================ FILE: admin/src/helpers/getTrad.js ================================================ import pluginId from './pluginId'; const getTrad = (id) => `${pluginId}.${id}`; export default getTrad; ================================================ FILE: admin/src/helpers/pluginId.js ================================================ import pluginPkg from '../../../package.json'; const pluginId = pluginPkg.name.replace( /^strapi-plugin-/i, '', ); export default pluginId; ================================================ FILE: admin/src/helpers/prefixPluginTranslations.js ================================================ const prefixPluginTranslations = (trad, pluginId) => { if (!pluginId) { throw new TypeError("pluginId can't be empty"); } return Object.keys(trad).reduce((acc, current) => { acc[`${pluginId}.${current}`] = trad[current]; return acc; }, {}); }; export { prefixPluginTranslations }; ================================================ FILE: admin/src/index.cy.jsx ================================================ // describe('Config Sync', () => { beforeEach(() => { cy.task('deleteFolder', 'playground/config/sync'); }); it('Check the config diff', () => { cy.login(); cy.navigateToInterface(); cy.initialExport(); cy.makeConfigChanges(); cy.navigateToInterface(); cy.get('tbody tr').contains('plugin_users-permissions_advanced').click(); cy.contains('"unique_email": true,'); cy.contains('"unique_email": false,'); }); it('Download the config as zip', () => { cy.login(); cy.navigateToInterface(); cy.initialExport(); cy.intercept({ method: 'GET', url: '/config-sync/zip', }).as('getConfigZip'); cy.get('button').contains('Download Config').click(); cy.wait('@getConfigZip').then((interception) => { const configZipResponse = interception.response.body; const downloadsFolder = Cypress.config('downloadsFolder'); cy.readFile(`${downloadsFolder}/${configZipResponse.name.replaceAll(':', '_')}`).should('exist'); }); }); it('Partial import & export', () => { cy.login(); cy.navigateToInterface(); cy.initialExport(); cy.makeConfigChanges(); cy.navigateToInterface(); cy.get('button[aria-label="Select all entries"]').click(); cy.intercept({ method: 'POST', url: '/config-sync/import', }).as('importConfig'); cy.get('button[aria-label="Select plugin_upload_settings"]').click(); cy.get('button').contains('Import').click(); cy.get('button').contains('Yes, import').click(); cy.wait('@importConfig').its('response.statusCode').should('equal', 200); cy.contains('plugin_users-permissions_advanced'); cy.contains('plugin_users-permissions_email'); cy.intercept({ method: 'POST', url: '/config-sync/export', }).as('exportConfig'); cy.get('button[aria-label="Select plugin_users-permissions_advanced"]').click(); cy.get('button').contains('Export').click(); cy.get('button').contains('Yes, export').click(); cy.wait('@exportConfig').its('response.statusCode').should('equal', 200); cy.contains('plugin_users-permissions_email'); }); }); ================================================ FILE: admin/src/index.js ================================================ import pluginPkg from '../../package.json'; import pluginId from './helpers/pluginId'; import { prefixPluginTranslations } from './helpers/prefixPluginTranslations'; import pluginPermissions from './permissions'; // import pluginIcon from './components/PluginIcon'; // import getTrad from './helpers/getTrad'; const pluginDescription = pluginPkg.strapi.description || pluginPkg.description; const { name } = pluginPkg.strapi; export default { register(app) { app.registerPlugin({ description: pluginDescription, id: pluginId, isReady: true, isRequired: pluginPkg.strapi.required || false, name, }); app.createSettingSection( { id: pluginId, intlLabel: { id: `${pluginId}.plugin.name`, defaultMessage: 'Config Sync', }, }, [ { intlLabel: { id: `${pluginId}.Settings.Tool.Title`, defaultMessage: 'Interface', }, id: 'config-sync-page', to: `${pluginId}`, Component: () => import('./containers/App'), permissions: pluginPermissions['settings'], }, ], ); }, bootstrap(app) {}, async registerTrads({ locales }) { const importedTrads = await Promise.all( locales.map((locale) => { return import(`./translations/${locale}.json`) .then(({ default: data }) => { return { data: prefixPluginTranslations(data, pluginId), locale, }; }) .catch(() => { return { data: {}, locale, }; }); }), ); return Promise.resolve(importedTrads); }, }; ================================================ FILE: admin/src/permissions.js ================================================ const pluginPermissions = { // This permission regards the main component (App) and is used to tell // If the plugin link should be displayed in the menu // And also if the plugin is accessible. This use case is found when a user types the url of the // plugin directly in the browser 'menu-link': [{ action: 'plugin::config-sync.menu-link', subject: null }], settings: [{ action: 'plugin::config-sync.settings.read', subject: null }], }; export default pluginPermissions; ================================================ FILE: admin/src/state/actions/Config.js ================================================ /** * * Main actions * */ import { saveAs } from 'file-saver'; import { b64toBlob } from '../../helpers/blob'; export function getAllConfigDiff(toggleNotification, formatMessage, get) { return async function(dispatch) { dispatch(setLoadingState(true)); try { const configDiff = await get('/config-sync/diff'); dispatch(setConfigPartialDiffInState([])); dispatch(setConfigDiffInState(configDiff.data)); dispatch(setLoadingState(false)); } catch (err) { toggleNotification({ type: 'warning', message: formatMessage({ id: 'notification.error' }) }); dispatch(setLoadingState(false)); } }; } export const SET_CONFIG_DIFF_IN_STATE = 'SET_CONFIG_DIFF_IN_STATE'; export function setConfigDiffInState(config) { return { type: SET_CONFIG_DIFF_IN_STATE, config, }; } export const SET_CONFIG_PARTIAL_DIFF_IN_STATE = 'SET_CONFIG_PARTIAL_DIFF_IN_STATE'; export function setConfigPartialDiffInState(config) { return { type: SET_CONFIG_PARTIAL_DIFF_IN_STATE, config, }; } export function exportAllConfig(partialDiff, toggleNotification, formatMessage, post, get) { return async function(dispatch) { dispatch(setLoadingState(true)); try { const response = await post('/config-sync/export', partialDiff); toggleNotification({ type: 'success', message: response.data.message }); dispatch(getAllConfigDiff(toggleNotification, formatMessage, get)); dispatch(setLoadingState(false)); } catch (err) { toggleNotification({ type: 'warning', message: formatMessage({ id: 'notification.error' }) }); dispatch(setLoadingState(false)); } }; } export function downloadZip(toggleNotification, formatMessage, post, get) { return async function(dispatch) { dispatch(setLoadingState(true)); try { const { message, base64Data, name } = (await get('/config-sync/zip')).data; toggleNotification({ type: 'success', message }); if (base64Data) { saveAs(b64toBlob(base64Data, 'application/zip'), name, { type: 'application/zip' }); } dispatch(setLoadingState(false)); } catch (err) { toggleNotification({ type: 'warning', message: formatMessage({ id: 'notification.error' }) }); dispatch(setLoadingState(false)); } }; } export function importAllConfig(partialDiff, force, toggleNotification, formatMessage, post, get) { return async function(dispatch) { dispatch(setLoadingState(true)); try { const response = await post('/config-sync/import', { force, config: partialDiff, }); toggleNotification({ type: 'success', message: response.data.message }); dispatch(getAllConfigDiff(toggleNotification, formatMessage, get)); dispatch(setLoadingState(false)); } catch (err) { toggleNotification({ type: 'warning', message: formatMessage({ id: 'notification.error' }) }); dispatch(setLoadingState(false)); } }; } export const SET_LOADING_STATE = 'SET_LOADING_STATE'; export function setLoadingState(value) { return { type: SET_LOADING_STATE, value, }; } export function getAppEnv(toggleNotification, formatMessage, get) { return async function(dispatch) { try { const envVars = await get('/config-sync/app-env'); dispatch(setAppEnvInState(envVars.data)); } catch (err) { toggleNotification({ type: 'warning', message: formatMessage({ id: 'notification.error' }) }); } }; } export const SET_APP_ENV_IN_STATE = 'SET_APP_ENV_IN_STATE'; export function setAppEnvInState(value) { return { type: SET_APP_ENV_IN_STATE, value, }; } ================================================ FILE: admin/src/state/reducers/Config/index.js ================================================ /** * * Main reducer * */ import { fromJS, Map, List } from 'immutable'; import { SET_CONFIG_DIFF_IN_STATE, SET_CONFIG_PARTIAL_DIFF_IN_STATE, SET_LOADING_STATE, SET_APP_ENV_IN_STATE, } from '../../actions/Config'; const initialState = fromJS({ configDiff: Map({}), partialDiff: List([]), isLoading: false, appEnv: Map({}), }); export default function configReducer(state = initialState, action) { switch (action.type) { case SET_CONFIG_DIFF_IN_STATE: return state .update('configDiff', () => fromJS(action.config)); case SET_CONFIG_PARTIAL_DIFF_IN_STATE: return state .update('partialDiff', () => fromJS(action.config)); case SET_LOADING_STATE: return state .update('isLoading', () => fromJS(action.value)); case SET_APP_ENV_IN_STATE: return state .update('appEnv', () => fromJS(action.value)); default: return state; } } ================================================ FILE: admin/src/state/reducers/index.js ================================================ import { combineReducers } from 'redux-immutable'; import configReducer from './Config'; const rootReducer = combineReducers({ config: configReducer, }); export default rootReducer; ================================================ FILE: admin/src/translations/ar.json ================================================ {} ================================================ FILE: admin/src/translations/cs.json ================================================ {} ================================================ FILE: admin/src/translations/de.json ================================================ {} ================================================ FILE: admin/src/translations/en.json ================================================ { "popUpWarning.warning.import_1": "If you continue all your local config files", "popUpWarning.warning.import_2": "will be imported into the database.", "popUpWarning.warning.export_1": "If you continue all your database config", "popUpWarning.warning.export_2": "will be written into config files.", "popUpWarning.button.import": "Yes, import", "popUpWarning.button.export": "Yes, export", "popUpWarning.button.cancel": "Cancel", "popUpWarning.force": "Force", "popUpWarning.Confirmation": "Confirmation", "envWarning.production.heading": "You're in the production environment", "envWarning.production.message_1": "Please be careful when syncing your config in production.", "envWarning.production.message_2": "Make sure you are not overriding critical config changes on import.", "Header.Title": "Config Sync", "Header.Description": "Manage your database config across environments.", "ConfigList.Loading": "Loading content...", "ConfigList.SelectAll": "Select all entries", "ConfigList.ConfigName": "Config name", "ConfigList.ConfigType": "Config type", "ConfigList.State": "State", "ConfigList.Different": "Different", "ConfigList.OnlyDir": "Only in sync dir", "ConfigList.OnlyDB": "Only in DB", "NoChanges.Message": "No differences between DB and sync directory. You are up-to-date!", "ConfigDiff.Title": "Config changes for", "ConfigDiff.SyncDirectory": "Sync directory", "ConfigDiff.Database": "Database", "Buttons.Export": "Export", "Buttons.DownloadConfig": "Download Config", "Buttons.Import": "Import", "FirstExport.Message": "Looks like this is your first time using config-sync for this project.", "FirstExport.Button": "Make the initial export", "Settings.Tool.Title": "Interface", "plugin.name": "Config Sync" } ================================================ FILE: admin/src/translations/es.json ================================================ { "popUpWarning.warning.import_1": "Si continuas todos tus ficheros de configuración locales", "popUpWarning.warning.import_2": "se importarán a la base de datos.", "popUpWarning.warning.export_1": "Si continuas las configuraciones de tu base de datos", "popUpWarning.warning.export_2": "se escribirán en ficheros de configuración locales.", "popUpWarning.button.import": "Sí, importar", "popUpWarning.button.export": "Sí, exportar", "popUpWarning.button.cancel": "Cancelar", "popUpWarning.force": "Forzar", "popUpWarning.Confirmation": "Confirmación", "Header.Title": "Config Sync", "Header.Description": "Gestiona las configuraciones de tu base de datos entre diferentes entornos o instancias.", "ConfigList.Loading": "Cargando contenido...", "ConfigList.SelectAll": "Seleccionar todas las entradas", "ConfigList.ConfigName": "Nombre", "ConfigList.ConfigType": "Tipo", "ConfigList.State": "Estado", "ConfigList.Different": "Diferentes", "ConfigList.OnlyDir": "Sólo en directorio de sincronización", "ConfigList.OnlyDB": "Sólo en la base de datos", "NoChanges.Message": "No hay diferencia entre la base de datos y el directorio de sincronización. ¡Estás actualizado!", "ConfigDiff.Title": "Cambios en la configuración para", "ConfigDiff.SyncDirectory": "Directorio de sincronización", "ConfigDiff.Database": "Base de datos", "Buttons.Import": "Importar", "Buttons.Export": "Exportar", "FirstExport.Message": "Parece ser la primera vez que se usa config-sync en este proyecto.", "FirstExport.Button": "Hacer la exportación inicial", "Settings.Tool.Title": "Interfaz", "plugin.name": "Config Sync" } ================================================ FILE: admin/src/translations/fr.json ================================================ {} ================================================ FILE: admin/src/translations/id.json ================================================ {} ================================================ FILE: admin/src/translations/index.js ================================================ import ar from './ar.json'; import cs from './cs.json'; import de from './de.json'; import en from './en.json'; import es from './es.json'; import fr from './fr.json'; import id from './id.json'; import it from './it.json'; import ko from './ko.json'; import ms from './ms.json'; import nl from './nl.json'; import pl from './pl.json'; import ptBR from './pt-BR.json'; import pt from './pt.json'; import ru from './ru.json'; import th from './th.json'; import tr from './tr.json'; import uk from './uk.json'; import vi from './vi.json'; import zhHans from './zh-Hans.json'; import zh from './zh.json'; import sk from './sk.json'; const trads = { ar, cs, de, en, es, fr, id, it, ko, ms, nl, pl, 'pt-BR': ptBR, pt, ru, th, tr, uk, vi, 'zh-Hans': zhHans, zh, sk, }; export default trads; ================================================ FILE: admin/src/translations/it.json ================================================ {} ================================================ FILE: admin/src/translations/ko.json ================================================ {} ================================================ FILE: admin/src/translations/ms.json ================================================ {} ================================================ FILE: admin/src/translations/nl.json ================================================ {} ================================================ FILE: admin/src/translations/pl.json ================================================ {} ================================================ FILE: admin/src/translations/pt-BR.json ================================================ {} ================================================ FILE: admin/src/translations/pt.json ================================================ {} ================================================ FILE: admin/src/translations/ru.json ================================================ { "popUpWarning.warning.import_1": "Если вы продолжите, все ваши локальные конфигурационные файлы", "popUpWarning.warning.import_2": "будут импортированы в базу данных.", "popUpWarning.warning.export_1": "Если вы продолжите, вся конфигурация вашей базы данных", "popUpWarning.warning.export_2": "будет записана в конфигурационные файлы.", "popUpWarning.button.import": "Да, импортировать", "popUpWarning.button.export": "Да, экспортитровать", "popUpWarning.button.cancel": "Отмена", "popUpWarning.force": "Принудительно", "popUpWarning.Confirmation": "Подтверждение", "envWarning.production.heading": "Вы находитесь в prodoction-среде", "envWarning.production.message_1": "Пожалуйста, будьте осторожны при синхронизации конфигурации в prodoction-среде.", "envWarning.production.message_2": "Убедитесь, что вы не переопределяете важные изменения конфигурации при импорте.", "Header.Title": "Config Sync", "Header.Description": "Управляйте конфигурацией своей базы данных в разных средах.", "ConfigList.Loading": "Загрузка содержимого...", "ConfigList.SelectAll": "Выбрать все записи", "ConfigList.ConfigName": "Имя конфигурации", "ConfigList.ConfigType": "Тип конфигурации", "ConfigList.State": "Состояние", "ConfigList.Different": "Различия", "ConfigList.OnlyDir": "Только в каталоге синхронизации", "ConfigList.OnlyDB": "Только в базе данных", "NoChanges.Message": "Нет различий между базой данных и каталогом синхронизации. Данные синхронизированы!", "ConfigDiff.Title": "Изменения конфигурации для", "ConfigDiff.SyncDirectory": "Каталог синхронизации", "ConfigDiff.Database": "База данных", "Buttons.Export": "Экспортировать", "Buttons.DownloadConfig": "Скачать конфиг", "Buttons.Import": "Импортировать", "FirstExport.Message": "Похоже, вы впервые используете config-sync для этого проекта.", "FirstExport.Button": "Выполнить первоначальный экспорт", "Settings.Tool.Title": "Управление", "plugin.name": "Config Sync" } ================================================ FILE: admin/src/translations/sk.json ================================================ {} ================================================ FILE: admin/src/translations/th.json ================================================ {} ================================================ FILE: admin/src/translations/tr.json ================================================ {} ================================================ FILE: admin/src/translations/uk.json ================================================ {} ================================================ FILE: admin/src/translations/vi.json ================================================ {} ================================================ FILE: admin/src/translations/zh-Hans.json ================================================ {} ================================================ FILE: admin/src/translations/zh.json ================================================ {} ================================================ FILE: bin/config-sync ================================================ #!/usr/bin/env node 'use strict'; require('../dist/cli'); ================================================ FILE: codecov.yml ================================================ comment: branches: - master - develop ================================================ FILE: cypress/support/commands.js ================================================ // // *********************************************** // This example commands.ts shows you how to // create various custom commands and overwrite // existing commands. // // For more comprehensive examples of custom // commands please read more here: // https://on.cypress.io/custom-commands // *********************************************** // // // -- This is a parent command -- // Cypress.Commands.add('login', (email, password) => { ... }) // // // -- This is a child command -- // Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) // // // -- This is a dual command -- // Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) // // // -- This will overwrite an existing command -- // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) // Cypress.Commands.add('login', (path) => { cy.visit('/'); cy.intercept({ method: 'GET', url: '/admin/users/me', }).as('sessionCheck'); cy.intercept({ method: 'GET', url: '/admin/init', }).as('adminInit'); // Wait for the initial request to complete. cy.wait('@adminInit').its('response.statusCode').should('equal', 200); // Wait for the form to render. // eslint-disable-next-line cypress/no-unnecessary-waiting cy.wait(1000); cy.get('body').then(($body) => { // Login if ($body.text().includes('Log in to your Strapi account')) { cy.get('input[name="email"]').type('johndoe@example.com'); cy.get('input[name="password"]').type('Abc12345678'); cy.get('button[type="submit"]').click(); cy.wait('@sessionCheck').its('response.statusCode').should('equal', 200); } // Register if ($body.text().includes('Credentials are only used to authenticate in Strapi')) { cy.get('input[name="firstname"]').type('John'); cy.get('input[name="email"]').type('johndoe@example.com'); cy.get('input[name="password"]').type('Abc12345678'); cy.get('input[name="confirmPassword"]').type('Abc12345678'); cy.get('button[type="submit"]').click(); cy.wait('@sessionCheck').its('response.statusCode').should('equal', 200); } }); }); Cypress.Commands.add('navigateToInterface', (path) => { cy.intercept({ method: 'GET', url: '/config-sync/diff', }).as('getConfigDiff'); cy.get('button[aria-controls="burger-menu"]').click(); cy.get('a[href="/admin/settings"]').click(); cy.get('a[href="/admin/settings/config-sync"]').click(); cy.wait('@getConfigDiff').its('response.statusCode').should('equal', 200); }); Cypress.Commands.add('initialExport', (path) => { cy.intercept({ method: 'POST', url: '/config-sync/export', }).as('exportConfig'); cy.get('button').contains('Make the initial export').click(); cy.get('button').contains('Yes, export').click(); cy.wait('@exportConfig').its('response.statusCode').should('equal', 200); cy.contains('Config was successfully exported to config/sync/.'); }); Cypress.Commands.add('makeConfigChanges', (path) => { // Change a setting in the UP advanced settings cy.intercept({ method: 'PUT', url: '/users-permissions/advanced', }).as('saveUpAdvanced'); cy.get('a[href="/admin/settings/users-permissions/advanced-settings"]').click(); cy.get('input[name="unique_email"').click(); cy.get('button[type="submit"]').click(); cy.wait('@saveUpAdvanced').its('response.statusCode').should('equal', 200); // Change a setting in the media library settings cy.intercept({ method: 'PUT', url: '/upload/settings', }).as('saveMediaLibrarySettings'); cy.get('a[href="/admin/settings/media-library"]').click(); cy.get('input[name="responsiveDimensions"').click(); cy.get('button[type="submit"]').click(); cy.wait('@saveMediaLibrarySettings').its('response.statusCode').should('equal', 200); // Change a setting in the email templates cy.intercept({ method: 'PUT', url: '/users-permissions/email-templates', }).as('saveUpEmailTemplates'); cy.get('a[href="/admin/settings/users-permissions/email-templates"]').click(); cy.get('tbody tr').contains('Reset password').click(); cy.get('input[name="options.response_email"]').clear(); cy.get('input[name="options.response_email"]').type(`${Math.random().toString(36).substring(2, 15)}@example.com`); cy.get('button[type="submit"]').click(); cy.wait('@saveUpEmailTemplates').its('response.statusCode').should('equal', 200); }); ================================================ FILE: cypress/support/e2e.js ================================================ // *********************************************************** // This example support/e2e.ts is processed and // loaded automatically before your test files. // // This is a great place to put global configuration and // behavior that modifies Cypress. // // You can change the location of this file or turn off // automatically serving support files with the // 'supportFile' configuration option. // // You can read more here: // https://on.cypress.io/configuration // *********************************************************** // Import commands.js using ES2015 syntax: import './commands'; require('cypress-terminal-report/src/installLogsCollector')(); // Alternatively you can use CommonJS syntax: // require('./commands') ================================================ FILE: cypress.config.js ================================================ const { defineConfig } = require('cypress'); const fs = require('fs-extra'); module.exports = defineConfig({ e2e: { baseUrl: 'http://localhost:1337', specPattern: '**/*.cy.{js,ts,jsx,tsx}', video: true, defaultCommandTimeout: 30000, requestTimeout: 30000, setupNodeEvents(on, config) { // implement node event listeners here. // eslint-disable-next-line global-require require('cypress-terminal-report/src/installLogsPrinter')(on); on('task', { deleteFolder(folderName) { console.log(`deleting folder ${folderName}`); return fs.remove(folderName) .then(() => { console.log(`folder ${folderName} deleted`); return null; }) .catch((err) => { console.error(`error deleting folder ${folderName}`, err); throw err; }); }, }); }, }, }); ================================================ FILE: dependabot.yml ================================================ version: 2 updates: - package-ecosystem: npm directory: / schedule: interval: daily ignore: - dependency-name: '\*' update-types: ["version-update:semver-patch"] groups: strapi: patterns: - "@strapi/*" ================================================ FILE: docs/.github/workflows/deploy.yml ================================================ name: Deploy on: workflow_dispatch: push: branches: - main jobs: deploy: name: Deploy runs-on: ubuntu-latest environment: name: docs.pluginpal.io url: https://docs.pluginpal.io steps: - name: Checkout repository uses: actions/checkout@v3 - name: Set up Docker uses: actions/setup-node@v3 with: node-version: '14' - name: Build a Docker image run: | docker build \ -t pluginpal-docs:latest . docker save -o pluginpal-docs-latest.tar pluginpal-docs:latest - name: Transfer the Docker image to the Dokku server uses: appleboy/scp-action@v0.1.3 with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_CI_USERNAME }} password: ${{ secrets.SSH_CI_PASSWORD }} source: pluginpal-docs-latest.tar target: /var/lib/dokku/data/storage/docs/docker-images - name: Deploy the Dokku app based on the Docker image uses: appleboy/ssh-action@v0.1.10 with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_CI_USERNAME }} password: ${{ secrets.SSH_CI_PASSWORD }} script_stop: true script: | sudo docker load -i /var/lib/dokku/data/storage/docs/docker-images/pluginpal-docs-latest.tar DOCS_LATEST_IMAGE=$(sudo docker images --format "{{.ID}}" pluginpal-docs:latest) sudo docker tag pluginpal-docs:latest pluginpal-docs:$DOCS_LATEST_IMAGE dokku git:from-image docs pluginpal-docs:$DOCS_LATEST_IMAGE sudo docker system prune --all --force ================================================ FILE: docs/.gitignore ================================================ # Dependencies /node_modules # Production /build # Generated files .docusaurus .cache-loader # Misc .DS_Store .env.local .env.development.local .env.test.local .env.production.local npm-debug.log* yarn-debug.log* yarn-error.log* ================================================ FILE: docs/Dockerfile ================================================ # syntax=docker/dockerfile:1 # Stage 1: Base image. ## Start with a base image containing NodeJS so we can build Docusaurus. FROM node:20-alpine as base ## Disable colour output from yarn to make logs easier to read. ENV FORCE_COLOR=0 ## Enable corepack. RUN corepack enable ## Set the working directory to `/opt/docusaurus`. WORKDIR /opt/docusaurus # Stage 2b: Production build mode. FROM base as prod ## Set the working directory to `/opt/docusaurus`. WORKDIR /opt/docusaurus ## Copy over the source code. COPY . /opt/docusaurus/ ## Install dependencies with `--immutable` to ensure reproducibility. RUN yarn install ## Build the static site. RUN yarn build # Stage 3a: Serve with `docusaurus serve`. FROM prod as serve ## Expose the port that Docusaurus will run on. EXPOSE 3000 ## Run the production server. CMD ["yarn", "serve", "--host", "0.0.0.0", "--no-open"] ================================================ FILE: docs/README.md ================================================ # Website This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator. ### Installation ``` $ yarn ``` ### Local Development ``` $ yarn start ``` This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. ### Build ``` $ yarn build ``` This command generates static content into the `build` directory and can be served using any static contents hosting service. ### Deployment Using SSH: ``` $ USE_SSH=true yarn deploy ``` Not using SSH: ``` $ GIT_USER= yarn deploy ``` If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. ================================================ FILE: docs/babel.config.js ================================================ module.exports = { presets: [require.resolve('@docusaurus/core/lib/babel/preset')], }; ================================================ FILE: docs/blog/2019-05-28-first-blog-post.md ================================================ --- slug: first-blog-post title: First Blog Post authors: [slorber, yangshun] tags: [hola, docusaurus] --- Lorem ipsum dolor sit amet... ...consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet ================================================ FILE: docs/blog/2019-05-29-long-blog-post.md ================================================ --- slug: long-blog-post title: Long Blog Post authors: yangshun tags: [hello, docusaurus] --- This is the summary of a very long blog post, Use a `` comment to limit blog post size in the list view. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet ================================================ FILE: docs/blog/2021-08-01-mdx-blog-post.mdx ================================================ --- slug: mdx-blog-post title: MDX Blog Post authors: [slorber] tags: [docusaurus] --- Blog posts support [Docusaurus Markdown features](https://docusaurus.io/docs/markdown-features), such as [MDX](https://mdxjs.com/). :::tip Use the power of React to create interactive blog posts. ::: {/* truncate */} For example, use JSX to create an interactive button: ```js ``` ================================================ FILE: docs/blog/2021-08-26-welcome/index.md ================================================ --- slug: welcome title: Welcome authors: [slorber, yangshun] tags: [facebook, hello, docusaurus] --- [Docusaurus blogging features](https://docusaurus.io/docs/blog) are powered by the [blog plugin](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog). Here are a few tips you might find useful. Simply add Markdown files (or folders) to the `blog` directory. Regular blog authors can be added to `authors.yml`. The blog post date can be extracted from filenames, such as: - `2019-05-30-welcome.md` - `2019-05-30-welcome/index.md` A blog post folder can be convenient to co-locate blog post images: ![Docusaurus Plushie](./docusaurus-plushie-banner.jpeg) The blog supports tags as well! **And if you don't want a blog**: just delete this directory, and use `blog: false` in your Docusaurus config. ================================================ FILE: docs/blog/authors.yml ================================================ yangshun: name: Yangshun Tay title: Front End Engineer @ Facebook url: https://github.com/yangshun image_url: https://github.com/yangshun.png page: true socials: x: yangshunz github: yangshun slorber: name: Sébastien Lorber title: Docusaurus maintainer url: https://sebastienlorber.com image_url: https://github.com/slorber.png page: # customize the url of the author page at /blog/authors/ permalink: '/all-sebastien-lorber-articles' socials: x: sebastienlorber linkedin: sebastienlorber github: slorber newsletter: https://thisweekinreact.com ================================================ FILE: docs/blog/tags.yml ================================================ facebook: label: Facebook permalink: /facebook description: Facebook tag description hello: label: Hello permalink: /hello description: Hello tag description docusaurus: label: Docusaurus permalink: /docusaurus description: Docusaurus tag description hola: label: Hola permalink: /hola description: Hola tag description ================================================ FILE: docs/docs/api/plugin-config-types.md ================================================ --- sidebar_label: 'Plugin config types' displayed_sidebar: configSyncSidebar slug: /api/plugin-config-types --- # Plugin config types When you're writing a plugin, which registers a content type, you might want to consider that content type as a config type as defined in the Config Sync specification. ## Register a config type programatically You can register a config type by adding some code to the register function of your plugin. ```md title="register.js" // Register the config type when using the config-sync plugin. if (strapi.plugin('config-sync')) { if (!strapi.plugin('config-sync').pluginTypes) { strapi.plugin('config-sync').pluginTypes = []; } strapi.plugin('config-sync').pluginTypes.push({ configName: 'url-pattern', queryString: 'plugin::webtools.url-pattern', uid: 'code', }); } ``` If you want to read more about what the different values of a config type actually mean please read the in depth [custom types](/config-types#custom-types) docs ================================================ FILE: docs/docs/configuration/custom-types.md ================================================ --- sidebar_label: 'Custom types' displayed_sidebar: configSyncSidebar slug: /configuration/custom-types --- # Custom types With this setting you can register your own custom config types. This is an array which expects objects with at least the `configName`, `queryString` and `uid` properties. Read more about registering custom types in the [Custom config types](/config-types#custom-types) documentation. | Name | Details | | ---- | ------- | | Key | `customTypes` | | Required | false | | Type | array | | Default | `[]` | ================================================ FILE: docs/docs/configuration/excluded-config.md ================================================ --- sidebar_label: 'Excluded config' displayed_sidebar: configSyncSidebar slug: /configuration/excluded-config --- # Excluded config Specify the names of configs you want to exclude from the syncing process. By default the API tokens for users-permissions, which are stored in core_store, are excluded. This setting expects the config names to comply with the naming convention. | Name | Details | | ---- | ------- | | Key | `excludedConfig` | | Required | false | | Type | array | | Default | `['core-store.plugin_users-permissions_grant', 'core-store.plugin_upload_metrics', 'core-store.strapi_content_types_schema', 'core-store.ee_information',]` | ================================================ FILE: docs/docs/configuration/excluded-types.md ================================================ --- sidebar_label: 'Excluded types' displayed_sidebar: configSyncSidebar slug: /configuration/excluded-types --- # Excluded types This setting will exclude all the config from a given type from the syncing process. The config types are specified by the `configName` of the type. For example: ``` excludedTypes: ['admin-role'] ``` | Name | Details | | ---- | ------- | | Key | `excludedTypes` | | Required | false | | Type | array | | Default | `[]` | ================================================ FILE: docs/docs/configuration/import-on-bootstrap.md ================================================ --- sidebar_label: 'Import on bootstrap' displayed_sidebar: configSyncSidebar slug: /configuration/import-on-bootstrap --- # Import on bootstrap Allows you to let the config be imported automaticly when strapi is bootstrapping (on `strapi start`). :::danger This setting can't be used locally and should be handled very carefully as it can unintendedly overwrite the changes in your database. **PLEASE USE WITH CARE**. ::: | Name | Details | | ---- | ------- | | Key | `importOnBootstrap` | | Required | false | | Type | bool | | Default | `false` | ================================================ FILE: docs/docs/configuration/introduction.md ================================================ --- sidebar_label: 'Introduction' displayed_sidebar: configSyncSidebar slug: /configuration --- # 🔧 Configuration The settings of the plugin can be overridden in the `config/plugins.js` file. In the example below you can see how, and also what the default settings are. ```md title="config/plugins.js" module.exports = ({ env }) => ({ // ... 'config-sync': { enabled: true, config: { syncDir: "config/sync/", minify: false, soft: false, importOnBootstrap: false, customTypes: [], excludedTypes: [], excludedConfig: [ "core-store.plugin_users-permissions_grant", "core-store.plugin_upload_metrics", "core-store.strapi_content_types_schema", "core-store.ee_information", ], }, }, }); ``` ================================================ FILE: docs/docs/configuration/minify.md ================================================ --- sidebar_label: 'Minify' displayed_sidebar: configSyncSidebar slug: /configuration/minify --- # Minify When enabled all the exported JSON files will be minified. | Name | Details | | ---- | ------- | | Key | `minify` | | Required | false | | Type | bool | | Default | `false` | ================================================ FILE: docs/docs/configuration/soft.md ================================================ --- sidebar_label: 'Soft' displayed_sidebar: configSyncSidebar slug: /configuration/soft --- # Soft When enabled the import action will be limited to only create new entries. Entries to be deleted, or updated will be skipped from the import process and will remain in it's original state. | Name | Details | | ---- | ------- | | Key | `soft` | | Required | false | | Type | bool | | Default | `false` | ================================================ FILE: docs/docs/configuration/sync-dir.md ================================================ --- sidebar_label: 'Sync dir' displayed_sidebar: configSyncSidebar slug: /configuration/sync-dir --- # Sync dir The path for reading and writing the sync files. | Name | Details | | ---- | ------- | | Key | `syncDir` | | Required | true | | Type | string | | Default | `config/sync/` | ================================================ FILE: docs/docs/getting-started/admin-gui.md ================================================ --- sidebar_label: 'Admin GUI' displayed_sidebar: configSyncSidebar slug: /admin-gui --- # 🖥️ Admin panel (GUI) This plugin ships with a React app which can be accessed from the settings page in Strapi admin panel. On this page you can pretty much do the same as you can from the CLI. You can import, export and see the difference between the config as found in the sync directory, and the config as found in the database. **Pro tip:** By clicking on one of the items in the diff table you can see the exact difference between sync dir and database in a git-style diff viewer. ![Config diff in admin](/img/assets/admin-diff-viewer.png) ================================================ FILE: docs/docs/getting-started/cli.md ================================================ --- 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. ```bash [command] --yes ``` ### Flag: `-t`, `--type` Use this flag to specify the type of config you want to sync. ```bash [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. ```bash [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. ```bash [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: `` 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 ``` ================================================ FILE: docs/docs/getting-started/config-types.md ================================================ --- sidebar_label: 'Config Types' displayed_sidebar: configSyncSidebar slug: /config-types --- # 🚀 Config types By default the plugin will track 4 (official) types. To track your own custom types you can register them by setting some plugin config. ## Default types These 4 types are by default registered in the sync process. ### Admin role > Config name: `admin-role` | UID: `code` | Query string: `admin::role` ### User role > Config name: `user-role` | UID: `type` | Query string: `plugin::users-permissions.role` ### Core store > Config name: `core-store` | UID: `key` | Query string: `strapi::core-store` ### I18n locale > Config name: `i18n-locale` | UID: `code` | Query string: `plugin::i18n.locale` ## Custom types Your custom types can be registered through the `customTypes` plugin config. This is a setting that can be set in the `config/plugins.js` file in your project. _Read more about the `config/plugins.js` file [here](/configuration)._ You can register a type by giving the `customTypes` array an object which contains at least the following 3 properties: ``` customTypes: [{ configName: 'webhook', queryString: 'webhook', uid: 'name', }], ``` _The example above will register the Strapi webhook type._ ### Config name The name of the config type. This value will be used as the first part of the filename for all config of this type. It should be unique from the other types and is preferably written in kebab-case. ##### Key: `configName` > `required:` YES | `type:` string ### Query string This is the query string of the type. Each type in Strapi has its own query string you can use to programatically preform CRUD actions on the entries of the type. Often for custom types in Strapi the format is something like `api::custom-api.custom-type`. ##### Key: `queryString` > `required:` YES | `type:` string ### UID The UID represents a field on the registered type. The value of this field will act as a unique identifier to identify the entries across environments. Therefore it should be unique and preferably un-editable after initial creation. Mind that you can not use an auto-incremental value like the `id` as auto-increment does not play nice when you try to match entries across different databases. If you do not have a single unique value, you can also pass in an array of keys for a combined uid key. This is for example the case for all content types which use i18n features (An example config would be `uid: ['productId', 'locale']`). ##### Key: `uid` > `required:` YES | `type:` string | string[] ### Relations The relations array specifies the relations you want to include in the sync process. This feature is used to sync the relations between `roles` and `permissions`. See https://github.com/boazpoolman/strapi-plugin-config-sync/blob/master/server/config/types.js#L16. Example: ``` { configName: 'admin-role', queryString: 'admin::role', uid: 'code', relations: [{ queryString: 'admin::permission', relationName: 'permissions', parentName: 'role', relationSortFields: ['action', 'subject'], }], }, ``` ##### Key: `relations` > `required:` NO | `type:` array ### Components This property can accept an array of component names from the type. Strapi Components can be included in the export/import process. With "." nested components can also be included in the process. ``` customTypes: [{ configName: 'webhook', queryString: 'webhook', uid: 'name', components: ['ParentComponentA', 'ParentComponentA.ChildComponent', 'ParentComponentB'] }], ``` ##### Key: `components` > `required:` NO | `type:` array ### JSON fields This property can accept an array of field names from the type. It is meant to specify the JSON fields on the type so the plugin can better format the field values when calculating the config difference. ##### Key: `jsonFields` > `required:` NO | `type:` array ================================================ FILE: docs/docs/getting-started/installation.md ================================================ --- sidebar_label: 'Installation' displayed_sidebar: configSyncSidebar slug: / --- # ⏳ Installation :::prerequisites Complete installation requirements are the exact same as for Strapi itself and can be found in the Strapi documentation. **Supported Strapi versions:** Strapi v5 use `strapi-plugin-config-sync@^3` Strapi v4 use `strapi-plugin-config-sync@^1` ::: Install the plugin in your Strapi project. ``` yarn add strapi-plugin-config-sync ``` ``` npm install strapi-plugin-config-sync --save ``` Add the export path to the `watchIgnoreFiles` list in the `config/admin.js` file. This way your app won't reload when you export the config in development. ```md title="config/admin.js" module.exports = ({ env }) => ({ // ... watchIgnoreFiles: [ '**/config/sync/**', ], }); ``` After successful installation you have to rebuild the admin UI so it'll include this plugin. To rebuild and restart Strapi run: ``` yarn build yarn develop ``` ``` npm run build npm run develop ``` 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. You can export either through [the CLI](/cli) or [Strapi admin panel](/admin-gui) Enjoy 🎉 ================================================ FILE: docs/docs/getting-started/motivation.md ================================================ --- sidebar_label: 'Motivation' displayed_sidebar: configSyncSidebar slug: /motivation --- # 💡 Motivation In Strapi we come across what I would call config types. These are models of which the records are stored in our database, just like content types. Though the big difference here is that your code often relies on the database records of these types. Having said that, it makes sense that these records can be exported, added to git, and be migrated across environments. This way we can make sure we have all the data our code relies on, on each environment. Examples of these types are: - Admin roles _(admin::role)_ - User roles _(plugin::users-permissions.role)_ - Admin settings _(strapi::core-store)_ - I18n locale _(plugin::i18n.locale)_ This plugin gives you the tools to sync this data. You can export the data as JSON files on one env, and import them on every other env. By writing this data as JSON files you can easily track them in your version control system (git). _With great power comes great responsibility - Uncle Ben_ ================================================ FILE: docs/docs/getting-started/naming-convention.md ================================================ --- sidebar_label: 'Naming convention' displayed_sidebar: configSyncSidebar slug: /naming-convention --- # 🔍 Naming convention All the config files written in the sync directory have the same naming convention. It goes as follows: [config-type].[identifier].json - `config-type` - Corresponds to the `configName` of the config type. - `identifier` - Corresponds to the value of the `uid` field of the config type. ================================================ FILE: docs/docs/getting-started/workflow.md ================================================ --- sidebar_label: 'Workflow' displayed_sidebar: configSyncSidebar slug: /workflow --- # ⌨️ Usage / Workflow This plugin works best when you use `git` for the version control of your Strapi project. _The following workflows are assuming you're using `git`._ ### Intro All database records tracked with this plugin will be exported to JSON files. Once exported each change to the file or the record will be tracked. Meaning you can now do one of two things: - Change the file(s), and run an import. You have now imported from filesystem -> database. - Change the record(s), and run an export. You have now exported from database -> filesystem. ### Local development When building a new feature locally for your Strapi project you'd use the following workflow: - Build the feature. - Export the config. - Commit and push the files to git. ### Deployment When deploying the newly created feature - to either a server, or a co-worker's machine - you'd use the following workflow: - Pull the latest file changes to the environment. - (Re)start your Strapi instance. - Import the config. ## Production deployment The production deployment will be the same as a regular deployment. You just have to be careful before running the import. Ideally making sure the are no open changes before you pull the new code to the environment. ================================================ FILE: docs/docs/upgrading/generic-update.md ================================================ --- sidebar_label: 'Generic update' displayed_sidebar: configSyncSidebar slug: /upgrading/generic-update --- # Updating Config Sync We are always working to make Config Sync better by fixing bugs and introducing new features. These changes will be released as minor or patch versions as defined in the Semantic Versioning specification. ## Bump a minor/patch version When you're updating Config Sync you'll have to follow these steps: 1. Make sure there are no config changes before starting. Either export or import all staged changes. 2. Update the version of the `strapi-plugin-config-sync` package in your `package.json` using your package manager of choice (yarn/npm/pnpm) 3. After you've bumped the version make sure to export any new changes that are now shown. It is possible that new configs are introduced, or old ones are updated/removed. 4. You're now ready to push these changes an commit them to your source control! ================================================ FILE: docs/docusaurus.config.ts ================================================ import {themes as prismThemes} from 'prism-react-renderer'; import type {Config} from '@docusaurus/types'; import type * as Preset from '@docusaurus/preset-classic'; const config: Config = { title: 'Strapi Config Sync', tagline: "Documentation for the config-sync plugin for Strapi", favicon: 'img/favicon.jpg', plugins: [ 'docusaurus-plugin-sass', ], // Set the production url of your site here url: 'https://docs.pluginpal.io', // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' baseUrl: '/config-sync/', // GitHub pages deployment config. // If you aren't using GitHub pages, you don't need these. organizationName: 'pluginpal', // Usually your GitHub org/user name. onBrokenLinks: 'throw', onBrokenMarkdownLinks: 'warn', // Even if you don't use internationalization, you can use this field to set // useful metadata like html lang. For example, if your site is Chinese, you // may want to replace "en" with "zh-Hans". i18n: { defaultLocale: 'en', locales: ['en'], }, // themes: ['@docusaurus/theme-live-codeblock', '@docusaurus/theme-mermaid'], presets: [ [ 'classic', { docs: { routeBasePath: '/', sidebarPath: './sidebars.ts', // Please change this to your repo. // Remove this to remove the "edit this page" links. editUrl: 'https://github.com/pluginpal/strapi-plugin-config-sync/tree/master/docs', admonitions: { keywords: [ // Admonitions defaults 'note', 'tip', 'info', 'caution', 'danger', // Admonitions custom 'callout', 'prerequisites', 'strapi', 'warning', ], }, }, blog: false, sitemap: { lastmod: 'date', changefreq: 'weekly', priority: 0.6, // ignorePatterns: ['/tags/**'], filename: 'sitemap.xml', createSitemapItems: async (params) => { const {defaultCreateSitemapItems, ...rest} = params; const items = await defaultCreateSitemapItems(rest); return items; }, }, theme: { customCss: './src/scss/__index.scss', }, } satisfies Preset.Options, ], ], themeConfig: { // Replace with your project's social card // image: 'img/docusaurus-social-card.jpg', navbar: { title: 'Strapi Config Sync', logo: { alt: 'Config Sync logo', src: 'img/logo.png', }, items: [ { href: 'https://github.com/pluginpal/strapi-plugin-config-sync', label: 'GitHub', position: 'right', }, ], }, footer: { style: 'dark', links: [ { title: 'Community', items: [ { label: 'Discord', href: 'https://discord.com/invite/strapi', }, { label: 'Forum', href: 'https://forum.strapi.io/', }, ], }, { title: 'More', items: [ { label: 'Website', href: 'https://www.pluginpal.io', }, { label: 'GitHub', href: 'https://github.com/pluginpal', }, ], }, ], }, algolia: { appId: 'ADLP623G89', apiKey: '8f91ceaf54e8e8db14479fd79a420a8c', indexName: 'pluginpal', }, prism: { theme: prismThemes.github, darkTheme: prismThemes.dracula, }, } satisfies Preset.ThemeConfig, }; export default config; ================================================ FILE: docs/package.json ================================================ { "name": "pluginpal-docs", "version": "0.0.0", "private": true, "scripts": { "docusaurus": "docusaurus", "start": "docusaurus start", "build": "docusaurus build", "swizzle": "docusaurus swizzle", "deploy": "docusaurus deploy", "clear": "docusaurus clear", "serve": "docusaurus serve", "write-translations": "docusaurus write-translations", "write-heading-ids": "docusaurus write-heading-ids", "typecheck": "tsc" }, "dependencies": { "@docusaurus/core": "^3.9.2", "@docusaurus/plugin-sitemap": "^3.9.2", "@docusaurus/preset-classic": "^3.9.2", "@docusaurus/theme-live-codeblock": "^3.9.2", "@docusaurus/theme-mermaid": "^3.9.2", "@docusaurus/theme-search-algolia": "^3.9.2", "@mdx-js/react": "^3.0.0", "classnames": "^2.5.1", "clsx": "^2.0.0", "docusaurus-plugin-sass": "^0.2.5", "prism-react-renderer": "^2.3.0", "react": "^18.0.0", "react-dom": "^18.0.0", "sass": "^1.78.0" }, "devDependencies": { "@docusaurus/module-type-aliases": "^3.9.2", "@docusaurus/tsconfig": "^3.9.2", "@docusaurus/types": "^3.9.2", "typescript": "~5.5.2" }, "browserslist": { "production": [ ">0.5%", "not dead", "not op_mini all" ], "development": [ "last 3 chrome version", "last 3 firefox version", "last 5 safari version" ] }, "engines": { "node": ">=18.0" } } ================================================ FILE: docs/sidebars.ts ================================================ /** - create an ordered group of docs - render a sidebar for each doc of that group - provide next/previous navigation The sidebars can be generated from the filesystem, or explicitly defined here. Create as many sidebars as you want. */ // @ts-check /** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ const sidebars = { // By default, Docusaurus generates a sidebar from the docs folder structure // tutorialSidebar: [{type: 'autogenerated', dirName: '.'}], // But you can create a sidebar manually configSyncSidebar: [ { type: "category", collapsed: false, label: "🚀 Getting Started", items: [ "getting-started/installation", "getting-started/motivation", "getting-started/cli", "getting-started/admin-gui", "getting-started/config-types", "getting-started/workflow", "getting-started/naming-convention", // "dev-docs/usage-information", ], }, { type: "category", collapsed: false, label: "⚙️ Configuration", items: [ "configuration/introduction", "configuration/sync-dir", "configuration/minify", "configuration/import-on-bootstrap", "configuration/custom-types", "configuration/soft", "configuration/excluded-types", "configuration/excluded-config", ], }, { type: "category", collapsed: false, label: "📦 API", items: [ "api/plugin-config-types", ], }, { type: "category", collapsed: false, label: "♻️ Upgrading", items: [ "upgrading/generic-update", ], }, ], }; module.exports = sidebars; ================================================ FILE: docs/src/components/ApiCall.js ================================================ import React from 'react' import clsx from 'clsx' export default function ApiCall({ children, noSideBySide = false, }) { return (
{children}
); } ================================================ FILE: docs/src/components/Badge.js ================================================ import React from 'react'; import clsx from 'clsx'; export default function Badge({ children, className, link = '', noLink = false, variant = '', ...rest }) { const variantNormalized = variant.toLowerCase().replace(/\W/g, ''); return ( {(noLink || !link) ? ( <> {variant} ) : ( {variant} )} {children} ); } export function AlphaBadge(props) { return ( ); } export function BetaBadge(props) { return ( ); } export function FutureBadge(props) { return ( ); } export function EnterpriseBadge(props) { return ( ); } export function CloudProBadge(props) { return ( ); } export function CloudTeamBadge(props) { return ( ); } export function CloudDevBadge(props) { return ( ); } export function NewBadge(props) { return ( ); } export function UpdatedBadge(props) { return ( ); } ================================================ FILE: docs/src/components/Button/Button.jsx ================================================ import clsx from 'clsx'; import React from 'react'; import Link from '@docusaurus/Link'; import styles from './button.module.scss'; export function Button({ href, to, children, className, decorative, size = '', variant = 'primary', ...rest }) { const ButtonElement = (to ? Link : (href ? 'a' : 'button')); return ( {children} {decorative && ( {decorative} )} ); } ================================================ FILE: docs/src/components/Button/button.module.scss ================================================ /** Component: Button */ @import '../../scss/_mixins.scss'; .button { --strapi-button-background-color: var(--strapi-primary-600); --strapi-button-border-color: var(--strapi-primary-600); --strapi-button-border-radius: 4px; --strapi-button-box-shadow: 0 0 0 transparent; --strapi-button-color: #fff; --strapi-button-font-size: 12px; --strapi-button-font-weight: 600; --strapi-button-line-height: 16px; --strapi-button-position: relative; --strapi-button-py: 7px; --strapi-button-px: 15px; --strapi-button-transition-property: color, background, border-color, box-shadow; --strapi-button-hover-background-color: var(--strapi-primary-700); --strapi-button-hover-border-color: var(--strapi-primary-700); --strapi-button-hover-box-shadow: 0px 9px 10px rgba(44, 56, 148, 0.2475); --strapi-button-hover-color: #fff; --ifm-button-color: var(--strapi-button-color); --ifm-button-background-color: var(--strapi-button-background-color); --ifm-button-border-color: var(--strapi-button-border-color); --ifm-button-border-radius: var(--strapi-button-border-radius); --ifm-button-font-weight: var(--strapi-button-font-weight); --ifm-button-padding-horizontal: var(--strapi-button-px); --ifm-button-padding-vertical: var(--strapi-button-py); --ifm-button-size-multiplier: 1; --ifm-color-primary-darker: var(--strapi-primary-200); --ifm-link-hover-color: var(--strapi-button-color); --ifm-link-hover-decoration: none; position: var(--strapi-button-position); font-size: var(--strapi-button-font-size); line-height: var(--strapi-button-line-height); box-shadow: var(--strapi-button-box-shadow); transition-property: var(--strapi-button-transition-property); &__decorative { position: absolute; font-size: 32px; line-height: 32px; bottom: -16px; right: -8px; } &:not(:disabled), &:not([aria-disabled="true"]) { &:focus, &:hover { --strapi-button-box-shadow: var(--strapi-button-hover-box-shadow); --strapi-button-background-color: var(--strapi-button-hover-background-color); --strapi-button-border-color: var(--strapi-button-hover-border-color); --strapi-button-color: var(--strapi-button-hover-color); } } /** Sizes */ &--huge { --strapi-button-border-radius: 6px; --strapi-button-font-size: 15px; --strapi-button-line-height: 23px; --strapi-button-py: 11px; --strapi-button-px: 71px; } /** Variants */ &--secondary { --strapi-button-background-color: #f0f0ff; --strapi-button-border-color: #d9d8ff; --strapi-button-color: var(--strapi-primary-600); --strapi-button-hover-background-color: var(--strapi-neutral-0); --strapi-button-hover-border-color: #d9d8ff; --strapi-button-hover-box-shadow: none; --strapi-button-hover-color: var(--strapi-primary-600); } } /** Dark mode */ @include dark { .button { /** Dark mode Variants */ &--secondary { --strapi-button-background-color: var(--strapi-neutral-100); --strapi-button-border-color: var(--strapi-neutral-200); --strapi-button-hover-background-color: var(--strapi-neutral-0); --strapi-button-hover-border-color: var(--strapi-neutral-200); } } } ================================================ FILE: docs/src/components/Card/Card.jsx ================================================ import React from 'react'; import clsx from 'clsx'; import Link from '@docusaurus/Link'; import styles from './card.module.scss'; import IconArrow from '@site/static/img/assets/icons/arrow-right.svg'; export function CardTitle({ as, children, className, withArrow, ...rest }) { const TitleElement = (as || 'h3'); return ( {children} {withArrow && ( )} ); } export function CardDescription({ as, className, ...rest }) { const DescriptionElement = (as || 'div'); return ( ); } export function CardImgBg({ className, ...rest }) { return ( ); } export function CardImg({ className, ...rest }) { return ( ); } export function Card({ className, href, isContentDelimited, to, variant, ...rest }) { const asCallToAction = !!(href || to); const CardElement = (to ? Link : (href ? 'a' : 'div')); return ( ); } ================================================ FILE: docs/src/components/Card/card.module.scss ================================================ /** Component: Card */ @import '../../scss/_mixins.scss'; :root { --strapi-card-background: var(--strapi-neutral-0); --strapi-card-border-color: #EDEDFF; --strapi-card-border-radius: 10px; --strapi-card-box-shadow: 0 0 0 transparent; --strapi-card-content-delimited: 395px; --strapi-card-img-border-width: 5px; --strapi-card-img-border-radius: 5px 5px 0 0; --strapi-card-img-bg-scale: 1; --strapi-card-justify-content: center; --strapi-card-position: relative; --strapi-card-overflow: hidden; --strapi-card-text-align: center; --strapi-card-gap: var(--strapi-spacing-2); --strapi-card-px: var(--strapi-spacing-6); --strapi-card-py: var(--strapi-spacing-6); --strapi-card-title-arrow-left: var(--strapi-card-gap); --strapi-card-title-color: #1D1B84; --strapi-card-title-font-size: 17px; --strapi-card-title-font-weight: 700; --strapi-card-title-line-height: 26px; --strapi-card-description-color: #4E6294; --strapi-card-description-font-size: 15px; --strapi-card-description-line-height: 24px; --strapi-card-hover-border-color: #D6D6FF; --strapi-card-hover-img-bg-scale: 1.15; } .card { position: var(--strapi-card-position); overflow: var(--strapi-card-overflow); background: var(--strapi-card-background); border-radius: var(--strapi-card-border-radius); border: 1px solid var(--strapi-card-border-color); box-shadow: var(--strapi-card-box-shadow); display: flex; flex-direction: column; gap: var(--strapi-card-gap); align-items: stretch; justify-content: var(--strapi-card-justify-content); text-align: var(--strapi-card-text-align); padding: var(--strapi-card-py) var(--strapi-card-px); transition: all 0.2s ease; &:focus, &:hover { --strapi-card-border-color: var(--strapi-card-hover-border-color); --strapi-card-title-arrow-left: var(--strapi-spacing-3); --strapi-card-img-bg-scale: var(--strapi-card-hover-img-bg-scale); } &__title { display: block; color: var(--strapi-card-title-color); font-size: var(--strapi-card-title-font-size); font-weight: var(--strapi-card-title-font-weight); line-height: var(--strapi-card-title-line-height); margin: 0; &:after { content: none; } &__arrow { display: inline-block; line-height: 0; margin-left: var(--strapi-card-title-arrow-left); transition: margin-left 0.1s ease; } } &__description { --ifm-link-color: var(--strapi-card-description-color); --ifm-link-decoration: underline; color: var(--strapi-card-description-color); opacity: 0.8; font-size: var(--strapi-card-description-font-size); line-height: var(--strapi-card-description-line-height); } &__img { border-bottom: none; box-shadow: 0 1px 10px 0 #7A78B61A; } &--cta { --ifm-link-color: currentColor; --strapi-card-background: linear-gradient( 310deg, rgba(168, 166, 255, 0.15) 1.16%, rgba(226, 225, 255, 0.15) 69.23% ), #FFFFFF ; --strapi-card-text-align: left; --strapi-card-gap: var(--strapi-spacing-2); --strapi-card-title-font-size: 21px; --strapi-card-title-font-weight: 600; --strapi-card-title-line-height: 28px; --ifm-link-decoration: none; --ifm-link-hover-decoration: none; } &--content-delimited { .card { &__title, &__description { width: 100%; max-width: var(--strapi-card-content-delimited); margin-right: auto; margin-left: auto; } } } } /** Responsive */ @include medium-up { :root { --strapi-card-px: var(--strapi-spacing-8); --strapi-card-py: var(--strapi-spacing-9); } .card { &__title { &__arrow { transition: margin-left 0.2s ease; will-change: margin-left; } } &:focus, &:hover { &.card--cta { --strapi-card-border-color: #D6D6FF; --strapi-card-box-shadow: 0px 1px 4px rgba(33, 33, 52, 0.1); } } &--cta { transition: all 0.2s ease; will-change: border-color, box-shadow, color; .card { &__img { transition: all 0.2s ease; will-change: border-radius, transform; transform: scale(var(--strapi-card-img-scale, 1)) translate(var(--strapi-card-img-translate, '0, 0')) ; } } } } } /** Dark mode */ @include dark { --strapi-card-border-color: var(--strapi-neutral-150); --strapi-card-title-color: var(--strapi-netral-1000); --strapi-card-description-color: var(--strapi-netral-1000); --strapi-card-img-border-color: rgba(255, 255, 255, 0.5); --strapi-card-hover-border-color: #49494D; .card { &--cta { --strapi-card-background: var(--strapi-neutral-0); &:focus, &:hover { --strapi-card-border-color: #49494D; --strapi-card-color: var(--strapi-neutral-1000); --ifm-link-hover-color: var(--strapi-neutral-1000); } } } } ================================================ FILE: docs/src/components/Container/Container.jsx ================================================ import React from 'react'; import clsx from 'clsx'; import styles from './container.module.scss'; export function Container({ className, ...rest }) { return (
); } ================================================ FILE: docs/src/components/Container/container.module.scss ================================================ /** Component: Container */ :root { --strapi-container-px: var(--ifm-spacing-horizontal); --strapi-container-mw: calc(863px + calc(var(--strapi-container-px) * 2)); } .container { display: flex; flex-direction: column; align-items: stretch; margin-right: auto; margin-left: auto; padding-right: var(--strapi-container-px); padding-left: var(--strapi-container-px); max-width: var(--strapi-container-mw); width: 100%; } ================================================ FILE: docs/src/components/CustomDocCard.js ================================================ import React from 'react' import classNames from 'classnames'; export default function CustomDocCard(props) { const { title, description, link, emoji, small = false } = props; const linkClasses = classNames({ card: true, cardContainer: true, 'padding--lg': !small, 'padding--md': small, }); const cardClasses = classNames({ 'custom-doc-card': true, 'margin-bottom--lg': !small, 'margin-bottom--sm': small, 'custom-doc-card--small': small, }); return ( ); } ================================================ FILE: docs/src/components/CustomDocCardsWrapper.js ================================================ import React from 'react'; export default function CustomDocCardsWrapper({ children }) { return (
{children}
); } ================================================ FILE: docs/src/components/FeaturesList/FeaturesList.jsx ================================================ import clsx from 'clsx'; import React from 'react'; import styles from './features-list.module.scss'; import { LinkWithArrow } from '../LinkWithArrow/LinkWithArrow'; export function FeatureListItem({ children, className, href, icon: Icon, iconColor, label, to, ...rest }) { const ContentElement = ((href || to) ? LinkWithArrow : 'span'); const IconElement = ((href || to) ? 'a' : 'span'); return (
  • {Icon && ( )} {children || label}
  • ); } export function FeaturesList({ className, id, icon, iconColor, items, ...rest }) { const defaultId = `featureListItem${Math.random()}`; return (
      {items?.map((featureListItem, featureListItemIndex) => { return ( ); })}
    ); } ================================================ FILE: docs/src/components/FeaturesList/features-list.module.scss ================================================ /** Component: Features List */ @import '../../scss/_mixins.scss'; :root { --strapi-features-list-gap: var(--strapi-spacing-2); --strapi-features-list-margin: 0; --strapi-features-list-py: var(--ifm-spacing-horizontal); --strapi-features-list-px: 0; --strapi-features-list-item-inner-gap: 8px; --strapi-features-list-item-icon-background-color: var(--strapi-secondary-100); --strapi-features-list-item-icon-border-color: #D4EDFF; --strapi-features-list-item-icon-color: var(--strapi-secondary-500); --strapi-features-list-item-icon-border-radius: 7px; --strapi-features-list-item-icon-area: 32px; --strapi-features-list-item-icon-size: 16px; } .features-list { margin: var(--strapi-features-list-margin); padding: var(--strapi-features-list-py) var(--strapi-features-list-px); list-style: none; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: var(--strapi-features-list-gap); &__item { display: flex; align-items: center; gap: var(--strapi-features-list-item-inner-gap); &__icon { background-color: var(--strapi-features-list-item-icon-background-color); border: 1px solid var(--strapi-features-list-item-icon-border-color); border-radius: var(--strapi-features-list-item-icon-border-radius); color: var(--strapi-features-list-item-icon-color); display: inline-flex; align-items: center; justify-content: center; height: var(--strapi-features-list-item-icon-area); width: var(--strapi-features-list-item-icon-area); transition: all 0.2s ease; &--green { --strapi-features-list-item-icon-background-color: var(--strapi-success-100); --strapi-features-list-item-icon-border-color: #DAF0D8; --strapi-features-list-item-icon-color: var(--strapi-success-500); } svg { height: var(--strapi-features-list-item-icon-size); width: var(--strapi-features-list-item-icon-size); } } } } /** Responsive */ @include medium-up { :root { --strapi-features-list-py: calc(var(--ifm-spacing-horizontal) * 2); --strapi-features-list-px: var(--ifm-spacing-horizontal); --strapi-features-list-item-inner-gap: 20px; --strapi-features-list-item-icon-area: 40px; } } /** Dark mode */ @include dark { --strapi-features-list-item-icon-background-color: var(--strapi-secondary-500); --strapi-features-list-item-icon-border-color: var(--strapi-secondary-600); .features-list { &__item { &__icon { --strapi-features-list-item-icon-color: #fff; &--green { --strapi-features-list-item-icon-background-color: var(--strapi-success-500); --strapi-features-list-item-icon-border-color: var(--strapi-success-600); } } } } } ================================================ FILE: docs/src/components/Hero/Hero.jsx ================================================ import clsx from 'clsx'; import React from 'react'; import styles from './hero.module.scss'; export function HeroTitle({ className, ...rest }) { return (

    ); } export function HeroDescription({ className, ...rest }) { return (
    ); } export function Hero({ className, ...rest }) { return (
    ); } ================================================ FILE: docs/src/components/Hero/hero.module.scss ================================================ /** Component: Hero */ @import '../../scss/_mixins.scss'; :root { --strapi-hero-py: var(--strapi-spacing-6); --strapi-hero-gap: var(--strapi-spacing-4); --strapi-hero-title-color: #1D1B84; --strapi-hero-title-font-size: var(--strapi-font-size-xl); --strapi-hero-title-line-height: 1.25; --strapi-hero-description-color: #4E6294; --strapi-hero-description-font-size: var(--strapi-font-size-lg); --strapi-hero-description-line-height: 1.25; } .hero { padding-top: var(--strapi-hero-py); padding-bottom: var(--strapi-hero-py); text-align: center; &__title { color: var(--strapi-hero-title-color); font-weight: 700; font-size: var(--strapi-hero-title-font-size); line-height: var(--strapi-hero-title-line-height); letter-spacing: 0.4px; margin: 0 0 var(--strapi-hero-gap); } &__description { color: var(--strapi-hero-description-color); font-size: var(--strapi-hero-description-font-size); line-height: var(--strapi-hero-description-line-height); margin: 0; } } /** Responsive */ @include medium-up { :root { --strapi-hero-py: 40px; --strapi-hero-title-font-size: 43px; --strapi-hero-title-line-height: 56px; --strapi-hero-description-font-size: 21px; --strapi-hero-description-line-height: 28px; } } /** Dark mode */ @include dark { --strapi-hero-title-color: white; --strapi-hero-description-color: white; } ================================================ FILE: docs/src/components/HomepageFeatures/index.tsx ================================================ import clsx from 'clsx'; import Heading from '@theme/Heading'; import styles from './styles.module.css'; type FeatureItem = { title: string; Svg: React.ComponentType>; description: JSX.Element; }; const FeatureList: FeatureItem[] = [ { title: 'Easy to Use', Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default, description: ( <> Docusaurus was designed from the ground up to be easily installed and used to get your website up and running quickly. ), }, { title: 'Focus on What Matters', Svg: require('@site/static/img/undraw_docusaurus_tree.svg').default, description: ( <> Docusaurus lets you focus on your docs, and we'll do the chores. Go ahead and move your docs into the docs directory. ), }, { title: 'Powered by React', Svg: require('@site/static/img/undraw_docusaurus_react.svg').default, description: ( <> Extend or customize your website layout by reusing React. Docusaurus can be extended while reusing the same header and footer. ), }, ]; function Feature({title, Svg, description}: FeatureItem) { return (
    {title}

    {description}

    ); } export default function HomepageFeatures(): JSX.Element { return (
    {FeatureList.map((props, idx) => ( ))}
    ); } ================================================ FILE: docs/src/components/HomepageFeatures/styles.module.css ================================================ .features { display: flex; align-items: center; padding: 2rem 0; width: 100%; } .featureSvg { height: 200px; width: 200px; } ================================================ FILE: docs/src/components/LinkWithArrow/LinkWithArrow.jsx ================================================ import clsx from 'clsx'; import React from 'react'; import Link from '@docusaurus/Link'; import IconArrow from '@site/static/img/assets/icons/arrow-right.svg'; import styles from './link-with-arrow.module.scss'; export function LinkWithArrow({ apart = false, children, className, href, to, ...rest }) { const LinkElement = (to ? Link : 'a'); return ( {children} ) } ================================================ FILE: docs/src/components/LinkWithArrow/link-with-arrow.module.scss ================================================ /** Component: Link with Arrow */ @import '../../scss/_mixins.scss'; :root { --strapi-lwa-icon-ml: var(--strapi-spacing-2); --strapi-lwa-font-size: 14px; --strapi-lwa-font-weight: 500; --strapi-lwa-line-height: 20px; --strapi-lwa-hover-icon-ml: var(--strapi-spacing-3); } .lwa { --ifm-link-color: #1D1B84; --ifm-link-decoration: none; --ifm-link-hover-color: #2825B8; --ifm-link-hover-decoration: none; font-size: var(--strapi-lwa-font-size); font-weight: var(--strapi-lwa-font-weight); line-height: var(--strapi-lwa-line-height); transition: all 0.2s ease; &:focus, &:hover { --strapi-lwa-icon-ml: var(--strapi-lwa-hover-icon-ml); } &__icon { display: inline-block; line-height: 0; margin-left: var(--strapi-lwa-icon-ml); transition: margin-left 0.1s ease; } &--apart { display: flex; align-items: center; .lwa { &__content { flex-grow: 1; } } } } /** Dark mode */ @include dark { .lwa { --ifm-link-color: var(--strapi-neutral-1000); --ifm-link-hover-color: var(--strapi-neutral-500); } } ================================================ FILE: docs/src/components/Request.js ================================================ import React from 'react' export default function Request({ children, title = 'Example request', }) { return (
    {title}
    {children}
    ); } ================================================ FILE: docs/src/components/Response.js ================================================ import React from 'react' export default function Response({ children, title = 'Example response', }) { return (
    {title}
    {children}
    ); } ================================================ FILE: docs/src/components/SubtleCallout.js ================================================ import React from 'react'; export default function SubtleCallout({ children, title, emoji = '🤓', }) { return (
    { emoji } { title }
    { children }
    ); } ================================================ FILE: docs/src/components/index.js ================================================ export * from './Button/Button'; export * from './Card/Card'; export * from './Container/Container'; export * from './HomepageFeatures'; export * from './FeaturesList/FeaturesList'; export * from './Hero/Hero'; export * from './LinkWithArrow/LinkWithArrow'; ================================================ FILE: docs/src/scss/__index.scss ================================================ /** * Any CSS included here will be global. * The classic template bundles Infima by default. * Infima is a CSS framework designed to work well for content-centric websites. */ /** Core */ @import '_mixins.scss'; @import '_tokens.scss'; @import '_tokens-overrides.scss'; /** Base */ @import '_fonts.scss'; @import '_base.scss'; /** Components */ @import 'admonition.scss'; @import 'api-call.scss'; @import 'badge.scss'; @import 'breadcrumbs.scss'; @import 'card.scss'; @import 'columns.scss'; @import 'container.scss'; @import 'custom-doc-cards.scss'; @import 'details.scss'; @import 'footer.scss'; @import 'grid.scss'; @import 'images.scss'; @import 'markdown.scss'; @import 'medium-zoom.scss'; @import 'navbar.scss'; @import 'pagination-nav.scss'; @import 'search.scss'; @import 'scene.scss'; @import 'sidebar.scss'; @import 'table.scss'; @import 'tabs.scss'; @import 'table-of-contents.scss'; @import 'typography.scss'; ================================================ FILE: docs/src/scss/_base.scss ================================================ /** Base: General Styles */ :root { --custom-selection-background-color: var(--strapi-primary-600); } ::selection { background-color: var(--custom-selection-background-color); color: var(--custom-selection-color, var(--strapi-neutral-0)); } main { article:first-child:not(.col):not(.custom-doc-card), article:first-child:not(.col) + nav { --custom-main-px: var(--strapi-spacing-0); --custom-main-width: 683px; max-width: calc(var(--custom-main-width) + calc(var(--strapi-spacing-4) * 2)); padding-left: var(--custom-main-px) !important; padding-right: var(--custom-main-px) !important; margin-left: auto; margin-right: auto; } } /** Responsive */ @include medium-up { main { article:first-child:not(.col), article:first-child:not(.col) + nav { --custom-main-px: var(--strapi-spacing-4); } } } /** Dark mode */ @include dark { .container img[width="16"] { /* 'Temporary' fix while we figure a way to display white icons in dark mode 😅 */ background-color: white; border-radius: 2px; padding: 1px; } } ================================================ FILE: docs/src/scss/_fonts.scss ================================================ /** Fonts */ @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;700&display=swap'); .font-poppins, .font-poppins button, .font-poppins input { --custom-font-family: "Poppins", sans-serif; --ifm-heading-font-family: "Poppins", sans-serif; font-family: var(--custom-font-family); } ================================================ FILE: docs/src/scss/_mixins.scss ================================================ /** Core: Sass Mixins */ /** Mixin: Responsive */ @mixin small-up { @media (min-width: 769px) { @content; } } /** Mixin: Responsive */ @mixin medium-up { @media (min-width: 997px) { @content; } } /** Mixin: Responsive */ @mixin large-up { @media (min-width: 1536px) { @content; } } /** Mixin: Dark mode */ @mixin dark { html[data-theme='dark'] { @content; } } /** Mixin: Light mode */ @mixin light { html[data-theme='light'] { @content; } } /** Mixin: Transition */ @mixin transition { transition: all 0.2s ease; } /** Mixin: Flex */ @mixin flex-row( $gap: var(--strapi-spacing-2), $align-items: center, $justify-content: null ) { display: flex; flex-direction: row; gap: $gap; align-items: $align-items; justify-content: $justify-content; } ================================================ FILE: docs/src/scss/_tokens-overrides.scss ================================================ /** Core: Docusaurus/Infima Style Tokens Overrides */ :root { --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1); --ifm-background-color: var(--strapi-neutral-0); --ifm-color-content: var(--strapi-neutral-800); --ifm-font-color-base: var(--strapi-neutral-800); --ifm-color-content-secondary: var(--strapi-neutral-600); --ifm-color-emphasis-100: var(--strapi-neutral-100); --ifm-color-emphasis-200: var(--strapi-neutral-150); --ifm-color-emphasis-300: var(--strapi-neutral-200); --ifm-color-emphasis-400: var(--strapi-neutral-300); --ifm-color-emphasis-500: var(--strapi-neutral-400); --ifm-color-emphasis-600: var(--strapi-neutral-500); --ifm-color-emphasis-700: var(--strapi-neutral-600); --ifm-color-emphasis-800: var(--strapi-neutral-700); --ifm-color-emphasis-900: var(--strapi-neutral-800); --ifm-color-emphasis-1000: var(--strapi-neutral-1000); --ifm-color-primary: var(--strapi-primary-600); --ifm-color-primary-dark: var(--strapi-primary-700); --ifm-color-primary-darker: var(--strapi-primary-800); --ifm-color-primary-darkest: var(--strapi-primary-900); --ifm-color-primary-light: var(--strapi-primary-500); --ifm-color-primary-lighter: var(--strapi-primary-400); --ifm-color-primary-lightest: var(--strapi-primary-300); --ifm-link-color: var(--strapi-primary-600); --ifm-link-decoration: none; // --ifm-link-hover-decoration: none; --ifm-paragraph-margin-bottom: var(--strapi-spacing-4); --ifm-scrollbar-track-background-color: var(--strapi-neutral-100); --ifm-scrollbar-thumb-background-color: var(--strapi-neutral-200); --ifm-scrollbar-thumb-hover-background-color: var(--strapi-neutral-300); --ifm-table-stripe-background: #DCDCE43E; --ifm-toc-border-color: var(--strapi-neutral-150); } /* Dark mode */ @include dark { --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3); --ifm-background-color: var(--strapi-neutral-0); --ifm-color-content: var(--strapi-neutral-800); --ifm-font-color-base: var(--strapi-neutral-800); --ifm-color-emphasis-100: var(--strapi-neutral-100); --ifm-color-emphasis-200: var(--strapi-neutral-150); --ifm-color-emphasis-300: var(--strapi-neutral-200); --ifm-color-emphasis-400: var(--strapi-neutral-300); --ifm-color-emphasis-500: var(--strapi-neutral-400); --ifm-color-emphasis-600: var(--strapi-neutral-500); --ifm-color-emphasis-700: var(--strapi-neutral-600); --ifm-color-emphasis-800: var(--strapi-neutral-700); --ifm-color-emphasis-900: var(--strapi-neutral-800); --ifm-color-emphasis-1000: var(--strapi-neutral-1000); --ifm-color-primary: var(--strapi-primary-600); --ifm-color-primary-dark: var(--strapi-primary-700); --ifm-color-primary-darker: var(--strapi-primary-800); --ifm-color-primary-darkest: var(--strapi-primary-900); --ifm-color-primary-light: var(--strapi-primary-500); --ifm-color-primary-lighter: var(--strapi-primary-400); --ifm-color-primary-lightest: var(--strapi-primary-300); --ifm-link-color: var(--strapi-primary-500); --ifm-navbar-background-color: #212134; --ifm-scrollbar-track-background-color: var(--strapi-neutral-100); --ifm-scrollbar-thumb-background-color: var(--strapi-neutral-150); --ifm-scrollbar-thumb-hover-background-color: var(--strapi-neutral-200); --ifm-toc-border-color: var(--strapi-neutral-150); } ================================================ FILE: docs/src/scss/_tokens.scss ================================================ /** Core: Strapi Design System Tokens */ :root { /** Spacing */ --strapi-spacing-0: 0; // 0px --strapi-spacing-1: 0.25rem; // 4px --strapi-spacing-2: 0.5rem; // 8px --strapi-spacing-3: 0.75rem; // 12px --strapi-spacing-4: 1rem; // 16px --strapi-spacing-5: 1.25rem; // 20px --strapi-spacing-6: 1.5rem; // 24px --strapi-spacing-7: 2rem; // 32px --strapi-spacing-8: 2.5rem; // 40px --strapi-spacing-9: 3rem; // 48px --strapi-spacing-10: 3.5rem; // 56px --strapi-spacing-11: 3.75rem; // 64px /** Fonts */ --strapi-font-size-tiny: 0.625rem; // 10px --strapi-font-size-xxs: 0.6875rem; // 11px --strapi-font-size-xs: 0.75rem; // 12px --strapi-font-size-ssm: 0.8125rem; // 13px --strapi-font-size-sm: 0.875rem; // 14px --strapi-font-size-md: 1rem; // 16px --strapi-font-size-lg: 1.125rem; // 18px --strapi-font-size-xl: 2rem; // 32px /** Color: Neutral */ --strapi-neutral-1000: #181826; --strapi-neutral-900: #212134; --strapi-neutral-800: #32324D; --strapi-neutral-700: #4A4A6A; --strapi-neutral-600: #666687; --strapi-neutral-500: #8E8EA9; --strapi-neutral-400: #A5A5BA; --strapi-neutral-300: #C0C0CF; --strapi-neutral-200: #DCDCE4; --strapi-neutral-150: #EAEAEF; --strapi-neutral-100: #F6F6F9; --strapi-neutral-0: #FFFFFF; /** Color: Primary */ --strapi-primary-700: #271FE0; --strapi-primary-600: #4945FF; --strapi-primary-500: #7B79FF; --strapi-primary-200: #D9D8FF; --strapi-primary-100: #F0F0FF; /** Color: Secondary */ --strapi-secondary-700: #006096; --strapi-secondary-600: #0C75AF; --strapi-secondary-500: #66B7F1; --strapi-secondary-200: #B8E1FF; --strapi-secondary-100: #EAF5FF; /** Color: Success */ --strapi-success-700: #2F6846; --strapi-success-600: #328048; --strapi-success-500: #5CB176; --strapi-success-300: #BBEFB5; /* not in Figma, used for code blocks */ --strapi-success-200: #C6F0C2; --strapi-success-100: #EAFBE7; /** Color: Danger */ --strapi-danger-800: #4B1113; /* not actually existing in Figma */ --strapi-danger-700: #B72B1A; --strapi-danger-600: #D02B20; --strapi-danger-500: #EE5E52; --strapi-danger-200: #F5C0B8; --strapi-danger-100: #FCECEA; /** Color: Warning */ --strapi-warning-700: #BE5D01; --strapi-warning-600: #D9822F; --strapi-warning-500: #F29D41; --strapi-warning-200: #FAE7B9; --strapi-warning-100: #FDF4DC; /** Color: Alternative */ --strapi-alternative-600: #9736E8; --strapi-alternative-500: #AC73E6; --strapi-alternative-200: #E0C1F4; --strapi-alternative-100: #F6ECFC; /** Color: Code */ --strapi-code-fluo-green: #50FA7B; --strapi-code-green: #50FA7B; --strapi-code-rose: #FF79C6; --strapi-code-purple: #BD93F9; --strapi-code-dark-blue: #6272A4; /** Components */ --strapi-input-border-color: var(--strapi-neutral-200); --strapi-input-border-width: 1px; --strapi-input-border-style: solid; --strapi-input-border: var(--strapi-input-border-width) var(--strapi-input-border-style) var(--strapi-input-border-color) ; } /** Dark mode */ @include dark { /** Dark Color: Neutral */ --strapi-neutral-1000: #FFFFFF; /* both 800 and 900 identical in Figma */ --strapi-neutral-900: #FFFFFF; /* both 800 and 900 identical in Figma */ --strapi-neutral-800: #FFFFFF; --strapi-neutral-700: #EAEAEF; --strapi-neutral-600: #666687; --strapi-neutral-500: #c0c0cf; --strapi-neutral-400: #A5A5BA; /* incorrecly named in Figma */ --strapi-neutral-300: #666687; --strapi-neutral-200: #4A4A6A; --strapi-neutral-150: #32324D; --strapi-neutral-100: #181826; --strapi-neutral-0: #212134; /** Dark Color: Primary */ --strapi-primary-600: #7B79FF; } ================================================ FILE: docs/src/scss/admonition.scss ================================================ /** Component: Alert */ .theme-admonition { --custom-admonition-background-color: var(--strapi-neutral-100); --custom-admonition-border-color: var(--strapi-neutral-500); --custom-admonition-border-radius: var(--strapi-spacing-0); --custom-admonition-color: var(--strapi-neutral-800); --custom-admonition-heading-color: var(--strapi-neutral-700); --custom-admonition-heading-mb: var(--strapi-spacing-2); --custom-admonition-mb: var(--strapi-spacing-4); --custom-admonition-px: var(--strapi-spacing-4); --custom-admonition-py: var(--strapi-spacing-4); --ifm-link-decoration: none; --ifm-link-color: var(--custom-admonition-heading-color); --ifm-link-hover-color: var(--custom-admonition-heading-color); background-color: var(--custom-admonition-background-color); border-left: 4px solid var(--custom-admonition-border-color); border-radius: var(--custom-admonition-border-radius); color: var(--custom-admonition-color); margin: 0 0 var(--custom-admonition-mb); padding: var(--custom-admonition-py) var(--custom-admonition-px); /** Alert Title element */ &__heading { color: var(--custom-admonition-heading-color); font-weight: var(--custom-admonition-heading-font-weight, 600); margin-bottom: var(--custom-admonition-heading-mb); } h1, h2, h3, li, p, table { code, a code { --custom-code-border-color: transparent; --custom-code-background-color: var(--custom-admonition-code-background-color); --custom-code-color: var(--custom-admonition-heading-color); } } a { font-weight: 700; } *:last-child { margin-bottom: 0; } &--info, &--callout, &--prerequisites { --custom-admonition-background-color: var(--strapi-neutral-100); --custom-admonition-border-color: var(--strapi-neutral-500); --custom-admonition-code-background-color: var(--strapi-neutral-200); --custom-admonition-code-color: var(--strapi-primary-600); --custom-admonition-heading-color: var(--strapi-neutral-700); --custom-selection-background-color: var(--strapi-neutral-700); --custom-selection-color: var(--strapi-neutral-100); --ifm-link-color: var(--strapi-primary-600); --ifm-link-hover-color: var(--strapi-primary-600); } &--note { --custom-admonition-background-color: var(--strapi-secondary-100); --custom-admonition-border-color: var(--strapi-secondary-500); --custom-admonition-code-background-color: var(--strapi-secondary-200); --custom-admonition-code-color: var(--strapi-secondary-600); --custom-admonition-heading-color: var(--strapi-secondary-700); --custom-selection-background-color: var(--strapi-secondary-700); --custom-selection-color: var(--strapi-secondary-100); } &--tip, &--success { --custom-admonition-background-color: var(--strapi-success-100); --custom-admonition-border-color: var(--strapi-success-500); --custom-admonition-code-background-color: var(--strapi-success-200); --custom-admonition-code-color: var(--strapi-success-600); --custom-admonition-heading-color: var(--strapi-success-700); --custom-selection-background-color: var(--strapi-success-700); --custom-selection-color: var(--strapi-success-100); } &--caution { --custom-admonition-background-color: var(--strapi-warning-100); --custom-admonition-border-color: var(--strapi-warning-500); --custom-admonition-code-background-color: var(--strapi-warning-200); --custom-admonition-code-color: var(--strapi-warning-600); --custom-admonition-heading-color: var(--strapi-warning-700); --custom-selection-background-color: var(--strapi-warning-700); --custom-selection-color: var(--strapi-warning-100); } &--danger, &--warning { --custom-admonition-background-color: var(--strapi-danger-100); --custom-admonition-border-color: var(--strapi-danger-500); --custom-admonition-code-background-color: var(--strapi-danger-200); --custom-admonition-code-color: var(--strapi-danger-600); --custom-admonition-heading-color: var(--strapi-danger-700); --custom-selection-background-color: var(--strapi-danger-700); --custom-selection-color: var(--strapi-danger-100); } &--strapi { --custom-admonition-background-color: var(--strapi-primary-100); --custom-admonition-border-color: var(--strapi-primary-500); --custom-admonition-code-background-color: var(--strapi-primary-200); --custom-admonition-code-color: var(--strapi-primary-600); --custom-admonition-heading-color: var(--strapi-primary-700); --custom-selection-background-color: var(--strapi-primary-700); --custom-selection-color: var(--strapi-primary-100); } &--subtle { border-radius: 8px; border: none; background-color: transparent; border: solid 1px var(--strapi-neutral-500); font-size: 90%; } } @media screen and (min-width: 997px) { [class*="sbs-column"]:nth-of-type(2) .theme-admonition--subtle { margin-left: 80px; } } /** Dark mode */ @include dark { .theme-admonition { // --custom-admonition-color: var(--strapi-neutral-150); --custom-admonition-background-color: var(--strapi-neutral-100); --custom-admonition-code-background-color: var(--strapi-neutral-200); &--info, &--callout, &--prerequisites { --custom-admonition-code-color: var(--strapi-primary-500); --custom-admonition-heading-color: var(--strapi-neutral-500); } &--note { --custom-admonition-code-color: var(--strapi-secondary-500); --custom-admonition-heading-color: var(--strapi-secondary-500); } &--tip, &--success { --custom-admonition-code-color: var(--strapi-success-500); --custom-admonition-heading-color: var(--strapi-success-500); } &--caution, &--warning { --custom-admonition-code-color: var(--strapi-warning-500); --custom-admonition-heading-color: var(--strapi-warning-500); } &--danger { --custom-admonition-code-color: var(--strapi-danger-500); --custom-admonition-heading-color: var(--strapi-danger-500); } &--strapi { --custom-admonition-code-color: var(--strapi-primary-500); --custom-admonition-heading-color: var(--strapi-primary-500); } code, a code { --custom-code-border-color: transparent; --custom-code-background-color: var(--custom-admonition-code-background-color); --custom-code-color: var(--custom-admonition-code-color); } .strapi-iqb { --strapi-iqb-background-color: var(--strapi-neutral-0); } } } ================================================ FILE: docs/src/scss/api-call.scss ================================================ /** Component: API Call / Request / Response */ :root { --custom-api-call-gap: var(--strapi-spacing-4); --custom-api-call-heading-font-size: var(--strapi-font-size-sm); --custom-api-call-heading-font-weight: 700; --custom-api-call-heading-py: var(--strapi-spacing-2); --custom-api-call-heading-px: var(--strapi-spacing-4); --custom-api-call-radius: var(--strapi-spacing-2); --custom-api-call-response-heading-background-color: var(--strapi-neutral-200); --custom-api-call-response-content-background-color: var(--strapi-neutral-300); --custom-api-call-request-heading-background-color: var(--strapi-neutral-100); --custom-api-call-request-content-background-color: var(--strapi-neutral-150); } .api-call { display: flex; flex-direction: column; align-items: stretch; gap: var(--custom-api-call-gap); margin-bottom: var(--custom-api-call-gap); &__request__content, &__request__heading, &__response__content, &__response__heading { background-color: var(--custom-api-call-background-color); color: var(--custom-api-call-color); } &__request, &__response { border-radius: var(--custom-api-call-radius); &__heading, &__content { *:last-child { margin-bottom: 0; } } &__heading { border-top-left-radius: var(--custom-api-call-radius); border-top-right-radius: var(--custom-api-call-radius); font-size: var(--custom-api-call-heading-font-size); font-weight: var(--custom-api-call-heading-font-weight); padding: var(--custom-api-call-heading-py) var(--custom-api-call-heading-px); } &__content { border-bottom-left-radius: var(--custom-api-call-radius); border-bottom-right-radius: var(--custom-api-call-radius); padding: var(--custom-api-call-content-py) var(--custom-api-call-content-px); } } &__request { &__heading { --custom-api-call-background-color: var(--custom-api-call-request-heading-background-color); } &__content { --custom-api-call-background-color: var(--custom-api-call-request-content-background-color); --custom-api-call-content-py: var(--custom-api-call-heading-px); --custom-api-call-content-px: var(--custom-api-call-heading-px); --custom-code-block-background-color: var(--custom-api-call-response-heading-background-color); --custom-code-background-color: var(--custom-api-call-response-heading-background-color); --custom-code-border-color: transparent; --custom-code-color: currentColor; } } &__response { &__heading { --custom-api-call-background-color: var(--custom-api-call-request-content-background-color); } &__content { --custom-api-call-background-color: var(--custom-api-call-request-content-background-color); --custom-code-block-background-color: var(--custom-api-call-response-content-background-color); } } .theme-code-block { border-radius: var(--custom-api-call-radius); } } /** Dark mode */ @include dark { --custom-api-call-color: var(--strapi-neutral-1000); --custom-api-call-request-heading-background-color: var(--strapi-neutral-300); --custom-api-call-request-content-background-color: var(--strapi-neutral-200); --custom-api-call-response-heading-background-color: var(--strapi-neutral-150); --custom-api-call-response-content-background-color: var(--strapi-neutral-100); .api-call { &__request { &__content { pre { --custom-code-block-background-color: var(--custom-api-call-response-heading-background-color); } } } &__response { &__content { pre { --custom-code-block-background-color: var(--custom-api-call-response-content-background-color); } } } } } ================================================ FILE: docs/src/scss/badge.scss ================================================ /** Component: Feature Badges (alpha, beta) */ .badge { --custom-badge-background-color: var(--strapi-neutral-200); --custom-badge-color: var(--strapi-neutral-800); --custom-badge-font-size: var(--strapi-font-size-sm); --custom-selection-background-color: var(--custom-badge-color); --ifm-badge-background-color: var(--custom-badge-background-color); --ifm-badge-color: var(--custom-badge-color); --ifm-badge-border-radius: var(--strapi-spacing-1); --ifm-badge-padding-horizontal: var(--strapi-spacing-2); --ifm-badge-padding-vertical: var(--strapi-spacing-2); --ifm-font-weight-bold: var(--strapi-font-size-sm); --ifm-link-color: var(--ifm-badge-color); --ifm-link-hover-color: var(--ifm-badge-color); position: relative; top: var(--custom-badge-inside-titles-top); font-size: var(--custom-badge-font-size); font-weight: 400; letter-spacing: 0.3px; text-align: center; &-link { font-weight: 400; } &--alpha { --custom-badge-background-color: rgb(255,230,228); --custom-badge-color: rgb(219, 0, 22); } &--beta { --custom-badge-background-color: rgb(246, 228, 253); --custom-badge-color: rgb(160,25,240); } &--future { --custom-badge-background-color: var(--strapi-danger-200); --custom-badge-color: rgb(219, 0, 22); } &--enterprise { --custom-badge-background-color: rgb(255, 241, 209); --custom-badge-color: rgb(229, 136, 41); } &--strapicloudpro { --custom-badge-background-color: rgb(55, 34, 254); --custom-badge-color: #fff; } &--strapicloudteam { --custom-badge-background-color: rgb(154, 53, 242); --custom-badge-color: #fff; } &--strapiclouddev { --custom-badge-background-color: rgb(44,170,73); --custom-badge-color: #fff; } &--new { --custom-badge-background-color: var(--strapi-warning-100); --custom-badge-border-color: var(--strapi-warning-200); --custom-badge-color: var(--strapi-warning-700); --ifm-badge-padding-horizontal: 2px; --ifm-badge-padding-vertical: 2px; font-weight: 500; font-size: 12px; line-height: 20px; letter-spacing: -0.5px; text-transform: uppercase; min-width: 52px; border: 1px solid var(--custom-badge-border-color); } &--updated { --custom-badge-background-color: var(--strapi-secondary-100); --custom-badge-border-color: var(--strapi-secondary-200); --custom-badge-color: var(--strapi-secondary-600); --ifm-badge-padding-horizontal: 2px; --ifm-badge-padding-vertical: 2px; font-weight: 500; font-size: 12px; line-height: 20px; letter-spacing: -0.5px; text-transform: uppercase; min-width: 52px; border: 1px solid var(--custom-badge-border-color); flex-shrink: 0; } } h1 .badge { --custom-badge-inside-titles-top: -.4em; } h2 .badge { --custom-badge-inside-titles-top: -.3em; } /** Dark mode */ @include dark { .badge { &--new { --custom-badge-background-color: var(--strapi-neutral-100); --custom-badge-border-color: var(--strapi-warning-500); --custom-badge-color: var(--strapi-warning-500); } &--updated { --custom-badge-background-color: var(--strapi-neutral-100); --custom-badge-border-color: var(--strapi-secondary-500); --custom-badge-color: var(--strapi-secondary-500); } } } ================================================ FILE: docs/src/scss/breadcrumbs.scss ================================================ /** Component: Breadcrumbs */ .breadcrumbs { --ifm-breadcrumb-item-background-active: transparent; --ifm-breadcrumb-border-radius: var(--strapi-spacing-1); --ifm-breadcrumb-color-active: var(--strapi-neutral-800); --ifm-link-hover-color: var(--strapi-neutral-700); --custom-breadcrumbs-font-size: var(--strapi-font-size-xs); --custom-breadcrumbs-pt: var(--strapi-spacing-4); --custom-breadcrumbs-item-caret-mx: var(--strapi-spacing-1); padding: var(--custom-breadcrumbs-pt) 0 0; &__item { &:after { --ifm-breadcrumb-spacing: var(--custom-breadcrumbs-item-caret-mx); } &--active { font-weight: 700; } } &__link { background-color: transparent; font-size: var(--custom-breadcrumbs-font-size); @include transition; &:any-link:hover { --ifm-breadcrumb-item-background-active: var(--strapi-neutral-100); } } } @include medium-up { .breadcrumbs { --custom-breadcrumbs-pt: var(--strapi-spacing-6); --custom-breadcrumbs-item-caret-mx: var(--strapi-spacing-3); } } ================================================ FILE: docs/src/scss/card.scss ================================================ /** Component: Card */ :root body { --custom-card-border-color: var(--strapi-neutral-200); --ifm-card-background-color: var(--strapi-neutral-0); --ifm-card-border-radius: var(--strapi-spacing-1); } .card { --ifm-color-emphasis-200: var(--custom-card-border-color); border: 1px solid var(--custom-card-border-color); box-shadow: 0px 1px 4px rgba(33, 33, 52, 0.1) !important; @include transition; &[href] { color: var(--strapi-neutral-600); &:hover { --ifm-color-primary: var(--strapi-neutral-300); box-shadow: 0px 2px 15px rgba(33, 33, 52, 0.1) !important; } } h2 { --ifm-h2-font-size: var(--strapi-font-size-md); margin-bottom: var(--strapi-spacing-2); } p { font-size: var(--strapi-font-size-sm); &:last-of-type { margin-bottom: 0; } } } /** Dark mode */ @include dark { .card { &[href] { color: var(--strapi-neutral-700); } } } ================================================ FILE: docs/src/scss/columns.scss ================================================ /** Components: Columns */ .column { &__title { font-weight: 700; margin-bottom: var(--strapi-spacing-1); } } /** Responsive */ @include medium-up { .columns { display: flex; justify-content: space-between; gap: var(--strapi-spacing-4); > .column { flex: 1; max-width: 50%; } } } ================================================ FILE: docs/src/scss/container.scss ================================================ /** Component: Container */ .container { padding-top: 0 !important; } ================================================ FILE: docs/src/scss/custom-doc-cards.scss ================================================ /** Component: CustomDocCardWrapper */ .custom-cards-wrapper { display: flex; flex-flow: row wrap; max-width: 715px; justify-content: flex-start; .custom-doc-card { max-width: 320px; width: 320px; margin-bottom: 10px; margin-right: 20px; a { height: 170px; } } } /** Component: CustomDocCard */ .custom-doc-card { a { text-decoration: none; } a:hover { .cardTitle { color: var(--strapi-primary-600); } } .text--truncate.cardDescription { // cancel --truncate styles since we can't remove the' class overflow: auto; white-space: normal; } } .custom-doc-card--small { .cardTitle { margin-bottom: 0; } } ================================================ FILE: docs/src/scss/details.scss ================================================ /** Component: Details/Accordion */ details.alert { --docusaurus-details-decoration-color: var(--strapi-neutral-800); --ifm-alert-background-color: var(--strapi-neutral-150); --ifm-alert-background-color-highlight: var(--strapi-neutral-500); --ifm-alert-border-radius: var(--strapi-spacing-1); --ifm-alert-foreground-color: var( --ifm-color-info-contrast-foreground ); --ifm-alert-border-color: transparent; --ifm-tabs-color-active: var(--ifm-color-primary); --ifm-tabs-color-active-border: var(--ifm-color-primary); summary { p { margin: 0; } } /** Content element */ > div > div { --docusaurus-details-decoration-color: transparent; margin-top: 0; } a { color: var(--custom-code-color); } a:hover { text-decoration: var(--ifm-link-decoration); } } @include dark { details a { color: var(--strapi-primary-500); font-weight: 700; } } ================================================ FILE: docs/src/scss/footer.scss ================================================ /** Component: Footer */ .footer { a { @include transition; font-weight: 400; &:hover { font-weight: 700; } } &.footer--dark { --ifm-footer-background-color: var(--strapi-neutral-700); --ifm-footer-link-hover-color: var(--strapi-neutral-0); } } /** Dark mode */ @include dark { .footer { &.footer--dark { --ifm-footer-background-color: var(--strapi-neutral-150); } } } ================================================ FILE: docs/src/scss/grid.scss ================================================ /** Component: Grid */ .row { --custom-grid-spacing: var(--strapi-spacing-2); --ifm-spacing-horizontal: var(--custom-grid-spacing); .col { &.margin-bottom--lg { margin-bottom: calc(var(--custom-grid-spacing) * 2) !important; } } } /** Responsive */ @include medium-up { .row { &--huge { --custom-grid-spacing: var(--strapi-spacing-4); } } } ================================================ FILE: docs/src/scss/images.scss ================================================ /** General: Images */ /** Dark Mode images border */ .theme-doc-markdown.markdown [class*="themedImage--dark"] { border: 0.125rem solid var(--strapi-neutral-200); border-radius: 0.25rem; } ================================================ FILE: docs/src/scss/markdown.scss ================================================ /** Component: Markdown */ $selector-markdown: ".theme-doc-markdown.markdown"; #{$selector-markdown} { --custom-markdown-pt: var(--strapi-spacing-0); --custom-markdown-pb: var(--strapi-spacing-2); --markdown-link-color: var(--strapi-primary-600); font-weight: 400; padding: var(--custom-markdown-pt) 0 var(--custom-markdown-pb); } /** Dark mode */ @include dark { #{$selector-markdown} { --markdown-link-color: var(--strapi-primary-600); } } ================================================ FILE: docs/src/scss/medium-zoom.scss ================================================ /** Component: Medium Zoom */ .medium-zoom { &-overlay { background: var(--strapi-neutral-150) !important; } } /** Responsive */ @include medium-up { .medium-zoom { &-image { &--opened { margin-top: var(--ifm-navbar-height) !important; margin-bottom: var(--ifm-navbar-height) !important; } } } } ================================================ FILE: docs/src/scss/navbar.scss ================================================ /** Component: Navbar */ $selector-color-mode-toggle-button: 'button[class*="ColorModeToggle"]'; $selector-color-mode-toggle-wrapper: 'div[class*="ColorModeToggle"]'; :root body { --docsearch-searchbox-background: var(--strapi-neutral-150); --docsearch-searchbox-shadow: 0 0 0 2px var(--strapi-primary-600); --docsearch-muted-color: var(--strapi-neutral-400); --docsearch-text-color: var(--strapi-neutral-400); --ifm-navbar-height: 56px; --ifm-navbar-padding-vertical: var(--strapi-spacing-1); --ifm-navbar-padding-horizontal: var(--strapi-spacing-2); --ifm-navbar-shadow: 0 1px 0 0 var(--strapi-neutral-150); } .navbar { --custom-navbar-brand-mr: 0; --custom-navbar-icon-color: var(--strapi-neutral-500); --custom-navbar-icon-button-size: 36px; --custom-navbar-icon-button-hover-background: var(--strapi-neutral-100); --custom-navbar-items-font-size: var(--strapi-font-size-sm); --custom-navbar-items-gap: var(--strapi-spacing-3); --custom-navbar-logo-img-width: 40px; --custom-navbar-toggle-mr: var(--strapi-spacing-1); --custom-navbar-transition: all 0.2s ease; --ifm-navbar-padding-horizontal: var(--custom-navbar-items-gap); transition: var(--custom-navbar-transition); &__items { max-width: var(--custom-navbar-items-width); gap: var(--strapi-spacing-2); } &__brand, &__logo { height: auto; display: flex; } &__brand { margin-right: var(--custom-navbar-brand-mr); font-size: large; @include small-up { font-size: x-large; } } &__toggle { margin-right: var(--custom-navbar-toggle-mr); } &__logo { margin-right: var(--custom-navbar-items-gap); img { height: var(--custom-navbar-logo-img-height); width: var(--custom-navbar-logo-img-width); } } &__link { --ifm-font-weight-semibold: 500; --ifm-navbar-link-hover-color: var(--strapi-neutral-800); font-size: var(--custom-navbar-items-font-size); &--active { --ifm-font-weight-semibold: 700; } } &__link svg, .navbar-sidebar__close, .DocSearch-Button, #{$selector-color-mode-toggle-button} { color: var(--custom-navbar-icon-color); } .navbar-sidebar__close, .DocSearch-Button, #{$selector-color-mode-toggle-button} { --ifm-color-emphasis-600: currentColor; background: transparent; border-radius: 50%; &:hover { background: var(--custom-navbar-icon-button-hover-background); } } .navbar__toggle, .navbar-sidebar__close, #{$selector-color-mode-toggle-wrapper} { align-items: center; justify-content: center; height: var(--custom-navbar-icon-button-size); width: var(--custom-navbar-icon-button-size); } .DocSearch-Button { width: var(--custom-navbar-search-button-width); } } /** Responsive */ @include small-up { .navbar { .DocSearch-Button { --custom-navbar-icon-button-hover-background: var(--strapi-neutral-0); color: var(--strapi-neutral-400); border: var(--strapi-input-border); border-radius: 6px; font-family: var(--ifm-font-family-base); height: 40px; padding: 0 var(--strapi-spacing-3); background-color: var(--custom-navbar-icon-button-hover-background); svg path { stroke-width: 2px; } &-Container { gap: var(--strapi-spacing-1); } &-Placeholder, &-Key { font-size: var(--custom-navbar-items-font-size); } &-Key { margin: 0; padding: 0; width: 14px; height: 14px; background: none; border: none; box-shadow: none; font-weight: 600; line-height: 0; align-items: center; justify-content: center; &:first-of-type { font-size: 150%; } } &-Keys { padding: 2px 0 0; justify-content: end; } } } } /** Responsive */ @include medium-up { .navbar { --custom-navbar-brand-mr: 60px; --custom-navbar-items-gap: var(--strapi-spacing-4); --custom-navbar-search-button-width: 266px; --ifm-navbar-padding-horizontal: var(--custom-navbar-items-gap); } } ================================================ FILE: docs/src/scss/pagination-nav.scss ================================================ /** Component: Pagination Nav */ .pagination-nav { --ifm-spacing-horizontal: var(--strapi-spacing-4); &__link { &:hover { --ifm-pagination-nav-color-hover: var(--custom-card-border-color); } } } ================================================ FILE: docs/src/scss/scene.scss ================================================ /** Component: Scene */ #scene { position: fixed; top: 0px; width: 100%; height: 100%; z-index: 1000; } ================================================ FILE: docs/src/scss/search.scss ================================================ /** Component: Search */ :root body { --docsearch-hit-height: 56px; --docsearch-searchbox-height: 40px; --docsearch-spacing: var(--strapi-spacing-4); } body .DocSearch { --custom-search-hit-pb: var(--strapi-spacing-2); &-SearchBar { padding-bottom: var(--strapi-spacing-1); } &-Input { --docsearch-text-color: var(--strapi-neutral-800); } &-Input, &-Cancel { font-size: var(--strapi-font-size-md); } &-Hit { padding-bottom: var(--custom-search-hit-pb); } } ================================================ FILE: docs/src/scss/sidebar.scss ================================================ /** Component: Sidebar / Menu */ $selector-color-mode-toggle-button: 'button[class*="ColorModeToggle"]'; $selector-color-mode-toggle-wrapper: 'div[class*="ColorModeToggle"]'; :root body { --doc-sidebar-width: 290px; } .navbar-sidebar { --ifm-navbar-background-color: var(--strapi-neutral-0); &__brand { --custom-navbar-sidebar-horizontal-padding: calc(var(--custom-navbar-items-gap) * 2); --ifm-navbar-padding-horizontal: var(--custom-navbar-items-gap) var(--ifm-navbar-padding-vertical) var(--custom-navbar-sidebar-horizontal-padding) ; } &__back { --ifm-menu-color-background-active: var(--strapi-neutral-100); top: -0.95rem; margin-bottom: -0.45rem; } .navbar__brand { flex-grow: 1; } .navbar-sidebar__close, #{$selector-color-mode-toggle-wrapper} { display: flex; } .navbar-sidebar__close { margin-left: initial; padding: 9px; } #{$selector-color-mode-toggle-wrapper} { margin-right: 0 !important; } } .menu { --custom-sidebar-caret-size: 1.25rem; --custom-sidebar-menu-font-weight: 400; --custom-sidebar-menu-padding-y: var(--strapi-spacing-4); --ifm-menu-color-background-active: transparent; --ifm-menu-color-background-hover: var(--strapi-neutral-100); --ifm-menu-link-padding-vertical: var(--strapi-spacing-1); font-weight: var(--custom-sidebar-menu-font-weight); padding-top: var(--custom-sidebar-menu-padding-y) !important; &__caret { margin: 0 0 0 3px; padding: 0; &:before { background-size: var(--custom-sidebar-caret-size); } } &__caret, &__caret:before { height: 16px; width: 16px; } &__list { &-item { font-size: var(--custom-sidebar-menu-list-item-font-size, --strapi-font-size-md); &-collapsible { &:hover { background-color: var(--ifm-menu-color-background-hover); } } } } &__link { font-weight: 500; min-height: var(--custom-menu-item-link-min-height, 24px); @include transition; &:hover { --ifm-menu-color: var(--strapi-neutral-800); } &--active { --ifm-menu-color-active: var(--strapi-neutral-700); font-weight: 700; &:not(.menu__link--sublist) { --ifm-menu-color-active: var(--strapi-primary-600); position: relative; &:before { position: absolute; content: " "; width: 5px; top: 0; bottom: 0; left: var(--custom-sidebar-menu-list-item-link-active-left, -8px); background-color: var(--strapi-primary-600); border-radius: 0 2px 2px 0; } } } &--sublist-caret { --ifm-menu-color: var(--strapi-neutral-800); --ifm-menu-color-active: var(--strapi-neutral-800); &:after { display: none; } } &--sublist { &.menu__link--with-badge { --custom-menu-link-content-mw: calc(100% - 84px); } } &--with-badge { max-width: 100%; .menu__link__content { max-width: var(--custom-menu-link-content-mw, calc(100% - 56px)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } } } &__link__content { padding-right: 10px; } .badge { margin: -1px 0 -1px auto; } .theme-doc-sidebar { &-item { &-category { &-level-1 { --custom-sidebar-menu-list-item-py: var(--strapi-spacing-1); padding-top: var(--custom-sidebar-menu-list-item-py); padding-bottom: var(--custom-sidebar-menu-list-item-py); > .menu__list-item-collapsible { font-weight: 700; font-size: var(--strapi-font-size-md); } } } &-category, &-link { &-level { &-1 { --custom-sidebar-menu-list-item-font-size: var(--strapi-font-size-md); } &-2 { --custom-sidebar-menu-list-item-font-size: var(--strapi-font-size-sm); // next levels will have this same value --custom-sidebar-menu-list-item-link-active-left: -30px; padding-left: 10px; } &-3 { --custom-sidebar-menu-list-item-link-active-left: -42px; } &-4 { --custom-sidebar-menu-list-item-link-active-left: -54px; } &-5 { --custom-sidebar-menu-list-item-link-active-left: -66px; } } } } } } .theme-doc-sidebar-container { --docusaurus-collapse-button-bg: var(--strapi-neutral-0); --docusaurus-collapse-button-bg-hover: var(--strapi-neutral-100); } /** Dark mode */ @include dark { --ifm-menu-color: var(--strapi-neutral-1000); .theme-doc-sidebar-container { .menu { --ifm-menu-color-background-hover: var(--strapi-neutral-100); &__link--active { --ifm-menu-color-active: var(--strapi-neutral-800); &:not(.menu__link--sublist) { --ifm-menu-color-active: var(--strapi-primary-500); } } } } } ================================================ FILE: docs/src/scss/table-of-contents.scss ================================================ /** Component: Table of Contents */ .table-of-contents { --custom-toc-py: var(--strapi-spacing-1); --custom-toc-items-py: var(--strapi-spacing-0); --ifm-toc-padding-vertical: var(--custom-toc-py); font-size: var(--strapi-font-size-xs); > li { margin: 0 var(--ifm-toc-padding-horizontal); padding-top: var(--custom-toc-items-py); padding-bottom: var(--custom-toc-items-py); } &__link { --custom-table-of-contents-link-active-before-left: -16px; position: relative; font-weight: 400; @include transition; &:hover { font-weight: 500; &:not(.table-of-contents__link--active) { --ifm-color-primary: var(--strapi-neutral-900); } } &--active { font-weight: 500; &:before { content: " "; position: absolute; top: 0; bottom: 0; left: var(--custom-table-of-contents-link-active-before-left); width: 3px; border-radius: 0 2px 2px 0; background-color: var(--strapi-primary-600); } } + ul li .table-of-contents { &__link { --custom-table-of-contents-link-active-before-left: -32px; } } img { display: inline-block; vertical-align: bottom; max-width: 22px; margin-right: 2px; } } } /** Responsive */ @include medium-up { .table-of-contents { --custom-toc-items-py: var(--strapi-spacing-2); } } ================================================ FILE: docs/src/scss/table.scss ================================================ /** Component: Table */ table { min-width: 100%; overflow: auto; thead { --ifm-table-background: transparent; --ifm-table-stripe-background: transparent; tr { border-bottom-width: 1px; th { --ifm-table-head-background: transparent; } } } } ================================================ FILE: docs/src/scss/tabs.scss ================================================ /** Component: Tab */ :root body { --custom-tabs-px: var(--strapi-spacing-5); --custom-tabs-py: var(--strapi-spacing-2); --ifm-tabs-padding-horizontal: var(--custom-tabs-px); --ifm-tabs-padding-vertical: var(--custom-tabs-py); } .tabs { &__item { border-top: 2px solid transparent; } /** Tabs inside Tabs */ + div { [role="tabpanel"] { .tabs { font-size: var(--strapi-font-size-ssm); &__item { &--active { --ifm-tabs-color-active-border: transparent; background-color: var(--ifm-hover-overlay); } } + [class*="margin-top"] { margin-top: 0 !important; } } } } } /** Tabs inside Details component */ details { .tabs { --ifm-tabs-color-active-border: var(--strapi-) } } ================================================ FILE: docs/src/scss/typography.scss ================================================ /** General: Typography */ :root { --custom-heading-decorative-line-color: var(--strapi-neutral-150); } h1, h2, h3, h4, h5, h6 { --ifm-heading-color: var(--strapi-neutral-900); --ifm-heading-font-weight: 600; --ifm-code-font-size: 70%; } h1, .markdown h1:first-child { --ifm-h1-font-size: 35px; // --ifm-heading-line-height: 24px; // not good } h2, .markdown > h2 { --ifm-h2-font-size: 26px; // --ifm-heading-line-height: 24px; // not good } h3, .markdown > h3 { --ifm-h3-font-size: var(--strapi-font-size-lg); @include flex-row; } h2 { position: relative; &:after { content: " "; position: absolute; left: 0; right: 0; bottom: -10px; height: 1px; background-color: var(--custom-heading-decorative-line-color); } } p, ul { img { display: inline-block; vertical-align: text-bottom; } } /** Dark mode */ @include dark { h1, h2, h3, h4, h5, h6 { --ifm-heading-color: var(--strapi-neutral-900); } } ================================================ FILE: docs/src/theme/Admonition/index.js ================================================ import React from 'react'; import clsx from 'clsx'; import { ThemeClassNames } from '@docusaurus/theme-common'; const defaultClassName = ThemeClassNames.common.admonition; const customDefaultProps = { note: { icon: '✏️', title: 'Note', }, tip: { icon: '💡', title: 'Tip', }, info: { icon: '👀', title: 'Info', }, caution: { icon: '✋', title: 'Caution', }, warning: { icon: '⚠️', title: 'Warning', }, danger: { icon: '❗️', title: 'Warning', }, strapi: { icon: '🤓', }, prerequisites: { icon: '☑️', title: 'Prerequisites', }, }; export default function CustomAdmonition({ children, className, icon: propIcon, title: propTitle, type, ...rest }) { const { icon: defaultIcon, title: defaultTitle } = (customDefaultProps[type] || {}); const icon = (propIcon || defaultIcon); const title = (propTitle || defaultTitle); const shouldRenderHeading = !!(icon || title); return (
    {shouldRenderHeading && (
    {icon && ( {icon}{' '} )} {title}
    )} {children}
    ); } ================================================ FILE: docs/src/theme/MDXComponents.js ================================================ import React from 'react'; // Import the original mapper import MDXComponents from '@theme-original/MDXComponents'; /** Import built-in Docusaurus components at the global level * so we don't have to re-import them in every file */ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; // Import custom components, globally as well import Request from '../components/Request'; import Response from '../components/Response'; import ApiCall from '../components/ApiCall'; import SubtleCallout from '../components/SubtleCallout'; import CustomDocCard from '../components/CustomDocCard'; import CustomDocCardsWrapper from '../components/CustomDocCardsWrapper'; export default { // Re-use the default mapping ...MDXComponents, /** * Components below are imported within the global scope, * meaning you don't have to insert the typical 'import SomeStuff from '/path/to/stuff' line * at the top of a Markdown file before being able to use these components * — see https://docusaurus.io/docs/next/markdown-features/react#mdx-component-scope */ Request, Response, ApiCall, Tabs, TabItem, SubtleCallout, CustomDocCard, CustomDocCardsWrapper, }; ================================================ FILE: docs/static/.nojekyll ================================================ ================================================ FILE: docs/tsconfig.json ================================================ { // This file is not used in compilation. It is here just for a nice editor experience. "extends": "@docusaurus/tsconfig", "compilerOptions": { "baseUrl": "." } } ================================================ FILE: jest.config.js ================================================ module.exports = { name: 'Unit test', testMatch: ['**/__tests__/?(*.)+(spec|test).js'], transform: {}, coverageDirectory: "./coverage/", collectCoverage: true, }; ================================================ FILE: package.json ================================================ { "name": "strapi-plugin-config-sync", "version": "3.2.0", "description": "Migrate your config data across environments using the CLI or Strapi admin panel.", "strapi": { "displayName": "Config Sync", "name": "config-sync", "icon": "sync", "description": "Migrate your config data across environments using the CLI or Strapi admin panel.", "required": false, "kind": "plugin" }, "bin": { "config-sync": "./bin/config-sync" }, "exports": { "./strapi-admin": { "source": "./admin/src/index.js", "import": "./dist/admin/index.mjs", "require": "./dist/admin/index.js", "default": "./dist/admin/index.js" }, "./strapi-server": { "source": "./server/index.js", "import": "./dist/server/index.mjs", "require": "./dist/server/index.js", "default": "./dist/server/index.js" }, "./cli": { "source": "./server/cli.js", "import": "./dist/cli/index.mjs", "require": "./dist/cli/index.js", "default": "./dist/cli/index.js" }, "./package.json": "./package.json" }, "scripts": { "develop": "strapi-plugin watch:link", "watch": "strapi-plugin watch", "build": "strapi-plugin build && yalc push --publish", "eslint": "eslint --max-warnings=0 './**/*.{js,jsx}'", "eslint:fix": "eslint --fix './**/*.{js,jsx}'", "test:unit": "jest --verbose", "test:integration": "cd playground && node_modules/.bin/jest --verbose --forceExit --detectOpenHandles", "test:e2e": "cypress open", "playground:install": "yarn playground:yalc-add-link && cd playground && yarn install", "playground:yalc-add": "cd playground && yalc add strapi-plugin-config-sync", "playground:yalc-add-link": "cd playground && yalc add --link strapi-plugin-config-sync", "playground:build": "cd playground && yarn build", "playground:develop": "cd playground && yarn develop", "playground:start": "cd playground && yarn start" }, "dependencies": { "adm-zip": "^0.5.16", "chalk": "^5.6.2", "cli-table": "^0.3.6", "commander": "^14.0.3", "file-saver": "^2.0.5", "git-diff": "^2.0.6", "immutable": "^4.0.0", "inquirer": "^13.3.0", "lodash": "^4.17.23", "react-diff-viewer-continued": "4.0.6", "react-intl": "^6", "react-query": "^3.39.3", "react-redux": "^9.2.0", "redux": "^5.0.1", "redux-immutable": "^4.0.0", "redux-thunk": "^3.1.0" }, "author": { "name": "Boaz Poolman", "email": "boaz@pluginpal.io", "url": "https://github.com/boazpoolman" }, "maintainers": [ { "name": "Boaz Poolman", "email": "boaz@pluginpal.io", "url": "https://github.com/boazpoolman" } ], "files": [ "dist", "bin" ], "peerDependencies": { "@strapi/admin": "^5.0.0", "@strapi/design-system": "^2.0.0", "@strapi/icons": "^2.0.0", "@strapi/strapi": "^5.0.0", "@strapi/typescript-utils": "^5.0.0", "@strapi/utils": "^5.0.0", "react": "^17.0.0 || ^18.0.0", "react-dom": "^17.0.0 || ^18.0.0", "react-router-dom": "^6.0.0", "styled-components": "^6.0.0" }, "devDependencies": { "@strapi/admin": "^5.0.0", "@strapi/design-system": "^2.0.0", "@strapi/icons": "^2.0.0", "@strapi/sdk-plugin": "^6.0.0", "@strapi/strapi": "^5.0.0", "@strapi/typescript-utils": "^5.0.0", "@strapi/utils": "^5.0.0", "babel-eslint": "9.0.0", "cypress": "^15", "cypress-terminal-report": "^7", "eslint": "^7.32.0", "eslint-config-airbnb": "^18.2.1", "eslint-config-react-app": "^3.0.7", "eslint-import-resolver-webpack": "^0.11.0", "eslint-loader": "^4.0.2", "eslint-plugin-babel": "^5.3.0", "eslint-plugin-cypress": "^3.2.0", "eslint-plugin-flowtype": "2.50.1", "eslint-plugin-import": "^2.22.1", "eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-react": "^7.21.5", "eslint-plugin-react-hooks": "^2.3.0", "jest": "^29.7.0", "jest-cli": "^29.3.1", "jest-styled-components": "^7.0.2", "nodemon": "^3.1.7", "react": "^17.0.0", "styled-components": "^5.2.3", "yalc": "^1.0.0-pre.53" }, "bugs": { "url": "https://github.com/pluginpal/strapi-plugin-config-sync/issues" }, "repository": { "type": "git", "url": "git://github.com/pluginpal/strapi-plugin-config-sync.git" }, "homepage": "https://www.pluginpal.io/plugin/config-sync", "engines": { "node": ">=20.0.0 <=24.x.x", "npm": ">=6.0.0" }, "license": "MIT", "publishConfig": { "registry": "https://registry.npmjs.org/", "access": "public", "provenance": true } } ================================================ FILE: packup.config.ts ================================================ // eslint-disable-next-line import/no-extraneous-dependencies import { defineConfig } from '@strapi/pack-up'; export default defineConfig({ bundles: [ { source: './admin/src/index.js', import: './dist/admin/index.mjs', require: './dist/admin/index.js', runtime: 'web', }, { source: './server/index.js', import: './dist/server/index.mjs', require: './dist/server/index.js', runtime: 'node', }, { source: './server/cli.js', import: './dist/cli/index.mjs', require: './dist/cli/index.js', runtime: 'node', }, ], dist: './dist', exports: {}, }); ================================================ FILE: playground/.editorconfig ================================================ root = true [*] indent_style = space indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [{package.json,*.yml}] indent_style = space indent_size = 2 [*.md] trim_trailing_whitespace = false ================================================ FILE: playground/.eslintignore ================================================ .cache build **/node_modules/** ================================================ FILE: playground/.eslintrc ================================================ { "parser": "babel-eslint", "extends": "eslint:recommended", "env": { "commonjs": true, "es6": true, "node": true, "browser": false }, "parserOptions": { "ecmaFeatures": { "experimentalObjectRestSpread": true, "jsx": false }, "sourceType": "module" }, "globals": { "strapi": true }, "rules": { "indent": ["error", 2, { "SwitchCase": 1 }], "linebreak-style": ["error", "unix"], "no-console": 0, "quotes": ["error", "single"], "semi": ["error", "always"] } } ================================================ FILE: playground/.gitignore ================================================ ############################ # OS X ############################ .DS_Store .AppleDouble .LSOverride Icon .Spotlight-V100 .Trashes ._* ############################ # Linux ############################ *~ ############################ # Windows ############################ Thumbs.db ehthumbs.db Desktop.ini $RECYCLE.BIN/ *.cab *.msi *.msm *.msp ############################ # Packages ############################ *.7z *.csv *.dat *.dmg *.gz *.iso *.jar *.rar *.tar *.zip *.com *.class *.dll *.exe *.o *.seed *.so *.swo *.swp *.swn *.swm *.out *.pid ############################ # Logs and databases ############################ .tmp *.log *.sql *.sqlite *.sqlite3 ############################ # Misc. ############################ *# ssl .idea nbproject public/uploads/* !public/uploads/.gitkeep ############################ # Node.js ############################ lib-cov lcov.info pids logs results node_modules .node_history yarn.lock ############################ # Tests ############################ testApp coverage /config/sync ############################ # Strapi ############################ license.txt exports .strapi dist build .strapi-updater.json .strapi-cloud.json # yalc .yalc yalc.lock ================================================ FILE: playground/README.md ================================================ # 🚀 Getting started with Strapi Strapi comes with a full featured [Command Line Interface](https://docs.strapi.io/dev-docs/cli) (CLI) which lets you scaffold and manage your project in seconds. ### `develop` Start your Strapi application with autoReload enabled. [Learn more](https://docs.strapi.io/dev-docs/cli#strapi-develop) ``` npm run develop # or yarn develop ``` ### `start` Start your Strapi application with autoReload disabled. [Learn more](https://docs.strapi.io/dev-docs/cli#strapi-start) ``` npm run start # or yarn start ``` ### `build` Build your admin panel. [Learn more](https://docs.strapi.io/dev-docs/cli#strapi-build) ``` npm run build # or yarn build ``` ## ⚙️ Deployment Strapi gives you many possible deployment options for your project including [Strapi Cloud](https://cloud.strapi.io). Browse the [deployment section of the documentation](https://docs.strapi.io/dev-docs/deployment) to find the best solution for your use case. ## 📚 Learn more - [Resource center](https://strapi.io/resource-center) - Strapi resource center. - [Strapi documentation](https://docs.strapi.io) - Official Strapi documentation. - [Strapi tutorials](https://strapi.io/tutorials) - List of tutorials made by the core team and the community. - [Strapi blog](https://strapi.io/blog) - Official Strapi blog containing articles made by the Strapi team and the community. - [Changelog](https://strapi.io/changelog) - Find out about the Strapi product updates, new features and general improvements. Feel free to check out the [Strapi GitHub repository](https://github.com/strapi/strapi). Your feedback and contributions are welcome! ## ✨ Community - [Discord](https://discord.strapi.io) - Come chat with the Strapi community including the core team. - [Forum](https://forum.strapi.io/) - Place to discuss, ask questions and find answers, show your Strapi project and get feedback or just talk with other Community members. - [Awesome Strapi](https://github.com/strapi/awesome-strapi) - A curated list of awesome things related to Strapi. --- 🤫 Psst! [Strapi is hiring](https://strapi.io/careers). ================================================ FILE: playground/__tests__/cli.test.js ================================================ 'use strict'; const util = require('util'); const exec = util.promisify(require('child_process').exec); jest.setTimeout(20000); describe('Test the config-sync CLI', () => { afterAll(async () => { // Remove the generated files and the DB. await exec('rm -rf config/sync'); await exec('rm -rf .tmp'); }); test('Export', async () => { const { stdout: exportOutput } = await exec('yarn cs export -y'); expect(exportOutput).toContain('Finished export'); const { stdout: diffOutput } = await exec('yarn cs diff'); expect(diffOutput).toContain('No differences between DB and sync directory'); }); test('Import (delete)', async () => { // Remove a file to trigger a delete. await exec('mv config/sync/admin-role.strapi-editor.json .tmp'); const { stdout: importOutput } = await exec('yarn cs import -y'); expect(importOutput).toContain('Finished import'); const { stdout: diffOutput } = await exec('yarn cs diff'); expect(diffOutput).toContain('No differences between DB and sync directory'); }); test('Import (update)', async () => { // Update a core-store file. await exec('sed -i \'s/"description":"",/"description":"test",/g\' config/sync/core-store.plugin_content_manager_configuration_content_types##plugin##users-permissions.user.json'); // Update a file that has relations. await exec('sed -i \'s/{"action":"plugin::users-permissions.auth.register"},//g\' config/sync/user-role.public.json'); const { stdout: importOutput } = await exec('yarn cs import -y'); expect(importOutput).toContain('Finished import'); const { stdout: diffOutput } = await exec('yarn cs diff'); expect(diffOutput).toContain('No differences between DB and sync directory'); }); test('Import (create)', async () => { // Add a file to trigger a creation. await exec('mv .tmp/admin-role.strapi-editor.json config/sync/'); const { stdout: importOutput } = await exec('yarn cs import -y'); expect(importOutput).toContain('Finished import'); const { stdout: diffOutput } = await exec('yarn cs diff'); expect(diffOutput).toContain('No differences between DB and sync directory'); }); test('Non-empty diff returns 1', async () => { await exec('rm -rf config/sync/admin-role.strapi-editor.json'); // Work around Jest not supporting custom error matching. // https://github.com/facebook/jest/issues/8140 let error; try { await exec('yarn cs diff'); } catch (e) { error = e; } expect(error).toHaveProperty('code', 1); }); test('Import build project', async () => { // First we make sure the dist folder is deleted. await exec('mv dist .tmp'); await exec('yarn cs import -y'); const { stdout: buildOutput } = await exec('ls dist'); expect(buildOutput).toContain('config'); expect(buildOutput).toContain('src'); expect(buildOutput).toContain('tsconfig.tsbuildinfo'); // We restore the dist folder. await exec('rm -rf dist'); await exec('mv .tmp/dist ./dist'); }); test('Import project already built', async () => { // First we make sure the dist folder exists by doing an import. await exec('yarn cs import -y'); const { stdout: lsDist } = await exec('ls dist'); expect(lsDist).toContain('config'); expect(lsDist).toContain('src'); expect(lsDist).toContain('tsconfig.tsbuildinfo'); // We remove on file from the dist folder await exec('mv dist/tsconfig.tsbuildinfo .tmp'); // The new import should not rebuild the project. await exec('yarn cs import -y'); const { stdout: buildOutput } = await exec('ls dist'); expect(buildOutput).toContain('config'); expect(buildOutput).toContain('src'); expect(buildOutput).not.toContain('tsconfig.tsbuildinfo'); // We restore the tsconfig.tsbuildinfo file. await exec('mv .tmp/tsconfig.tsbuildinfo dist/tsconfig.tsbuildinfo'); }); }); ================================================ FILE: playground/__tests__/helpers.js ================================================ const fs = require('fs'); const { createStrapi, compileStrapi } = require('@strapi/strapi'); let instance; async function setupStrapi() { if (!instance) { const appContext = await compileStrapi(); await createStrapi(appContext).load(); instance = strapi; await instance.server.mount(); } return instance; } async function cleanupStrapi() { const dbSettings = strapi.config.get('database.connection'); // close server to release the db-file. await strapi.server.httpServer.close(); // close the connection to the database before deletion. await strapi.db.connection.destroy(); // delete test database after all tests have completed. if (dbSettings && dbSettings.connection && dbSettings.connection.filename) { const tmpDbFile = dbSettings.connection.filename; if (fs.existsSync(tmpDbFile)) { fs.unlinkSync(tmpDbFile); } } } module.exports = { setupStrapi, cleanupStrapi }; ================================================ FILE: playground/__tests__/import-on-boostrap.test.js ================================================ const util = require('util'); const exec = util.promisify(require('child_process').exec); const { setupStrapi, cleanupStrapi } = require('./helpers'); jest.setTimeout(20000); afterEach(async () => { // Disable importOnBootstrap await exec('sed -i "s/importOnBootstrap: true/importOnBootstrap: false/g" config/plugins.ts'); await cleanupStrapi(); await exec('rm -rf config/sync'); }); describe('Test the importOnBootstrap feature', () => { test('Without a database', async () => { // Do the initial export and remove the database. await exec('yarn cs export -y'); await exec('rm -rf .tmp'); // Manually change the plugins.ts to enable importOnBoostrap. await exec('sed -i "s/importOnBootstrap: false/importOnBootstrap: true/g" config/plugins.ts'); // Start up Strapi to initiate the importOnBootstrap function. await setupStrapi(); expect(strapi).toBeDefined(); }); test('With a database', async () => { // Delete any existing database and do an export. await exec('rm -rf .tmp'); await exec('yarn cs export -y'); // Manually change the plugins.ts to enable importOnBoostrap. await exec('sed -i "s/importOnBootstrap: false/importOnBootstrap: true/g" config/plugins.ts'); // Remove a config file to make sure the importOnBoostrap // function actually attempts to import. await exec('rm -rf config/sync/admin-role.strapi-editor.json'); // Start up Strapi to initiate the importOnBootstrap function. await setupStrapi(); expect(strapi).toBeDefined(); }); }); ================================================ FILE: playground/config/admin.ts ================================================ export default ({ env }) => ({ auth: { secret: env('ADMIN_JWT_SECRET'), }, apiToken: { salt: env('API_TOKEN_SALT'), }, rateLimit: { enabled: false, }, transfer: { token: { salt: env('TRANSFER_TOKEN_SALT'), }, }, flags: { nps: env.bool('FLAG_NPS', true), promoteEE: env.bool('FLAG_PROMOTE_EE', true), }, watchIgnoreFiles: [ '**/config/sync/**', '!**/.yalc/**/server/**', ], }); ================================================ FILE: playground/config/api.ts ================================================ export default { rest: { defaultLimit: 25, maxLimit: 100, withCount: true, }, }; ================================================ FILE: playground/config/database.ts ================================================ import path from 'path'; export default ({ env }) => { return { connection: { client: 'sqlite', connection: { filename: path.join(__dirname, '..', '..', env('DATABASE_FILENAME', '.tmp/data.db')), }, useNullAsDefault: true, }, }; }; ================================================ FILE: playground/config/middlewares.ts ================================================ export default [ 'strapi::logger', 'strapi::errors', 'strapi::security', 'strapi::cors', 'strapi::poweredBy', 'strapi::query', 'strapi::body', 'strapi::session', 'strapi::favicon', 'strapi::public', ]; ================================================ FILE: playground/config/plugins.ts ================================================ export default () => ({ 'config-sync': { enabled: true, config: { importOnBootstrap: false, minify: true, }, }, }); ================================================ FILE: playground/config/server.ts ================================================ export default ({ env }) => ({ host: env('HOST', '0.0.0.0'), port: env.int('PORT', 1337), app: { keys: env.array('APP_KEYS'), }, webhooks: { populateRelations: env.bool('WEBHOOKS_POPULATE_RELATIONS', false), }, }); ================================================ FILE: playground/database/migrations/.gitkeep ================================================ ================================================ FILE: playground/jest.config.js ================================================ module.exports = { name: 'Integration test', testMatch: ['**/__tests__/?(*.)+(spec|test).js'], transform: {}, coverageDirectory: '../coverage/', collectCoverage: true, }; ================================================ FILE: playground/package.json ================================================ { "name": "strapi-5-beta", "private": true, "version": "0.1.0", "description": "A Strapi application", "scripts": { "develop": "strapi develop", "start": "strapi start", "build": "strapi build", "strapi": "strapi", "cs": "config-sync" }, "devDependencies": { "@types/node": "^24.0.7", "@types/react": "^19.1.8", "@types/react-dom": "^19.1.6", "jest": "^29.7.0", "jest-cli": "^29.7.0", "supertest": "^6.3.3", "typescript": "^5.8.3", "yalc": "^1.0.0-pre.53" }, "dependencies": { "@strapi/plugin-cloud": "5.37.1", "@strapi/plugin-users-permissions": "5.37.1", "@strapi/strapi": "5.37.1", "better-sqlite3": "11.3.0", "react": "^18.0.0", "react-dom": "^18.0.0", "react-router-dom": "^6.0.0", "strapi-plugin-config-sync": "link:.yalc/strapi-plugin-config-sync", "styled-components": "^6.0.0" }, "author": { "name": "A Strapi developer" }, "strapi": { "uuid": "edadddbd-0f25-4da7-833b-d4cd7dcae2fc" }, "engines": { "node": ">=20.0.0 <=24.x.x", "npm": ">=6.0.0" }, "license": "MIT" } ================================================ FILE: playground/public/robots.txt ================================================ # To prevent search engines from seeing the site altogether, uncomment the next two lines: # User-Agent: * # Disallow: / ================================================ FILE: playground/public/uploads/.gitkeep ================================================ ================================================ FILE: playground/src/admin/app.example.tsx ================================================ import type { StrapiApp } from '@strapi/strapi/admin'; export default { config: { locales: [ // 'ar', // 'fr', // 'cs', // 'de', // 'dk', // 'es', // 'he', // 'id', // 'it', // 'ja', // 'ko', // 'ms', // 'nl', // 'no', // 'pl', // 'pt-BR', // 'pt', // 'ru', // 'sk', // 'sv', // 'th', // 'tr', // 'uk', // 'vi', // 'zh-Hans', // 'zh', ], }, bootstrap(app: StrapiApp) { console.log(app); }, }; ================================================ FILE: playground/src/admin/tsconfig.json ================================================ { "compilerOptions": { "target": "ESNext", "module": "ESNext", "moduleResolution": "Bundler", "useDefineForClassFields": true, "lib": ["DOM", "DOM.Iterable", "ESNext"], "allowJs": false, "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, "noEmit": true, "jsx": "react-jsx" }, "include": ["../plugins/**/admin/src/**/*", "./"], "exclude": ["node_modules/", "build/", "dist/", "**/*.test.ts"] } ================================================ FILE: playground/src/admin/webpack.config.example.ts ================================================ import { mergeConfig, type UserConfig } from 'vite'; export default (config: UserConfig) => { // Important: always return the modified config return mergeConfig(config, { resolve: { alias: { '@': '/src', }, }, }); }; ================================================ FILE: playground/src/api/.gitkeep ================================================ ================================================ FILE: playground/src/api/home/content-types/home/schema.json ================================================ { "kind": "singleType", "collectionName": "homes", "info": { "singularName": "home", "pluralName": "homes", "displayName": "Home", "description": "" }, "options": { "draftAndPublish": false }, "pluginOptions": {}, "attributes": { "title": { "type": "string" }, "slug": { "type": "uid", "targetField": "title" } } } ================================================ FILE: playground/src/api/home/controllers/home.ts ================================================ /** * home controller */ import { factories } from '@strapi/strapi'; export default factories.createCoreController('api::home.home'); ================================================ FILE: playground/src/api/home/routes/home.ts ================================================ /** * home router */ import { factories } from '@strapi/strapi'; export default factories.createCoreRouter('api::home.home'); ================================================ FILE: playground/src/api/home/services/home.ts ================================================ /** * home service */ import { factories } from '@strapi/strapi'; export default factories.createCoreService('api::home.home'); ================================================ FILE: playground/src/api/page/content-types/page/schema.json ================================================ { "kind": "collectionType", "collectionName": "pages", "info": { "singularName": "page", "pluralName": "pages", "displayName": "Page" }, "options": { "draftAndPublish": false }, "pluginOptions": {}, "attributes": { "title": { "type": "string", "required": true } } } ================================================ FILE: playground/src/api/page/controllers/page.ts ================================================ /** * page controller */ import { factories } from '@strapi/strapi'; export default factories.createCoreController('api::page.page'); ================================================ FILE: playground/src/api/page/routes/page.ts ================================================ /** * page router */ import { factories } from '@strapi/strapi'; export default factories.createCoreRouter('api::page.page'); ================================================ FILE: playground/src/api/page/services/page.ts ================================================ /** * page service */ import { factories } from '@strapi/strapi'; module.exports = factories.createCoreService('api::page.page'); ================================================ FILE: playground/src/extensions/.gitkeep ================================================ ================================================ FILE: playground/src/index.ts ================================================ // import type { Core } from '@strapi/strapi'; export default { /** * An asynchronous register function that runs before * your application is initialized. * * This gives you an opportunity to extend code. */ register(/* { strapi }: { strapi: Core.Strapi } */) {}, /** * An asynchronous bootstrap function that runs before * your application gets started. * * This gives you an opportunity to set up your data model, * run jobs, or perform some special logic. */ bootstrap(/* { strapi }: { strapi: Core.Strapi } */) {}, }; ================================================ FILE: playground/tsconfig.json ================================================ { "compilerOptions": { "module": "CommonJS", "moduleResolution": "Node", "lib": ["ES2020"], "target": "ES2019", "strict": false, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "incremental": true, "esModuleInterop": true, "resolveJsonModule": true, "noEmitOnError": true, "noImplicitThis": true, "outDir": "dist", "rootDir": ".", }, "include": [ // Include root files "./", // Include all ts files "./**/*.ts", // Include all js files "./**/*.js", // Force the JSON files in the src folder to be included "src/**/*.json" ], "exclude": [ "node_modules/", "build/", "dist/", ".cache/", ".tmp/", // Do not include admin files in the server compilation "src/admin/", // Do not include test files "**/*.test.*", // Do not include plugins in the server compilation "src/plugins/**" ] } ================================================ FILE: playground/types/generated/components.d.ts ================================================ /* * The app doesn't have any components yet. */ ================================================ FILE: playground/types/generated/contentTypes.d.ts ================================================ import type { Schema, Struct } from '@strapi/strapi'; export interface AdminApiToken extends Struct.CollectionTypeSchema { collectionName: 'strapi_api_tokens'; info: { description: ''; displayName: 'Api Token'; name: 'Api Token'; pluralName: 'api-tokens'; singularName: 'api-token'; }; options: { draftAndPublish: false; }; pluginOptions: { 'content-manager': { visible: false; }; 'content-type-builder': { visible: false; }; }; attributes: { accessKey: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.SetMinMaxLength<{ minLength: 1; }>; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; description: Schema.Attribute.String & Schema.Attribute.SetMinMaxLength<{ minLength: 1; }> & Schema.Attribute.DefaultTo<''>; encryptedKey: Schema.Attribute.Text & Schema.Attribute.SetMinMaxLength<{ minLength: 1; }>; expiresAt: Schema.Attribute.DateTime; lastUsedAt: Schema.Attribute.DateTime; lifespan: Schema.Attribute.BigInteger; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation<'oneToMany', 'admin::api-token'> & Schema.Attribute.Private; name: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.Unique & Schema.Attribute.SetMinMaxLength<{ minLength: 1; }>; permissions: Schema.Attribute.Relation< 'oneToMany', 'admin::api-token-permission' >; publishedAt: Schema.Attribute.DateTime; type: Schema.Attribute.Enumeration<['read-only', 'full-access', 'custom']> & Schema.Attribute.Required & Schema.Attribute.DefaultTo<'read-only'>; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; }; } export interface AdminApiTokenPermission extends Struct.CollectionTypeSchema { collectionName: 'strapi_api_token_permissions'; info: { description: ''; displayName: 'API Token Permission'; name: 'API Token Permission'; pluralName: 'api-token-permissions'; singularName: 'api-token-permission'; }; options: { draftAndPublish: false; }; pluginOptions: { 'content-manager': { visible: false; }; 'content-type-builder': { visible: false; }; }; attributes: { action: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.SetMinMaxLength<{ minLength: 1; }>; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation< 'oneToMany', 'admin::api-token-permission' > & Schema.Attribute.Private; publishedAt: Schema.Attribute.DateTime; token: Schema.Attribute.Relation<'manyToOne', 'admin::api-token'>; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; }; } export interface AdminPermission extends Struct.CollectionTypeSchema { collectionName: 'admin_permissions'; info: { description: ''; displayName: 'Permission'; name: 'Permission'; pluralName: 'permissions'; singularName: 'permission'; }; options: { draftAndPublish: false; }; pluginOptions: { 'content-manager': { visible: false; }; 'content-type-builder': { visible: false; }; }; attributes: { action: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.SetMinMaxLength<{ minLength: 1; }>; actionParameters: Schema.Attribute.JSON & Schema.Attribute.DefaultTo<{}>; conditions: Schema.Attribute.JSON & Schema.Attribute.DefaultTo<[]>; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation<'oneToMany', 'admin::permission'> & Schema.Attribute.Private; properties: Schema.Attribute.JSON & Schema.Attribute.DefaultTo<{}>; publishedAt: Schema.Attribute.DateTime; role: Schema.Attribute.Relation<'manyToOne', 'admin::role'>; subject: Schema.Attribute.String & Schema.Attribute.SetMinMaxLength<{ minLength: 1; }>; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; }; } export interface AdminRole extends Struct.CollectionTypeSchema { collectionName: 'admin_roles'; info: { description: ''; displayName: 'Role'; name: 'Role'; pluralName: 'roles'; singularName: 'role'; }; options: { draftAndPublish: false; }; pluginOptions: { 'content-manager': { visible: false; }; 'content-type-builder': { visible: false; }; }; attributes: { code: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.Unique & Schema.Attribute.SetMinMaxLength<{ minLength: 1; }>; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; description: Schema.Attribute.String; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation<'oneToMany', 'admin::role'> & Schema.Attribute.Private; name: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.Unique & Schema.Attribute.SetMinMaxLength<{ minLength: 1; }>; permissions: Schema.Attribute.Relation<'oneToMany', 'admin::permission'>; publishedAt: Schema.Attribute.DateTime; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; users: Schema.Attribute.Relation<'manyToMany', 'admin::user'>; }; } export interface AdminSession extends Struct.CollectionTypeSchema { collectionName: 'strapi_sessions'; info: { description: 'Session Manager storage'; displayName: 'Session'; name: 'Session'; pluralName: 'sessions'; singularName: 'session'; }; options: { draftAndPublish: false; }; pluginOptions: { 'content-manager': { visible: false; }; 'content-type-builder': { visible: false; }; i18n: { localized: false; }; }; attributes: { absoluteExpiresAt: Schema.Attribute.DateTime & Schema.Attribute.Private; childId: Schema.Attribute.String & Schema.Attribute.Private; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; deviceId: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.Private; expiresAt: Schema.Attribute.DateTime & Schema.Attribute.Required & Schema.Attribute.Private; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation<'oneToMany', 'admin::session'> & Schema.Attribute.Private; origin: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.Private; publishedAt: Schema.Attribute.DateTime; sessionId: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.Private & Schema.Attribute.Unique; status: Schema.Attribute.String & Schema.Attribute.Private; type: Schema.Attribute.String & Schema.Attribute.Private; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; userId: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.Private; }; } export interface AdminTransferToken extends Struct.CollectionTypeSchema { collectionName: 'strapi_transfer_tokens'; info: { description: ''; displayName: 'Transfer Token'; name: 'Transfer Token'; pluralName: 'transfer-tokens'; singularName: 'transfer-token'; }; options: { draftAndPublish: false; }; pluginOptions: { 'content-manager': { visible: false; }; 'content-type-builder': { visible: false; }; }; attributes: { accessKey: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.SetMinMaxLength<{ minLength: 1; }>; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; description: Schema.Attribute.String & Schema.Attribute.SetMinMaxLength<{ minLength: 1; }> & Schema.Attribute.DefaultTo<''>; expiresAt: Schema.Attribute.DateTime; lastUsedAt: Schema.Attribute.DateTime; lifespan: Schema.Attribute.BigInteger; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation< 'oneToMany', 'admin::transfer-token' > & Schema.Attribute.Private; name: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.Unique & Schema.Attribute.SetMinMaxLength<{ minLength: 1; }>; permissions: Schema.Attribute.Relation< 'oneToMany', 'admin::transfer-token-permission' >; publishedAt: Schema.Attribute.DateTime; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; }; } export interface AdminTransferTokenPermission extends Struct.CollectionTypeSchema { collectionName: 'strapi_transfer_token_permissions'; info: { description: ''; displayName: 'Transfer Token Permission'; name: 'Transfer Token Permission'; pluralName: 'transfer-token-permissions'; singularName: 'transfer-token-permission'; }; options: { draftAndPublish: false; }; pluginOptions: { 'content-manager': { visible: false; }; 'content-type-builder': { visible: false; }; }; attributes: { action: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.SetMinMaxLength<{ minLength: 1; }>; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation< 'oneToMany', 'admin::transfer-token-permission' > & Schema.Attribute.Private; publishedAt: Schema.Attribute.DateTime; token: Schema.Attribute.Relation<'manyToOne', 'admin::transfer-token'>; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; }; } export interface AdminUser extends Struct.CollectionTypeSchema { collectionName: 'admin_users'; info: { description: ''; displayName: 'User'; name: 'User'; pluralName: 'users'; singularName: 'user'; }; options: { draftAndPublish: false; }; pluginOptions: { 'content-manager': { visible: false; }; 'content-type-builder': { visible: false; }; }; attributes: { blocked: Schema.Attribute.Boolean & Schema.Attribute.Private & Schema.Attribute.DefaultTo; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; email: Schema.Attribute.Email & Schema.Attribute.Required & Schema.Attribute.Private & Schema.Attribute.Unique & Schema.Attribute.SetMinMaxLength<{ minLength: 6; }>; firstname: Schema.Attribute.String & Schema.Attribute.SetMinMaxLength<{ minLength: 1; }>; isActive: Schema.Attribute.Boolean & Schema.Attribute.Private & Schema.Attribute.DefaultTo; lastname: Schema.Attribute.String & Schema.Attribute.SetMinMaxLength<{ minLength: 1; }>; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation<'oneToMany', 'admin::user'> & Schema.Attribute.Private; password: Schema.Attribute.Password & Schema.Attribute.Private & Schema.Attribute.SetMinMaxLength<{ minLength: 6; }>; preferedLanguage: Schema.Attribute.String; publishedAt: Schema.Attribute.DateTime; registrationToken: Schema.Attribute.String & Schema.Attribute.Private; resetPasswordToken: Schema.Attribute.String & Schema.Attribute.Private; roles: Schema.Attribute.Relation<'manyToMany', 'admin::role'> & Schema.Attribute.Private; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; username: Schema.Attribute.String; }; } export interface ApiHomeHome extends Struct.SingleTypeSchema { collectionName: 'homes'; info: { description: ''; displayName: 'Home'; pluralName: 'homes'; singularName: 'home'; }; options: { draftAndPublish: false; }; attributes: { createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation<'oneToMany', 'api::home.home'> & Schema.Attribute.Private; publishedAt: Schema.Attribute.DateTime; slug: Schema.Attribute.UID<'title'>; title: Schema.Attribute.String; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; }; } export interface ApiPagePage extends Struct.CollectionTypeSchema { collectionName: 'pages'; info: { displayName: 'Page'; pluralName: 'pages'; singularName: 'page'; }; options: { draftAndPublish: false; }; attributes: { createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation<'oneToMany', 'api::page.page'> & Schema.Attribute.Private; publishedAt: Schema.Attribute.DateTime; title: Schema.Attribute.String & Schema.Attribute.Required; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; }; } export interface PluginContentReleasesRelease extends Struct.CollectionTypeSchema { collectionName: 'strapi_releases'; info: { displayName: 'Release'; pluralName: 'releases'; singularName: 'release'; }; options: { draftAndPublish: false; }; pluginOptions: { 'content-manager': { visible: false; }; 'content-type-builder': { visible: false; }; }; attributes: { actions: Schema.Attribute.Relation< 'oneToMany', 'plugin::content-releases.release-action' >; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation< 'oneToMany', 'plugin::content-releases.release' > & Schema.Attribute.Private; name: Schema.Attribute.String & Schema.Attribute.Required; publishedAt: Schema.Attribute.DateTime; releasedAt: Schema.Attribute.DateTime; scheduledAt: Schema.Attribute.DateTime; status: Schema.Attribute.Enumeration< ['ready', 'blocked', 'failed', 'done', 'empty'] > & Schema.Attribute.Required; timezone: Schema.Attribute.String; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; }; } export interface PluginContentReleasesReleaseAction extends Struct.CollectionTypeSchema { collectionName: 'strapi_release_actions'; info: { displayName: 'Release Action'; pluralName: 'release-actions'; singularName: 'release-action'; }; options: { draftAndPublish: false; }; pluginOptions: { 'content-manager': { visible: false; }; 'content-type-builder': { visible: false; }; }; attributes: { contentType: Schema.Attribute.String & Schema.Attribute.Required; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; entryDocumentId: Schema.Attribute.String; isEntryValid: Schema.Attribute.Boolean; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation< 'oneToMany', 'plugin::content-releases.release-action' > & Schema.Attribute.Private; publishedAt: Schema.Attribute.DateTime; release: Schema.Attribute.Relation< 'manyToOne', 'plugin::content-releases.release' >; type: Schema.Attribute.Enumeration<['publish', 'unpublish']> & Schema.Attribute.Required; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; }; } export interface PluginI18NLocale extends Struct.CollectionTypeSchema { collectionName: 'i18n_locale'; info: { collectionName: 'locales'; description: ''; displayName: 'Locale'; pluralName: 'locales'; singularName: 'locale'; }; options: { draftAndPublish: false; }; pluginOptions: { 'content-manager': { visible: false; }; 'content-type-builder': { visible: false; }; }; attributes: { code: Schema.Attribute.String & Schema.Attribute.Unique; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation< 'oneToMany', 'plugin::i18n.locale' > & Schema.Attribute.Private; name: Schema.Attribute.String & Schema.Attribute.SetMinMax< { max: 50; min: 1; }, number >; publishedAt: Schema.Attribute.DateTime; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; }; } export interface PluginReviewWorkflowsWorkflow extends Struct.CollectionTypeSchema { collectionName: 'strapi_workflows'; info: { description: ''; displayName: 'Workflow'; name: 'Workflow'; pluralName: 'workflows'; singularName: 'workflow'; }; options: { draftAndPublish: false; }; pluginOptions: { 'content-manager': { visible: false; }; 'content-type-builder': { visible: false; }; }; attributes: { contentTypes: Schema.Attribute.JSON & Schema.Attribute.Required & Schema.Attribute.DefaultTo<'[]'>; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation< 'oneToMany', 'plugin::review-workflows.workflow' > & Schema.Attribute.Private; name: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.Unique; publishedAt: Schema.Attribute.DateTime; stageRequiredToPublish: Schema.Attribute.Relation< 'oneToOne', 'plugin::review-workflows.workflow-stage' >; stages: Schema.Attribute.Relation< 'oneToMany', 'plugin::review-workflows.workflow-stage' >; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; }; } export interface PluginReviewWorkflowsWorkflowStage extends Struct.CollectionTypeSchema { collectionName: 'strapi_workflows_stages'; info: { description: ''; displayName: 'Stages'; name: 'Workflow Stage'; pluralName: 'workflow-stages'; singularName: 'workflow-stage'; }; options: { draftAndPublish: false; version: '1.1.0'; }; pluginOptions: { 'content-manager': { visible: false; }; 'content-type-builder': { visible: false; }; }; attributes: { color: Schema.Attribute.String & Schema.Attribute.DefaultTo<'#4945FF'>; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation< 'oneToMany', 'plugin::review-workflows.workflow-stage' > & Schema.Attribute.Private; name: Schema.Attribute.String; permissions: Schema.Attribute.Relation<'manyToMany', 'admin::permission'>; publishedAt: Schema.Attribute.DateTime; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; workflow: Schema.Attribute.Relation< 'manyToOne', 'plugin::review-workflows.workflow' >; }; } export interface PluginUploadFile extends Struct.CollectionTypeSchema { collectionName: 'files'; info: { description: ''; displayName: 'File'; pluralName: 'files'; singularName: 'file'; }; options: { draftAndPublish: false; }; pluginOptions: { 'content-manager': { visible: false; }; 'content-type-builder': { visible: false; }; }; attributes: { alternativeText: Schema.Attribute.Text; caption: Schema.Attribute.Text; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; ext: Schema.Attribute.String; focalPoint: Schema.Attribute.JSON; folder: Schema.Attribute.Relation<'manyToOne', 'plugin::upload.folder'> & Schema.Attribute.Private; folderPath: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.Private & Schema.Attribute.SetMinMaxLength<{ minLength: 1; }>; formats: Schema.Attribute.JSON; hash: Schema.Attribute.String & Schema.Attribute.Required; height: Schema.Attribute.Integer; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation< 'oneToMany', 'plugin::upload.file' > & Schema.Attribute.Private; mime: Schema.Attribute.String & Schema.Attribute.Required; name: Schema.Attribute.String & Schema.Attribute.Required; previewUrl: Schema.Attribute.Text; provider: Schema.Attribute.String & Schema.Attribute.Required; provider_metadata: Schema.Attribute.JSON; publishedAt: Schema.Attribute.DateTime; related: Schema.Attribute.Relation<'morphToMany'>; size: Schema.Attribute.Decimal & Schema.Attribute.Required; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; url: Schema.Attribute.Text & Schema.Attribute.Required; width: Schema.Attribute.Integer; }; } export interface PluginUploadFolder extends Struct.CollectionTypeSchema { collectionName: 'upload_folders'; info: { displayName: 'Folder'; pluralName: 'folders'; singularName: 'folder'; }; options: { draftAndPublish: false; }; pluginOptions: { 'content-manager': { visible: false; }; 'content-type-builder': { visible: false; }; }; attributes: { children: Schema.Attribute.Relation<'oneToMany', 'plugin::upload.folder'>; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; files: Schema.Attribute.Relation<'oneToMany', 'plugin::upload.file'>; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation< 'oneToMany', 'plugin::upload.folder' > & Schema.Attribute.Private; name: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.SetMinMaxLength<{ minLength: 1; }>; parent: Schema.Attribute.Relation<'manyToOne', 'plugin::upload.folder'>; path: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.SetMinMaxLength<{ minLength: 1; }>; pathId: Schema.Attribute.Integer & Schema.Attribute.Required & Schema.Attribute.Unique; publishedAt: Schema.Attribute.DateTime; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; }; } export interface PluginUsersPermissionsPermission extends Struct.CollectionTypeSchema { collectionName: 'up_permissions'; info: { description: ''; displayName: 'Permission'; name: 'permission'; pluralName: 'permissions'; singularName: 'permission'; }; options: { draftAndPublish: false; }; pluginOptions: { 'content-manager': { visible: false; }; 'content-type-builder': { visible: false; }; }; attributes: { action: Schema.Attribute.String & Schema.Attribute.Required; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation< 'oneToMany', 'plugin::users-permissions.permission' > & Schema.Attribute.Private; publishedAt: Schema.Attribute.DateTime; role: Schema.Attribute.Relation< 'manyToOne', 'plugin::users-permissions.role' >; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; }; } export interface PluginUsersPermissionsRole extends Struct.CollectionTypeSchema { collectionName: 'up_roles'; info: { description: ''; displayName: 'Role'; name: 'role'; pluralName: 'roles'; singularName: 'role'; }; options: { draftAndPublish: false; }; pluginOptions: { 'content-manager': { visible: false; }; 'content-type-builder': { visible: false; }; }; attributes: { createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; description: Schema.Attribute.String; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation< 'oneToMany', 'plugin::users-permissions.role' > & Schema.Attribute.Private; name: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.SetMinMaxLength<{ minLength: 3; }>; permissions: Schema.Attribute.Relation< 'oneToMany', 'plugin::users-permissions.permission' >; publishedAt: Schema.Attribute.DateTime; type: Schema.Attribute.String & Schema.Attribute.Unique; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; users: Schema.Attribute.Relation< 'oneToMany', 'plugin::users-permissions.user' >; }; } export interface PluginUsersPermissionsUser extends Struct.CollectionTypeSchema { collectionName: 'up_users'; info: { description: ''; displayName: 'User'; name: 'user'; pluralName: 'users'; singularName: 'user'; }; options: { draftAndPublish: false; timestamps: true; }; attributes: { blocked: Schema.Attribute.Boolean & Schema.Attribute.DefaultTo; confirmationToken: Schema.Attribute.String & Schema.Attribute.Private; confirmed: Schema.Attribute.Boolean & Schema.Attribute.DefaultTo; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; email: Schema.Attribute.Email & Schema.Attribute.Required & Schema.Attribute.SetMinMaxLength<{ minLength: 6; }>; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation< 'oneToMany', 'plugin::users-permissions.user' > & Schema.Attribute.Private; password: Schema.Attribute.Password & Schema.Attribute.Private & Schema.Attribute.SetMinMaxLength<{ minLength: 6; }>; provider: Schema.Attribute.String; publishedAt: Schema.Attribute.DateTime; resetPasswordToken: Schema.Attribute.String & Schema.Attribute.Private; role: Schema.Attribute.Relation< 'manyToOne', 'plugin::users-permissions.role' >; updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; username: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.Unique & Schema.Attribute.SetMinMaxLength<{ minLength: 3; }>; }; } declare module '@strapi/strapi' { export module Public { export interface ContentTypeSchemas { 'admin::api-token': AdminApiToken; 'admin::api-token-permission': AdminApiTokenPermission; 'admin::permission': AdminPermission; 'admin::role': AdminRole; 'admin::session': AdminSession; 'admin::transfer-token': AdminTransferToken; 'admin::transfer-token-permission': AdminTransferTokenPermission; 'admin::user': AdminUser; 'api::home.home': ApiHomeHome; 'api::page.page': ApiPagePage; 'plugin::content-releases.release': PluginContentReleasesRelease; 'plugin::content-releases.release-action': PluginContentReleasesReleaseAction; 'plugin::i18n.locale': PluginI18NLocale; 'plugin::review-workflows.workflow': PluginReviewWorkflowsWorkflow; 'plugin::review-workflows.workflow-stage': PluginReviewWorkflowsWorkflowStage; 'plugin::upload.file': PluginUploadFile; 'plugin::upload.folder': PluginUploadFolder; 'plugin::users-permissions.permission': PluginUsersPermissionsPermission; 'plugin::users-permissions.role': PluginUsersPermissionsRole; 'plugin::users-permissions.user': PluginUsersPermissionsUser; } } } ================================================ FILE: server/bootstrap.js ================================================ 'use strict'; import fs from 'fs'; import ConfigType from './config/type'; import defaultTypes from './config/types'; import { logMessage } from './utils'; /** * An asynchronous bootstrap function that runs before * your application gets started. * * This gives you an opportunity to set up your data model, * run jobs, or perform some special logic. * * See more details here: https://strapi.io/documentation/v3.x/concepts/configurations.html#bootstrap */ export default async () => { // Register config types. const registerTypes = () => { const types = {}; // The default types provided by the plugin. defaultTypes(strapi).map((type) => { if (!strapi.config.get('plugin::config-sync.excludedTypes').includes(type.configName)) { types[type.configName] = new ConfigType(type); } }); // The types provided by other plugins. strapi.plugin('config-sync').pluginTypes.map((type) => { if (!strapi.config.get('plugin::config-sync.excludedTypes').includes(type.configName)) { types[type.configName] = new ConfigType(type); } }); // The custom types provided by the user. strapi.config.get('plugin::config-sync.customTypes').map((type) => { if (!strapi.config.get('plugin::config-sync.excludedTypes').includes(type.configName)) { types[type.configName] = new ConfigType(type); } }); return types; }; strapi.plugin('config-sync').types = registerTypes(); // Import on bootstrap. if (strapi.config.get('plugin::config-sync.importOnBootstrap')) { if (strapi.server.app.env === 'development') { strapi.log.warn(logMessage(`You can't use the 'importOnBootstrap' setting in the development env.`)); } else if (process.env.CONFIG_SYNC_CLI === 'true') { strapi.log.warn(logMessage(`The 'importOnBootstrap' setting was ignored because Strapi was started from the config-sync CLI itself.`)); } else if (fs.existsSync(strapi.config.get('plugin::config-sync.syncDir'))) { await strapi.plugin('config-sync').service('main').importAllConfig(); } } // Register permission actions. const actions = [ { section: 'plugins', displayName: 'Access the plugin settings', uid: 'settings.read', pluginName: 'config-sync', }, { section: 'plugins', displayName: 'Menu link to plugin settings', uid: 'menu-link', pluginName: 'config-sync', }, ]; await strapi.admin.services.permission.actionProvider.registerMany(actions); }; ================================================ FILE: server/cli.js ================================================ #!/usr/bin/env node import fs from 'fs'; import { Command } from 'commander'; import Table from 'cli-table'; import chalk from 'chalk'; import inquirer from 'inquirer'; import isEmpty from 'lodash/isEmpty'; import { createStrapi, compileStrapi } from '@strapi/strapi'; import gitDiff from 'git-diff'; import tsUtils from '@strapi/typescript-utils'; import warnings from './warnings'; import packageJSON from '../package.json'; const program = new Command(); const getStrapiApp = async () => { process.env.CONFIG_SYNC_CLI = 'true'; const appDir = process.cwd(); const isTSProject = await tsUtils.isUsingTypeScript(appDir); const outDir = await tsUtils.resolveOutDir(appDir); const alreadyCompiled = await fs.existsSync(outDir); let appContext; if (!isTSProject || !alreadyCompiled) { appContext = await compileStrapi(); } else { const distDir = isTSProject ? outDir : appDir; appContext = { appDir, distDir }; } const app = await createStrapi(appContext).load(); return app; }; const initTable = (head) => { return new Table({ head: [chalk.green('Name'), chalk.green(head || 'State')], colWidths: [65, 20], chars: { top: '═', 'top-mid': '╤', 'top-left': '╔', 'top-right': '╗', bottom: '═', 'bottom-mid': '╧', 'bottom-left': '╚', 'bottom-right': '╝', left: '║', 'left-mid': '╟', mid: '─', 'mid-mid': '┼', right: '║', 'right-mid': '╢', middle: '│', }, }); }; const getConfigState = (diff, configName, syncType) => { if ( diff.fileConfig[configName] && diff.databaseConfig[configName] ) { return chalk.yellow(syncType ? 'Update' : 'Different'); } else if ( diff.fileConfig[configName] && !diff.databaseConfig[configName] ) { if (syncType === 'import') { return chalk.green('Create'); } else if (syncType === 'export') { return chalk.red('Delete'); } else { return chalk.red('Only in sync dir'); } } else if ( !diff.fileConfig[configName] && diff.databaseConfig[configName] ) { if (syncType === 'import') { return chalk.red('Delete'); } else if (syncType === 'export') { return chalk.green('Create'); } else { return chalk.green('Only in DB'); } } }; const handleAction = async (syncType, skipConfirm, configType, partials, force) => { const app = await getStrapiApp(); 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. if (isEmpty(diff.diff)) { console.log(`${chalk.cyan.bold('[notice]')} There are no changes to ${syncType}.`); process.exit(0); } // Init table. const table = initTable('Action'); const configNames = partials && partials.split(','); const partialDiff = {}; // Fill partialDiff with arguments. if (configNames) { configNames.map((name) => { if (diff.diff[name]) partialDiff[name] = diff.diff[name]; }); } if (configType) { Object.keys(diff.diff).map((name) => { if (configType === name.split('.')[0]) { partialDiff[name] = diff.diff[name]; } }); } // No changes for partial diff. if ((partials || configType) && isEmpty(partialDiff)) { console.log(`${chalk.cyan.bold('[notice]')} There are no changes for the specified config.`); process.exit(0); } const finalDiff = (partials || configType) && partialDiff ? partialDiff : diff.diff; // Add diff to table. Object.keys(finalDiff).map((configName) => { table.push([configName, getConfigState(diff, configName, syncType)]); }); // Print table. if (hasSyncDir) { console.log(table.toString(), '\n'); } // Prompt to confirm. let answer = {}; if (!skipConfirm) { answer = await inquirer.prompt([{ type: 'confirm', name: 'confirm', message: `Are you sure you want to ${syncType} the config changes?`, }]); console.log(''); } // Preform the action. if (skipConfirm || answer.confirm) { if (syncType === 'import') { const onSuccess = (name) => console.log(`${chalk.cyan.bold('[notice]')} Imported ${name}`); try { await Promise.all(Object.keys(finalDiff).map(async (name) => { let warning; if ( getConfigState(diff, name, syncType) === chalk.red('Delete') && warnings.delete[name] ) warning = warnings.delete[name]; await app.plugin('config-sync').service('main').importSingleConfig(name, onSuccess, force); if (warning) console.log(`${chalk.yellow.bold('[warning]')} ${warning}`); })); console.log(`${chalk.green.bold('[success]')} Finished import`); } catch (e) { console.log(`${chalk.red.bold('[error]')} ${e}`); } } if (syncType === 'export') { const onSuccess = (name) => console.log(`${chalk.cyan.bold('[notice]')} Exported ${name}`); try { await Promise.all(Object.keys(finalDiff).map(async (name) => { await app.plugin('config-sync').service('main').exportSingleConfig(name, onSuccess); })); console.log(`${chalk.green.bold('[success]')} Finished export`); } catch (e) { console.log(`${chalk.red.bold('[error]')} ${e}`); } } } process.exit(0); }; // Initial program setup program.storeOptionsAsProperties(false).allowUnknownOption(true); program.helpOption('-h, --help', 'Display help for command'); program.addHelpCommand('help [command]', 'Display help for command'); // `$ config-sync version` (--version synonym) program.version(packageJSON.version, '-v, --version', 'Output the version number'); program .command('version') .description('Output your version of the config-sync plugin') .action(() => { process.stdout.write(`${packageJSON.version}\n`); process.exit(0); }); // `$ config-sync import` program .command('import') .alias('i') .option('-t, --type ', 'The type of config') .option('-p, --partial ', 'A comma separated string of configs') .option('-y, --yes', 'Skip the confirm prompt') .option('-f, --force', 'Ignore the soft setting') .description('Import the config') .action(async ({ yes, type, partial, force }) => { return handleAction('import', yes, type, partial, force); }); // `$ config-sync export` program .command('export') .alias('e') .option('-t, --type ', 'The type of config') .option('-p, --partial ', 'A comma separated string of configs') .option('-y, --yes', 'Skip the confirm prompt') .description('Export the config') .action(async ({ yes, type, partial }) => { return handleAction('export', yes, type, partial); }); // `$ config-sync diff` program .command('diff') .alias('d') .description('The config diff') .action(async (options, { args }) => { const single = args[0]; const app = await getStrapiApp(); const diff = await app.plugin('config-sync').service('main').getFormattedDiff(); // No changes. if (isEmpty(diff.diff)) { console.log(`${chalk.cyan.bold('[notice]')} No differences between DB and sync directory.`); process.exit(0); } // Single config diff. if (single) { // No changes. if (!diff.fileConfig[single] && !diff.databaseConfig[single]) { console.log(`${chalk.cyan.bold('[notice]')} No differences between DB and sync directory for ${single}.`); process.exit(0); } // Git diff. console.log(gitDiff( JSON.stringify(diff.fileConfig[single], null, 2), JSON.stringify(diff.databaseConfig[single], null, 2), { color: true }, )); process.exit(1); } // Init table. const table = initTable(); // Add diff to table. Object.keys(diff.diff).map((configName) => { table.push([configName, getConfigState(diff, configName)]); }); // Print table. console.log(table.toString()); process.exit(1); }); program.parseAsync(process.argv); ================================================ FILE: server/config/type.js ================================================ import isEmpty from 'lodash/isEmpty'; import { logMessage, sanitizeConfig, dynamicSort, noLimit, getCombinedUid, getCombinedUidWhereFilter, getUidParamsFromName } from '../utils'; import { difference, same } from '../utils/getArrayDiff'; import queryFallBack from '../utils/queryFallBack'; const ConfigType = class ConfigType { constructor({ queryString, configName, uid, jsonFields, relations, components }) { if (!configName) { strapi.log.error(logMessage('A config type was registered without a config name.')); process.exit(0); } if (!queryString) { strapi.log.error(logMessage(`No query string found for the '${configName}' config type.`)); process.exit(0); } // uid could be a single key or an array for a combined uid. So the type of uid is either string or string[] if (typeof uid === "string") { this.uidKeys = [uid]; } else if (Array.isArray(uid)) { this.uidKeys = uid.sort(); } else { strapi.log.error(logMessage(`Wrong uid config for the '${configName}' config type.`)); process.exit(0); } this.queryString = queryString; this.configPrefix = configName; this.jsonFields = jsonFields || []; this.relations = relations || []; this.components = components || null; } /** * Import a single role-permissions config file into the db. * * @param {string} configName - The name of the config file. * @param {string} configContent - The JSON content of the config file. * @param {boolean} force - Ignore the soft setting. * @returns {void} */ importSingle = async (configName, configContent, force) => { // Check if the config should be excluded. const shouldExclude = !isEmpty(strapi.config.get('plugin::config-sync.excludedConfig').filter((option) => `${this.configPrefix}.${configName}`.startsWith(option))); if (shouldExclude) return; const softImport = strapi.config.get('plugin::config-sync.soft'); const queryAPI = strapi.query(this.queryString); const uidParams = getUidParamsFromName(this.uidKeys, configName); const combinedUidWhereFilter = getCombinedUidWhereFilter(this.uidKeys, uidParams); let existingConfig = await queryAPI .findOne({ where: combinedUidWhereFilter, populate: this.relations.map(({ relationName }) => relationName), }); // Config exists in DB but no configfile content --> delete config from DB if (existingConfig && configContent === null) { // Don't preform action when soft setting is true. if (softImport && !force) return false; // Exit when trying to delete the super-admin role. if (this.configPrefix === 'admin-role' && configName === 'strapi-super-admin') { return false; } await Promise.all(this.relations.map(async ({ queryString, parentName }) => { const relations = await noLimit(strapi.query(queryString), { where: { [parentName]: existingConfig.id, }, }); await Promise.all(relations.map(async (relation) => { await queryFallBack.delete(queryString, { where: { id: relation.id, }}); })); })); await queryFallBack.delete(this.queryString, { where: { id: existingConfig.id, }}); return; } // Config does not exist in DB --> create config in DB if (!existingConfig) { // Format JSON fields. const query = { ...configContent }; this.jsonFields.map((field) => query[field] = JSON.stringify(configContent[field])); // Create entity. this.relations.map(({ relationName }) => delete query[relationName]); const newEntity = await queryFallBack.create(this.queryString, { data: query, }); // Create relation entities. await Promise.all(this.relations.map(async ({ queryString, relationName, parentName }) => { await Promise.all(configContent[relationName].map(async (relationEntity) => { const relationQuery = { ...relationEntity, [parentName]: newEntity }; await queryFallBack.create(queryString, { data: relationQuery, }); })); })); } else { // Config does exist in DB --> update config in DB // Don't preform action when soft setting is true. if (softImport && !force) return false; // Format JSON fields. configContent = sanitizeConfig({ config: configContent, configName, }); const query = { ...configContent }; this.jsonFields.map((field) => query[field] = JSON.stringify(configContent[field])); // Update entity. this.relations.map(({ relationName }) => delete query[relationName]); const entity = await queryFallBack.update(this.queryString, { where: combinedUidWhereFilter, data: query }); // Delete/create relations. await Promise.all(this.relations.map(async ({ queryString, relationName, parentName, relationSortFields }) => { const relationQueryApi = strapi.query(queryString); existingConfig = sanitizeConfig({ config: existingConfig, configName, relation: relationName, relationSortFields }); configContent = sanitizeConfig({ config: configContent, configName, relation: relationName, relationSortFields }); const configToAdd = difference(configContent[relationName], existingConfig[relationName], relationSortFields); const configToDelete = difference(existingConfig[relationName], configContent[relationName], relationSortFields); const configToUpdate = same(configContent[relationName], existingConfig[relationName], relationSortFields); await Promise.all(configToDelete.map(async (config) => { const whereClause = {}; relationSortFields.map((sortField) => { whereClause[sortField] = config[sortField]; }); await relationQueryApi.delete({ where: { ...whereClause, [parentName]: entity.id, }, }); })); await Promise.all(configToAdd.map(async (config) => { await queryFallBack.create(queryString, { data: { ...config, [parentName]: entity.id }, }); })); await Promise.all(configToUpdate.map(async (config, index) => { const whereClause = {}; relationSortFields.map((sortField) => { whereClause[sortField] = config[sortField]; }); await relationQueryApi.update({ where: { ...whereClause, [parentName]: entity.id, }, data: { ...config, [parentName]: entity.id }, }); })); })); } } /** * Export a single core-store config to a file. * * @param {string} configName - The name of the config file. * @returns {void} */ exportSingle = async (configName) => { const formattedDiff = await strapi.plugin('config-sync').service('main').getFormattedDiff(this.configPrefix); // Check if the config should be excluded. const shouldExclude = !isEmpty(strapi.config.get('plugin::config-sync.excludedConfig').filter((option) => configName.startsWith(option))); if (shouldExclude) return; const currentConfig = formattedDiff.databaseConfig[configName]; if ( !currentConfig && formattedDiff.fileConfig[configName] ) { await strapi.plugin('config-sync').service('main').deleteConfigFile(configName); } else { const combinedUid = getCombinedUid(this.uidKeys, currentConfig); await strapi.plugin('config-sync').service('main').writeConfigFile(this.configPrefix, combinedUid, currentConfig); } } /** * Zip config files * * @param {string} configName - The name of the zip archive. * @returns {void} */ zipConfig = async () => { return strapi.plugin('config-sync').service('main').zipConfigFiles(); } /** * Get all role-permissions config from the db. * * @returns {object} Object with key value pairs of configs. */ getAllFromDatabase = async () => { const AllConfig = await noLimit(strapi.query(this.queryString), { populate: this.components, }); const configs = {}; await Promise.all(Object.entries(AllConfig).map(async ([configName, config]) => { const combinedUid = getCombinedUid(this.uidKeys, config); const combinedUidWhereFilter = getCombinedUidWhereFilter(this.uidKeys, config); if (!combinedUid) { strapi.log.warn(logMessage(`Missing data for entity with id ${config.id} of type ${this.configPrefix}`)); return; } // Check if the config should be excluded. const shouldExclude = !isEmpty(strapi.config.get('plugin::config-sync.excludedConfig').filter((option) => `${this.configPrefix}.${combinedUid}`.startsWith(option))); if (shouldExclude) return; const formattedConfig = { ...sanitizeConfig({ config, configName }) }; await Promise.all(this.relations.map(async ({ queryString, relationName, relationSortFields, parentName }) => { const relations = await noLimit(strapi.query(queryString), { where: { [parentName]: combinedUidWhereFilter }, }); relations.map((relation) => sanitizeConfig({ config: relation, configName: relationName })); relationSortFields.map((sortField) => { relations.sort(dynamicSort(sortField)); }); formattedConfig[relationName] = relations; })); this.jsonFields.map((field) => formattedConfig[field] = JSON.parse(config[field])); configs[`${this.configPrefix}.${combinedUid}`] = formattedConfig; })); return configs; } /** * Import all core-store config files into the db. * * @returns {void} */ importAll = async () => { // The main.importAllConfig service will loop the core-store.importSingle service. await strapi.plugin('config-sync').service('main').importAllConfig(this.configPrefix); } /** * Export all core-store config to files. * * @returns {void} */ exportAll = async () => { // The main.importAllConfig service will loop the core-store.importSingle service. await strapi.plugin('config-sync').service('main').exportAllConfig(this.configPrefix); } }; export default ConfigType; ================================================ FILE: server/config/types.js ================================================ 'use strict'; const types = (strapi) => { // Initiate Strapi 'core-store' and 'admin-role' types. const typesArray = [ { configName: 'core-store', queryString: 'strapi::core-store', uid: 'key', jsonFields: ['value'], }, { configName: 'admin-role', queryString: 'admin::role', uid: 'code', relations: [{ queryString: 'admin::permission', relationName: 'permissions', parentName: 'role', relationSortFields: ['action', 'subject'], }], }, ]; // Register plugin users-permissions 'role' type. if (strapi.plugin('users-permissions')) { typesArray.push({ configName: 'user-role', queryString: 'plugin::users-permissions.role', uid: 'type', relations: [{ queryString: 'plugin::users-permissions.permission', relationName: 'permissions', parentName: 'role', relationSortFields: ['action'], }], }); } // Register plugin i18n 'locale' type. if (strapi.plugin('i18n')) { typesArray.push({ configName: 'i18n-locale', queryString: 'plugin::i18n.locale', uid: 'code', }); } return typesArray; }; export default types; ================================================ FILE: server/config.js ================================================ 'use strict'; export default { default: { syncDir: "config/sync/", minify: false, soft: false, importOnBootstrap: false, customTypes: [], excludedTypes: [], excludedConfig: [ "core-store.plugin_users-permissions_grant", "core-store.plugin_upload_metrics", "core-store.plugin_upload_api-folder", "core-store.strapi_content_types_schema", "core-store.ee_information", ], }, validator() {}, }; ================================================ FILE: server/controllers/config.js ================================================ 'use strict'; import fs from 'fs'; import isEmpty from 'lodash/isEmpty'; /** * Main controllers for config import/export. */ export default { /** * Export all config, from db to filesystem. * * @param {object} ctx - Request context object. * @returns {void} */ exportAll: async (ctx) => { if (isEmpty(ctx.request.body)) { await strapi.plugin('config-sync').service('main').exportAllConfig(); } else { await Promise.all(ctx.request.body.map(async (configName) => { await strapi.plugin('config-sync').service('main').exportSingleConfig(configName); })); } ctx.send({ message: `Config was successfully exported to ${strapi.config.get('plugin::config-sync.syncDir')}.`, }); }, /** * Import all config, from filesystem to db. * * @param {object} ctx - Request context object. * @returns {void} */ importAll: async (ctx) => { // Check for existance of the config file sync dir. if (!fs.existsSync(strapi.config.get('plugin::config-sync.syncDir'))) { ctx.send({ message: 'No config files were found.', }); return; } if (!ctx.request.body.config) { ctx.send({ message: 'No config was specified for the import endpoint.', }); return; } await Promise.all(ctx.request.body.config.map(async (configName) => { await strapi.plugin('config-sync').service('main').importSingleConfig(configName, null, ctx.request.body.force); })); ctx.send({ message: 'Config was successfully imported.', }); }, /** * Get config diff between filesystem & db. * * @param {object} ctx - Request context object. * @returns {object} formattedDiff - The formatted diff object. * @returns {object} formattedDiff.fileConfig - The config as found in the filesystem. * @returns {object} formattedDiff.databaseConfig - The config as found in the database. * @returns {object} formattedDiff.diff - The diff between the file config and databse config. */ getDiff: async (ctx) => { // Check for existance of the config file sync dir. if (!fs.existsSync(strapi.config.get('plugin::config-sync.syncDir'))) { ctx.send({ message: 'No config files were found.', }); return; } return strapi.plugin('config-sync').service('main').getFormattedDiff(); }, zipConfig: async (ctx) => { // Check for existance of the config file sync dir. if (!fs.existsSync(strapi.config.get('plugin::config-sync.syncDir'))) { ctx.send({ message: 'No config files were found.', }); return; } return strapi.plugin('config-sync').service('main').zipConfigFiles(); }, /** * Get the current Strapi env. * @returns {string} The current Strapi environment. */ getAppEnv: async () => { return { env: strapi.server.app.env, config: strapi.config.get('plugin::config-sync'), }; }, }; ================================================ FILE: server/controllers/index.js ================================================ 'use strict'; import config from './config'; export default { config: config, }; ================================================ FILE: server/index.js ================================================ 'use strict'; import register from './register'; import bootstrap from './bootstrap'; import services from './services'; import routes from './routes'; import config from './config'; import controllers from './controllers'; export default { register, bootstrap, routes, config, controllers, services, }; ================================================ FILE: server/register.js ================================================ 'use strict'; export default async ({ strapi }) => { // Instantiate the pluginTypes array. if (!strapi.plugin('config-sync').pluginTypes) { strapi.plugin('config-sync').pluginTypes = []; } }; ================================================ FILE: server/routes/admin.js ================================================ 'use strict'; export default { type: 'admin', routes: [ { method: "POST", path: "/export", handler: "config.exportAll", config: { policies: [], }, }, { method: "POST", path: "/import", handler: "config.importAll", config: { policies: [], }, }, { method: "GET", path: "/diff", handler: "config.getDiff", config: { policies: [], }, }, { method: "GET", path: "/zip", handler: "config.zipConfig", config: { policies: [], }, }, { method: "GET", path: "/app-env", handler: "config.getAppEnv", config: { policies: [], }, }, ], }; ================================================ FILE: server/routes/index.js ================================================ 'use strict'; import adminRoutes from './admin'; export default { admin: adminRoutes, }; ================================================ FILE: server/services/index.js ================================================ 'use strict'; import main from './main'; export default { main, }; ================================================ FILE: server/services/main.js ================================================ 'use strict'; import isEmpty from 'lodash/isEmpty'; import fs from 'fs'; import util from 'util'; import AdmZip from 'adm-zip'; import difference from '../utils/getObjectDiff'; import { logMessage } from '../utils'; /** * Main services for config import/export. */ export default () => ({ /** * Write a single config file. * * @param {string} configType - The type of the config. * @param {string} configName - The name of the config file. * @param {string} fileContents - The JSON content of the config file. * @returns {void} */ writeConfigFile: async (configType, configName, fileContents) => { // Check if the config should be excluded. const shouldExclude = !isEmpty(strapi.config.get('plugin::config-sync.excludedConfig').filter((option) => `${configType}.${configName}`.startsWith(option))); if (shouldExclude) return; // Replace reserved characters in filenames. configName = configName.replace(/:/g, "#").replace(/\//g, "$"); // Check if the JSON content should be minified. const json = !strapi.config.get('plugin::config-sync').minify ? JSON.stringify(fileContents, null, 2) : JSON.stringify(fileContents); if (!fs.existsSync(strapi.config.get('plugin::config-sync.syncDir'))) { fs.mkdirSync(strapi.config.get('plugin::config-sync.syncDir'), { recursive: true }); } const writeFile = util.promisify(fs.writeFile); await writeFile(`${strapi.config.get('plugin::config-sync.syncDir')}${configType}.${configName}.json`, json) .then(() => { // @TODO: // Add logging for successfull config export. }) .catch(() => { // @TODO: // Add logging for failed config export. }); }, /** * Delete config file. * * @param {string} configName - The name of the config file. * @returns {void} */ deleteConfigFile: async (configName) => { // Check if the config should be excluded. const shouldExclude = !isEmpty(strapi.config.get('plugin::config-sync.excludedConfig').filter((option) => configName.startsWith(option))); if (shouldExclude) return; // Replace reserved characters in filenames. configName = configName.replace(/:/g, "#").replace(/\//g, "$"); fs.unlinkSync(`${strapi.config.get('plugin::config-sync.syncDir')}${configName}.json`); }, /** * Zip config files. * * @param {string} configName - The name of the config file. * @returns {void} */ zipConfigFiles: async () => { const fileName = `config-sync-${new Date().toJSON()}.zip`; const zip = new AdmZip(); zip.addLocalFolder(strapi.config.get('plugin::config-sync.syncDir')); const base64Data = zip.toBuffer().toString('base64'); return { base64Data, name: fileName, message: 'Success' }; }, /** * Read from a config file. * * @param {string} configType - The type of config. * @param {string} configName - The name of the config file. * @returns {object} The JSON content of the config file. */ readConfigFile: async (configType, configName) => { // Replace reserved characters in filenames. configName = configName.replace(/:/g, "#").replace(/\//g, "$"); const readFile = util.promisify(fs.readFile); return readFile(`${strapi.config.get('plugin::config-sync.syncDir')}${configType}.${configName}.json`) .then((data) => { return JSON.parse(data); }) .catch(() => { return null; }); }, /** * Get all the config JSON from the filesystem. * * @param {string} configType - Type of config to gather. Leave empty to get all config. * @returns {object} Object with key value pairs of configs. */ getAllConfigFromFiles: async (configType = null) => { if (!fs.existsSync(strapi.config.get('plugin::config-sync.syncDir'))) { return {}; } const configFiles = fs.readdirSync(strapi.config.get('plugin::config-sync.syncDir')); const getConfigs = async () => { const fileConfigs = {}; await Promise.all(configFiles.map(async (file) => { const type = file.split('.')[0]; // Grab the first part of the filename. const name = file.split(/\.(.+)/)[1].split('.').slice(0, -1).join('.'); // Grab the rest of the filename minus the file extension. // Put back reserved characters from filenames. const formattedName = name.replace(/#/g, ":").replace(/\$/g, "/"); if ( configType && configType !== type || !strapi.plugin('config-sync').types[type] || !isEmpty(strapi.config.get('plugin::config-sync.excludedConfig').filter((option) => `${type}.${name}`.startsWith(option))) ) { return; } const fileContents = await strapi.plugin('config-sync').service('main').readConfigFile(type, name); if (!fileContents) { strapi.log.warn(logMessage(`An empty config file '${file}' was found in the sync directory`)); return; } fileConfigs[`${type}.${formattedName}`] = fileContents; })); return fileConfigs; }; return getConfigs(); }, /** * Get all the config JSON from the database. * * @param {string} configType - Type of config to gather. Leave empty to get all config. * @returns {object} Object with key value pairs of configs. */ getAllConfigFromDatabase: async (configType = null) => { const getConfigs = async () => { let databaseConfigs = {}; await Promise.all(Object.entries(strapi.plugin('config-sync').types).map(async ([name, type]) => { if (configType && configType !== name) { return; } const config = await type.getAllFromDatabase(); databaseConfigs = Object.assign(config, databaseConfigs); })); return databaseConfigs; }; return getConfigs(); }, /** * Import all config files into the db. * * @param {string} configType - Type of config to impor. Leave empty to import all config. * @param {object} onSuccess - Success callback to run on each single successfull import. * @returns {void} */ importAllConfig: async (configType = null, onSuccess) => { const fileConfig = await strapi.plugin('config-sync').service('main').getAllConfigFromFiles(); const databaseConfig = await strapi.plugin('config-sync').service('main').getAllConfigFromDatabase(); const diff = difference(databaseConfig, fileConfig); await Promise.all(Object.keys(diff).map(async (file) => { const type = file.split('.')[0]; // Grab the first part of the filename. const name = file.split(/\.(.+)/)[1]; // Grab the rest of the filename. if (configType && configType !== type) { return; } await strapi.plugin('config-sync').service('main').importSingleConfig(`${type}.${name}`, onSuccess); })); }, /** * Export all config files. * * @param {string} configType - Type of config to export. Leave empty to export all config. * @param {object} onSuccess - Success callback to run on each single successfull import. * @returns {void} */ exportAllConfig: async (configType = null, onSuccess) => { const fileConfig = await strapi.plugin('config-sync').service('main').getAllConfigFromFiles(); const databaseConfig = await strapi.plugin('config-sync').service('main').getAllConfigFromDatabase(); const diff = difference(databaseConfig, fileConfig); await Promise.all(Object.keys(diff).map(async (file) => { const type = file.split('.')[0]; // Grab the first part of the filename. const name = file.split(/\.(.+)/)[1]; // Grab the rest of the filename. if (configType && configType !== type) { return; } await strapi.plugin('config-sync').service('main').exportSingleConfig(`${type}.${name}`, onSuccess); })); }, /** * Import a single config file into the db. * * @param {string} configName - The name of the config file. * @param {object} onSuccess - Success callback to run on each single successfull import. * @param {boolean} force - Ignore the soft setting. * @returns {void} */ importSingleConfig: async (configName, onSuccess, force) => { // Check if the config should be excluded. const shouldExclude = !isEmpty(strapi.config.get('plugin::config-sync.excludedConfig').filter((option) => configName.startsWith(option))); if (shouldExclude) return; const type = configName.split('.')[0]; // Grab the first part of the filename. const name = configName.split(/\.(.+)/)[1]; // Grab the rest of the filename. const fileContents = await strapi.plugin('config-sync').service('main').readConfigFile(type, name); try { const importState = await strapi.plugin('config-sync').types[type].importSingle(name, fileContents, force); if (onSuccess && importState !== false) onSuccess(`${type}.${name}`); } catch (e) { throw new Error(`Error when trying to import ${type}.${name}. ${e}`); } }, /** * Export a single config file. * * @param {string} configName - The name of the config file. * @param {object} onSuccess - Success callback to run on each single successfull import. * * @returns {void} */ exportSingleConfig: async (configName, onSuccess) => { // Check if the config should be excluded. const shouldExclude = !isEmpty(strapi.config.get('plugin::config-sync.excludedConfig').filter((option) => configName.startsWith(option))); if (shouldExclude) return; const type = configName.split('.')[0]; // Grab the first part of the filename. const name = configName.split(/\.(.+)/)[1]; // Grab the rest of the filename. try { await strapi.plugin('config-sync').types[type].exportSingle(configName); if (onSuccess) onSuccess(`${type}.${name}`); } catch (e) { throw new Error(`Error when trying to export ${type}.${name}. ${e}`); } }, /** * Get the formatted diff. * * @param {string} configType - Type of config to get the diff of. Leave empty to get the diff of all config. * * @returns {object} - the formatted diff. */ getFormattedDiff: async (configType = null) => { const formattedDiff = { fileConfig: {}, databaseConfig: {}, diff: {}, }; const fileConfig = await strapi.plugin('config-sync').service('main').getAllConfigFromFiles(configType); const databaseConfig = await strapi.plugin('config-sync').service('main').getAllConfigFromDatabase(configType); const diff = difference(databaseConfig, fileConfig); formattedDiff.diff = diff; Object.keys(diff).map((changedConfigName) => { formattedDiff.fileConfig[changedConfigName] = fileConfig[changedConfigName]; formattedDiff.databaseConfig[changedConfigName] = databaseConfig[changedConfigName]; }); return formattedDiff; }, }); ================================================ FILE: server/utils/getArrayDiff.js ================================================ export const difference = (arrayOne, arrayTwo, compareKeys) => { return arrayOne.filter(({ [compareKeys[0]]: id1, [compareKeys[1]]: id2, }) => { return !arrayTwo.some(({ [compareKeys[0]]: id3, [compareKeys[1]]: id4, }) => id1 === id3 && id2 === id4); }); }; export const same = (arrayOne, arrayTwo, compareKeys) => { return arrayOne.filter(({ [compareKeys[0]]: id1, [compareKeys[1]]: id2, ...restOne }) => { return !arrayTwo.some(({ [compareKeys[0]]: id3, [compareKeys[1]]: id4, ...restTwo }) => id1 === id3 && id2 === id4 && JSON.stringify(restOne) === JSON.stringify(restTwo)); }); }; ================================================ FILE: server/utils/getObjectDiff.js ================================================ 'use strict'; import transform from 'lodash/transform'; import isEqual from 'lodash/isEqual'; import isArray from 'lodash/isArray'; import isObject from 'lodash/isObject'; /** * Find difference between two objects * @param {object} origObj - Source object to compare newObj against * @param {object} newObj - New object with potential changes * @return {object} differences */ const difference = (origObj, newObj) => { let arrayIndexCounter = 0; const newObjChange = transform(newObj, (result, value, key) => { if (!isEqual(value, origObj[key])) { const resultKey = isArray(origObj) ? arrayIndexCounter++ : key; result[resultKey] = (isObject(value) && isObject(origObj[key])) ? difference(value, origObj[key]) : value; } }); const origObjChange = transform(origObj, (result, value, key) => { if (!isEqual(value, newObj[key])) { const resultKey = isArray(newObj) ? arrayIndexCounter++ : key; result[resultKey] = (isObject(value) && isObject(newObj[key])) ? difference(value, newObj[key]) : value; } }); return Object.assign(newObjChange, origObjChange); }; export default difference; ================================================ FILE: server/utils/index.js ================================================ 'use strict'; const COMBINED_UID_JOINSTR = '.combine-uid.'; const escapeUid = (uid) => typeof uid === "string" ? uid.replace(/\.combine-uid\./g, '.combine-uid-escape.') : uid; const unEscapeUid = (uid) => typeof uid === "string" ? uid.replace(/\.combine-uid-escape\./g, '.combine-uid.') : uid; export const getCombinedUid = (uidKeys, params) => uidKeys.map((uidKey) => escapeUid(params[uidKey])).join(COMBINED_UID_JOINSTR); export const getCombinedUidWhereFilter = (uidKeys, params) => uidKeys.reduce(((akku, uidKey) => ({ ...akku, [uidKey]: params[uidKey] })), {}); export const getUidParamsFromName = (uidKeys, configName) => configName.split(COMBINED_UID_JOINSTR).map(unEscapeUid).reduce((akku, param, i) => ({ ...akku, [uidKeys[i]]: param }), {}); export const getCoreStore = () => { return strapi.store({ type: 'plugin', name: 'config-sync' }); }; export const getService = (name) => { return strapi.plugin('config-sync').service(name); }; export const logMessage = (msg = '') => `[strapi-plugin-config-sync]: ${msg}`; const sortByKeys = (unordered) => { return Object.keys(unordered).sort().reduce((obj, key) => { obj[key] = unordered[key]; return obj; }, {}, ); }; export const dynamicSort = (property) => { let sortOrder = 1; if (property[0] === "-") { sortOrder = -1; property = property.substr(1); } return (a, b) => { if (sortOrder === -1) { if (b[property]) { return b[property].localeCompare(a[property]); } } else if (a[property]) { return a[property].localeCompare(b[property]); } }; }; export const sanitizeConfig = ({ config, relation, relationSortFields, configName, }) => { delete config._id; delete config.id; delete config.updatedAt; delete config.createdAt; delete config.publishedAt; if (relation) { const formattedRelations = []; config[relation].map((relationEntity) => { delete relationEntity._id; delete relationEntity.id; delete relationEntity.updatedAt; delete config.publishedAt; delete relationEntity.createdAt; relationEntity = sortByKeys(relationEntity); formattedRelations.push(relationEntity); }); if (relationSortFields) { relationSortFields.map((sortField) => { formattedRelations.sort(dynamicSort(sortField)); }); } config[relation] = formattedRelations; } // We recursively sanitize the config to remove environment specific data. // Except for the plugin_content_manager_configuration. // This is because that stores the "edit the view" data which includes only configuration, not content. if (configName && !configName.startsWith('plugin_content_manager_configuration_')) { const recursiveSanitizeConfig = (recursivedSanitizedConfig) => { delete recursivedSanitizedConfig._id; delete recursivedSanitizedConfig.id; delete recursivedSanitizedConfig.updatedAt; delete recursivedSanitizedConfig.createdAt; Object.keys(recursivedSanitizedConfig).map((key, index) => { if (recursivedSanitizedConfig[key] && typeof recursivedSanitizedConfig[key] === "object") { recursiveSanitizeConfig(recursivedSanitizedConfig[key]); } }); }; recursiveSanitizeConfig(config); } return config; }; export const noLimit = async (query, parameters, limit = 100) => { let entries = []; const amountOfEntries = await query.count(parameters); for (let i = 0; i < (amountOfEntries / limit); i++) { /* eslint-disable-next-line */ const chunk = await query.findMany({ ...parameters, limit: limit, offset: (i * limit), orderBy: 'id', }); entries = [...chunk, ...entries]; } return entries; }; ================================================ FILE: server/utils/queryFallBack.js ================================================ const queryFallBack = { create: async (queryString, options) => { try { const newEntity = await strapi.documents(queryString).create(options); return newEntity; } catch (e) { return strapi.query(queryString).create(options); } }, update: async (queryString, options) => { try { const entity = await strapi.query(queryString).findOne(options); const updatedEntity = await strapi.documents(queryString).update({ documentId: entity.documentId, ...options, }); return updatedEntity; } catch (e) { return strapi.query(queryString).update(options); } }, delete: async (queryString, options) => { try { const entity = await strapi.query(queryString).findOne(options); await strapi.documents(queryString).delete({ documentId: entity.documentId, }); } catch (e) { await strapi.query(queryString).delete(options); } }, }; export default queryFallBack; ================================================ FILE: server/warnings.js ================================================ 'use strict'; export default { delete: { 'user-role.public': "You've just deleted a default role from the users-permissions plugin.", 'user-role.authenticated': "You've just deleted a default role from the users-permissions plugin.", 'admin-role.strapi-super-admin': "You've just deleted one of the default admin roles from Strapi.", 'admin-role.strapi-author': "You've just deleted one of the default admin roles from Strapi.", 'admin-role.strapi-editor': "You've just deleted one of the default admin roles from Strapi.", }, };