diff --git a/.gitignore b/.gitignore index f60df091be..e317108564 100644 --- a/.gitignore +++ b/.gitignore @@ -109,3 +109,7 @@ dist # IDE .idea .vscode + + +# Auto generated files +docs/.vuepress/config.js \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 66fe2af414..1dabef27c6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -78,11 +78,26 @@ The core team will review your pull request and will either merge it, request ch cd docs ``` -6. Make sure all dependencies are installed, then run the server: +6. Make sure all dependencies are installed ```bash - yarn && yarn dev + yarn ``` + +7. Start the documentation server + + ```bash + # Launch the full documentation + yarn dev + + # Launch only the developer docs + yarn dev:developer + + # Launch only the user docs + yarn dev:user + ``` + + #### Writing We can't provide you specific procedures with step-by-step instructions to write technical documentation. But our ["12 Rules of Technical Writing"](https://handbook.strapi.io/user-success-manual/12-rules-of-technical-writing) and [style guide](https://handbook.strapi.io/user-success-manual/strapi-documentation-style-guide) should help you get started. If you have any question or need help, do feel free to reach us through [our forum](https://forum.strapi.io/). diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config-backup.js similarity index 99% rename from docs/.vuepress/config.js rename to docs/.vuepress/config-backup.js index d51cd6f282..c1ba9fe43d 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config-backup.js @@ -1,3 +1,8 @@ +/** + * This file is the backyup the old config.js one. + * @Piwi & @DerrickMehaffy I'll let you decide if you want to keep it. + */ + const sidebar = { developer: [ { @@ -693,7 +698,6 @@ module.exports = { port: 8080, description: 'The headless CMS developers love.', base: '/', - plugins: plugins, head: [ [ 'link', @@ -874,8 +878,8 @@ module.exports = { ], }, { - text: 'v3 Documentation', - link: 'https://docs-v3.strapi.io' + text: 'v3 documentation', + link: 'https://docs-v3.strapi.io', }, { text: 'Ecosystem', @@ -958,4 +962,5 @@ module.exports = { md.use(require('markdown-it-include')); }, }, + plugins: plugins, }; diff --git a/docs/.vuepress/config/markdown.js b/docs/.vuepress/config/markdown.js new file mode 100644 index 0000000000..92e66410a7 --- /dev/null +++ b/docs/.vuepress/config/markdown.js @@ -0,0 +1,6 @@ +const markdown = { + extendMarkdown: md => { + // use more markdown-it plugins! + md.use(require('markdown-it-include')); + }, +}; diff --git a/docs/.vuepress/config/metas.js b/docs/.vuepress/config/metas.js new file mode 100644 index 0000000000..67894cf874 --- /dev/null +++ b/docs/.vuepress/config/metas.js @@ -0,0 +1,104 @@ +const metas = { + title: '', + port: 8080, + description: 'The headless CMS developers love.', + base: '/', + head: [ + [ + 'link', + { + rel: 'icon', + href: 'https://strapi.io/assets/favicon-32x32.png', + }, + ], + [ + 'meta', + { + property: 'og:title', + content: 'Strapi Documentation', + }, + ], + [ + 'meta', + { + property: 'og:type', + content: 'article', + }, + ], + [ + 'meta', + { + property: 'og:url', + content: 'https://strapi.io/documentation/', + }, + ], + [ + 'meta', + { + property: 'og:description', + content: 'The headless CMS developers love.', + }, + ], + [ + 'meta', + { + property: 'og:image', + content: 'https://strapi.io/documentation/assets/meta.png', + }, + ], + [ + 'meta', + { + property: 'og:article:author', + content: 'strapi', + }, + ], + [ + 'meta', + { + property: 'twitter:card', + content: 'summary_large_image', + }, + ], + [ + 'meta', + { + property: 'twitter:url', + content: 'https://strapi.io/documentation/', + }, + ], + [ + 'meta', + { + property: 'twitter:site', + content: '@strapijs', + }, + ], + [ + 'meta', + { + property: 'twitter:title', + content: 'Strapi Documentation', + }, + ], + [ + 'meta', + { + property: 'twitter:description', + content: 'The headless CMS developers love.', + }, + ], + [ + 'meta', + { + property: 'twitter:image', + content: 'http://strapi.io/assets/images/strapi-website-preview.png', + }, + ], + [ + 'script', + {}, + `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-KN9JRWG');`, + ], + ], +}; diff --git a/docs/.vuepress/config/patterns-developer.js b/docs/.vuepress/config/patterns-developer.js new file mode 100644 index 0000000000..16d896b1fe --- /dev/null +++ b/docs/.vuepress/config/patterns-developer.js @@ -0,0 +1 @@ +const patterns = ['**/*.md', '!**/user-docs/**/*.md', '!node_modules']; diff --git a/docs/.vuepress/config/patterns-user.js b/docs/.vuepress/config/patterns-user.js new file mode 100644 index 0000000000..86ae9fe48c --- /dev/null +++ b/docs/.vuepress/config/patterns-user.js @@ -0,0 +1,8 @@ +const patterns = [ + '**/*.md', + '!**/developer-docs/**/*.md', + // We import the homepage of the documentation from the developer documentation, + // without this when launching the doc it redirects to the 404 page. + '**/developer-docs/latest/getting-started/introduction.md', + '!node_modules', +]; diff --git a/docs/.vuepress/config/plugins.js b/docs/.vuepress/config/plugins.js new file mode 100644 index 0000000000..9a913a6185 --- /dev/null +++ b/docs/.vuepress/config/plugins.js @@ -0,0 +1,123 @@ +const checklinksIgnoredFiles = [ + '**/node_modules', // please never remove this one + /** + * Caution: Adding an individual file to this section + * will prevent the _whole_ file from being scanned for broken links. + * + * Currently, there is no easy way to ignore a specific link inside a file. + */ + + /** + * Files below give false positives + */ + '/developer-docs/latest/developer-resources/plugin-api-reference/admin-panel.md', + './developer-docs/latest/development/backend-customization/models.md', + './developer-docs/latest/guides/count-graphql.md', // might be removed once GraphQL customization is ready + './developer-docs/latest/setup-deployment-guides/configurations.md', // the script thinks filename[]() at line 977 is a real link + './developer-docs/latest/development/backend-customization/webhooks.md', // 'missing" links are in commented part of file +]; + +const plugins = [ + ['vuepress-plugin-element-tabs', {}], + [ + 'check-md', + { + ignore: checklinksIgnoredFiles, + }, + ], + [ + 'seo', + { + siteTitle: (_, $site) => $site.title, + title: $page => $page.title, + }, + ], + ['@vuepress/medium-zoom'], + [ + 'vuepress-plugin-code-copy', + { + color: '#ffffff', + successText: 'Copied to clipboard!', + }, + ], + ['@vuepress/back-to-top', {}], + [ + 'vuepress-plugin-container', + { + type: 'callout', + defaultTitle: '', + }, + ], + [ + 'vuepress-plugin-container', + { + type: 'strapi', + defaultTitle: '', + before: info => + `

