diff options
Diffstat (limited to 'playground/src')
31 files changed, 454 insertions, 0 deletions
diff --git a/playground/src/admin/app.example.tsx b/playground/src/admin/app.example.tsx new file mode 100644 index 0000000..3ea4d91 --- /dev/null +++ b/playground/src/admin/app.example.tsx @@ -0,0 +1,37 @@ +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); + }, +}; diff --git a/playground/src/admin/tsconfig.json b/playground/src/admin/tsconfig.json new file mode 100644 index 0000000..083046e --- /dev/null +++ b/playground/src/admin/tsconfig.json @@ -0,0 +1,20 @@ +{ + "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"] +} diff --git a/playground/src/admin/vite.config.example.ts b/playground/src/admin/vite.config.example.ts new file mode 100644 index 0000000..85f6982 --- /dev/null +++ b/playground/src/admin/vite.config.example.ts @@ -0,0 +1,12 @@ +import { mergeConfig, type UserConfig } from 'vite'; + +export default (config: UserConfig) => { + // Important: always return the modified config + return mergeConfig(config, { + resolve: { + alias: { + '@': '/src', + }, + }, + }); +}; diff --git a/playground/src/api/.gitkeep b/playground/src/api/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/playground/src/api/.gitkeep diff --git a/playground/src/api/about/content-types/about/schema.json b/playground/src/api/about/content-types/about/schema.json new file mode 100644 index 0000000..581336f --- /dev/null +++ b/playground/src/api/about/content-types/about/schema.json @@ -0,0 +1,23 @@ +{ + "kind": "singleType", + "collectionName": "abouts", + "info": { + "singularName": "about", + "pluralName": "abouts", + "displayName": "About", + "description": "Write about yourself and the content you create" + }, + "options": { + "draftAndPublish": false + }, + "pluginOptions": {}, + "attributes": { + "title": { + "type": "string" + }, + "blocks": { + "type": "dynamiczone", + "components": ["shared.media", "shared.quote", "shared.rich-text", "shared.slider"] + } + } +} diff --git a/playground/src/api/about/controllers/about.ts b/playground/src/api/about/controllers/about.ts new file mode 100644 index 0000000..b8971a2 --- /dev/null +++ b/playground/src/api/about/controllers/about.ts @@ -0,0 +1,7 @@ +/** + * about controller + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreController('api::about.about'); diff --git a/playground/src/api/about/routes/about.ts b/playground/src/api/about/routes/about.ts new file mode 100644 index 0000000..872ab53 --- /dev/null +++ b/playground/src/api/about/routes/about.ts @@ -0,0 +1,7 @@ +/** + * about router. + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreRouter('api::about.about'); diff --git a/playground/src/api/about/services/about.ts b/playground/src/api/about/services/about.ts new file mode 100644 index 0000000..654db23 --- /dev/null +++ b/playground/src/api/about/services/about.ts @@ -0,0 +1,7 @@ +/** + * about service. + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreService('api::about.about'); diff --git a/playground/src/api/article/content-types/article/schema.json b/playground/src/api/article/content-types/article/schema.json new file mode 100644 index 0000000..8df8823 --- /dev/null +++ b/playground/src/api/article/content-types/article/schema.json @@ -0,0 +1,49 @@ +{ + "kind": "collectionType", + "collectionName": "articles", + "info": { + "singularName": "article", + "pluralName": "articles", + "displayName": "Article", + "description": "Create your blog content" + }, + "options": { + "draftAndPublish": true + }, + "pluginOptions": {}, + "attributes": { + "title": { + "type": "string" + }, + "description": { + "type": "text", + "maxLength": 80 + }, + "slug": { + "type": "uid", + "targetField": "title" + }, + "cover": { + "type": "media", + "multiple": false, + "required": false, + "allowedTypes": ["images", "files", "videos"] + }, + "author": { + "type": "relation", + "relation": "manyToOne", + "target": "api::author.author", + "inversedBy": "articles" + }, + "category": { + "type": "relation", + "relation": "manyToOne", + "target": "api::category.category", + "inversedBy": "articles" + }, + "blocks": { + "type": "dynamiczone", + "components": ["shared.media", "shared.quote", "shared.rich-text", "shared.slider"] + } + } +} diff --git a/playground/src/api/article/controllers/article.ts b/playground/src/api/article/controllers/article.ts new file mode 100644 index 0000000..8b9d100 --- /dev/null +++ b/playground/src/api/article/controllers/article.ts @@ -0,0 +1,7 @@ +/** + * article controller + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreController('api::article.article'); diff --git a/playground/src/api/article/routes/article.ts b/playground/src/api/article/routes/article.ts new file mode 100644 index 0000000..a018052 --- /dev/null +++ b/playground/src/api/article/routes/article.ts @@ -0,0 +1,7 @@ +/** + * article router. + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreRouter('api::article.article'); diff --git a/playground/src/api/article/services/article.ts b/playground/src/api/article/services/article.ts new file mode 100644 index 0000000..4f14efa --- /dev/null +++ b/playground/src/api/article/services/article.ts @@ -0,0 +1,7 @@ +/** + * article service. + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreService('api::article.article'); diff --git a/playground/src/api/author/content-types/author/schema.json b/playground/src/api/author/content-types/author/schema.json new file mode 100644 index 0000000..a202482 --- /dev/null +++ b/playground/src/api/author/content-types/author/schema.json @@ -0,0 +1,34 @@ +{ + "kind": "collectionType", + "collectionName": "authors", + "info": { + "singularName": "author", + "pluralName": "authors", + "displayName": "Author", + "description": "Create authors for your content" + }, + "options": { + "draftAndPublish": false + }, + "pluginOptions": {}, + "attributes": { + "name": { + "type": "string" + }, + "avatar": { + "type": "media", + "multiple": false, + "required": false, + "allowedTypes": ["images", "files", "videos"] + }, + "email": { + "type": "string" + }, + "articles": { + "type": "relation", + "relation": "oneToMany", + "target": "api::article.article", + "mappedBy": "author" + } + } +} diff --git a/playground/src/api/author/controllers/author.ts b/playground/src/api/author/controllers/author.ts new file mode 100644 index 0000000..2649762 --- /dev/null +++ b/playground/src/api/author/controllers/author.ts @@ -0,0 +1,7 @@ +/** + * author controller + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreController('api::author.author'); diff --git a/playground/src/api/author/routes/author.ts b/playground/src/api/author/routes/author.ts new file mode 100644 index 0000000..10475e7 --- /dev/null +++ b/playground/src/api/author/routes/author.ts @@ -0,0 +1,7 @@ +/** + * author router. + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreRouter('api::author.author'); diff --git a/playground/src/api/author/services/author.ts b/playground/src/api/author/services/author.ts new file mode 100644 index 0000000..16f75eb --- /dev/null +++ b/playground/src/api/author/services/author.ts @@ -0,0 +1,7 @@ +/** + * author service. + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreService('api::author.author'); diff --git a/playground/src/api/category/content-types/category/schema.json b/playground/src/api/category/content-types/category/schema.json new file mode 100644 index 0000000..5121cdd --- /dev/null +++ b/playground/src/api/category/content-types/category/schema.json @@ -0,0 +1,31 @@ +{ + "kind": "collectionType", + "collectionName": "categories", + "info": { + "singularName": "category", + "pluralName": "categories", + "displayName": "Category", + "description": "Organize your content into categories" + }, + "options": { + "draftAndPublish": false + }, + "pluginOptions": {}, + "attributes": { + "name": { + "type": "string" + }, + "slug": { + "type": "uid" + }, + "articles": { + "type": "relation", + "relation": "oneToMany", + "target": "api::article.article", + "mappedBy": "category" + }, + "description": { + "type": "text" + } + } +} diff --git a/playground/src/api/category/controllers/category.ts b/playground/src/api/category/controllers/category.ts new file mode 100644 index 0000000..dbfbd34 --- /dev/null +++ b/playground/src/api/category/controllers/category.ts @@ -0,0 +1,7 @@ +/** + * category controller + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreController('api::category.category'); diff --git a/playground/src/api/category/routes/category.ts b/playground/src/api/category/routes/category.ts new file mode 100644 index 0000000..4cbab60 --- /dev/null +++ b/playground/src/api/category/routes/category.ts @@ -0,0 +1,7 @@ +/** + * category router. + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreRouter('api::category.category'); diff --git a/playground/src/api/category/services/category.ts b/playground/src/api/category/services/category.ts new file mode 100644 index 0000000..c956dda --- /dev/null +++ b/playground/src/api/category/services/category.ts @@ -0,0 +1,7 @@ +/** + * category service. + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreService('api::category.category'); diff --git a/playground/src/api/global/content-types/global/schema.json b/playground/src/api/global/content-types/global/schema.json new file mode 100644 index 0000000..3daa1e8 --- /dev/null +++ b/playground/src/api/global/content-types/global/schema.json @@ -0,0 +1,35 @@ +{ + "kind": "singleType", + "collectionName": "globals", + "info": { + "singularName": "global", + "pluralName": "globals", + "displayName": "Global", + "description": "Define global settings" + }, + "options": { + "draftAndPublish": false + }, + "pluginOptions": {}, + "attributes": { + "siteName": { + "type": "string", + "required": true + }, + "favicon": { + "type": "media", + "multiple": false, + "required": false, + "allowedTypes": ["images", "files", "videos"] + }, + "siteDescription": { + "type": "text", + "required": true + }, + "defaultSeo": { + "type": "component", + "repeatable": false, + "component": "shared.seo" + } + } +} diff --git a/playground/src/api/global/controllers/global.ts b/playground/src/api/global/controllers/global.ts new file mode 100644 index 0000000..ead6ee0 --- /dev/null +++ b/playground/src/api/global/controllers/global.ts @@ -0,0 +1,7 @@ +/** + * global controller + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreController('api::global.global'); diff --git a/playground/src/api/global/routes/global.ts b/playground/src/api/global/routes/global.ts new file mode 100644 index 0000000..047b3b7 --- /dev/null +++ b/playground/src/api/global/routes/global.ts @@ -0,0 +1,7 @@ +/** + * global router. + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreRouter('api::global.global'); diff --git a/playground/src/api/global/services/global.ts b/playground/src/api/global/services/global.ts new file mode 100644 index 0000000..ef21df8 --- /dev/null +++ b/playground/src/api/global/services/global.ts @@ -0,0 +1,7 @@ +/** + * global service. + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreService('api::global.global'); diff --git a/playground/src/components/shared/media.json b/playground/src/components/shared/media.json new file mode 100644 index 0000000..f8e9454 --- /dev/null +++ b/playground/src/components/shared/media.json @@ -0,0 +1,15 @@ +{ + "collectionName": "components_shared_media", + "info": { + "displayName": "Media", + "icon": "file-video" + }, + "options": {}, + "attributes": { + "file": { + "allowedTypes": ["images", "files", "videos"], + "type": "media", + "multiple": false + } + } +} diff --git a/playground/src/components/shared/quote.json b/playground/src/components/shared/quote.json new file mode 100644 index 0000000..b9ae1ae --- /dev/null +++ b/playground/src/components/shared/quote.json @@ -0,0 +1,16 @@ +{ + "collectionName": "components_shared_quotes", + "info": { + "displayName": "Quote", + "icon": "indent" + }, + "options": {}, + "attributes": { + "title": { + "type": "string" + }, + "body": { + "type": "text" + } + } +} diff --git a/playground/src/components/shared/rich-text.json b/playground/src/components/shared/rich-text.json new file mode 100644 index 0000000..faa0ed9 --- /dev/null +++ b/playground/src/components/shared/rich-text.json @@ -0,0 +1,14 @@ +{ + "collectionName": "components_shared_rich_texts", + "info": { + "displayName": "Rich text", + "icon": "align-justify", + "description": "" + }, + "options": {}, + "attributes": { + "body": { + "type": "richtext" + } + } +} diff --git a/playground/src/components/shared/seo.json b/playground/src/components/shared/seo.json new file mode 100644 index 0000000..ff2b353 --- /dev/null +++ b/playground/src/components/shared/seo.json @@ -0,0 +1,26 @@ +{ + "collectionName": "components_shared_seos", + "info": { + "name": "Seo", + "icon": "allergies", + "displayName": "Seo", + "description": "" + }, + "options": {}, + "attributes": { + "metaTitle": { + "type": "string", + "required": true + }, + "metaDescription": { + "type": "text", + "required": true + }, + "shareImage": { + "type": "media", + "multiple": false, + "required": false, + "allowedTypes": ["images"] + } + } +} diff --git a/playground/src/components/shared/slider.json b/playground/src/components/shared/slider.json new file mode 100644 index 0000000..e565fc1 --- /dev/null +++ b/playground/src/components/shared/slider.json @@ -0,0 +1,17 @@ +{ + "collectionName": "components_shared_sliders", + "info": { + "displayName": "Slider", + "icon": "address-book", + "description": "" + }, + "options": {}, + "attributes": { + "files": { + "type": "media", + "multiple": true, + "required": false, + "allowedTypes": ["images"] + } + } +} diff --git a/playground/src/extensions/.gitkeep b/playground/src/extensions/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/playground/src/extensions/.gitkeep diff --git a/playground/src/index.ts b/playground/src/index.ts new file mode 100644 index 0000000..58be268 --- /dev/null +++ b/playground/src/index.ts @@ -0,0 +1,20 @@ +// 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 } */) {}, +}; |
