diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 73ce618f17..6e5ac9aee8 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,3 +5,5 @@ updates: schedule: interval: 'daily' versioning-strategy: increase + reviewers: + - strapi/maintainers diff --git a/.travis.yml b/.travis.yml index 55e3be7390..c13584753c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,11 +23,66 @@ cache: # end to end testing template e2e_tests: &e2e_tests - stage: 'End to End tests' + stage: 'End to End tests CE' + script: + - STRAPI_DISABLE_EE=true yarn run -s test:generate-app -- $DB_STRING + - STRAPI_DISABLE_EE=true yarn run -s test:start-app & wait-on http://localhost:1337 + - STRAPI_DISABLE_EE=true yarn run -s test:e2e + +# end to end testing template +e2e_tests_ee: &e2e_tests_ee + stage: 'End to End tests EE' script: - yarn run -s test:generate-app -- $DB_STRING - yarn run -s test:start-app & wait-on http://localhost:1337 - yarn run -s test:e2e + if: fork = false + +pg_test: &pg_test + name: 'E2E Postgresql' + before_install: + - curl -o- -L https://yarnpkg.com/install.sh | bash + - export PATH="$HOME/.yarn/bin:$PATH" + - sudo apt-get update + - sudo apt-get --yes remove postgresql-* + - sudo apt-get install -y postgresql-11 postgresql-client-11 + - sudo cp /etc/postgresql/{9.6,11}/main/pg_hba.conf + - sudo service postgresql restart 11 + - psql -c 'create database strapi_test;' -U postgres + env: + - DB_STRING='--dbclient=postgres --dbhost=localhost --dbport=5433 --dbname=strapi_test --dbusername=postgres --dbpassword=' + +mysql_test: &mysql_test + name: 'E2E Mysql' + before_install: + - curl -o- -L https://yarnpkg.com/install.sh | bash + - export PATH="$HOME/.yarn/bin:$PATH" + - sudo cp $TRAVIS_BUILD_DIR/_travis/mysql.cnf /etc/mysql/conf.d/ + - sudo service mysql restart + - mysql -e 'CREATE DATABASE strapi_test;' + env: + - DB_STRING='--dbclient=mysql --dbhost=localhost --dbport=3306 --dbname=strapi_test --dbusername=travis --dbpassword=' + +sqlite_test: &sqlite_test + name: 'E2E Sqlite' + before_install: + - curl -o- -L https://yarnpkg.com/install.sh | bash + - export PATH="$HOME/.yarn/bin:$PATH" + env: + - DB_STRING='--dbclient=sqlite --dbfile=./tmp/data.db' + +mongo_test: &mongo_test + name: 'E2E MongoDB' + before_install: + - curl -o- -L https://yarnpkg.com/install.sh | bash + - export PATH="$HOME/.yarn/bin:$PATH" + - wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.6.tgz + - tar -zxvf mongodb-linux-x86_64-3.6.6.tgz + - mkdir -p ./data/db/27017 + - mkdir -p ./data/db/27000 + - ./mongodb-linux-x86_64-3.6.6/bin/mongod --fork --dbpath ./data/db/27017 --syslog --port 27017 + env: + - DB_STRING='--dbclient=mongo --dbhost=localhost --dbport=27017 --dbname=strapi_test --dbusername= --dbpassword=' before_script: - yarn build @@ -55,47 +110,25 @@ jobs: - yarn run -s test:front && codecov -C -F front - <<: *e2e_tests - name: 'E2E Postgresql' - before_install: - - curl -o- -L https://yarnpkg.com/install.sh | bash - - export PATH="$HOME/.yarn/bin:$PATH" - - sudo apt-get update - - sudo apt-get --yes remove postgresql-* - - sudo apt-get install -y postgresql-11 postgresql-client-11 - - sudo cp /etc/postgresql/{9.6,11}/main/pg_hba.conf - - sudo service postgresql restart 11 - - psql -c 'create database strapi_test;' -U postgres - env: - - DB_STRING='--dbclient=postgres --dbhost=localhost --dbport=5433 --dbname=strapi_test --dbusername=postgres --dbpassword=' + <<: *pg_test - <<: *e2e_tests - name: 'E2E Mysql' - before_install: - - curl -o- -L https://yarnpkg.com/install.sh | bash - - export PATH="$HOME/.yarn/bin:$PATH" - - sudo cp $TRAVIS_BUILD_DIR/_travis/mysql.cnf /etc/mysql/conf.d/ - - sudo service mysql restart - - mysql -e 'CREATE DATABASE strapi_test;' - env: - - DB_STRING='--dbclient=mysql --dbhost=localhost --dbport=3306 --dbname=strapi_test --dbusername=travis --dbpassword=' + <<: *mysql_test - <<: *e2e_tests - name: 'E2E Sqlite' - before_install: - - curl -o- -L https://yarnpkg.com/install.sh | bash - - export PATH="$HOME/.yarn/bin:$PATH" - env: - - DB_STRING='--dbclient=sqlite --dbfile=./tmp/data.db' + <<: *sqlite_test - <<: *e2e_tests - name: 'E2E MongoDB' - before_install: - - curl -o- -L https://yarnpkg.com/install.sh | bash - - export PATH="$HOME/.yarn/bin:$PATH" - - wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.6.tgz - - tar -zxvf mongodb-linux-x86_64-3.6.6.tgz - - mkdir -p ./data/db/27017 - - mkdir -p ./data/db/27000 - - ./mongodb-linux-x86_64-3.6.6/bin/mongod --fork --dbpath ./data/db/27017 --syslog --port 27017 - env: - - DB_STRING='--dbclient=mongo --dbhost=localhost --dbport=27017 --dbname=strapi_test --dbusername= --dbpassword=' + <<: *mongo_test + + - <<: *e2e_tests_ee + <<: *pg_test + + - <<: *e2e_tests_ee + <<: *mysql_test + + - <<: *e2e_tests_ee + <<: *sqlite_test + + - <<: *e2e_tests_ee + <<: *mongo_test diff --git a/README.md b/README.md index ea86454f56..88461edf5e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

- Strapi logo + Strapi logo

API creation made simple, secure and fast.

diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index bdb0c52651..9c420a08fb 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -160,8 +160,8 @@ module.exports = { ['/v3.x/getting-started/deployment', 'Deployment'], ['/v3.x/getting-started/contributing', 'Contributing'], ['/v3.x/getting-started/troubleshooting', 'Troubleshooting'], + ['/v3.x/getting-started/usage-information', 'Telemetry'], '/v3.x/getting-started/quick-start', - '/v3.x/getting-started/quick-start-tutorial', ], }, { @@ -257,7 +257,7 @@ module.exports = { { collapsable: true, title: '🏗 Global strapi', - children: ['/v3.x/global-strapi/api-reference', '/v3.x/global-strapi/usage-information'], + children: ['/v3.x/global-strapi/api-reference'], }, { collapsable: false, diff --git a/docs/v3.x/admin-panel/deploy.md b/docs/v3.x/admin-panel/deploy.md index 59503255d5..6ce3265c73 100644 --- a/docs/v3.x/admin-panel/deploy.md +++ b/docs/v3.x/admin-panel/deploy.md @@ -22,7 +22,7 @@ module.exports = ({ env }) => ({ admin: { url: '/dashboard', // We change the path to access to the admin (highly recommended for security reasons). }, -}; +}); ``` **You have to rebuild the administration panel to make this work.** [Build instructions](./customization.md#build). @@ -42,7 +42,7 @@ module.exports = ({ env }) => ({ url: '/', // Note: The administration will be accessible from the root of the domain (ex: http://yourfrontend.com/) serveAdminPanel: false, // http://yourbackend.com will not serve any static admin files }, -}; +}); ``` After running `yarn build` with this configuration, the folder `build` will be created/overwritten. You can then use this folder to serve it from another server with the domain of your choice (ex: `http://youfrontend.com`). diff --git a/docs/v3.x/concepts/configurations.md b/docs/v3.x/concepts/configurations.md index a0a7641b89..e171745ba7 100644 --- a/docs/v3.x/concepts/configurations.md +++ b/docs/v3.x/concepts/configurations.md @@ -56,6 +56,8 @@ Instead of writing those credentials into your configuration files, you can defi **Example** +**Path —** `.env` + ``` DATABASE_PASSWORD=acme ``` @@ -70,7 +72,7 @@ Now you can access those variables in your configuration files and application. In your configuration files you will have access to a `env` utility that allows defining defaults and casting values. -`config/database.js` +**Path —** `./config/database.js` ```js module.exports = ({ env }) => ({ diff --git a/docs/v3.x/concepts/controllers.md b/docs/v3.x/concepts/controllers.md index 2bf70cdd75..da51be2cfa 100644 --- a/docs/v3.x/concepts/controllers.md +++ b/docs/v3.x/concepts/controllers.md @@ -43,6 +43,8 @@ const { parseMultipartData, sanitizeEntity } = require('strapi-utils'); - `parseMultipartData`: This function parses Strapi's formData format. - `sanitizeEntity`: This function removes all private fields from the model and its relations. +#### Collection Type + :::: tabs ::: tab find @@ -194,7 +196,7 @@ const { sanitizeEntity } = require('strapi-utils'); module.exports = { /** - * delete a record. + * Delete a record. * * @return {Object} */ @@ -212,6 +214,90 @@ module.exports = { :::: +#### Single Type + +:::: tabs + +::: tab find + +#### `find` + +```js +const { sanitizeEntity } = require('strapi-utils'); + +module.exports = { + /** + * Retrieve the record. + * + * @return {Array} + */ + + async find(ctx) { + const entity = await strapi.services.restaurant.findOne(); + return sanitizeEntity(entity, { model: strapi.models.restaurant }); + }, +}; +``` + +::: + +::: tab update + +#### `update` + +```js +const { parseMultipartData, sanitizeEntity } = require('strapi-utils'); + +module.exports = { + /** + * Update the record. + * + * @return {Object} + */ + + async update(ctx) { + let entity; + if (ctx.is('multipart')) { + const { data, files } = parseMultipartData(ctx); + entity = await strapi.services.restaurant.createOrUpdate(data, { + files, + }); + } else { + entity = await strapi.services.restaurant.createOrUpdate(ctx.request.body); + } + + return sanitizeEntity(entity, { model: strapi.models.restaurant }); + }, +}; +``` + +::: + +::: tab delete + +#### `delete` + +```js +const { sanitizeEntity } = require('strapi-utils'); + +module.exports = { + /** + * Delete the record. + * + * @return {Object} + */ + + async delete(ctx) { + const entity = await strapi.services.restaurant.delete(); + return sanitizeEntity(entity, { model: strapi.models.restaurant }); + }, +}; +``` + +::: + +:::: + ## Custom controllers You can also create custom controllers to build your own business logic and API endpoints. diff --git a/docs/v3.x/concepts/customization.md b/docs/v3.x/concepts/customization.md index 21214acaf1..0685606b95 100644 --- a/docs/v3.x/concepts/customization.md +++ b/docs/v3.x/concepts/customization.md @@ -16,6 +16,10 @@ Extensions folder structure: - `controllers`: You can extend the plugin's controllers by creating controllers with the same names and override certain methods. - `services`: You can extend the plugin's services by creating services with the same names and override certain methods. +::: warning +When using **extensions** you will need to update your code whenever you upgrade your strapi version. Not updating and comparing your **extensions** with the new changes on the repository, can break your app in unexpected ways that we cannot predict in the [migration guides](../migration-guide/README.md). +::: + ## Admin extension The admin panel is a `node_module` that is similar to a plugin, with the slight difference that it encapsulates all the installed plugins of your application. diff --git a/docs/v3.x/concepts/middlewares.md b/docs/v3.x/concepts/middlewares.md index ffabd4d6d7..fcb7ed4ad1 100644 --- a/docs/v3.x/concepts/middlewares.md +++ b/docs/v3.x/concepts/middlewares.md @@ -79,6 +79,46 @@ By default this file doesn't exist, you will have to create it. - `{middlewareName}` (Object): Configuration of one middleware - `enabled` (boolean): Tells Strapi to run the middleware or not +### Settings + +**Example**: + +**Path —** `./config/middleware.js`. + +```js +module.exports = { + //... + settings: { + cors: { + origin: 'http://localhost', + }, + }, +}; +``` + +### Load order + +The middlewares are injected into the Koa stack asynchronously. Sometimes it happens that some of these middlewares need to be loaded in a specific order. To define a load order, create or edit the file `./config/middleware.js`. + +**Path —** `./config/middleware.js`. + +```js +module.exports = { + load: { + before: ['responseTime', 'logger', 'cors', 'responses'], + order: [ + "Define the middlewares' load order by putting their name in this array in the right order", + ], + after: ['parser', 'router'], + }, +}; +``` + +- `load`: + - `before`: Array of middlewares that need to be loaded in the first place. The order of this array matters. + - `order`: Array of middlewares that need to be loaded in a specific order. + - `after`: Array of middlewares that need to be loaded at the end of the stack. The order of this array matters. + ## Core middleware configurations The core of Strapi embraces a small list of middlewares for performances, security and great error handling. @@ -139,7 +179,7 @@ The following middlewares cannot be disabled: responses, router, logger and boom The session doesn't work with `mongo` as a client. The package that we should use is broken for now. ::: -## Response middlewares +### Response middlewares - [`gzip`](https://en.wikipedia.org/wiki/Gzip) - `enabled` (boolean): Enable or not GZIP response compression. @@ -178,45 +218,7 @@ The session doesn't work with `mongo` as a client. The package that we should us - `whiteList` (array): Whitelisted IPs. Default value: `[]`. - `blackList` (array): Blacklisted IPs. Default value: `[]`. -**Example**: - -**Path —** `./config/middleware.js`. - -```js -module.exports = { - //... - settings: { - cors: { - origin: 'http://localhost', - }, - }, -}; -``` - -### Load order - -The middlewares are injected into the Koa stack asynchronously. Sometimes it happens that some of these middlewares need to be loaded in a specific order. To define a load order, create or edit the file `./config/middleware.js`. - -**Path —** `./config/middleware.js`. - -```js -module.exports = { - load: { - before: ['responseTime', 'logger', 'cors', 'responses'], - order: [ - "Define the middlewares' load order by putting their name in this array in the right order", - ], - after: ['parser', 'router'], - }, -}; -``` - -- `load`: - - `before`: Array of middlewares that need to be loaded in the first place. The order of this array matters. - - `order`: Array of middlewares that need to be loaded in a specific order. - - `after`: Array of middlewares that need to be loaded at the end of the stack. The order of this array matters. - -### Examples +## Example Create your custom middleware. diff --git a/docs/v3.x/concepts/models.md b/docs/v3.x/concepts/models.md index 6fc8263713..7e9901e7db 100644 --- a/docs/v3.x/concepts/models.md +++ b/docs/v3.x/concepts/models.md @@ -796,7 +796,7 @@ xhr.send( ## Dynamic Zone -Dynamic Zone field let your create flexible space to content based on a component list. +Dynamic Zone fields let you create a flexible space, in which to compose content, based on a mixed list of components. #### Example diff --git a/docs/v3.x/concepts/services.md b/docs/v3.x/concepts/services.md index 2484334be1..c570ee054c 100644 --- a/docs/v3.x/concepts/services.md +++ b/docs/v3.x/concepts/services.md @@ -19,6 +19,8 @@ You can read about `strapi.query` calls [here](./queries.md). In the following example your controller, service and model are named `restaurant`. ::: +#### Collection Type + :::: tabs ::: tab find @@ -277,6 +279,102 @@ module.exports = { :::: +#### Single Type + +:::: tabs + +::: tab find + +#### `find` + +```js +const _ = require('lodash'); + +module.exports = { + /** + * Promise to fetch the record + * + * @return {Promise} + */ + async find(populate) { + const results = await strapi.query('restaurant').find({ _limit: 1 }, populate); + return _.first(results) || null; + }, +}; +``` + +- `populate` (array): you have to mention data you want populate `["author", "author.name", "comment", "comment.content"]` + +::: + +::: tab createOrUpdate + +#### `createOrUpdate` + +```js +const _ = require('lodash'); + +module.exports = { + /** + * Promise to add/update the record + * + * @return {Promise} + */ + + async createOrUpdate(data, { files } = {}) { + const results = await strapi.query('restaurant').find({ _limit: 1 }); + const entity = _.first(results) || null; + + let entry; + if (!entity) { + entry = await strapi.query('restaurant').create(data); + } else { + entry = await strapi.query('restaurant').update({ id: entity.id }, data); + } + + if (files) { + // automatically uploads the files based on the entry and the model + await strapi.entityService.uploadFiles(entry, files, { + model: 'restaurant', + // if you are using a plugin's model you will have to add the `plugin` key (plugin: 'users-permissions') + }); + return this.findOne({ id: entry.id }); + } + + return entry; + }, +}; +``` + +::: + +::: tab delete + +#### `delete` + +```js +module.exports = { + /** + * Promise to delete a record + * + * @return {Promise} + */ + + delete() { + const results = await strapi.query('restaurant').find({ _limit: 1 }); + const entity = _.first(results) || null; + + if (!entity) return; + + return strapi.query('restaurant').delete({id: entity.id}); + }, +}; +``` + +::: + +:::: + ## Custom services You can also create custom services to build your own business logic. diff --git a/docs/v3.x/content-api/api-endpoints.md b/docs/v3.x/content-api/api-endpoints.md index 752c8b13f9..c6767cc96c 100644 --- a/docs/v3.x/content-api/api-endpoints.md +++ b/docs/v3.x/content-api/api-endpoints.md @@ -144,7 +144,9 @@ Here is the list of endpoints generated for each of your **Content Types**. :::: -### Here are some Content Type examples +### Examples + +Here are some Content Type examples #### Single Types @@ -289,12 +291,20 @@ Here is the list of endpoints generated for each of your **Content Types**. Returns entries matching the query filters. You can read more about parameters [here](./parameters.md). +:::: tabs + +::: tab Request + **Example request** ```js GET http://localhost:1337/restaurants ``` +::: + +::: tab Response + **Example response** ```json @@ -356,16 +366,28 @@ GET http://localhost:1337/restaurants ] ``` +::: + +:::: + ## Get an entry Returns an entry by id. +:::: tabs + +::: tab Request + **Example request** ```js GET http://localhost:1337/restaurants/1 ``` +::: + +::: tab Response + **Example response** ```json @@ -425,26 +447,46 @@ GET http://localhost:1337/restaurants/1 } ``` +::: + +:::: + ## Count entries Returns the count of entries matching the query filters. You can read more about parameters [here](./parameters.md). +:::: tabs + +::: tab Request + **Example request** ```js GET http://localhost:1337/restaurants/count ``` +::: + +::: tab Response + **Example response** ``` 1 ``` +::: + +:::: + ## Create an entry Creates an entry and returns its value. +:::: tabs + +::: tab Request + **Example request** ```js @@ -478,6 +520,10 @@ POST http://localhost:1337/restaurants } ``` +::: + +::: tab Response + **Example response** ```json @@ -537,11 +583,19 @@ POST http://localhost:1337/restaurants } ``` +::: + +:::: + ## Update an entry Partially updates an entry by id and returns its value. Fields that aren't sent in the query are not changed in the db. Send a `null` value if you want to clear them. +:::: tabs + +::: tab Request + **Example request** ```js @@ -584,6 +638,10 @@ PUT http://localhost:1337/restaurants/1 } ``` +::: + +::: tab Response + **Example response** ```json @@ -649,16 +707,28 @@ PUT http://localhost:1337/restaurants/1 } ``` +::: + +:::: + ## Delete an entry Deletes an entry by id and returns its value. +:::: tabs + +::: tab Request + **Example request** ```js DELETE http://localhost:1337/restaurants/1 ``` +::: + +::: tab Response + **Example response** ```json @@ -724,6 +794,6 @@ DELETE http://localhost:1337/restaurants/1 } ``` -::: tip -Whether you are using MongoDB or a SQL database you can use the field `id` as described in this documentation. It will be provided in both cases and work the same way. ::: + +:::: diff --git a/docs/v3.x/content-api/parameters.md b/docs/v3.x/content-api/parameters.md index 0663258fe5..45a3cdecf5 100644 --- a/docs/v3.x/content-api/parameters.md +++ b/docs/v3.x/content-api/parameters.md @@ -60,20 +60,20 @@ or `GET /restaurants?_where[0][price_gte]=3&[0][price_lte]=7` -## Complexe queries +## Complex queries ::: tip NOTE `OR` and `AND` operations are availabled starting from v3.1.0 ::: -When building more complexe queries you must use the `_where` query parameter in combination with the [`qs`](https://github.com/ljharb/qs) library. +When building more complex queries you must use the `_where` query parameter in combination with the [`qs`](https://github.com/ljharb/qs) library. -We are taking advantage of the capability of `qs` to parse nested objects to create more complexe queries. +We are taking advantage of the capability of `qs` to parse nested objects to create more complex queries. -This will give you full power to create complexe queries with logical `AND` and `OR` operations. +This will give you full power to create complex queries with logical `AND` and `OR` operations. ::: tip NOTE -We strongly recommend using `qs` directly to generate complexe queries instead of creating them manually. +We strongly recommend using `qs` directly to generate complex queries instead of creating them manually. ::: ### `AND` operator @@ -212,7 +212,7 @@ To achieve this, there are three options: ::: ::: warning -This feature isn't available for the `upload` plugin. +This feature isn't available for **polymorphic** relations. This relation type is used in `media`, `component` and `dynamic zone` fields. ::: ## Sort diff --git a/docs/v3.x/getting-started/contributing.md b/docs/v3.x/getting-started/contributing.md index fc819853a8..8e064b2adf 100644 --- a/docs/v3.x/getting-started/contributing.md +++ b/docs/v3.x/getting-started/contributing.md @@ -1,4 +1,4 @@ -# 🦸 Contributing +# Contributing Strapi is a community oriented project and we really appreciate every contribution made by the community: feature requests, bug reports, and especially pull requests! If you have any questions please reach out the [Core team](https://strapi.io/company) on [Slack](https://slack.strapi.io). diff --git a/docs/v3.x/getting-started/installation.md b/docs/v3.x/getting-started/installation.md index cfad1f522a..74ce7dab06 100644 --- a/docs/v3.x/getting-started/installation.md +++ b/docs/v3.x/getting-started/installation.md @@ -1,6 +1,12 @@ -# ⚙️ Installation +# Installation -### Installation guides +Strapi gives you many possible installation options for your project or application. Strapi can be installed on your computer or services such as DigitalOcean, Amazon AWS, or Platform.sh. The following documentation covers many different options to install Strapi and getting started on using it. + +::: tip +For a more detailed overview of deployment please see the [related documentation](./deployment.md). +::: + +## Installation guides
@@ -49,7 +55,3 @@
- -### Deployment guides - -For a more detailed overview of deployment please see the [related documentation](./deployment.md). diff --git a/docs/v3.x/getting-started/introduction.md b/docs/v3.x/getting-started/introduction.md index 2142c821b0..a1a581efbb 100644 --- a/docs/v3.x/getting-started/introduction.md +++ b/docs/v3.x/getting-started/introduction.md @@ -1,4 +1,4 @@ -# 🚀 Welcome to the Strapi documentation! +# Welcome to the Strapi documentation! **Strapi is the open-source [Headless CMS](https://strapi.io) developers love.** @@ -62,7 +62,7 @@ To help you get started with Strapi, we and the community have provided you with ### Demo -Want to see Strapi in action? check out the [demo video](https://strapi.io/demo) or request a live demo via the form present on the page. +Want to see Strapi in action? check out the [demo video](https://youtu.be/zd0_S_FPzKg) or request a [live demo](https://strapi.io/demo) via the form present on the page. ### Blog diff --git a/docs/v3.x/getting-started/quick-start-tutorial.md b/docs/v3.x/getting-started/quick-start-tutorial.md deleted file mode 100644 index 355756c9fe..0000000000 --- a/docs/v3.x/getting-started/quick-start-tutorial.md +++ /dev/null @@ -1,640 +0,0 @@ -# Tutorial - -This **tutorial** is written for developers to **teach and explain** a step-by-step introduction to Strapi. (The [Quick Start Guide](quick-start.md) is a more concise **How-to** version.) This tutorial takes you through the beginning steps of how you start a project like **"FoodAdvisor"** ([Github](https://github.com/strapi/foodadvisor/))([Demo](https://foodadvisor.strapi.io/)). - -You get a good overview of the features found in Strapi that developers love. - - - -By following this tutorial, you install and create your first Strapi project. - -::: tip NOTE - -You need to have **_Node.js and npm_** installed on your system before following these steps. If you do not have Node.js and npm installed (or are not sure), please visit our [installation requirements](../installation/cli.md). - -::: - -**Table of Contents** - -[[toc]] - -## 1. Install Strapi and create a project - -Navigate to your parent `Projects/` directory from your command line. - -::: tip NOTE - -In this tutorial, the example assumes a **Projects** folder on your **Desktop**. However, this is not required, and you may put your project where you want. - -::: - -**Path —** `~/Desktop/Projects/` - -Use **only one** of the following commands to create a new Strapi project - -:::: tabs - -::: tab yarn - -Use **yarn** to install the Strapi project (**recommended**). [Install yarn with these docs](https://yarnpkg.com/lang/en/docs/install/) - -```bash -yarn create strapi-app my-project --quickstart -``` - -::: - -::: tab npx - -Use **npm/npx** to install the Strapi project - -```bash -npx create-strapi-app my-project --quickstart -``` - -::: - -:::: - -The command creates a Strapi project `my-project/` folder within your parent `Projects/` directory. - -::: tip NOTE - -When you create a new Quick Start(`--quickstart`) project, Strapi downloads the node modules and the Strapi files needed. Using `--quickstart` automatically completes an **additional** step of **building the administration panel** for Strapi and then **starting** Strapi for you. This opens the browser for you and brings you to the [Welcome](http://localhost:1337/admin/plugins/users-permissions/auth/register) page. - -You can replace the `my-project` name with any name you want. E.g., `yarn create strapi-app my-foodadvisor-project --quickstart` creates a folder `./Projects/my-foodadvisor-project`. - -::: - -You see something like this. The output below indicates that your Strapi project is being downloaded and installed. - -```bash -yarn create v1.17.3 -[1/4] 🔍 Resolving packages... -[2/4] 🚚 Fetching packages... -[3/4] 🔗 Linking dependencies... -[4/4] 🔨 Building fresh packages... -success Installed "create-strapi-app@3.0.0" with binaries: - - create-strapi-app -[#####################################################################] 71/71Creating a new Strapi application at /Users/paulbocuse/Desktop/Projects/my-project. - -Creating a quickstart project. -Creating files. -Dependencies installed successfully. - -Your application was created at /Users/paulbocuse/Desktop/Projects/my-project. - -Available commands in your project: - - yarn develop - Start Strapi in watch mode. - - yarn start - Start Strapi without watch mode. - - yarn build - Build Strapi admin panel. - - yarn strapi - Display all available commands. - -You can start by doing: - - cd /Users/paulbocuse/Desktop/Projects/my-project - yarn develop - -Running your Strapi application. - -``` - -Next, you notice the following that builds your Strapi administration panel and automatically starts up Strapi: - -```bash -> my-project@0.1.0 develop /Users/paulbocuse/Desktop/Projects/my-project -> strapi develop - -Building your admin UI with development configuration ... - -✔ Webpack - Compiled successfully in 52.21s - -[2019-07-30T15:21:17.698Z] info File created: /Users/paulbocuse/Desktop/Projects/my-project/extensions/users-permissions/config/jwt.json -[2019-07-30T15:21:17.701Z] info The server is restarting - -[2019-07-30T15:21:19.037Z] info Time: Tue Jul 30 2019 17:21:19 GMT+0200 (Central European Summer Time) -[2019-07-30T15:21:19.037Z] info Launched in: 910 ms -[2019-07-30T15:21:19.038Z] info Environment: development -[2019-07-30T15:21:19.038Z] info Process PID: 70615 -[2019-07-30T15:21:19.038Z] info Version: 3.0.0 (node v10.16.0) -[2019-07-30T15:21:19.038Z] info To shut down your server, press + C at any time - -[2019-07-30T15:21:19.038Z] info ☄️ Admin panel: http://localhost:1337/admin -[2019-07-30T15:21:19.039Z] info ⚡️ Server: http://localhost:1337 - -``` - -![Strapi Registration Page](../assets/getting-started/tutorial/strapi-beta-registration-page.png 'Strapi Registration Page') - -::: tip NOTE -Using the `--quickstart` flag installs Strapi using an [SQLite](https://www.sqlite.org/index.html) database. You may, at any time, leave off the **--flag**, but you need to follow a few configuration steps for your database choice. **You need to have your database choice installed and running locally before creating your project.** - -If you would like to use **MongoDB** in production, you need to [install, run, and use MongoDB to develop your Strapi project (in development)](../guides/databases.md#mongodb-installation). -::: - -You are now ready to create a new **Administrator** and new front-end **User**. - -## 2. Create an Administrator and front-end User - -The first step is to create an **Administrator** (or "root user") for your project. An **Administrator** has all administrator privileges and access rights. (You can read more about why **Administrators** and front-end **Users** are separate [here](https://strapi.io/blog/why-we-split-the-management-of-the-admin-users-and-end-users/).) - -You need to complete the following fields: - -- **Username**, create a username for login access to your project, e.g. `paulbocuse`. -- **Password**, create a unique password for logging into your project. -- **Email address**, this is used for recovery. -- Check **Receive news**, this is optional but **recommended**. -- Click the **Ready to Start** button. - -![Completed Registration Page](../assets/getting-started/tutorial/completed-registration-page.png 'Completed Registration Page') - -After your **Administrator** registration is complete, you see the Strapi _Administration Dashboard_: - -![Strapi Administration Dashboard](../assets/getting-started/tutorial/strapi-dashboard.png 'Strapi Admin Dashboard') - -**Administrators** and front-end **Users** are separate roles. - -**A.** An **Administrator** has access and rights to the Administration Dashboard (or backend) of Strapi. **Administrators** can, for example, add content, add plugins, and upload images. - -**B.** A front-end **User** is someone who interacts with your project through the front-end. A front-end **User** can, for example, be an "Author" of an article, make a purchase, has an account, leaves a review, or leaves a comment. - -Up until this point, you have created an **Administrator**, and so you next want to create a front-end **User**. - -::: tip NOTE - -It is not necessary to always create a front-end **User** for your **Administrators**; in this case, the **Administrator** is also a front-end **User** as an "Author" of content in the application. - -::: - -- Click on `Users` located under **COLLECTION TYPES** in the left-hand menu. -- Click the blue **+ Add New User** button in the top right corner. -- Next, complete the `Username`, `Email`, and `Password` fields. -- Select `ON` for the **Confirmed** toggle field. -- To the right, under **Role**, select `Authenticated`. -- Save the new user by clicking the blue **Save** button (top right). - -![New front-end User](../assets/getting-started/tutorial/new-front-end-user.png 'New front-end User') - -You are now ready to create your first **Collection Type**. - -## 3. Create a new Collection Type called "Restaurant" - -A **Content Type** can be considered a sort of _blueprint_ for the data created. In other words, a **Content Type** is the schema of the data structure. - -Both **Collection Type** and **Single Type** are types of **Content Type**. **Collection Type** is used for content that repeats such as restaurants, or blog posts (hence "collection"). **Single Type** is used to manage content that will have only one instance - for example, your menu, a static page, or a footer. - -**Content Type** can hold data represented by fields. For example, a **Collection Type** called `Restaurant` may be intended to display information regarding restaurants. A `restaurant` **Collection Type** could have fields that include a `name`, the main `image`, and a `description` - _at a minimum_. However, a `restaurant` could also have a `category` or multiple `categories`, and a `restaurant` could perhaps need to show `hoursofoperation`. - -The next section guides you through the steps needed for each of these above **Content Type** fields. - -::: tip NOTE - -Additional **Restaurant** themed **Content Types** and fields can be seen in the [FoodAdvisor demo site](https://foodadvisor.strapi.io/). - -::: - -### The Restaurant Content Type - -Go to the **Content Type Builder** plugin, located in the left menu: Under **PLUGINS** -> **Content Type Builder** - -You are now able to see the three available **Content Types**. At this point, three Content Types are available `Permission`, `Role`, and `Users`. - -![Content Type Dashboard](../assets/getting-started/tutorial/content-type-dashboard.png 'Content Type Dashboard') - -You need to create a new **Content Type** for `Restaurants`. - -1. Complete these steps to **Add a Restaurant Content Type**. - -- Click the `+ Create new collection type` link (under existing **CONTENT TYPES**). -- Enter a **Name** for your new **Content Type** (call this `restaurant`). -- Click the `Continue` button. - -![Singular Name Entries for Content Type](../assets/getting-started/tutorial/singular-name-entry.png 'Singular Name Entries or Content Type') - -::: tip NOTE - -The Content Type **Name** is always **singular**. For example, `restaurant` not `restaurants`. - -::: - -2. You are now at the **Field Selection** panel. - -You may add your first field, a **Text** field for the **Restaurant** name. - -![Field Section Panel](../assets/getting-started/tutorial/field-selection-panel.png 'Field Selection Panel') - -- Click on the `Text` field. -- In the **Name** field, type `name`. - -![Restaurant Name Input Field](../assets/getting-started/tutorial/restaurant-name-input-field.png 'Restaurant Name Input Field') - -- Click on the `ADVANCED SETTINGS` tab. -- Check the `Required field` checkbox. -- Check the `Unique field` checkbox. - -![Restaurant Name Advanced Settings](../assets/getting-started/tutorial/restaurant-name-advanced-settings.png 'Restaurant Name Advanced Settings') - -- Click the `+ Add another field` button. - -You are now ready to add the second field, a **Rich Text** field for the **Restaurant** description. - -![Field Section Panel](../assets/getting-started/tutorial/field-selection-panel-after-restaurant-name.png 'Field Selection Panel') - -- Click the `Rich Text` field. - -- In the **Name** field, type `description`. - -![Restaurant Rich Text Field](../assets/getting-started/tutorial/restaurant-rich-text-field.png 'Restaurant Rich Text Field') - -- Click the `+ Add another field` button. - -You are now ready to add the third field, a **Media** field for the **Restaurant** thumbnail image. - -![Field Section Panel](../assets/getting-started/tutorial/field-selection-panel-after-restaurant-description.png 'Field Selection Panel') - -- Click the `Media` field. - -- In the **Name** field, type `image`. - -![Restaurant Rich Image Field](../assets/getting-started/tutorial/restaurant-image-field.png 'Restaurant Rich Image Field') - -- Click on the **ADVANCED SETTINGS** tab. -- Check the `Required field` checkbox. - -![Restaurant Rich Image Field Advanced Settings](../assets/getting-started/tutorial/restaurant-image-field-advanced-settings.png 'Restaurant Rich Image Field Advanced Settings') - -- Click the `Finish` button. - -Your new Content Type called **Restaurant** is ready to be **Saved**. - -![Restaurant Save Screen](../assets/getting-started/tutorial/restaurant-save-screen.png 'Restuarant Save Screen') - -- Click the `Save` button. - -- Wait for Strapi to restart. - -![Strapi Restart](../assets/getting-started/tutorial/restaurant-strapi-restart.png 'Strapi Restart') - -After Strapi has restarted, you are ready to continue to create the `Category` **Content Type**. - -## 4. Create a new Content Type called "Category" - -### The Category Content Type - -The `Category` **Content Type** will have a **Text** field named `category`, and a **Relation field** with a **Many to Many** relationship. - -![Category Add Content Type](../assets/getting-started/tutorial/category-add-content-type.png 'Category Add Content Type') - -1. Complete these steps to **add a Category Content Type**. - -- Click the `+ Create new collection type` link. -- Enter a **Name** for your new **Content Type** (call this `category`). - -![Category Name Field](../assets/getting-started/tutorial/category-name-field.png 'Category Name Field') - -- Click the `Continue` button. - -2. Now, you are ready to add fields to your **Category**. - -![Category Fields](../assets/getting-started/tutorial/category-fields.png 'Category Fields') - -- Click on the `Text` field. -- In the **Name** field, type `name`. - -![Category Name Entry Field](../assets/getting-started/tutorial/category-name-entry-field.png 'Category Name Entry Fields') - -- Click on the `ADVANCED SETTINGS` tab. -- Check the `Required field` checkbox. -- Check the `Unique field` checkbox. - -![Category Advanced Settings](../assets/getting-started/tutorial/category-advanced-settings.png 'Category Advanced Settings') - -- Click the `+ Add another field` button. - -You are now ready to add the second field, a **Relation** field for creating a **Many to Many** relationship between the **Category** and **Restaurant** Content Types. - -- Click on the `Relation` field. - -![Category Add Field Panel](../assets/getting-started/tutorial/category-add-field-panel-after-category-name.png 'Category Add Field Panel') - -This brings you to the **Add New Relation** screen. - -![Category New Relation Field](../assets/getting-started/tutorial/category-new-relation-field.png 'Category New Relation Field') - -- Click on the _right dropdown_ with `Permission (Users-Permissions)` and change it to `Restaurant`. - -![Category Relation Dropdown](../assets/getting-started/tutorial/category-relation-dropdown.png 'Category Relation Dropdown') - -- Click the `Many to Many` icon (from the middle icon choices). It should now read, **"Categories has and belongs to many Restaurants"**. - -![Category Relation Many to Many](../assets/getting-started/tutorial/category-relation-many-to-many.png 'Category Relation Many to Many') - -- Click the `Finish` button. - -![Category Save](../assets/getting-started/tutorial/category-save.png 'Category Save') - -- Click the `Save` button. - -- Wait for Strapi to restart. - -![Category Save Strapi Restart](../assets/getting-started/tutorial/categor-create-strapi-restart.png 'Category Save Strapi Restart') - -After Strapi has restarted, you are ready to create a `Component` called **"Hours of Operations"**. - -## 5. Create a new Component called, "Hours of Operation" - -### The Hours of Operation Component - -The `Restaurant` Content Type has a **Component** field named `hours_of_operation`. This Component is **Repeatable** and for displaying the **Opening hours** and **Closing hours** of a **Restaurant**. - -1. Complete these steps to **add a new Component**. - -- Click the `+ Create new component` link to add a new **Component**. -- Enter a **Name** for your new **Component** (call this `hours_of_operation`). -- Select the icon of your choice. -- Create a new category for your **Component** (call it `hours`). - -![Hours of Operation Add Component](../assets/getting-started/tutorial/hours-of-operation-add-compo.png 'Hours of Operation Add Component') - -- Click the `continue` button. - -2. Now, you are ready to add fields to your **Component**. - -![Hours of Operation Add Fields](../assets/getting-started/tutorial/hours-of-operation-add-fields.png 'Hours of Operation Add Fields') - -- Click on the `Text` field. -- In the **Name** field, type `day_interval`. This is to enter the **Day (or Days)** with **Hours of Operation**. - -![Hours of Operation Days](../assets/getting-started/tutorial/hours-of-operation-days.png 'Hours of Operation Days') - -- Click on the `ADVANCED SETTINGS` tab. -- Check the `Required field` checkbox. - -![Hours of Operation Days Advanced Settings](../assets/getting-started/tutorial/hours-of-operation-days-advanced-settings.png 'Hours of Operation Days Advanced Settings') - -- Click the `+ Add another field`. - -You are now ready to add a second field, another **Text** field for the **Opening Hours**. - -![Hours of Operation Opening Hours](../assets/getting-started/tutorial/hours-of-operation-opening-hours.png 'Hours of Operation Opening Hours') - -- Click on the `Text` field. -- In the **Name** field, type `opening_hours`. - -![Hours of Operation Opening Hours Name](../assets/getting-started/tutorial/hours-of-operation-opening-hours-name.png 'Hours of Operation Opening Hours Name') - -- Click the `+ Add another field` button. - -You are now ready to add a third field, another **Text** field for the **Closing Hours**. - -![Hours of Operation Closing Hours](../assets/getting-started/tutorial/hours-of-operation-closing-hours.png 'Hours of Operation Closing Hours') - -- Click on the `Text` field. -- In the **Name** field, type `closing_hours`. - -![Hours of Operation Closing Hours Name](../assets/getting-started/tutorial/hours-of-operation-closing-hours-name.png 'Hours of Operation Closing Hours Name') - -- Click the `Finish` button. - -![Hours of Operation Save](../assets/getting-started/tutorial/hours-of-operation-save.png 'Hours of Operation Save') - -- Click the `Save` button. -- Wait for Strapi to restart. - -![Hours of Operation Strapi Restart](../assets/getting-started/tutorial/hours-of-operation-strapi-restart.png 'Hours of Operation Strapi Restart') - -After Strapi has restarted, you are ready to assign this **Hours_of_operation** Component to the **Restaurant** Content Type. - -::: tip NOTE - -It would be possible to assign the **Hours_of_operation** Component to another **Content Type**, let's say, a **Cafe** Content Type. You have the option to reuse this component across your application. - -::: - -3. Next, you need to assign the **Hours_of_operation** Component to the **Restaurant** Content Type. - -To access the **Hours_of_operation** Component from within the **Restaurant** Content Type, you need to **edit** the **Restaurant** Content Type in the **Content Type Builder**. - -- If needed, navigate back to the **Content Type Builder**. - -![Edit Restaurant Content Type](../assets/getting-started/tutorial/edit-restaurant-content-type.png 'Edit Restaurant Content Type') - -- Click on the `Restaurant` Content Type, under **CONTENT TYPES**. - -![Edit Restaurant Add Another Field](../assets/getting-started/tutorial/edit-restaurant-add-another-field.png 'Edit Restaurant Add Another Field') - -- Click on the `+ Add another field` button to add the **Component** - -![Edit Restaurant Component Field](../assets/getting-started/tutorial/edit-restaurant-group-field.png 'Edit Restaurant Component Field') - -- Click on the `Component` field. -- Select `Use an existing component` option. -- Click on the `Select a component` button. - -![Restaurant Component Inputs](../assets/getting-started/tutorial/restaurant-group-inputs-use.png 'Restaurant Component Inputs') - -- Ensure `hours_of_operation` is displayed in the **Select a component** dropdown. -- Provide a **name** for this component in the **Restaurant** Content Type. E.g. `restaurant_hours` -- Select the `Repeatable component` option. - -![Restaurant Component Inputs](../assets/getting-started/tutorial/restaurant-group-inputs.png 'Restaurant Component Inputs') - -- Click on the `ADVANCED SETTINGS` tab. -- Check the `Required field` checkbox. - -![Restaurant Component Advanced Settings](../assets/getting-started/tutorial/restaurant-group-advanced-settings.png 'Restaurant Component Advanced Settings') - -- Click the `Finish` button. - -![Restaurant Component Save](../assets/getting-started/tutorial/restaurant-group-save.png 'Restaurant Component save') - -- Click the `Save` button. - -- Wait for Strapi to restart. - -![Restaurant Component Strapi Restart](../assets/getting-started/tutorial/restaurant-group-strapi-restart.png 'Restaurant Component Strapi Restart') - -After Strapi has restarted, you are ready to continue to the next section where you customize the user-interface of your **Restaurant** Content Type. - -4. Next, you will edit the **View Settings** for the new **Hoursofoperation Component** from within the **Content Manager**. - -You can _drag and drop_ fields into a different layout and _rename the labels_. This are two examples of how you can customize the user interface for your **Content Types**. - -- Click on the `Configure the view`, button. - -![Content Manager](../assets/getting-started/tutorial/content-manager-restaurant.png 'Content Manager') - -- Click on the `Set the component's layout`. - -![Content Manager Components Tab](../assets/getting-started/tutorial/content-manager-restaurant-group.png 'Content Manager Components Tab') - -- Rearrange the fields and make them more user friendly. Grab the `opening_hours` and slide it next to `closing_hours`. - -![Content Manager Hoursofoperation Rearrange Fields](../assets/getting-started/tutorial/content-manager-hoursofoperation-rearrange-fields.png 'Content Manager Hoursofoperation Rearrange Fields') - -Next, you will change the **field labels** to make them easier to understand. - -- Click on the `day_interval` field. -- Edit the **Label** to read, `Day (or Days)`. -- Add a **Description**, `You can type in one day or a series of days to complete this field. E.g. "Tuesday" or "Tues - Wed"`. - -![Content Manager Hoursofoperation Day Interval](../assets/getting-started/tutorial/content-manager-hoursofoperation-day-interval.png 'Content Manager Hoursofoperation Day Interval') - -- Click on the `opening_hours` field. -- Edit the **Label** to read, `Opening Hours`. - -![Content Manager Hoursofoperation Opening Hours](../assets/getting-started/tutorial/content-manager-hoursofoperation-day-opening-hours.png 'Content Manager Hoursofoperation Day Opening Hours') - -- Click on `closing_hours` field. -- Edit the **Label** to read, `Closing Hours`. - -![Content Manager Hoursofoperation Closing Hours](../assets/getting-started/tutorial/content-manager-hoursofoperation-day-closing-hours.png 'Content Manager Hoursofoperation Day Closing Hours') - -- Click the `Save` button, and then the `Confirm` button to save your settings. - -Your settings have now saved. - -Whenever anyone enters in information for a **Restaurant**, the entry form is cleared. With Strapi you can modify these and more settings to provide the best experience possible. - -You are ready to start inputting actual content. - -## 6. Manage and add content to a "Restaurant" Content Type - -You are now ready to add some **Restaurants** and **Categories**. - -1. You are now going to enter a new **Restaurant**. - -- Navigate to and click on the `Restaurants`, under **CONTENT TYPES** in the left-hand menu. - -![Restaurants Content Type](../assets/getting-started/tutorial/restaurants-content-type.png 'Restaurants Content Type') - -- Next, click on the **+ Add new Restaurant** button (in the top right corner). -- Enter in the following information for your first **Restaurant** called **Biscotte Restaurant**. - - In the **Name** field, enter `Biscotte Restaurant`. - - In the **Description** field, enter `Welcome to Biscotte restaurant! Restaurant Biscotte offers a cuisine based on fresh, quality products, often local, organic when possible, and always produced by passionate producers.`. - - Upload an **Image** to represent the **Restaurant**. - -**Note:** At this point, you would generally select the **Categories** for this **Restaurant**. You have not entered any **Categories**, so you do this step after entering this first **Restaurant**. - -![Restaurant Content Type Basic Data](../assets/getting-started/tutorial/restaurant-content-type-basic-data.png 'Restaurant Content Type Basic Data') - -- Next scroll down to **RestaurantHours|(0)** and click the `+ ADD NEW ENTRY` button. - - In the **Create an Entry** section, enter the following details. - - In the **Day (or Days)** field, enter `Sun - Mon`. - - In the **Opening Hours** field, enter `Closed`. - - **Skip** the **Closing Hours** field, as this **Restaurant** is closed all day. - - Click the `+ ADD NEW ENTRY` button to create another new entry. - - In the **Day (or Days)** field, enter `Tues - Fri`. - - In the **Opening Hours** field, enter `12:00`. - - In the **Closing Hours** field, enter `22:30`. - - Click the `+ ADD NEW ENTRY` button to create the last entry. - - In the **Day (or Days)** field, enter `Sat`. - - In the **Opening Hours** field, enter `11:30`. - - In the **Closing Hours** field, enter `16:00`. - -You have now entered in all the information necessary for your first **Restaurant**. - -![Restaurants Entry](../assets/getting-started/tutorial/restaurants-entry.png 'Restaurants Entry') - -- **Scroll up** and click the `Save` button. - -Next, you need to enter in some **Categories** that can relate to the above and other **Restaurants**. - -- Navigate to and click on `Categories`, under **CONTENT TYPES** in the left-hand menu. - -![Categories Entry](../assets/getting-started/tutorial/categories-content-type.png 'Categories Entry') - -You are going to enter two **Categories**, but you could add as many **Categories** as you need. Later, you can add additional **Categories** and assign them to existing and new **Restaurants**. - -- Click on the `+ Add New Category` button. - - In the **Name** field, enter `French food`. - - In the **Restaurants(0)** dropdown, select `Biscotte Restaurant`. - -![Categories Entry 1](../assets/getting-started/tutorial/categories-entry-1.png 'Categories Entry 1') - -- Click the `Save` button. - -You now enter your second **Category**. - -- Click on the `+ Add New Category` button. - - In the **Name** field, enter `Brunch`. - - In the **Restaurants(0)** dropdown, select `Biscotte Restaurant`. - -![Categories Entry 2](../assets/getting-started/tutorial/categories-entry-2.png 'Categories Entry 2') - -- Click the `Save` button. - -You have now entered your first **Restaurant** Content Type. You have also assigned two **Categories** to this **Restaurant**. Your next step is to set the **Roles and Permissions**. - -## 7. Set Roles and Permissions - -By default, Strapi publishes all **Content Types** with restricted permissions. Which means you have to explicitly give permissions to each **Content Type** you create. You are going to give **Public** API (or URL) access to both the **Restaurant** Content Type and **Category** Content Type. - -- Click on the `Roles & Permissions` menu item, under **PLUGINS** in the left-hand-menu. - -![Roles and Permissions](../assets/getting-started/tutorial/roles-and-permissions.png 'Roles And Permissions') - -- Next, click on the **Public** Role. - -![Roles and Permissions Public Role](../assets/getting-started/tutorial/roles-and-permissions-public-role.png 'Roles And Permissions Public Role') - -- Next, scroll down under **Permissions** and locate the **Restaurant** and **Category** Content Types. -- Click the checkbox for **find** and **findone** in the **Restaurant** Content Type. -- Click the checkbox for **find** and **findone** in the **Category** Content Type. - -![Roles and Permissions Find Permissions](../assets/getting-started/tutorial/roles-and-permissions-find-permissions.png 'Roles And Permissions Find Permissions') - -- Scroll back to the top, and click the **Save** button. - -You have now opened the API and are ready to consume the content. - -## 8. Consume the Content Type API - -Each of your **Content Types** are accessible by following their automatically generated routes. - -Both your **Restaurant** and **Category** Content Types can now be accessed. - -- In your browser, follow `http://localhost:1337/restaurants` to return the data for the allowed **Find** value of your **Restaurant** Content Type - -![Restaurant Api](../assets/getting-started/tutorial/restaurant-api.png 'Restaurant API') - -- In your browser, follow `http://localhost:1337/categories` to return the data for the allowed **Find** value of your **Category** Content Type. - -![Category Api](../assets/getting-started/tutorial/category-api.png 'Category API') - -::: tip NOTE - -If you have incorrectly (or not at all) set the permissions of your content type, you get a **"403"** permission error. See the below example. - -Forbidden Access Looks like this: - -![Forbidden Access to Restaurant Content Type](../assets/getting-started/tutorial/permission-forbidden-access.png 'Forbidden Access to Restaurant Content Type') -::: - -::: tip NOTE - -If you would like to see the route of any specific **Content Type**, you need to navigate to the **Content Type** under the **Roles and Permissions** plugin and click the ⚙️ next to the value. On the right, you see the route: - -![Permission Routes](../assets/getting-started/tutorial/permission-routes.png 'Permission Routes') - -::: - -::: tip CONGRATULATIONS -👏 Congratulations, you have now completed the **Strapi Getting Started Tutorial**. Where to go next? - -- Learn how to use Strapi with React ([Gatsby](https://strapi.io/blog/building-a-static-website-using-gatsby-and-strapi) or [Next.js](https://strapi.io/blog/strapi-next-setup/)) or Vue.js ([Nuxt.js](https://strapi.io/blog/cooking-a-deliveroo-clone-with-nuxt-vue-js-graphql-strapi-and-stripe-setup-part-1-7/)). -- Read the **concepts** to deep dive into Strapi. -- Get help on [Github Discussions](https://github.com/strapi/strapi/discussions). -- Read the [source code](https://github.com/strapi/strapi), [contribute](https://github.com/strapi/strapi/blob/master/CONTRIBUTING.md) or [give a star](https://github.com/strapi/strapi) on GitHub. -- Follow us on [Twitter](https://twitter.com/strapijs) to get the latest news. -- [Join the vibrant and active Strapi community](https://slack.strapi.io) on Slack. - ::: diff --git a/docs/v3.x/getting-started/quick-start.md b/docs/v3.x/getting-started/quick-start.md index f1c464f06e..44ec5a39dd 100644 --- a/docs/v3.x/getting-started/quick-start.md +++ b/docs/v3.x/getting-started/quick-start.md @@ -1,12 +1,12 @@ # Quick Start Guide -Get ready to get Strapi up and running in **less than 5 minutes** 🚀. +Get ready to get Strapi up and running in **less than 3 minutes** 🚀.
- +
-_For a step-by-step guide, please take a look at the [detailed tutorial](quick-start-tutorial.md)._ +_For a step-by-step guide, please take a look at the following steps. This quickstart is really close to the [FoodAdvisor](https://github.com/strapi/foodadvisor) application._ (Before continuing, please make sure [Node.js and npm are properly installed](../installation/cli.md#step-1-make-sure-requirements-are-met) on your machine. You can [install the Yarn v1.2.0+ package here](https://yarnpkg.com/en/).) @@ -45,14 +45,14 @@ Navigate to [**PLUGINS** - **Content Type Builder**](http://localhost:1337/admin - Click the **"+ Create new collection type"** link - Enter `restaurant`, and click `Continue` -- A window opens with fields options: - - Click the **Text** field - - Type `name` in the **Name** field - - Click over to the **ADVANCED SETTINGS** tab, and check the `Required field` and the `Unique field` - - Click the **"+ Add another Field"** button - - Click the **Rich Text** field - - Type `description` under the **BASE SETTINGS** tab, in the **Name** field - - Click `Finish` +- Click the **"+ Add another Field"** button +- Click the **Text** field +- Type `name` in the **Name** field +- Click over to the **ADVANCED SETTINGS** tab, and check the `Required field` and the `Unique field` +- Click the **"+ Add another Field"** button +- Click the **Rich Text** field +- Type `description` under the **BASE SETTINGS** tab, in the **Name** field +- Click `Finish` - Click the **Save** button and wait for Strapi to restart ## 4. Create a Category Content type @@ -61,15 +61,15 @@ Navigate back to [**PLUGINS** - **Content Type Builder**](http://localhost:1337/ - Click the **"+ Create new collection type"** link - Enter `category`, and click `Continue` -- A window opens with fields options: - - Click the **Text** field - - Type `name` under the **BASE SETTINGS** tab, in the **Name** field - - Click over to the **ADVANCED SETTINGS** tab, and check the `Required field` and the `Unique field` - - Click the **"+ Add another field"** button - - Click the **Relation** field - - On the right side, click the **Category** dropdown and select, `Restaurant` - - In the center, select the icon that represents `many-to-many`. The text should read, `Categories has and belongs to many Restaurants` - - Click `Finish` +- Click the **"+ Add another Field"** button +- Click the **Text** field +- Type `name` under the **BASE SETTINGS** tab, in the **Name** field +- Click over to the **ADVANCED SETTINGS** tab, and check the `Required field` and the `Unique field` +- Click the **"+ Add another field"** button +- Click the **Relation** field +- On the right side, click the **Category** dropdown and select, `Restaurant` +- In the center, select the icon that represents `many-to-many`. The text should read, `Categories has and belongs to many Restaurants` +- Click `Finish` - Click the **Save** button and wait for Strapi to restart ## 5. Add content to "Restaurant" Content Type diff --git a/docs/v3.x/getting-started/troubleshooting.md b/docs/v3.x/getting-started/troubleshooting.md index 60b7a46a60..a05c0797ca 100644 --- a/docs/v3.x/getting-started/troubleshooting.md +++ b/docs/v3.x/getting-started/troubleshooting.md @@ -1,4 +1,4 @@ -# 💬 Troubleshooting +# Troubleshooting Below are solutions to some common issues that you may experience when working with Strapi. You can also post questions to [Github Discussions](https://github.com/strapi/strapi/discussions) or reach out to the members of our [Slack](https://slack.strapi.io) community! @@ -84,7 +84,7 @@ You gain the ability to modify these files without forking the plugin package, h ### Can I add my own 3rd party auth provider -Yes you can either follow the following [guide](../plugins/users-permissions.md#adding-a-new-provider-to-your-project) or you can take a look at the [users-permissions](https://github.com/strapi/strapi/tree/master/packages/strapi-plugin-users-permissions) and submit a pull request to include the provider for everyone. Eventually Strapi does plan to move from the current grant/purest provider to a split natured system similar to the upload providers. +Yes, you can either follow the following [guide](../plugins/users-permissions.md#adding-a-new-provider-to-your-project) or you can take a look at the [users-permissions](https://github.com/strapi/strapi/tree/master/packages/strapi-plugin-users-permissions) and submit a pull request to include the provider for everyone. Eventually Strapi does plan to move from the current grant/purest provider to a split natured system similar to the upload providers. There is currently no ETA on this migration however. diff --git a/docs/v3.x/global-strapi/usage-information.md b/docs/v3.x/getting-started/usage-information.md similarity index 100% rename from docs/v3.x/global-strapi/usage-information.md rename to docs/v3.x/getting-started/usage-information.md diff --git a/docs/v3.x/guides/api-token.md b/docs/v3.x/guides/api-token.md index a0ad14f467..c2785f5343 100644 --- a/docs/v3.x/guides/api-token.md +++ b/docs/v3.x/guides/api-token.md @@ -44,6 +44,11 @@ const _ = require('lodash'); module.exports = async (ctx, next) => { let role; + if (ctx.state.user) { + // request is already authenticated in a different way + return next(); + } + // add the detection of `token` query parameter if ( (ctx.request && ctx.request.header && ctx.request.header.authorization) || diff --git a/docs/v3.x/guides/draft.md b/docs/v3.x/guides/draft.md index 5971cd3d7d..12df28e4b5 100644 --- a/docs/v3.x/guides/draft.md +++ b/docs/v3.x/guides/draft.md @@ -86,7 +86,7 @@ Here we want to force it to fetch articles that have status equal to `published` The way to do that is to set `ctx.query.status` to `published`. It will force the filter of the query. -**Path —** `./api/restaurant/controller/Restaurant.js` +**Path —** `./api/article/controller/Article.js` ```js const { sanitizeEntity } = require('strapi-utils'); diff --git a/docs/v3.x/installation/cli.md b/docs/v3.x/installation/cli.md index 586b5d0ef1..99a6590053 100644 --- a/docs/v3.x/installation/cli.md +++ b/docs/v3.x/installation/cli.md @@ -8,7 +8,7 @@ Fast-track local install for getting Strapi running on your computer. #### Node.js -Strapi only requires [Node.js](https://nodejs.org). The current recommended version to run strapi is Node v12 (current LTS). +Strapi only requires [Node.js](https://nodejs.org). The current recommended version to run strapi is **Node v12** (current LTS). This is everything you need to run Strapi on your local environment. diff --git a/docs/v3.x/installation/docker.md b/docs/v3.x/installation/docker.md index c43d22ed75..f081338349 100644 --- a/docs/v3.x/installation/docker.md +++ b/docs/v3.x/installation/docker.md @@ -21,7 +21,7 @@ services: strapi: image: strapi/strapi volumes: - - ./:/srv/app + - ./app:/srv/app ports: - '1337:1337' ``` @@ -42,22 +42,21 @@ services: DATABASE_PORT: 5432 DATABASE_USERNAME: strapi DATABASE_PASSWORD: strapi - links: - - postgres:postgres volumes: - ./app:/srv/app ports: - '1337:1337' + depends_on: + - postgres postgres: image: postgres environment: + POSTGRES_DB: strapi POSTGRES_USER: strapi POSTGRES_PASSWORD: strapi volumes: - ./data:/var/lib/postgresql/data - ports: - - '5432:5432' ``` ::: @@ -76,22 +75,21 @@ services: DATABASE_PORT: 27017 DATABASE_USERNAME: strapi DATABASE_PASSWORD: strapi - links: - - mongo:mongo volumes: - ./app:/srv/app ports: - '1337:1337' + depends_on: + - mongo mongo: image: mongo environment: + MONGO_INITDB_DATABASE: strapi MONGO_INITDB_ROOT_USERNAME: strapi MONGO_INITDB_ROOT_PASSWORD: strapi volumes: - - ./data/db:/data/db - ports: - - '27017:27017' + - ./data:/data/db ``` ::: diff --git a/docs/v3.x/migration-guide/migration-guide-3.0.x-to-3.1.x.md b/docs/v3.x/migration-guide/migration-guide-3.0.x-to-3.1.x.md index 36e5f1ade3..9b431e4193 100644 --- a/docs/v3.x/migration-guide/migration-guide-3.0.x-to-3.1.x.md +++ b/docs/v3.x/migration-guide/migration-guide-3.0.x-to-3.1.x.md @@ -2,6 +2,12 @@ **Make sure your server is not running until the end of the migration** +:::warning +If you are using **extensions** to create custom code or modifying existing code, you will need to update your code and compare your version to the new changes on the repository. +
+Not updating your **extensions** can break your app in unexpected ways that we cannot predict. +::: + ## Summary [[toc]] diff --git a/docs/v3.x/plugins/email.md b/docs/v3.x/plugins/email.md index 06a64844fc..37920ead61 100644 --- a/docs/v3.x/plugins/email.md +++ b/docs/v3.x/plugins/email.md @@ -60,9 +60,7 @@ await strapi.plugins.email.services.email.sendTemplatedEmail( ## Configure the plugin -### Install the provider you want - -By default Strapi provides a local email system ([sendmail](https://www.npmjs.com/package/sendmail)). If you want to use a third party to send emails, you need to install the correct provider module. Otherwise you can skip this part and continue to [Configure your provider](#configure-your-provider). +By default Strapi provides a local email system ([sendmail](https://www.npmjs.com/package/sendmail)). If you want to use a third party to send emails, you need to install the correct provider module. Otherwise you can skip this part and continue to configure your provider. You can check all the available providers developed by the community on npmjs.org - [Providers list](https://www.npmjs.com/search?q=strapi-provider-email-) @@ -125,7 +123,7 @@ module.exports = ({ env }) => ({ If you're using a different provider depending on your environment, you can specify the correct configuration in `config/env/${yourEnvironment}/plugins.js`. More info here: [Environments](../concepts/configurations.md#environments) ::: -## Create new provider +## Create a provider If you want to create your own, make sure the name starts with `strapi-provider-email-` (duplicating an existing one will be easier) and customize the `send` function. diff --git a/docs/v3.x/plugins/upload.md b/docs/v3.x/plugins/upload.md index fbd6dcbedd..5648bbd75e 100644 --- a/docs/v3.x/plugins/upload.md +++ b/docs/v3.x/plugins/upload.md @@ -300,16 +300,26 @@ You can check all the available providers developed by the community on npmjs.or To install a new provider run: -``` -$ npm install strapi-provider-upload-aws-s3 --save -``` +:::: tabs -or +::: tab yarn ``` -$ yarn add strapi-provider-upload-aws-s3 +yarn add strapi-provider-upload-aws-s3 ``` +::: + +::: tab npm + +``` +npm install strapi-provider-upload-aws-s3 --save +``` + +::: + +:::: + ### Using scoped packages as providers If your package name is [scoped](https://docs.npmjs.com/about-scopes) (for example `@username/strapi-provider-upload-aws2`) you need to take an extra step by aliasing it in `package.json`. Go to the `dependencies` section and change the provider line to look like this: diff --git a/examples/getstarted/package.json b/examples/getstarted/package.json index d4e7f1be39..ab5d232115 100644 --- a/examples/getstarted/package.json +++ b/examples/getstarted/package.json @@ -1,7 +1,7 @@ { "name": "getstarted", "private": true, - "version": "3.1.1", + "version": "3.1.2", "description": "A Strapi application.", "scripts": { "develop": "strapi develop", @@ -13,26 +13,26 @@ }, "dependencies": { "knex": "^0.20.0", - "lodash": "^4.17.5", + "lodash": "4.17.19", "mysql": "^2.17.1", "pg": "^7.10.0", "sqlite3": "^4.0.6", - "strapi": "3.1.1", - "strapi-admin": "3.1.1", - "strapi-connector-bookshelf": "3.1.1", - "strapi-connector-mongoose": "3.1.1", - "strapi-middleware-views": "3.1.1", - "strapi-plugin-content-manager": "3.1.1", - "strapi-plugin-content-type-builder": "3.1.1", - "strapi-plugin-documentation": "3.1.1", - "strapi-plugin-email": "3.1.1", - "strapi-plugin-graphql": "3.1.1", - "strapi-plugin-upload": "3.1.1", - "strapi-plugin-users-permissions": "3.1.1", - "strapi-provider-email-mailgun": "3.1.1", - "strapi-provider-upload-aws-s3": "3.1.1", - "strapi-provider-upload-cloudinary": "3.1.1", - "strapi-utils": "3.1.1" + "strapi": "3.1.2", + "strapi-admin": "3.1.2", + "strapi-connector-bookshelf": "3.1.2", + "strapi-connector-mongoose": "3.1.2", + "strapi-middleware-views": "3.1.2", + "strapi-plugin-content-manager": "3.1.2", + "strapi-plugin-content-type-builder": "3.1.2", + "strapi-plugin-documentation": "3.1.2", + "strapi-plugin-email": "3.1.2", + "strapi-plugin-graphql": "3.1.2", + "strapi-plugin-upload": "3.1.2", + "strapi-plugin-users-permissions": "3.1.2", + "strapi-provider-email-mailgun": "3.1.2", + "strapi-provider-upload-aws-s3": "3.1.2", + "strapi-provider-upload-cloudinary": "3.1.2", + "strapi-utils": "3.1.2" }, "strapi": { "uuid": "getstarted" diff --git a/lerna.json b/lerna.json index eb88b17a04..74c9d1dbe1 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "3.1.1", + "version": "3.1.2", "packages": [ "packages/*", "examples/*" diff --git a/packages/create-strapi-app/package.json b/packages/create-strapi-app/package.json index 1778be11bc..ca77b5d177 100644 --- a/packages/create-strapi-app/package.json +++ b/packages/create-strapi-app/package.json @@ -1,6 +1,6 @@ { "name": "create-strapi-app", - "version": "3.1.1", + "version": "3.1.2", "description": "Generate a new Strapi application.", "license": "SEE LICENSE IN LICENSE", "homepage": "http://strapi.io", @@ -21,7 +21,7 @@ ], "dependencies": { "commander": "^2.20.0", - "strapi-generate-new": "3.1.1" + "strapi-generate-new": "3.1.2" }, "scripts": { "test": "echo \"no tests yet\"" diff --git a/packages/strapi-admin/admin/src/containers/Onboarding/StaticLinks/index.js b/packages/strapi-admin/admin/src/containers/Onboarding/StaticLinks/index.js index b00885986b..49ddcc22d0 100644 --- a/packages/strapi-admin/admin/src/containers/Onboarding/StaticLinks/index.js +++ b/packages/strapi-admin/admin/src/containers/Onboarding/StaticLinks/index.js @@ -5,18 +5,23 @@ */ import React from 'react'; -import { FormattedMessage } from 'react-intl'; +import { useIntl } from 'react-intl'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; - import StyledLink from './StyledLink'; function StaticLinks() { + const { formatMessage } = useIntl(); const staticLinks = [ { icon: 'book', - label: 'documentation', + label: formatMessage({ id: 'app.components.LeftMenuFooter.documentation' }), destination: 'https://strapi.io/documentation', }, + { + icon: 'file', + label: formatMessage({ id: 'app.static.links.cheatsheet' }), + destination: 'https://strapi-showcase.s3-us-west-2.amazonaws.com/CheatSheet.pdf', + } ]; return ( @@ -28,7 +33,7 @@ function StaticLinks() {
  • - + {label}
  • ); diff --git a/packages/strapi-admin/admin/src/translations/en.json b/packages/strapi-admin/admin/src/translations/en.json index c0bdb4aa9d..8545ee483a 100644 --- a/packages/strapi-admin/admin/src/translations/en.json +++ b/packages/strapi-admin/admin/src/translations/en.json @@ -250,6 +250,7 @@ "app.utils.defaultMessage": " ", "app.utils.delete": "Delete", "app.utils.filters": "Filters", + "app.static.links.cheatsheet": "CheatSheet", "app.utils.placeholder.defaultMessage": " ", "component.Input.error.validation.integer": "The value must be an integer", "components.AutoReloadBlocker.description": "Run Strapi with one of the following commands:", diff --git a/packages/strapi-admin/admin/src/translations/ja.json b/packages/strapi-admin/admin/src/translations/ja.json index 99148bcb17..10fa02c77e 100644 --- a/packages/strapi-admin/admin/src/translations/ja.json +++ b/packages/strapi-admin/admin/src/translations/ja.json @@ -38,6 +38,7 @@ "HomePage.welcome.congrats": "おめでとうございます!", "HomePage.welcome.congrats.content": "初期管理者としてログインしました。Strapiが提供する強力な機能を探すために、", "HomePage.welcome.congrats.content.bold": "まずはコンテンツタイプを作ることをオススメします。", + "Media Library": "メディアライブラリ", "New entry": "新規投稿", "Password": "パスワード", "Provider": "プロバイダ", @@ -203,6 +204,7 @@ "notification.error.layout": "レイアウトを復旧できませんでした", "notification.form.error.fields": "フォームに同じエラーがあります", "notification.form.success.fields": "保存されました", + "notification.link-copied": "クリップボードにリンクをコピーしました", "notification.success.delete": "アイテムは削除されました", "request.error.model.unknown": "モデルが存在しません" } diff --git a/packages/strapi-admin/package.json b/packages/strapi-admin/package.json index 837ad4d42e..b2ac985d02 100644 --- a/packages/strapi-admin/package.json +++ b/packages/strapi-admin/package.json @@ -1,6 +1,6 @@ { "name": "strapi-admin", - "version": "3.1.1", + "version": "3.1.2", "description": "Strapi Admin", "repository": { "type": "git", @@ -63,7 +63,7 @@ "jsonwebtoken": "8.5.1", "koa-compose": "4.1.0", "koa-passport": "4.1.3", - "lodash": "^4.17.11", + "lodash": "4.17.19", "match-sorter": "^4.0.2", "mini-css-extract-plugin": "^0.6.0", "moment": "^2.24.0", @@ -94,8 +94,8 @@ "reselect": "^4.0.0", "sanitize.css": "^4.1.0", "sift": "13.1.10", - "strapi-helper-plugin": "3.1.1", - "strapi-utils": "3.1.1", + "strapi-helper-plugin": "3.1.2", + "strapi-utils": "3.1.2", "style-loader": "^0.23.1", "styled-components": "^5.0.0", "terser-webpack-plugin": "^1.2.3", diff --git a/packages/strapi-admin/test/admin-auth.test.e2e.js b/packages/strapi-admin/test/admin-auth.test.e2e.js index 0afb8e4dbc..d94d0ce514 100644 --- a/packages/strapi-admin/test/admin-auth.test.e2e.js +++ b/packages/strapi-admin/test/admin-auth.test.e2e.js @@ -4,6 +4,8 @@ const { registerAndLogin } = require('../../../test/helpers/auth'); const { createAuthRequest } = require('../../../test/helpers/request'); +const edition = process.env.STRAPI_DISABLE_EE === 'true' ? 'CE' : 'EE'; + let rq; const createAuthRole = async () => { @@ -42,7 +44,17 @@ describe('Admin Auth End to End', () => { beforeAll(async () => { const token = await registerAndLogin(); rq = createAuthRequest(token); - internals.role = await createAuthRole(); + + if (edition === 'EE') { + internals.role = await createAuthRole(); + } else { + internals.role = ( + await rq({ + url: '/admin/roles', + method: 'GET', + }) + ).body.data[0]; + } }, 60000); afterAll(async () => { diff --git a/packages/strapi-admin/test/admin-user.test.e2e.js b/packages/strapi-admin/test/admin-user.test.e2e.js index c84eb74cab..140d2d4766 100644 --- a/packages/strapi-admin/test/admin-user.test.e2e.js +++ b/packages/strapi-admin/test/admin-user.test.e2e.js @@ -5,6 +5,8 @@ const { login, registerAndLogin, getUser } = require('../../../test/helpers/auth const { createAuthRequest } = require('../../../test/helpers/request'); const { SUPER_ADMIN_CODE } = require('../services/constants'); +const edition = process.env.STRAPI_DISABLE_EE === 'true' ? 'CE' : 'EE'; + const omitTimestamps = obj => _.omit(obj, ['updatedAt', 'createdAt', 'updated_at', 'created_at']); const getAuthToken = async () => { @@ -85,7 +87,18 @@ describe('Admin User CRUD (e2e)', () => { beforeAll(async () => { const token = await getAuthToken(); rq = createAuthRequest(token); - testData.role = await createUserRole(); + + if (edition === 'EE') { + testData.role = await createUserRole(); + } else { + testData.role = ( + await rq({ + url: '/admin/roles', + method: 'GET', + }) + ).body.data[0]; + } + testData.firstSuperAdminUser = await getUser(); testData.superAdminRole = await getSuperAdminRole(); }); diff --git a/packages/strapi-connector-bookshelf/lib/buildDatabaseSchema.js b/packages/strapi-connector-bookshelf/lib/build-database-schema.js similarity index 100% rename from packages/strapi-connector-bookshelf/lib/buildDatabaseSchema.js rename to packages/strapi-connector-bookshelf/lib/build-database-schema.js diff --git a/packages/strapi-connector-bookshelf/lib/index.js b/packages/strapi-connector-bookshelf/lib/index.js index 342c9dd7fd..58918f0f8f 100644 --- a/packages/strapi-connector-bookshelf/lib/index.js +++ b/packages/strapi-connector-bookshelf/lib/index.js @@ -68,17 +68,37 @@ module.exports = function(strapi) { ORM, }; - return Promise.all([ - mountComponents(connectionName, ctx), - mountApis(connectionName, ctx), - mountAdmin(connectionName, ctx), - mountPlugins(connectionName, ctx), - ]); + return mountConnection(connectionName, ctx); }); return Promise.all(connectionsPromises); } + async function mountConnection(connectionName, ctx) { + if (strapi.models['core_store'].connection === connectionName) { + await mountCoreStore(ctx); + } + + return Promise.all([ + mountComponents(connectionName, ctx), + mountApis(connectionName, ctx), + mountAdmin(connectionName, ctx), + mountPlugins(connectionName, ctx), + ]); + } + + function mountCoreStore(ctx) { + return mountModels( + { + models: { + core_store: strapi.models['core_store'], + }, + target: strapi.models, + }, + ctx + ); + } + function mountComponents(connectionName, ctx) { const options = { models: _.pickBy(strapi.components, ({ connection }) => connection === connectionName), @@ -90,7 +110,10 @@ module.exports = function(strapi) { function mountApis(connectionName, ctx) { const options = { - models: _.pickBy(strapi.models, ({ connection }) => connection === connectionName), + models: _.pickBy( + strapi.models, + ({ connection }, name) => connection === connectionName && name !== 'core_store' + ), target: strapi.models, }; diff --git a/packages/strapi-connector-bookshelf/lib/mount-models.js b/packages/strapi-connector-bookshelf/lib/mount-models.js index d01fa14f28..ae98922896 100644 --- a/packages/strapi-connector-bookshelf/lib/mount-models.js +++ b/packages/strapi-connector-bookshelf/lib/mount-models.js @@ -4,7 +4,7 @@ const { singular } = require('pluralize'); const utilsModels = require('strapi-utils').models; const relations = require('./relations'); -const buildDatabaseSchema = require('./buildDatabaseSchema'); +const buildDatabaseSchema = require('./build-database-schema'); const { createComponentJoinTables, createComponentModels, diff --git a/packages/strapi-connector-bookshelf/package.json b/packages/strapi-connector-bookshelf/package.json index efc18bcb23..a3923a3f47 100644 --- a/packages/strapi-connector-bookshelf/package.json +++ b/packages/strapi-connector-bookshelf/package.json @@ -1,6 +1,6 @@ { "name": "strapi-connector-bookshelf", - "version": "3.1.1", + "version": "3.1.2", "description": "Bookshelf hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -19,11 +19,11 @@ "bookshelf": "^1.0.1", "date-fns": "^2.8.1", "inquirer": "^6.3.1", - "lodash": "^4.17.11", + "lodash": "4.17.19", "p-map": "4.0.0", - "pluralize": "^7.0.0", + "pluralize": "^8.0.0", "rimraf": "3.0.0", - "strapi-utils": "3.1.1" + "strapi-utils": "3.1.2" }, "peerDependencies": { "knex": "^0.20.0" diff --git a/packages/strapi-connector-mongoose/package.json b/packages/strapi-connector-mongoose/package.json index 02fb8da77d..f6a8c925d9 100644 --- a/packages/strapi-connector-mongoose/package.json +++ b/packages/strapi-connector-mongoose/package.json @@ -1,6 +1,6 @@ { "name": "strapi-connector-mongoose", - "version": "3.1.1", + "version": "3.1.2", "description": "Mongoose hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -15,13 +15,13 @@ }, "main": "./lib", "dependencies": { - "lodash": "^4.17.11", + "lodash": "4.17.19", "mongoose": "5.8.0", "mongoose-float": "^1.0.4", "mongoose-long": "^0.2.1", - "pluralize": "^7.0.0", + "pluralize": "^8.0.0", "semver": "^7.3.2", - "strapi-utils": "3.1.1" + "strapi-utils": "3.1.2" }, "author": { "email": "hi@strapi.io", diff --git a/packages/strapi-database/package.json b/packages/strapi-database/package.json index 68437af713..c182aa505a 100644 --- a/packages/strapi-database/package.json +++ b/packages/strapi-database/package.json @@ -1,6 +1,6 @@ { "name": "strapi-database", - "version": "3.1.1", + "version": "3.1.2", "description": "Strapi's database layer", "homepage": "http://strapi.io", "main": "./lib/index.js", @@ -28,7 +28,7 @@ }, "license": "SEE LICENSE IN LICENSE", "dependencies": { - "lodash": "^4.17.11", + "lodash": "4.17.19", "p-map": "4.0.0", "verror": "^1.10.0" } diff --git a/packages/strapi-generate-api/package.json b/packages/strapi-generate-api/package.json index 14988410f9..16165cd7f1 100644 --- a/packages/strapi-generate-api/package.json +++ b/packages/strapi-generate-api/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-api", - "version": "3.1.1", + "version": "3.1.2", "description": "Generate an API for a Strapi application.", "homepage": "http://strapi.io", "keywords": [ @@ -13,9 +13,9 @@ "lib": "./lib" }, "dependencies": { - "lodash": "^4.17.11", - "pluralize": "^7.0.0", - "strapi-utils": "3.1.1" + "lodash": "4.17.19", + "pluralize": "^8.0.0", + "strapi-utils": "3.1.2" }, "scripts": { "test": "echo \"no tests yet\"" diff --git a/packages/strapi-generate-controller/package.json b/packages/strapi-generate-controller/package.json index 484013a174..82d5481c90 100644 --- a/packages/strapi-generate-controller/package.json +++ b/packages/strapi-generate-controller/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-controller", - "version": "3.1.1", + "version": "3.1.2", "description": "Generate a controller for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ @@ -14,8 +14,8 @@ "lib": "./lib" }, "dependencies": { - "lodash": "^4.17.11", - "strapi-utils": "3.1.1" + "lodash": "4.17.19", + "strapi-utils": "3.1.2" }, "scripts": { "test": "echo \"no tests yet\"" diff --git a/packages/strapi-generate-model/package.json b/packages/strapi-generate-model/package.json index 0dba4cca77..0de95aa3f2 100644 --- a/packages/strapi-generate-model/package.json +++ b/packages/strapi-generate-model/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-model", - "version": "3.1.1", + "version": "3.1.2", "description": "Generate a model for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ @@ -14,9 +14,9 @@ "lib": "./lib" }, "dependencies": { - "lodash": "^4.17.11", - "pluralize": "^7.0.0", - "strapi-utils": "3.1.1" + "lodash": "4.17.19", + "pluralize": "^8.0.0", + "strapi-utils": "3.1.2" }, "scripts": { "test": "echo \"no tests yet\"" diff --git a/packages/strapi-generate-new/package.json b/packages/strapi-generate-new/package.json index d00d982ddf..27c7c3ac49 100644 --- a/packages/strapi-generate-new/package.json +++ b/packages/strapi-generate-new/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-new", - "version": "3.1.1", + "version": "3.1.2", "description": "Generate a new Strapi application.", "homepage": "http://strapi.io", "keywords": [ @@ -18,7 +18,7 @@ "execa": "^1.0.0", "fs-extra": "^8.0.1", "inquirer": "^6.3.1", - "lodash": "^4.17.11", + "lodash": "4.17.19", "node-fetch": "^1.7.3", "node-machine-id": "^1.1.10", "ora": "^3.4.0", diff --git a/packages/strapi-generate-plugin/files/admin/src/index.js b/packages/strapi-generate-plugin/files/admin/src/index.js index 9c28968668..6c5be5bb99 100644 --- a/packages/strapi-generate-plugin/files/admin/src/index.js +++ b/packages/strapi-generate-plugin/files/admin/src/index.js @@ -27,7 +27,7 @@ export default strapi => { preventComponentRendering: false, trads, menu: { - pluginsSection: [ + pluginsSectionLinks: [ { destination: `/plugins/${pluginId}`, icon, diff --git a/packages/strapi-generate-plugin/package.json b/packages/strapi-generate-plugin/package.json index b031e975bb..a6374d6dc4 100644 --- a/packages/strapi-generate-plugin/package.json +++ b/packages/strapi-generate-plugin/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-plugin", - "version": "3.1.1", + "version": "3.1.2", "description": "Generate an plugin for a Strapi application.", "homepage": "http://strapi.io", "keywords": [ @@ -14,8 +14,8 @@ }, "dependencies": { "fs-extra": "^8.0.1", - "lodash": "^4.17.11", - "strapi-utils": "3.1.1" + "lodash": "4.17.19", + "strapi-utils": "3.1.2" }, "scripts": { "test": "echo \"no tests yet\"" diff --git a/packages/strapi-generate-policy/package.json b/packages/strapi-generate-policy/package.json index 37fe74cd8e..f0fdf48377 100644 --- a/packages/strapi-generate-policy/package.json +++ b/packages/strapi-generate-policy/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-policy", - "version": "3.1.1", + "version": "3.1.2", "description": "Generate a policy for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ @@ -14,8 +14,8 @@ "lib": "./lib" }, "dependencies": { - "lodash": "^4.17.11", - "strapi-utils": "3.1.1" + "lodash": "4.17.19", + "strapi-utils": "3.1.2" }, "scripts": { "test": "echo \"no tests yet\"" diff --git a/packages/strapi-generate-service/package.json b/packages/strapi-generate-service/package.json index f9b97f4f01..621ff52285 100644 --- a/packages/strapi-generate-service/package.json +++ b/packages/strapi-generate-service/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate-service", - "version": "3.1.1", + "version": "3.1.2", "description": "Generate a service for a Strapi API.", "homepage": "http://strapi.io", "keywords": [ @@ -14,8 +14,8 @@ "lib": "./lib" }, "dependencies": { - "lodash": "^4.17.11", - "strapi-utils": "3.1.1" + "lodash": "4.17.19", + "strapi-utils": "3.1.2" }, "scripts": { "test": "echo \"no tests yet\"" diff --git a/packages/strapi-generate/package.json b/packages/strapi-generate/package.json index 0b8c8168ec..ccb1a8f1ac 100644 --- a/packages/strapi-generate/package.json +++ b/packages/strapi-generate/package.json @@ -1,6 +1,6 @@ { "name": "strapi-generate", - "version": "3.1.1", + "version": "3.1.2", "description": "Master of ceremonies for the Strapi generators.", "homepage": "http://strapi.io", "keywords": [ @@ -18,9 +18,9 @@ "dependencies": { "async": "^2.6.2", "fs-extra": "^8.0.1", - "lodash": "^4.17.11", + "lodash": "4.17.19", "reportback": "^2.0.2", - "strapi-utils": "3.1.1" + "strapi-utils": "3.1.2" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-helper-plugin/package.json b/packages/strapi-helper-plugin/package.json index 84e0aae0fe..28682c35ae 100644 --- a/packages/strapi-helper-plugin/package.json +++ b/packages/strapi-helper-plugin/package.json @@ -1,6 +1,6 @@ { "name": "strapi-helper-plugin", - "version": "3.1.1", + "version": "3.1.2", "description": "Helper for Strapi plugins development", "files": [ "dist" @@ -59,7 +59,7 @@ "classnames": "^2.2.5", "immutable": "^3.8.2", "invariant": "^2.2.1", - "lodash": "^4.17.5", + "lodash": "4.17.19", "moment": "^2.16.0", "react": "^16.9.0", "react-dom": "^16.9.0", diff --git a/packages/strapi-hook-ejs/package.json b/packages/strapi-hook-ejs/package.json index 2be08887e9..d2f2db55d7 100644 --- a/packages/strapi-hook-ejs/package.json +++ b/packages/strapi-hook-ejs/package.json @@ -1,6 +1,6 @@ { "name": "strapi-hook-ejs", - "version": "3.1.1", + "version": "3.1.2", "description": "EJS hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ diff --git a/packages/strapi-hook-redis/package.json b/packages/strapi-hook-redis/package.json index 23b5307031..31f6271c38 100644 --- a/packages/strapi-hook-redis/package.json +++ b/packages/strapi-hook-redis/package.json @@ -1,6 +1,6 @@ { "name": "strapi-hook-redis", - "version": "3.1.1", + "version": "3.1.2", "description": "Redis hook for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -16,10 +16,10 @@ "main": "./lib", "dependencies": { "ioredis": "^4.9.3", - "lodash": "^4.17.11", + "lodash": "4.17.19", "rimraf": "3.0.0", "stack-trace": "0.0.10", - "strapi-utils": "3.1.1" + "strapi-utils": "3.1.2" }, "author": { "email": "hi@strapi.io", diff --git a/packages/strapi-middleware-views/package.json b/packages/strapi-middleware-views/package.json index ece1d58e0b..0bdb9110ce 100644 --- a/packages/strapi-middleware-views/package.json +++ b/packages/strapi-middleware-views/package.json @@ -1,6 +1,6 @@ { "name": "strapi-middleware-views", - "version": "3.1.1", + "version": "3.1.2", "description": "Views middleware to enable server-side rendering for the Strapi framework", "homepage": "http://strapi.io", "keywords": [ @@ -17,7 +17,7 @@ "dependencies": { "consolidate": "^0.15.1", "koa-views": "^6.2.0", - "lodash": "^4.17.11" + "lodash": "4.17.19" }, "author": { "email": "hi@strapi.io", diff --git a/packages/strapi-plugin-content-manager/admin/src/components/FilterPicker/index.js b/packages/strapi-plugin-content-manager/admin/src/components/FilterPicker/index.js index 13652e23a9..79af4aad2f 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/FilterPicker/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/FilterPicker/index.js @@ -34,7 +34,11 @@ function FilterPicker({ actions, isOpen, name, onSubmit, toggleFilterPickerState return get(matchingPermissions, ['0', 'fields'], []); }, [userPermissions, slug]); - const timestamps = get(schema, ['options', 'timestamps']); + let timestamps = get(schema, ['options', 'timestamps']); + + if (!Array.isArray(timestamps)) { + timestamps = []; + } const allowedAttributes = Object.keys(get(schema, ['attributes']), {}) .filter(attr => { diff --git a/packages/strapi-plugin-content-manager/admin/src/components/Inputs/index.js b/packages/strapi-plugin-content-manager/admin/src/components/Inputs/index.js index 5b238685a8..514523cd31 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/Inputs/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/Inputs/index.js @@ -123,11 +123,11 @@ function Inputs({ let step; if (type === 'float' || type === 'decimal') { - step = 'any'; + step = 0.1; } else if (type === 'time' || type === 'datetime') { step = 30; } else { - step = '1'; + step = 1; } return step; diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/EditViewDataManagerProvider/utils/schema.js b/packages/strapi-plugin-content-manager/admin/src/containers/EditViewDataManagerProvider/utils/schema.js index da5925f17c..dc850c32e7 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/EditViewDataManagerProvider/utils/schema.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/EditViewDataManagerProvider/utils/schema.js @@ -9,6 +9,7 @@ import { isNaN, toNumber, } from 'lodash'; +import moment from 'moment'; import * as yup from 'yup'; import { translatedErrors as errorsTrads } from 'strapi-helper-plugin'; @@ -285,6 +286,14 @@ const createYupSchemaAttribute = (type, validations, isCreatingEntry) => { return !!value; } + if (['date', 'datetime'].includes(type)) { + return moment(value)._isValid === true; + } + + if (type === 'boolean') { + return value !== undefined; + } + return !isEmpty(value); }); } diff --git a/packages/strapi-plugin-content-manager/package.json b/packages/strapi-plugin-content-manager/package.json index 2897f446f2..cc6211e6ab 100644 --- a/packages/strapi-plugin-content-manager/package.json +++ b/packages/strapi-plugin-content-manager/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-content-manager", - "version": "3.1.1", + "version": "3.1.2", "description": "A powerful UI to easily manage your data.", "strapi": { "name": "Content Manager", @@ -15,7 +15,7 @@ "draft-js": "^0.11.5", "highlight.js": "^10.1.1", "immutable": "^3.8.2", - "lodash": "^4.17.11", + "lodash": "4.17.19", "markdown-it": "^11.0.0", "markdown-it-abbr": "^1.0.4", "markdown-it-container": "^3.0.0", @@ -26,7 +26,7 @@ "markdown-it-mark": "^3.0.0", "markdown-it-sub": "^1.0.0", "markdown-it-sup": "^1.0.0", - "pluralize": "^7.0.0", + "pluralize": "^8.0.0", "react": "^16.9.0", "react-dom": "^16.9.0", "react-fast-compare": "^3.2.0", @@ -38,8 +38,8 @@ "redux": "^4.0.1", "redux-immutable": "^4.0.0", "reselect": "^4.0.0", - "strapi-helper-plugin": "3.1.1", - "strapi-utils": "3.1.1", + "strapi-helper-plugin": "3.1.2", + "strapi-utils": "3.1.2", "yup": "^0.27.0" }, "author": { diff --git a/packages/strapi-plugin-content-type-builder/package.json b/packages/strapi-plugin-content-type-builder/package.json index ca020bda18..aa2122d7d7 100644 --- a/packages/strapi-plugin-content-type-builder/package.json +++ b/packages/strapi-plugin-content-type-builder/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-content-type-builder", - "version": "3.1.1", + "version": "3.1.2", "description": "Strapi plugin to create content type (API).", "strapi": { "name": "Content Type Builder", @@ -11,8 +11,8 @@ "@sindresorhus/slugify": "1.1.0", "fs-extra": "^7.0.0", "immutable": "^3.8.2", - "lodash": "^4.17.11", - "pluralize": "^7.0.0", + "lodash": "4.17.19", + "pluralize": "^8.0.0", "react": "^16.9.0", "react-dom": "^16.9.0", "react-intl": "4.5.0", @@ -23,10 +23,10 @@ "redux": "^4.0.1", "redux-immutable": "^4.0.0", "reselect": "^4.0.0", - "strapi-generate": "3.1.1", - "strapi-generate-api": "3.1.1", - "strapi-helper-plugin": "3.1.1", - "strapi-utils": "3.1.1", + "strapi-generate": "3.1.2", + "strapi-generate-api": "3.1.2", + "strapi-helper-plugin": "3.1.2", + "strapi-utils": "3.1.2", "yup": "^0.27.0" }, "author": { diff --git a/packages/strapi-plugin-documentation/package.json b/packages/strapi-plugin-documentation/package.json old mode 100755 new mode 100644 index bc7fec33d0..4c1ead9b20 --- a/packages/strapi-plugin-documentation/package.json +++ b/packages/strapi-plugin-documentation/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-documentation", - "version": "3.1.1", + "version": "3.1.2", "description": "This is the description of the plugin.", "strapi": { "name": "Documentation", @@ -15,7 +15,7 @@ "fs-extra": "^8.1.0", "immutable": "^3.8.2", "koa-static": "^5.0.0", - "lodash": "^4.17.15", + "lodash": "4.17.19", "moment": "^2.24.0", "path-to-regexp": "^3.1.0", "react": "^16.9.0", @@ -29,7 +29,7 @@ "redux": "^4.0.1", "redux-immutable": "^4.0.0", "reselect": "^4.0.0", - "strapi-helper-plugin": "3.1.1", + "strapi-helper-plugin": "3.1.2", "swagger-ui-dist": "3.24.3" }, "author": { diff --git a/packages/strapi-plugin-email/package.json b/packages/strapi-plugin-email/package.json index 0c74dafe42..28b054bd17 100644 --- a/packages/strapi-plugin-email/package.json +++ b/packages/strapi-plugin-email/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-email", - "version": "3.1.1", + "version": "3.1.2", "description": "This is the description of the plugin.", "strapi": { "name": "Email", @@ -12,13 +12,13 @@ "test": "echo \"no tests yet\"" }, "dependencies": { - "lodash": "^4.17.11", - "strapi-provider-email-sendmail": "3.1.1", - "strapi-utils": "3.1.1" + "lodash": "4.17.19", + "strapi-provider-email-sendmail": "3.1.2", + "strapi-utils": "3.1.2" }, "devDependencies": { "rimraf": "3.0.0", - "strapi-helper-plugin": "3.1.1" + "strapi-helper-plugin": "3.1.2" }, "author": { "name": "Strapi team", diff --git a/packages/strapi-plugin-graphql/hooks/graphql/index.js b/packages/strapi-plugin-graphql/hooks/graphql/index.js index ee5f2e324d..8633b3a556 100644 --- a/packages/strapi-plugin-graphql/hooks/graphql/index.js +++ b/packages/strapi-plugin-graphql/hooks/graphql/index.js @@ -118,6 +118,7 @@ module.exports = strapi => { cors: false, bodyParserConfig: true, introspection: _.get(strapi.plugins.graphql, 'config.introspection', true), + engine: _.get(strapi.plugins.graphql, 'config.engine', false), }; // Disable GraphQL Playground in production environment. diff --git a/packages/strapi-plugin-graphql/package.json b/packages/strapi-plugin-graphql/package.json index b3661f001f..966c8f4971 100644 --- a/packages/strapi-plugin-graphql/package.json +++ b/packages/strapi-plugin-graphql/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-graphql", - "version": "3.1.1", + "version": "3.1.2", "description": "This is the description of the plugin.", "strapi": { "name": "graphql", @@ -23,9 +23,9 @@ "graphql-type-json": "0.3.1", "graphql-type-long": "^0.1.1", "koa-compose": "^4.1.0", - "lodash": "4.17.12", - "pluralize": "^7.0.0", - "strapi-utils": "3.1.1" + "lodash": "4.17.19", + "pluralize": "^8.0.0", + "strapi-utils": "3.1.2" }, "devDependencies": { "cross-env": "^5.2.0", diff --git a/packages/strapi-plugin-upload/admin/src/translations/index.js b/packages/strapi-plugin-upload/admin/src/translations/index.js index ca05bf31ae..1a7f62604f 100644 --- a/packages/strapi-plugin-upload/admin/src/translations/index.js +++ b/packages/strapi-plugin-upload/admin/src/translations/index.js @@ -1,10 +1,12 @@ import en from './en.json'; +import ja from './ja.json'; import ms from './ms.json'; import ru from './ru.json'; import uk from './uk.json'; const trads = { en, + ja, ms, ru, uk, diff --git a/packages/strapi-plugin-upload/admin/src/translations/ja.json b/packages/strapi-plugin-upload/admin/src/translations/ja.json new file mode 100644 index 0000000000..713d30545d --- /dev/null +++ b/packages/strapi-plugin-upload/admin/src/translations/ja.json @@ -0,0 +1,82 @@ +{ + "button.next": "次へ", + "checkControl.crop-duplicate": "複製したアセットをトリミングする", + "checkControl.crop-original": "元のアセットをトリミングする", + "control-card.add": "追加", + "control-card.cancel": "キャンセル", + "control-card.copy-link": "リンクをコピー", + "control-card.crop": "クロップ", + "control-card.delete": "削除", + "control-card.download": "ダウンロード", + "control-card.edit": "編集", + "control-card.replace-media": "メディアの置き換え", + "control-card.save": "保存", + "filter.add": "フィルタを追加", + "form.button.replace-media": "メディアの置き換え", + "form.input.decription.file-alt": "このテキストはアセットを表示できない場合に表示されます。", + "form.input.label.file-alt": "代替テキスト", + "form.input.label.file-caption": "キャプション", + "form.input.label.file-name": "ファイル名", + "form.upload-url.error.url.invalid": "1つのURLが無効です", + "form.upload-url.error.url.invalids": "{number}つのURLは無効です", + "header.actions.upload-assets": "アップロード", + "header.content.assets-empty": "アセットはありません", + "header.content.assets-multiple": "{number} アセット", + "header.content.assets-single": "1 アセット", + "input.button.label": "ファイルを選択", + "input.label-bold": "ドラッグ&ドロップ", + "input.label-normal": "でアップロードするか", + "input.placeholder": "クリックしてアセットを選択するか、このエリアにファイルをドラッグ&ドロップします。", + "input.url.description": "URLのリンクは改行で区切ってください。", + "input.url.label": "URL", + "list.assets-empty.subtitle": "最初の1つを追加します。", + "list.assets-empty.title": "アセットはまだありません", + "list.assets-empty.title-withSearch": "適用されたフィルターを持つアセットはありません", + "list.assets.selected.plural": "選択されたアセット数: {number}", + "list.assets.selected.singular": "選択されたアセット数: {number}", + "list.assets.type-not-allowed": "このファイルの拡張子は許可されていません。", + "modal.file-details.date": "日付", + "modal.file-details.dimensions": "寸法", + "modal.file-details.extension": "拡張", + "modal.file-details.size": "データサイズ", + "modal.header.browse": "アセットのアップロード", + "modal.header.file-detail": "詳細", + "modal.header.pending-assets": "アップロード前のアセット", + "modal.header.select-files": "選択されたファイル", + "modal.nav.browse": "ブラウズ", + "modal.nav.computer": "PCから", + "modal.nav.selected": "選りすぐり", + "modal.nav.url": "URLから", + "modal.selected-list.sub-header-subtitle": "ドラッグ&ドロップでフィールド内のアセットを並べ替える", + "modal.upload-list.footer.button.plural": "メディアライブラリに{number}つのアセットをアップロードする", + "modal.upload-list.footer.button.singular": "メディアライブラリに{number}つのアセットをアップロードする", + "modal.upload-list.sub-header-subtitle": "メディアライブラリに追加する前にアセットを管理する", + "modal.upload-list.sub-header-title.plural": "選択したアセットの数: {number}", + "modal.upload-list.sub-header-title.singular": "選択されたアセット数: {number}", + "modal.upload-list.sub-header.button": "別のアセットを追加する", + "plugin.description.long": "メディアファイルの管理", + "plugin.description.short": "メディアファイルの管理", + "notification.link-copied": "クリップボードにリンクをコピーしました。", + "plugin.name": "メディアライブラリ", + "search.placeholder": "アセットの検索...", + "settings.form.responsiveDimensions.description": "アップロードされたアセットから複数のサイズ(大、中、小)を自動的に生成します。", + "settings.form.responsiveDimensions.label": "レスポンシブに最適化するアップロードを有効にする", + "settings.form.sizeOptimization.label": "サイズの最適化を有効にする (品質は落とさない)", + "settings.form.autoOrientation.label": "画像の自動方向補正機能を有効にする", + "settings.form.autoOrientation.description": "EXIF情報に従って画像を自動的に回転させます。", + "settings.form.videoPreview.description": "動画(GIF)の6秒プレビューを生成します。", + "settings.form.videoPreview.label": "プレビュー", + "settings.header.label": "メディアライブラリ - 設定", + "settings.section.image.label": "イメージ", + "settings.section.video.label": "ビデオ", + "settings.sub-header.label": "メディアライブラリの設定を行う", + "sort.created_at_asc": "アップロードが古い順", + "sort.created_at_desc": "アップロードが新しい順", + "sort.label": "並び替え", + "sort.name_asc": "アルファベット順(A~Z", + "sort.name_desc": "アルファベット逆順(Z〜A", + "sort.updated_at_asc": "アップデートが古い順", + "sort.updated_at_desc": "アップデートが新しい順", + "window.confirm.close-modal.files": "まだアップロードされていないファイルがありますが、いいですか?", + "window.confirm.close-modal.file": "保存されていない変更がありますが、いいですか?。" +} diff --git a/packages/strapi-plugin-upload/package.json b/packages/strapi-plugin-upload/package.json index 234872103d..89b5bdfb29 100644 --- a/packages/strapi-plugin-upload/package.json +++ b/packages/strapi-plugin-upload/package.json @@ -1,6 +1,6 @@ { "name": "strapi-plugin-upload", - "version": "3.1.1", + "version": "3.1.2", "description": "This is the description of the plugin.", "strapi": { "name": "Media Library", @@ -18,7 +18,7 @@ "is-valid-domain": "0.0.14", "koa-range": "0.3.0", "koa-static": "^5.0.0", - "lodash": "^4.17.11", + "lodash": "4.17.19", "node-fetch": "2.6.0", "react": "^16.9.0", "react-copy-to-clipboard": "^5.0.1", @@ -29,9 +29,9 @@ "react-router-dom": "^5.0.0", "reactstrap": "8.4.1", "sharp": "0.24.1", - "strapi-helper-plugin": "3.1.1", - "strapi-provider-upload-local": "3.1.1", - "strapi-utils": "3.1.1", + "strapi-helper-plugin": "3.1.2", + "strapi-provider-upload-local": "3.1.2", + "strapi-utils": "3.1.2", "stream-to-array": "^2.3.0", "uuid": "^3.2.1" }, diff --git a/packages/strapi-plugin-upload/test/__tests__/bootstrap.test.js b/packages/strapi-plugin-upload/test/__tests__/bootstrap.test.js index ac6de6de52..5daed59e8a 100644 --- a/packages/strapi-plugin-upload/test/__tests__/bootstrap.test.js +++ b/packages/strapi-plugin-upload/test/__tests__/bootstrap.test.js @@ -6,6 +6,7 @@ describe('Upload plugin bootstrap function', () => { const register = jest.fn(() => {}); global.strapi = { + dir: process.cwd(), admin: { services: { permission: { actionProvider: { register } } }, }, @@ -13,6 +14,10 @@ describe('Upload plugin bootstrap function', () => { error() {}, }, config: { + get() { + return 'public'; + }, + paths: {}, info: { dependencies: {}, }, diff --git a/packages/strapi-plugin-users-permissions/admin/src/components/InputCheckboxPlugin/index.js b/packages/strapi-plugin-users-permissions/admin/src/components/InputCheckboxPlugin/index.js index 03bec1a8f3..936df2838e 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/components/InputCheckboxPlugin/index.js +++ b/packages/strapi-plugin-users-permissions/admin/src/components/InputCheckboxPlugin/index.js @@ -9,13 +9,7 @@ import PropTypes from 'prop-types'; import { useEditPageContext } from '../../contexts/EditPage'; import { Label, Wrapper } from './Components'; -function InputCheckboxPlugin({ - inputSelected, - label, - name, - setNewInputSelected, - value, -}) { +function InputCheckboxPlugin({ inputSelected, label, name, setNewInputSelected, value }) { const { onChange, resetShouldDisplayPoliciesHint, @@ -61,14 +55,11 @@ function InputCheckboxPlugin({ return (
    -