🤓 ${info}

`, + after: '
', + }, + ], + [ + 'vuepress-plugin-container', + { + type: 'tip', + before: info => `

💡 ${info}

`, + after: '
', + }, + ], + [ + 'vuepress-plugin-container', + { + type: 'note', + before: info => `

✏️ ${info}

`, + after: '
', + }, + ], + [ + 'vuepress-plugin-container', + { + type: 'caution', + before: info => + `

✋ ${info}

`, + after: '
', + }, + ], + [ + 'vuepress-plugin-container', + { + type: 'warning', + before: info => + `

️❗️ ${info}

`, + after: '
', + }, + ], + [ + 'vuepress-plugin-container', + { + type: 'prerequisites', + defaultTitle: 'PREREQUISITES', + }, + ], + [ + 'vuepress-plugin-container', + { + type: 'api-call', + defaultTitle: '', + }, + ], + [ + 'vuepress-plugin-container', + { + type: 'request', + defaultTitle: 'Request', + }, + ], + [ + 'vuepress-plugin-container', + { + type: 'response', + defaultTitle: 'Response', + }, + ], +]; diff --git a/docs/.vuepress/config/sidebar-developer.js b/docs/.vuepress/config/sidebar-developer.js new file mode 100644 index 0000000000..24e5d059a0 --- /dev/null +++ b/docs/.vuepress/config/sidebar-developer.js @@ -0,0 +1,432 @@ +const developer = [ + { + title: '🚀 Getting Started', + collapsable: false, + children: [ + ['/developer-docs/latest/getting-started/introduction', 'Introduction'], + ['/developer-docs/latest/getting-started/quick-start', 'Quick Start Guide'], + ['/developer-docs/latest/getting-started/troubleshooting', 'Frequently Asked Questions'], + ['/developer-docs/latest/getting-started/usage-information', 'Usage Information'], + ], + }, + { + title: '⚙️ Setup & Deployment', + collapsable: false, + sidebarDepth: 0, + initialOpenGroupIndex: -1, // make sure that no subgroup is expanded by default + children: [ + { + title: 'Installation', + path: '/developer-docs/latest/setup-deployment-guides/installation.html', + collapsable: true, + sidebarDepth: 1, + children: [ + ['/developer-docs/latest/setup-deployment-guides/installation/cli.md', 'CLI'], + ['/developer-docs/latest/setup-deployment-guides/installation/docker.md', 'Docker'], + [ + '/developer-docs/latest/setup-deployment-guides/installation/digitalocean-one-click.md', + 'DigitalOcean One-Click', + ], + [ + '/developer-docs/latest/setup-deployment-guides/installation/platformsh.md', + 'Platform.sh One-Click', + ], + [ + '/developer-docs/latest/setup-deployment-guides/installation/render.md', + 'Render One-Click', + ], + ], + }, + ['/developer-docs/latest/setup-deployment-guides/file-structure.md', 'Project structure'], + { + title: 'Configurations', + path: '/developer-docs/latest/setup-deployment-guides/configurations.html', + collapsable: true, + children: [ + { + title: 'Required configurations', + collapsable: true, + children: [ + [ + '/developer-docs/latest/setup-deployment-guides/configurations/required/databases.md', + 'Database', + ], + [ + '/developer-docs/latest/setup-deployment-guides/configurations/required/server.md', + 'Server', + ], + [ + '/developer-docs/latest/setup-deployment-guides/configurations/required/admin-panel.md', + 'Admin panel', + ], + [ + '/developer-docs/latest/setup-deployment-guides/configurations/required/middlewares.md', + 'Middlewares', + ], + ], + }, + { + title: 'Optional configurations', + collapsable: true, + children: [ + [ + '/developer-docs/latest/setup-deployment-guides/configurations/optional/api-tokens.md', + 'API tokens', + ], + [ + '/developer-docs/latest/setup-deployment-guides/configurations/optional/functions.md', + 'Functions', + ], + [ + '/developer-docs/latest/setup-deployment-guides/configurations/optional/cronjobs.md', + 'Cron jobs', + ], + [ + '/developer-docs/latest/setup-deployment-guides/configurations/optional/api.md', + 'API', + ], + [ + '/developer-docs/latest/setup-deployment-guides/configurations/optional/plugins.md', + 'Plugins', + ], + [ + '/developer-docs/latest/setup-deployment-guides/configurations/optional/environment.md', + 'Environment', + ], + [ + '/developer-docs/latest/setup-deployment-guides/configurations/optional/public-assets.md', + 'Public Assets', + ], + [ + '/developer-docs/latest/setup-deployment-guides/configurations/optional/sso.md', + 'Single Sign On (SSO)', + ], + [ + '/developer-docs/latest/setup-deployment-guides/configurations/optional/rbac.md', + 'Role-Based Access Control (RBAC)', + ], + ], + }, + ], + }, + { + title: 'Deployment', + path: '/developer-docs/latest/setup-deployment-guides/deployment', + collapsable: true, + initialOpenGroupIndex: -1, // make sure that no subgroup is open by default — if set to 0, 'Hosting Provider Guides' is expanded + children: [ + { + title: 'Hosting Provider Guides', + path: + '/developer-docs/latest/setup-deployment-guides/deployment.html#hosting-provider-guides', + collapsable: true, + children: [ + [ + '/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/21yunbox.md', + '21YunBox', + ], + [ + '/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/amazon-aws.md', + 'Amazon AWS', + ], + [ + '/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/azure.md', + 'Azure', + ], + [ + '/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/digitalocean-app-platform.md', + 'DigitalOcean App Platform', + ], + [ + '/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/digitalocean.md', + 'DigitalOcean Droplets', + ], + [ + '/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/google-app-engine.md', + 'Google App Engine', + ], + [ + '/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/heroku.md', + 'Heroku', + ], + [ + '/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/qovery.md', + 'Qovery', + ], + [ + '/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/render.md', + 'Render', + ], + ], + sidebarDepth: 2, + }, + { + title: 'Optional Software Guides', + path: + '/developer-docs/latest/setup-deployment-guides/deployment.html#optional-software-guides', + collapsable: true, + children: [ + [ + '/developer-docs/latest/setup-deployment-guides/deployment/optional-software/caddy-proxy.md', + 'Caddy', + ], + [ + '/developer-docs/latest/setup-deployment-guides/deployment/optional-software/haproxy-proxy.md', + 'HAProxy', + ], + [ + '/developer-docs/latest/setup-deployment-guides/deployment/optional-software/nginx-proxy.md', + 'Nginx', + ], + ], + sidebarDepth: 2, + }, + ], + sidebarDepth: 0, + }, + ], + }, + { + title: '🔧 Development', + collapsable: false, + initialOpenGroupIndex: -1, // make sure that no subgroup is expanded by default + children: [ + { + title: 'Back-end customization', + collapsable: true, + path: '/developer-docs/latest/development/backend-customization', + children: [ + ['/developer-docs/latest/development/backend-customization/routes.md', 'Routes'], + ['/developer-docs/latest/development/backend-customization/policies.md', 'Policies'], + [ + '/developer-docs/latest/development/backend-customization/middlewares.md', + 'Middlewares', + ], + [ + '/developer-docs/latest/development/backend-customization/controllers.md', + 'Controllers', + ], + [ + '/developer-docs/latest/development/backend-customization/requests-responses.md', + 'Requests & Responses', + ], + ['/developer-docs/latest/development/backend-customization/services.md', 'Services'], + ['/developer-docs/latest/development/backend-customization/models.md', 'Models'], + ['/developer-docs/latest/development/backend-customization/webhooks.md', 'Webhooks'], + ], + }, + ['/developer-docs/latest/development/admin-customization', 'Admin panel customization'], + ['/developer-docs/latest/development/plugins-extension.md', 'Plugins extension'], + ['/developer-docs/latest/development/plugins-development.md', 'Plugins development'], + ], + }, + { + title: '💻 Developer Resources', + collapsable: false, + initialOpenGroupIndex: -1, // make sure that no subgroup is expanded by default + sidebarDepth: 2, + children: [ + { + title: 'APIs Reference', + collapsable: true, + sidebarDepth: 1, + children: [ + [ + '/developer-docs/latest/developer-resources/database-apis-reference/rest-api.md', + 'REST API', + ], + [ + '/developer-docs/latest/developer-resources/database-apis-reference/graphql-api.md', + 'GraphQL API', + ], + { + title: 'Query Engine API', + path: + '/developer-docs/latest/developer-resources/database-apis-reference/query-engine-api.html', + collapsable: true, + // sidebarDepth: 3, + children: [ + [ + '/developer-docs/latest/developer-resources/database-apis-reference/query-engine/single-operations.md', + 'Single Operations', + ], + [ + '/developer-docs/latest/developer-resources/database-apis-reference/query-engine/bulk-operations.md', + 'Bulk Operations', + ], + [ + '/developer-docs/latest/developer-resources/database-apis-reference/query-engine/filtering.md', + 'Filtering', + ], + [ + '/developer-docs/latest/developer-resources/database-apis-reference/query-engine/populating.md', + 'Populating', + ], + [ + '/developer-docs/latest/developer-resources/database-apis-reference/query-engine/order-pagination.md', + 'Ordering & pagination', + ], + ], + }, + { + title: 'Entity Service API', + path: + '/developer-docs/latest/developer-resources/database-apis-reference/entity-service-api', + collapsable: true, + children: [ + [ + '/developer-docs/latest/developer-resources/database-apis-reference/entity-service/crud.md', + 'CRUD operations', + ], + [ + '/developer-docs/latest/developer-resources/database-apis-reference/entity-service/filter.md', + 'Filters', + ], + [ + '/developer-docs/latest/developer-resources/database-apis-reference/entity-service/populate.md', + 'Populate', + ], + [ + '/developer-docs/latest/developer-resources/database-apis-reference/entity-service/order-pagination.md', + 'Ordering & pagination', + ], + [ + '/developer-docs/latest/developer-resources/database-apis-reference/entity-service/components-dynamic-zones.md', + 'Components and dynamic zones', + ], + ], + }, + { + title: 'Plugin APIs Reference', + collapsable: true, + children: [ + [ + '/developer-docs/latest/developer-resources/plugin-api-reference/server.md', + 'Server API for plugins', + ], + [ + '/developer-docs/latest/developer-resources/plugin-api-reference/admin-panel.md', + 'Admin Panel API for plugins', + ], + ], + }, + ], + }, + ['/developer-docs/latest/developer-resources/cli/CLI', 'Command Line Interface'], + ['/developer-docs/latest/developer-resources/error-handling.md', 'Error handling'], + { + title: 'Integrations', + path: '/developer-docs/latest/developer-resources/content-api/integrations.html', + collapsable: true, + sidebarDepth: 1, + children: [ + ['/developer-docs/latest/developer-resources/content-api/integrations/react', 'React'], + [ + '/developer-docs/latest/developer-resources/content-api/integrations/vue-js', + 'Vue.js', + ], + [ + '/developer-docs/latest/developer-resources/content-api/integrations/angular', + 'Angular', + ], + [ + '/developer-docs/latest/developer-resources/content-api/integrations/next-js', + 'Next.js', + ], + [ + '/developer-docs/latest/developer-resources/content-api/integrations/nuxt-js', + 'Nuxt.js', + ], + [ + '/developer-docs/latest/developer-resources/content-api/integrations/graphql', + 'GraphQL', + ], + [ + '/developer-docs/latest/developer-resources/content-api/integrations/gatsby', + 'Gatsby', + ], + [ + '/developer-docs/latest/developer-resources/content-api/integrations/gridsome', + 'Gridsome', + ], + [ + '/developer-docs/latest/developer-resources/content-api/integrations/jekyll', + 'Jekyll', + ], + ['/developer-docs/latest/developer-resources/content-api/integrations/11ty', '11ty'], + [ + '/developer-docs/latest/developer-resources/content-api/integrations/svelte', + 'Svelte', + ], + [ + '/developer-docs/latest/developer-resources/content-api/integrations/sapper', + 'Sapper', + ], + ['/developer-docs/latest/developer-resources/content-api/integrations/ruby', 'Ruby'], + [ + '/developer-docs/latest/developer-resources/content-api/integrations/python', + 'Python', + ], + ['/developer-docs/latest/developer-resources/content-api/integrations/dart', 'Dart'], + [ + '/developer-docs/latest/developer-resources/content-api/integrations/flutter', + 'Flutter', + ], + ['/developer-docs/latest/developer-resources/content-api/integrations/go', 'Go'], + ['/developer-docs/latest/developer-resources/content-api/integrations/php', 'PHP'], + [ + '/developer-docs/latest/developer-resources/content-api/integrations/laravel', + 'Laravel', + ], + ], + }, + ], + }, + { + title: '🧩 Strapi plugins', + path: '/developer-docs/latest/plugins/plugins-intro.html', + collapsable: false, + children: [ + ['/developer-docs/latest/plugins/graphql', 'GraphQL'], + ['/developer-docs/latest/plugins/i18n', 'Internationalization (i18n)'], + ['/developer-docs/latest/plugins/users-permissions', 'Users & Permissions'], + ['/developer-docs/latest/plugins/email', 'Email'], + ['/developer-docs/latest/plugins/upload', 'Upload'], + ['/developer-docs/latest/plugins/documentation', 'API Documentation'], + ], + sidebarDepth: 1, + }, + { + title: '♻️ Update & Migration', + collapsable: false, + children: [ + ['/developer-docs/latest/update-migration-guides/update-version.md', 'Update'], + ['/developer-docs/latest/update-migration-guides/migration-guides.md', 'Migration'], + ], + }, + { + title: '📚 Guides', + collapsable: true, + children: [ + ['/developer-docs/latest/guides/auth-request', 'Authenticated request'], + // ['/developer-docs/latest/guides/slug', 'Create a slug system'], + // ['/developer-docs/latest/guides/is-owner', 'Create is owner policy'], + // ['/developer-docs/latest/guides/custom-admin', 'Custom admin'], + // ['/developer-docs/latest/guides/custom-data-response', 'Custom data response'], + ['/developer-docs/latest/guides/draft', 'Draft system'], + // ['/developer-docs/latest/guides/error-catching', 'Error catching'], + // ['/developer-docs/latest/guides/external-data', 'Fetching external data'], + ['/developer-docs/latest/guides/jwt-validation', 'JWT validation'], + ['/developer-docs/latest/guides/process-manager', 'Process manager'], + ['/developer-docs/latest/guides/scheduled-publication', 'Scheduled publication'], + // ['/developer-docs/latest/guides/secure-your-app', 'Secure your application'], + // ['/developer-docs/latest/guides/send-email', 'Send email programmatically'], + // [ + // '/developer-docs/latest/guides/registering-a-field-in-admin', + // 'Registering a new field in the admin panel', + // ], + // ['/developer-docs/latest/guides/client', 'Setup a third party client'], + ['/developer-docs/latest/guides/unit-testing', 'Unit testing'], + ], + }, +]; \ No newline at end of file diff --git a/docs/.vuepress/config/sidebar-user.js b/docs/.vuepress/config/sidebar-user.js new file mode 100644 index 0000000000..bef5421bdb --- /dev/null +++ b/docs/.vuepress/config/sidebar-user.js @@ -0,0 +1,104 @@ +const user = [ + { + collapsable: false, + title: '', + children: [ + ['/user-docs/latest/getting-started/introduction', 'Welcome to the Strapi user guide!'], + ], + }, + { + collapsable: false, + title: 'Content Manager', + children: [ + [ + '/user-docs/latest/content-manager/introduction-to-content-manager', + 'Introduction to the Content Manager', + ], + [ + '/user-docs/latest/content-manager/configuring-view-of-content-type', + 'Configuring the views of a content type', + ], + ['/user-docs/latest/content-manager/writing-content', 'Writing content'], + [ + '/user-docs/latest/content-manager/managing-relational-fields', + 'Managing relational fields', + ], + ['/user-docs/latest/content-manager/translating-content', 'Translating content'], + [ + '/user-docs/latest/content-manager/saving-and-publishing-content', + 'Saving, publishing and deleting content', + ], + ], + }, + { + collapsable: false, + title: 'Content-Type Builder', + children: [ + [ + '/user-docs/latest/content-types-builder/introduction-to-content-types-builder', + 'Introduction to the Content-Type Builder', + ], + [ + '/user-docs/latest/content-types-builder/creating-new-content-type', + 'Creating content types', + ], + [ + '/user-docs/latest/content-types-builder/managing-content-types', + 'Managing content types', + ], + [ + '/user-docs/latest/content-types-builder/configuring-fields-content-type', + 'Configuring fields for content types', + ], + ], + }, + { + collapsable: false, + title: 'Users, Roles & Permissions', + children: [ + [ + '/user-docs/latest/users-roles-permissions/introduction-to-users-roles-permissions', + 'Introduction to users, roles & permissions', + ], + [ + '/user-docs/latest/users-roles-permissions/configuring-administrator-roles', + 'Configuring administrator roles', + ], + [ + '/user-docs/latest/users-roles-permissions/managing-administrators', + 'Managing administrator accounts', + ], + [ + '/user-docs/latest/users-roles-permissions/configuring-end-users-roles', + 'Configuring end-users roles', + ], + [ + '/user-docs/latest/users-roles-permissions/managing-end-users', + 'Managing end-users accounts', + ], + ], + }, + { + collapsable: false, + title: 'Plugins', + children: [ + ['/user-docs/latest/plugins/introduction-to-plugins', 'Introduction to plugins'], + [ + '/user-docs/latest/plugins/installing-plugins-via-marketplace', + 'Installing plugins via the Marketplace', + ], + ['/user-docs/latest/plugins/strapi-plugins', 'List of Strapi plugins'], + ], + }, + { + collapsable: false, + title: 'General settings', + children: [ + ['/user-docs/latest/settings/managing-global-settings', 'Managing global settings'], + [ + '/user-docs/latest/settings/configuring-users-permissions-plugin-settings', + 'Configuring Users & Permissions plugin settings', + ], + ], + }, +]; \ No newline at end of file diff --git a/docs/.vuepress/config/theme-config.js b/docs/.vuepress/config/theme-config.js new file mode 100644 index 0000000000..664db2ef6d --- /dev/null +++ b/docs/.vuepress/config/theme-config.js @@ -0,0 +1,151 @@ +const themeConfig = { + logo: '/assets/logo.png', + nav: [ + { + text: 'Resource Center', + link: 'https://strapi.io/resource-center', + }, + { + text: 'v4 Documentation', + items: [ + { + text: 'Developer Docs', + items: [ + { + text: 'Getting Started', + link: '/developer-docs/latest/getting-started/introduction.html', + }, + { + text: 'Setup & Deployment', + link: '/developer-docs/latest/setup-deployment-guides/installation.html', + }, + { + text: 'Plugins', + link: '/developer-docs/latest/plugins/plugins-intro.html', + }, + { + text: 'Development', + link: '/developer-docs/latest/development/backend-customization.html', + }, + { + text: 'Update & Migration', + link: '/developer-docs/latest/update-migration-guides/update-version.html', + }, + { + text: 'Developer Resources', + link: '/developer-docs/latest/developer-resources/content-api/content-api.html', + }, + ], + }, + { + text: 'User Guide', + items: [ + { + text: 'Getting Started', + link: '/user-docs/latest/getting-started/introduction.html', + }, + { + text: 'Content Manager', + link: '/user-docs/latest/content-manager/introduction-to-content-manager.html', + }, + { + text: 'Content-Type Builder', + link: + '/user-docs/latest/content-types-builder/introduction-to-content-types-builder.html', + }, + { + text: 'Users, Roles, and Permissions', + link: + '/user-docs/latest/users-roles-permissions/introduction-to-users-roles-permissions.html', + }, + { + text: 'Plugins', + link: '/user-docs/latest/plugins/introduction-to-plugins.html', + }, + { + text: 'General Settings', + link: '/user-docs/latest/settings/managing-global-settings.html', + }, + ], + }, + ], + }, + { + text: 'v3 documentation', + link: 'https://docs-v3.strapi.io', + }, + { + text: 'Ecosystem', + items: [ + { + text: 'Strapi', + items: [ + { + text: 'Website', + link: 'https://strapi.io', + }, + { + text: 'Blog', + link: 'https://strapi.io/blog', + }, + { + text: 'StrapiConf 2021', + link: 'https://www.strapi.io/strapi-conf-2021', + }, + ], + }, + { + text: 'Community', + items: [ + { + text: 'Forum', + link: 'https://forum.strapi.io', + }, + { + text: 'Discord', + link: 'https://discord.strapi.io', + }, + { + text: 'Awesome-Strapi', + link: 'https://github.com/strapi/awesome-strapi', + }, + ], + }, + { + text: 'Resources', + items: [ + { + text: 'Tutorials', + link: 'https://strapi.io/tutorials', + }, + { + text: 'Academy', + link: 'https://academy.strapi.io/', + }, + ], + }, + ], + }, + { + text: "We're hiring!", + link: 'https://strapi.io/careers#open-positions', + }, + ], + repo: 'strapi/documentation', + docsDir: 'docs', + docsBranch: 'main', + algolia: { + appId: '9FTY6J9E4X', + apiKey: 'cf49c82a1865df2618a3d89e18657051', + indexName: 'documentation', + }, + editLinks: true, + editLinkText: 'Improve this page', + serviceWorker: true, + sidebarDepth: 1, + smoothScroll: false, + sidebar: { + '/developer-docs/latest/': sidebar.developer, + '/user-docs/latest/': sidebar.user, + }, +}; diff --git a/docs/developer-docs/latest/developer-resources/cli/CLI.md b/docs/developer-docs/latest/developer-resources/cli/CLI.md index c9d8dc0fda..3ddf24258a 100644 --- a/docs/developer-docs/latest/developer-resources/cli/CLI.md +++ b/docs/developer-docs/latest/developer-resources/cli/CLI.md @@ -96,7 +96,7 @@ options: [--no-optimization] ## strapi watch-admin -Starts the admin server. Strapi should already be running with `strapi develop`. +Starts the admin server. Strapi should already be running with `strapi develop`. ```sh strapi watch-admin diff --git a/docs/package.json b/docs/package.json index 62bdba061e..00ed94e201 100644 --- a/docs/package.json +++ b/docs/package.json @@ -3,10 +3,14 @@ "version": "4.0.0", "main": "index.js", "scripts": { - "dev": "vuepress dev", - "build": "vuepress build", + "dev": "yarn create:config-file && vuepress dev", + "dev:developer": "yarn create:dev-config-file && vuepress dev", + "dev:user": "yarn create:user-config-file && vuepress dev", + "build": "yarn create:config-file && vuepress build", "check-links": "vuepress check-md", - "lint": "" + "create:config-file": "node ./scripts/create-main-config-file.js", + "create:dev-config-file": "node ./scripts/create-developer-docs-config-file.js", + "create:user-config-file": "node ./scripts/create-user-docs-config-file.js" }, "dependencies": { "@vuepress/plugin-medium-zoom": "^1.8.2", diff --git a/docs/scripts/create-developer-docs-config-file.js b/docs/scripts/create-developer-docs-config-file.js new file mode 100644 index 0000000000..f6eaa9e2a5 --- /dev/null +++ b/docs/scripts/create-developer-docs-config-file.js @@ -0,0 +1,47 @@ +'use strict'; + +const path = require('path'); +const fs = require('fs-extra'); + +const createConfigFile = async () => { + const dest = path.resolve(__dirname, '..', '.vuepress', 'config'); + const developerSidebar = await fs.readFile(path.resolve(dest, 'sidebar-developer.js')); + const plugins = await fs.readFile(path.resolve(dest, 'plugins.js')); + const metas = await fs.readFile(path.resolve(dest, 'metas.js')); + const themeConfig = await fs.readFile(path.resolve(dest, 'theme-config.js')); + const markdown = await fs.readFile(path.resolve(dest, 'markdown.js')); + const patterns = await fs.readFile(path.resolve(dest, 'patterns-developer.js')); + + const content = ` +${developerSidebar.toString()} + +const sidebar = { + developer, +}; + +${plugins.toString()} + +${metas.toString()}; + +${themeConfig.toString()} + +${markdown.toString()} + +${patterns.toString()} + + +module.exports = { + ...metas, + themeConfig, + markdown, + plugins, + patterns +}; + `; + + const destination = path.resolve(__dirname, '..', '.vuepress', 'config.js'); + + await fs.writeFile(destination, content); +}; + +createConfigFile(); diff --git a/docs/scripts/create-main-config-file.js b/docs/scripts/create-main-config-file.js new file mode 100644 index 0000000000..189d38852d --- /dev/null +++ b/docs/scripts/create-main-config-file.js @@ -0,0 +1,48 @@ +'use strict'; + +const path = require('path'); +const fs = require('fs-extra'); + +const createConfigFile = async () => { + const dest = path.resolve(__dirname, '..', '.vuepress', 'config'); + const plugins = await fs.readFile(path.resolve(dest, 'plugins.js')); + const metas = await fs.readFile(path.resolve(dest, 'metas.js')); + const themeConfig = await fs.readFile(path.resolve(dest, 'theme-config.js')); + const markdown = await fs.readFile(path.resolve(dest, 'markdown.js')); + const developerSidebar = await fs.readFile(path.resolve(dest, 'sidebar-developer.js')); + const userSidebar = await fs.readFile(path.resolve(dest, 'sidebar-user.js')); + + const content = ` +${developerSidebar.toString()} + +${userSidebar.toString()} + +const sidebar = { + developer, + user, +}; + +${plugins.toString()} + +${metas.toString()}; + +${themeConfig.toString()} + +${markdown.toString()} + + + +module.exports = { + ...metas, + themeConfig, + markdown, + plugins, +}; + `; + + const destination = path.resolve(__dirname, '..', '.vuepress', 'config.js'); + + await fs.writeFile(destination, content); +}; + +createConfigFile(); diff --git a/docs/scripts/create-user-docs-config-file.js b/docs/scripts/create-user-docs-config-file.js new file mode 100644 index 0000000000..47b96b17b8 --- /dev/null +++ b/docs/scripts/create-user-docs-config-file.js @@ -0,0 +1,47 @@ +'use strict'; + +const path = require('path'); +const fs = require('fs-extra'); + +const createConfigFile = async () => { + const dest = path.resolve(__dirname, '..', '.vuepress', 'config'); + const userSidebar = await fs.readFile(path.resolve(dest, 'sidebar-user.js')); + const plugins = await fs.readFile(path.resolve(dest, 'plugins.js')); + const metas = await fs.readFile(path.resolve(dest, 'metas.js')); + const themeConfig = await fs.readFile(path.resolve(dest, 'theme-config.js')); + const markdown = await fs.readFile(path.resolve(dest, 'markdown.js')); + const patterns = await fs.readFile(path.resolve(dest, 'patterns-user.js')); + + const content = ` +${userSidebar.toString()} + +const sidebar = { + user, +}; + +${plugins.toString()} + +${metas.toString()}; + +${themeConfig.toString()} + +${markdown.toString()} + +${patterns.toString()} + + +module.exports = { + ...metas, + themeConfig, + markdown, + plugins, + patterns +}; + `; + + const destination = path.resolve(__dirname, '..', '.vuepress', 'config.js'); + + await fs.writeFile(destination, content); +}; + +createConfigFile();