mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 10:55:37 +00:00
Merge branch 'features/api-token-v2' into api-token-v2/permissions-for-api-token
This commit is contained in:
commit
b2b1432322
@ -7,6 +7,7 @@ examples/**
|
||||
cypress/**
|
||||
packages/generators/generators/lib/files/
|
||||
packages/generators/app/lib/resources/files/
|
||||
packages/core/admin/admin/src/plugins.js
|
||||
packages/core/helper-plugin/build/**
|
||||
packages/core/helper-plugin/lib/src/old/components/**
|
||||
packages/core/helper-plugin/lib/src/testUtils/**
|
||||
|
||||
@ -1,55 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'prettier',
|
||||
'plugin:import/errors',
|
||||
'plugin:import/warnings',
|
||||
'plugin:node/recommended',
|
||||
// 'plugin:jsdoc/recommended',
|
||||
],
|
||||
plugins: ['jsdoc'],
|
||||
env: {
|
||||
es6: true,
|
||||
node: true,
|
||||
jest: true,
|
||||
},
|
||||
extends: '@strapi/eslint-config/back',
|
||||
globals: {
|
||||
strapi: false,
|
||||
},
|
||||
rules: {
|
||||
// 'jsdoc/require-jsdoc': [
|
||||
// 'warn',
|
||||
// {
|
||||
// publicOnly: true,
|
||||
// require: {
|
||||
// ArrowFunctionExpression: true,
|
||||
// ClassDeclaration: true,
|
||||
// ClassExpression: true,
|
||||
// FunctionDeclaration: true,
|
||||
// FunctionExpression: true,
|
||||
// MethodDefinition: true,
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
'node/no-unpublished-require': 'off',
|
||||
'require-atomic-updates': 'off',
|
||||
'no-process-exit': 'off',
|
||||
strict: ['error', 'global'],
|
||||
'no-return-await': 'error',
|
||||
'object-shorthand': ['error', 'always', { avoidExplicitReturnArrows: true }],
|
||||
'import/order': 'error',
|
||||
'import/no-cycle': 'error',
|
||||
'import/no-useless-path-segments': 'error',
|
||||
'import/first': 'error',
|
||||
'import/extensions': ['error', 'never'],
|
||||
'import/newline-after-import': 'error',
|
||||
'node/exports-style': ['error', 'module.exports'],
|
||||
'node/no-new-require': 'error',
|
||||
'node/no-path-concat': 'error',
|
||||
'node/no-callback-literal': 'error',
|
||||
'node/handle-callback-err': 'error',
|
||||
'one-var': ['error', 'never'],
|
||||
'import/no-dynamic-require': 'off',
|
||||
'global-require': 'off',
|
||||
'import/no-extraneous-dependencies': [
|
||||
'error',
|
||||
{
|
||||
devDependencies: [
|
||||
'packages/admin-test-utils/**/*.js',
|
||||
'packages/generators/admin/**/*.js',
|
||||
'scripts/**/*.js',
|
||||
'**/test/**/*.js',
|
||||
'**/tests/**/*.js',
|
||||
'**/__tests__/**/*.js',
|
||||
'**/__mocks__/**/*.js',
|
||||
],
|
||||
},
|
||||
],
|
||||
'prefer-destructuring': ['error', { AssignmentExpression: { array: false } }],
|
||||
eqeqeq: 'warn',
|
||||
'no-underscore-dangle': 'warn',
|
||||
'no-use-before-define': 'warn',
|
||||
'no-param-reassign': 'warn',
|
||||
'no-continue': 'warn',
|
||||
'no-process-exit': 'warn',
|
||||
'no-plusplus': 'warn',
|
||||
'no-loop-func': 'warn',
|
||||
'guard-for-in': 'warn',
|
||||
},
|
||||
};
|
||||
|
||||
@ -1,13 +1,6 @@
|
||||
module.exports = {
|
||||
parser: 'babel-eslint',
|
||||
extends: [
|
||||
'airbnb',
|
||||
'eslint:recommended',
|
||||
'plugin:react/recommended',
|
||||
'plugin:redux-saga/recommended',
|
||||
'prettier',
|
||||
],
|
||||
plugins: ['react', 'redux-saga', 'react-hooks', 'import', 'jsx-a11y'],
|
||||
parser: '@babel/eslint-parser',
|
||||
extends: ['@strapi/eslint-config/front'],
|
||||
env: {
|
||||
browser: true,
|
||||
commonjs: true,
|
||||
@ -16,11 +9,10 @@ module.exports = {
|
||||
mocha: true,
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018,
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
requireConfigFile: false,
|
||||
babelOptions: {
|
||||
presets: ['@babel/preset-react'],
|
||||
},
|
||||
sourceType: 'module',
|
||||
},
|
||||
globals: {
|
||||
strapi: false,
|
||||
@ -39,86 +31,12 @@ module.exports = {
|
||||
},
|
||||
settings: {
|
||||
react: {
|
||||
version: '16.5.2',
|
||||
version: 'detect',
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'import/no-unresolved': 0,
|
||||
'generator-star-spacing': 0,
|
||||
'no-console': 0,
|
||||
'require-atomic-updates': 0,
|
||||
'react-hooks/rules-of-hooks': 'error',
|
||||
'react-hooks/exhaustive-deps': 'error',
|
||||
'arrow-body-style': 0,
|
||||
'arrow-parens': 0,
|
||||
camelcase: 0,
|
||||
'comma-dangle': 0,
|
||||
'consistent-return': [
|
||||
2,
|
||||
{
|
||||
treatUndefinedAsUnspecified: true,
|
||||
},
|
||||
],
|
||||
'template-curly-spacing': 0,
|
||||
'func-names': ['error', 'never'],
|
||||
'function-paren-newline': 0,
|
||||
'implicit-arrow-linebreak': 0,
|
||||
'import/no-extraneous-dependencies': 0,
|
||||
'import/no-named-as-default': 0,
|
||||
'import/order': 2,
|
||||
'import/prefer-default-export': 'off',
|
||||
'jsx-a11y/click-events-have-key-events': 1,
|
||||
'max-len': [
|
||||
2,
|
||||
{
|
||||
code: 120,
|
||||
ignoreComments: true,
|
||||
ignoreUrls: true,
|
||||
ignoreTrailingComments: true,
|
||||
ignoreStrings: true,
|
||||
ignoreTemplateLiterals: true,
|
||||
},
|
||||
],
|
||||
'newline-before-return': 2,
|
||||
'no-confusing-arrow': 0,
|
||||
'no-else-return': 1,
|
||||
'no-nested-ternary': ['error'],
|
||||
'no-return-assign': 0,
|
||||
'no-param-reassign': 0,
|
||||
'no-plusplus': 0,
|
||||
'no-shadow': 0,
|
||||
'no-underscore-dangle': 0,
|
||||
'no-use-before-define': ['error', { functions: false, classes: false, variables: false }],
|
||||
'object-curly-newline': [2, { multiline: true, consistent: true }],
|
||||
'one-var': ['error', 'never'],
|
||||
'operator-linebreak': 0,
|
||||
'padding-line-between-statements': [
|
||||
'error',
|
||||
{ blankLine: 'always', prev: '*', next: 'if' },
|
||||
{ blankLine: 'any', prev: 'block-like', next: 'if' },
|
||||
],
|
||||
'prefer-arrow-callback': 0,
|
||||
'prefer-const': 0,
|
||||
'prefer-destructuring': 0,
|
||||
'prefer-object-spread': 0,
|
||||
'prefer-spread': 0,
|
||||
'space-before-function-paren': [
|
||||
'error',
|
||||
{
|
||||
anonymous: 'never',
|
||||
named: 'never',
|
||||
asyncArrow: 'always',
|
||||
},
|
||||
],
|
||||
'react/destructuring-assignment': 0,
|
||||
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
|
||||
'react/forbid-prop-types': 0,
|
||||
'react/no-unused-prop-types': 2,
|
||||
'react/jsx-props-no-spreading': 0,
|
||||
'react/jsx-one-expression-per-line': 0,
|
||||
'react/state-in-constructor': 0,
|
||||
'react/static-property-placement': 0,
|
||||
'react/display-name': 0,
|
||||
'react/jsx-wrap-multilines': 0,
|
||||
'react/jsx-no-constructed-context-values': 'warn',
|
||||
'react/jsx-no-useless-fragment': 'warn',
|
||||
'react/no-unstable-nested-components': 'warn',
|
||||
},
|
||||
};
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/BUG_REPORT.md
vendored
2
.github/ISSUE_TEMPLATE/BUG_REPORT.md
vendored
@ -13,7 +13,7 @@ https://guides.github.com/features/mastering-markdown/
|
||||
|
||||
Please ensure you have also read and understand the contributing guide.
|
||||
|
||||
https://github.com/strapi/strapi/blob/master/CONTRIBUTING.md#reporting-an-issue
|
||||
https://github.com/strapi/strapi/blob/main/CONTRIBUTING.md#reporting-an-issue
|
||||
-->
|
||||
|
||||
## Bug report
|
||||
|
||||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -8,7 +8,7 @@ To help us merge your PR, make sure to follow the instructions below:
|
||||
- Refer to the issue you are closing in the PR description: Fix #issue
|
||||
- Specify if the PR is ready to be merged or work in progress (by opening a draft PR)
|
||||
|
||||
Please ensure you read the Contributing Guide: https://github.com/strapi/strapi/blob/master/CONTRIBUTING.md
|
||||
Please ensure you read the Contributing Guide: https://github.com/strapi/strapi/blob/main/CONTRIBUTING.md
|
||||
-->
|
||||
|
||||
### What does it do?
|
||||
|
||||
2
.github/actions/check-pr-status/README.md
vendored
2
.github/actions/check-pr-status/README.md
vendored
@ -1,6 +1,6 @@
|
||||
# PR checker for status
|
||||
|
||||
This action checks a PR labels, milestone and status to validate it is ready for merging into master.
|
||||
This action checks a PR labels, milestone and status to validate it is ready for merging into main.
|
||||
|
||||
> ❗️ When making changes to this code, make sure to run the build before committing. See [Development](#development) to know more.
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ jest.mock('@actions/core');
|
||||
const github = require('@actions/github');
|
||||
const core = require('@actions/core');
|
||||
|
||||
test.each(action.BLOCKING_LABELS)('Test blocking labels %s', async label => {
|
||||
test.each(action.BLOCKING_LABELS)('Test blocking labels %s', async (label) => {
|
||||
github.context = {
|
||||
payload: {
|
||||
pull_request: {
|
||||
|
||||
8
.github/actions/check-pr-status/index.js
vendored
8
.github/actions/check-pr-status/index.js
vendored
@ -7,20 +7,20 @@ async function main() {
|
||||
try {
|
||||
const labels = github.context.payload.pull_request?.labels ?? [];
|
||||
|
||||
const blockingLabels = labels.filter(label => BLOCKING_LABELS.includes(label.name));
|
||||
const blockingLabels = labels.filter((label) => BLOCKING_LABELS.includes(label.name));
|
||||
|
||||
if (blockingLabels.length > 0) {
|
||||
core.setFailed(
|
||||
`The PR has been labelled with a blocking label (${blockingLabels
|
||||
.map(label => label.name)
|
||||
.map((label) => label.name)
|
||||
.join(', ')}).`
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const sourceLabelCount = labels.filter(label => label.name.startsWith('source: ')).length;
|
||||
const issueLabelCount = labels.filter(label => label.name.startsWith('pr: ')).length;
|
||||
const sourceLabelCount = labels.filter((label) => label.name.startsWith('source: ')).length;
|
||||
const issueLabelCount = labels.filter((label) => label.name.startsWith('pr: ')).length;
|
||||
|
||||
if (sourceLabelCount !== 1) {
|
||||
core.setFailed(`The PR must have one and only one 'source:' label.`);
|
||||
|
||||
2
.github/actions/check-pr-status/package.json
vendored
2
.github/actions/check-pr-status/package.json
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "check-pr-status",
|
||||
"version": "4.3.2",
|
||||
"version": "4.3.4",
|
||||
"main": "dist/index.js",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
|
||||
2
.github/workflows/checks.yml
vendored
2
.github/workflows/checks.yml
vendored
@ -9,7 +9,7 @@ on:
|
||||
- labeled
|
||||
- unlabeled
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
|
||||
jobs:
|
||||
check-pr-status:
|
||||
|
||||
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@ -3,7 +3,7 @@ name: 'Tests'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
trigger_deploy:
|
||||
stage: deploy
|
||||
script:
|
||||
- curl -X POST
|
||||
--form "token=$TRIGGER_TOKEN"
|
||||
--form "ref=master"
|
||||
--form "variables[UPSTREAM_COMMIT_SHA]=$CI_COMMIT_SHA"
|
||||
https://gitlab.com/api/v4/projects/12825884/trigger/pipeline
|
||||
only:
|
||||
- develop
|
||||
@ -5,4 +5,5 @@ module.exports = {
|
||||
tabWidth: 2,
|
||||
trailingComma: 'es5',
|
||||
printWidth: 100,
|
||||
arrowParens: 'always',
|
||||
};
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# Contribute to Strapi
|
||||
|
||||
Strapi is an open-source project administered by [the Strapi team](https://strapi.io/about-us). We appreciate your interest and efforts to contribute to Strapi. See the [LICENSE](https://github.com/strapi/strapi/blob/master/LICENSE) licensing information. All work done is available on GitHub.
|
||||
Strapi is an open-source project administered by [the Strapi team](https://strapi.io/about-us). We appreciate your interest and efforts to contribute to Strapi. See the [LICENSE](https://github.com/strapi/strapi/blob/main/LICENSE) licensing information. All work done is available on GitHub.
|
||||
|
||||
We highly appreciate your effort to contribute, but we recommend you talk to a maintainer before spending a lot of time making a pull request that may not align with the project roadmap. Whether it is from Strapi or contributors, every pull request goes through the same process.
|
||||
|
||||
@ -51,7 +51,7 @@ The Strapi core team will review your pull request and either merge it, request
|
||||
|
||||
**Before submitting your pull request** make sure the following requirements are fulfilled:
|
||||
|
||||
- Fork the repository and create your new branch from `master`.
|
||||
- Fork the repository and create your new branch from `main`.
|
||||
- Run `yarn setup` in the root of the repository.
|
||||
- If you've fixed a bug or added code that should be tested, please make sure to add tests
|
||||
- Ensure the following test suites are passing:
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
<img src="https://img.shields.io/npm/v/@strapi/strapi/latest.svg" alt="NPM Version" />
|
||||
</a>
|
||||
<a href="https://github.com/strapi/strapi/actions/workflows/tests.yml">
|
||||
<img src="https://github.com/strapi/strapi/actions/workflows/tests.yml/badge.svg?branch=master" alt="Tests" />
|
||||
<img src="https://github.com/strapi/strapi/actions/workflows/tests.yml/badge.svg?branch=main" alt="Tests" />
|
||||
</a>
|
||||
<a href="https://discord.strapi.io">
|
||||
<img src="https://img.shields.io/discord/811989166782021633?label=Discord" alt="Strapi on Discord" />
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
[mysqld]
|
||||
collation-server=utf8_unicode_ci
|
||||
character-set-server=utf8
|
||||
@ -1,7 +1,6 @@
|
||||
comment:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
- main
|
||||
|
||||
github_checks:
|
||||
annotations: false
|
||||
|
||||
20
docs/.gitignore
vendored
Normal file
20
docs/.gitignore
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
# Dependencies
|
||||
/node_modules
|
||||
|
||||
# Production
|
||||
/build
|
||||
|
||||
# Generated files
|
||||
.docusaurus
|
||||
.cache-loader
|
||||
|
||||
# Misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
27
docs/README.md
Normal file
27
docs/README.md
Normal file
@ -0,0 +1,27 @@
|
||||
# Docs
|
||||
|
||||
This is the technical documentation of the project. If you want to contribute to Strapi you are in the right place 🚀.
|
||||
|
||||
> If you are looking for the official Strapi document it is available [here](https://docs.strapi.io)
|
||||
|
||||
### Installation
|
||||
|
||||
```
|
||||
$ yarn
|
||||
```
|
||||
|
||||
### Local Development
|
||||
|
||||
```
|
||||
$ yarn start
|
||||
```
|
||||
|
||||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
|
||||
|
||||
### Build
|
||||
|
||||
```
|
||||
$ yarn build
|
||||
```
|
||||
|
||||
This command generates static content into the `build` directory and can be served using any static contents hosting service.
|
||||
3
docs/babel.config.js
Normal file
3
docs/babel.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
|
||||
};
|
||||
1
docs/docs/api/index.md
Normal file
1
docs/docs/api/index.md
Normal file
@ -0,0 +1 @@
|
||||
# API
|
||||
6
docs/docs/index.md
Normal file
6
docs/docs/index.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
sidebar_label: Intro
|
||||
---
|
||||
|
||||
# Index
|
||||
76
docs/docusaurus.config.js
Normal file
76
docs/docusaurus.config.js
Normal file
@ -0,0 +1,76 @@
|
||||
// @ts-check
|
||||
// Note: type annotations allow type checking and IDEs autocompletion
|
||||
|
||||
const lightCodeTheme = require('prism-react-renderer/themes/github');
|
||||
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
|
||||
|
||||
/** @type {import('@docusaurus/types').Config} */
|
||||
const config = {
|
||||
title: 'Doc',
|
||||
tagline: 'Dinosaurs are cool',
|
||||
url: 'https://your-docusaurus-test-site.com',
|
||||
baseUrl: '/',
|
||||
onBrokenLinks: 'throw',
|
||||
onBrokenMarkdownLinks: 'warn',
|
||||
favicon: 'img/favicon.ico',
|
||||
organizationName: 'strapi',
|
||||
projectName: 'strapi',
|
||||
|
||||
// Even if you don't use internalization, you can use this field to set useful
|
||||
// metadata like html lang. For example, if your site is Chinese, you may want
|
||||
// to replace "en" with "zh-Hans".
|
||||
i18n: {
|
||||
defaultLocale: 'en',
|
||||
locales: ['en'],
|
||||
},
|
||||
plugins: [],
|
||||
presets: [
|
||||
[
|
||||
'classic',
|
||||
/** @type {import('@docusaurus/preset-classic').Options} */
|
||||
{
|
||||
docs: {
|
||||
routeBasePath: '/',
|
||||
sidebarPath: require.resolve('./sidebars.js'),
|
||||
// editUrl: 'https://github.com/strapi/strapi/tree/main/docs//docs',
|
||||
},
|
||||
blog: false,
|
||||
},
|
||||
],
|
||||
],
|
||||
|
||||
themeConfig:
|
||||
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
|
||||
{
|
||||
navbar: {
|
||||
// title: 'Doc',
|
||||
hideOnScroll: true,
|
||||
logo: {
|
||||
alt: 'Doc',
|
||||
src: 'img/logo.svg',
|
||||
srcDark: 'img/logo_dark.svg',
|
||||
width: 100,
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: 'doc',
|
||||
position: 'left',
|
||||
docId: 'index',
|
||||
label: 'Docs',
|
||||
},
|
||||
{
|
||||
type: 'docSidebar',
|
||||
position: 'left',
|
||||
sidebarId: 'api',
|
||||
label: 'API',
|
||||
},
|
||||
],
|
||||
},
|
||||
prism: {
|
||||
theme: lightCodeTheme,
|
||||
darkTheme: darkCodeTheme,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
40
docs/package.json
Normal file
40
docs/package.json
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "docs",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
"start": "docusaurus start",
|
||||
"build": "docusaurus build",
|
||||
"swizzle": "docusaurus swizzle",
|
||||
"deploy": "docusaurus deploy",
|
||||
"clear": "docusaurus clear",
|
||||
"serve": "docusaurus serve",
|
||||
"write-translations": "docusaurus write-translations",
|
||||
"write-heading-ids": "docusaurus write-heading-ids"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.21",
|
||||
"@docusaurus/preset-classic": "2.0.0-beta.21",
|
||||
"@mdx-js/react": "^1.6.22",
|
||||
"clsx": "^1.1.1",
|
||||
"prism-react-renderer": "^1.3.3",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "2.0.0-beta.21"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.5%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
||||
21
docs/sidebars.js
Normal file
21
docs/sidebars.js
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Creating a sidebar enables you to:
|
||||
- create an ordered group of docs
|
||||
- render a sidebar for each doc of that group
|
||||
- provide next/previous navigation
|
||||
|
||||
The sidebars can be generated from the filesystem, or explicitly defined here.
|
||||
|
||||
Create as many sidebars as you want.
|
||||
*/
|
||||
|
||||
// @ts-check
|
||||
|
||||
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
||||
const sidebars = {
|
||||
// By default, Docusaurus generates a sidebar from the docs folder structure
|
||||
docs: ['index'],
|
||||
api: [{ type: 'autogenerated', dirName: 'api' }],
|
||||
};
|
||||
|
||||
module.exports = sidebars;
|
||||
0
docs/static/.nojekyll
vendored
Normal file
0
docs/static/.nojekyll
vendored
Normal file
7
docs/static/img/logo.svg
vendored
Normal file
7
docs/static/img/logo.svg
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 119 31">
|
||||
<defs/>
|
||||
<path fill="#8E75FF" fill-rule="evenodd" d="M25.979 4.727H8.751v8.638h8.477c.302 0 .547.245.547.547v8.36h8.751V5.275a.547.547 0 00-.547-.548z" clip-rule="evenodd"/>
|
||||
<path fill="#8E75FF" fill-rule="evenodd" d="M8.75 4.727v8.638H.668a.274.274 0 01-.192-.469L8.75 4.727zM18.241 30.45a.274.274 0 01-.466-.195v-7.983h8.751l-8.285 8.177z" clip-rule="evenodd" opacity=".405"/>
|
||||
<path fill="#8E75FF" d="M8.75 13.365h8.752c.15 0 .273.122.273.273v8.634H9.298a.547.547 0 01-.547-.547v-8.36z" opacity=".405"/>
|
||||
<path fill="#1d1b84" fill-rule="evenodd" d="M114.771 4.182c.489.484 1.066.725 1.732.725.687 0 1.275-.241 1.764-.725.489-.484.733-1.054.733-1.713 0-.658-.244-1.234-.733-1.728A2.393 2.393 0 00116.503 0c-.666 0-1.243.247-1.732.74-.489.495-.733 1.07-.733 1.73 0 .658.244 1.228.733 1.712zm-53.06 6.312c0 .05-.042.092-.093.092h-3.435v6.42c0 .535.136.926.406 1.173s.666.385 1.186.416c.476.029 1.056.027 1.741-.005l.097-.005a.092.092 0 01.097.092v3.431a.092.092 0 01-.082.092l-.063.007c-2.69.283-4.593.02-5.707-.788-1.134-.823-1.7-2.294-1.7-4.413v-6.42h-2.624a.092.092 0 01-.092-.092V6.851c0-.05.041-.092.092-.092h2.623V4.212c0-.074.044-.14.111-.17l3.786-1.647a.092.092 0 01.13.084v4.28h3.434c.05 0 .092.041.092.092v3.643zm7.3-1.08c.374-.988.993-1.729 1.856-2.223a5.65 5.65 0 012.794-.74c.051 0 .093.041.093.093v4.185a.15.15 0 01-.165.149c-1.161-.104-2.204.149-3.128.758-.967.637-1.45 1.697-1.45 3.179v7.284a.092.092 0 01-.093.092h-3.842a.092.092 0 01-.092-.092V6.85c0-.05.041-.092.092-.092h3.842c.05 0 .092.041.092.092v2.562zm19.036-2.655a.092.092 0 00-.093.092v1.73c-1.206-1.503-2.902-2.254-5.087-2.254-2.08 0-3.865.787-5.352 2.361-1.488 1.574-2.232 3.503-2.232 5.787s.744 4.213 2.232 5.787c1.487 1.574 3.272 2.361 5.352 2.361 2.185 0 3.88-.751 5.087-2.253v1.729c0 .05.042.092.093.092h3.841c.051 0 .093-.041.093-.092V6.85a.092.092 0 00-.093-.092h-3.841zm-7.52 10.864c.811.803 1.84 1.204 3.09 1.204 1.248 0 2.283-.407 3.105-1.22.822-.812 1.232-1.856 1.232-3.132s-.41-2.32-1.232-3.133c-.822-.812-1.857-1.219-3.106-1.219-1.248 0-2.278.407-3.09 1.22-.81.812-1.217 1.856-1.217 3.132s.406 2.325 1.218 3.148zm29.35-8.935c-1.488-1.574-3.283-2.361-5.384-2.361-2.185 0-3.87.751-5.056 2.253V6.851a.092.092 0 00-.092-.092h-3.842a.092.092 0 00-.092.092v21.42c0 .051.041.093.092.093h3.842c.05 0 .092-.042.092-.093V20.37c1.186 1.502 2.871 2.253 5.056 2.253 2.101 0 3.896-.787 5.384-2.361 1.487-1.574 2.231-3.503 2.231-5.787s-.744-4.213-2.231-5.787zm-9.223 8.935c.812.803 1.841 1.204 3.09 1.204 1.248 0 2.283-.407 3.105-1.22.822-.812 1.233-1.856 1.233-3.132s-.411-2.32-1.233-3.133c-.822-.812-1.857-1.219-3.105-1.219-1.249 0-2.278.407-3.09 1.22-.811.812-1.217 1.856-1.217 3.132s.406 2.325 1.217 3.148zm13.944 4.568a.092.092 0 01-.092-.092V6.85c0-.05.041-.092.092-.092h3.842c.051 0 .092.041.092.092V22.1a.092.092 0 01-.092.092h-3.842zM42.813 12.145c-.552-.257-.827-.592-.827-1.003 0-.391.171-.7.515-.926.343-.226.775-.34 1.295-.34.997 0 1.75.385 2.26 1.154a.133.133 0 00.163.05l3.398-1.487a.092.092 0 00.042-.13 8.523 8.523 0 00-.12-.194c-.581-.905-1.334-1.58-2.279-2.093-1.04-.566-2.195-.849-3.464-.849-1.686 0-3.095.437-4.23 1.312-1.133.874-1.7 2.073-1.7 3.595 0 1.009.276 1.847.827 2.516a4.867 4.867 0 002.013 1.466c.79.308 1.581.566 2.372.771.79.206 1.462.438 2.013.695.551.257.827.591.827 1.003 0 .885-.718 1.327-2.153 1.327-1.367 0-2.314-.5-2.841-1.498a.185.185 0 00-.238-.087l-3.388 1.485a.092.092 0 00-.046.124l.038.077c1.184 2.34 3.342 3.51 6.475 3.51 1.789 0 3.282-.427 4.478-1.28 1.197-.855 1.795-2.074 1.795-3.658 0-1.05-.276-1.924-.827-2.624a4.6 4.6 0 00-2.013-1.496 20.991 20.991 0 00-2.372-.741c-.791-.196-1.462-.422-2.013-.68z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.7 KiB |
7
docs/static/img/logo_dark.svg
vendored
Normal file
7
docs/static/img/logo_dark.svg
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 119 31">
|
||||
<defs/>
|
||||
<path fill="#8E75FF" fill-rule="evenodd" d="M25.979 4.727H8.751v8.638h8.477c.302 0 .547.245.547.547v8.36h8.751V5.275a.547.547 0 00-.547-.548z" clip-rule="evenodd"/>
|
||||
<path fill="#8E75FF" fill-rule="evenodd" d="M8.75 4.727v8.638H.668a.274.274 0 01-.192-.469L8.75 4.727zM18.241 30.45a.274.274 0 01-.466-.195v-7.983h8.751l-8.285 8.177z" clip-rule="evenodd" opacity=".405"/>
|
||||
<path fill="#8E75FF" d="M8.75 13.365h8.752c.15 0 .273.122.273.273v8.634H9.298a.547.547 0 01-.547-.547v-8.36z" opacity=".405"/>
|
||||
<path fill="#fff" fill-rule="evenodd" d="M114.771 4.182c.489.484 1.066.725 1.732.725.687 0 1.275-.241 1.764-.725.489-.484.733-1.054.733-1.713 0-.658-.244-1.234-.733-1.728A2.393 2.393 0 00116.503 0c-.666 0-1.243.247-1.732.74-.489.495-.733 1.07-.733 1.73 0 .658.244 1.228.733 1.712zm-53.06 6.312c0 .05-.042.092-.093.092h-3.435v6.42c0 .535.136.926.406 1.173s.666.385 1.186.416c.476.029 1.056.027 1.741-.005l.097-.005a.092.092 0 01.097.092v3.431a.092.092 0 01-.082.092l-.063.007c-2.69.283-4.593.02-5.707-.788-1.134-.823-1.7-2.294-1.7-4.413v-6.42h-2.624a.092.092 0 01-.092-.092V6.851c0-.05.041-.092.092-.092h2.623V4.212c0-.074.044-.14.111-.17l3.786-1.647a.092.092 0 01.13.084v4.28h3.434c.05 0 .092.041.092.092v3.643zm7.3-1.08c.374-.988.993-1.729 1.856-2.223a5.65 5.65 0 012.794-.74c.051 0 .093.041.093.093v4.185a.15.15 0 01-.165.149c-1.161-.104-2.204.149-3.128.758-.967.637-1.45 1.697-1.45 3.179v7.284a.092.092 0 01-.093.092h-3.842a.092.092 0 01-.092-.092V6.85c0-.05.041-.092.092-.092h3.842c.05 0 .092.041.092.092v2.562zm19.036-2.655a.092.092 0 00-.093.092v1.73c-1.206-1.503-2.902-2.254-5.087-2.254-2.08 0-3.865.787-5.352 2.361-1.488 1.574-2.232 3.503-2.232 5.787s.744 4.213 2.232 5.787c1.487 1.574 3.272 2.361 5.352 2.361 2.185 0 3.88-.751 5.087-2.253v1.729c0 .05.042.092.093.092h3.841c.051 0 .093-.041.093-.092V6.85a.092.092 0 00-.093-.092h-3.841zm-7.52 10.864c.811.803 1.84 1.204 3.09 1.204 1.248 0 2.283-.407 3.105-1.22.822-.812 1.232-1.856 1.232-3.132s-.41-2.32-1.232-3.133c-.822-.812-1.857-1.219-3.106-1.219-1.248 0-2.278.407-3.09 1.22-.81.812-1.217 1.856-1.217 3.132s.406 2.325 1.218 3.148zm29.35-8.935c-1.488-1.574-3.283-2.361-5.384-2.361-2.185 0-3.87.751-5.056 2.253V6.851a.092.092 0 00-.092-.092h-3.842a.092.092 0 00-.092.092v21.42c0 .051.041.093.092.093h3.842c.05 0 .092-.042.092-.093V20.37c1.186 1.502 2.871 2.253 5.056 2.253 2.101 0 3.896-.787 5.384-2.361 1.487-1.574 2.231-3.503 2.231-5.787s-.744-4.213-2.231-5.787zm-9.223 8.935c.812.803 1.841 1.204 3.09 1.204 1.248 0 2.283-.407 3.105-1.22.822-.812 1.233-1.856 1.233-3.132s-.411-2.32-1.233-3.133c-.822-.812-1.857-1.219-3.105-1.219-1.249 0-2.278.407-3.09 1.22-.811.812-1.217 1.856-1.217 3.132s.406 2.325 1.217 3.148zm13.944 4.568a.092.092 0 01-.092-.092V6.85c0-.05.041-.092.092-.092h3.842c.051 0 .092.041.092.092V22.1a.092.092 0 01-.092.092h-3.842zM42.813 12.145c-.552-.257-.827-.592-.827-1.003 0-.391.171-.7.515-.926.343-.226.775-.34 1.295-.34.997 0 1.75.385 2.26 1.154a.133.133 0 00.163.05l3.398-1.487a.092.092 0 00.042-.13 8.523 8.523 0 00-.12-.194c-.581-.905-1.334-1.58-2.279-2.093-1.04-.566-2.195-.849-3.464-.849-1.686 0-3.095.437-4.23 1.312-1.133.874-1.7 2.073-1.7 3.595 0 1.009.276 1.847.827 2.516a4.867 4.867 0 002.013 1.466c.79.308 1.581.566 2.372.771.79.206 1.462.438 2.013.695.551.257.827.591.827 1.003 0 .885-.718 1.327-2.153 1.327-1.367 0-2.314-.5-2.841-1.498a.185.185 0 00-.238-.087l-3.388 1.485a.092.092 0 00-.046.124l.038.077c1.184 2.34 3.342 3.51 6.475 3.51 1.789 0 3.282-.427 4.478-1.28 1.197-.855 1.795-2.074 1.795-3.658 0-1.05-.276-1.924-.827-2.624a4.6 4.6 0 00-2.013-1.496 20.991 20.991 0 00-2.372-.741c-.791-.196-1.462-.422-2.013-.68z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.6 KiB |
7509
docs/yarn.lock
Normal file
7509
docs/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,61 +0,0 @@
|
||||
{
|
||||
"sourceType": "unambiguous",
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"shippedProposals": true,
|
||||
"loose": true
|
||||
}
|
||||
],
|
||||
"@babel/preset-typescript"
|
||||
],
|
||||
"plugins": [
|
||||
"@babel/plugin-transform-shorthand-properties",
|
||||
"@babel/plugin-transform-block-scoping",
|
||||
[
|
||||
"@babel/plugin-proposal-decorators",
|
||||
{
|
||||
"legacy": true
|
||||
}
|
||||
],
|
||||
[
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
{
|
||||
"loose": true
|
||||
}
|
||||
],
|
||||
[
|
||||
"@babel/plugin-proposal-private-methods",
|
||||
{
|
||||
"loose": true
|
||||
}
|
||||
],
|
||||
"@babel/plugin-proposal-export-default-from",
|
||||
"@babel/plugin-syntax-dynamic-import",
|
||||
[
|
||||
"@babel/plugin-proposal-object-rest-spread",
|
||||
{
|
||||
"loose": true,
|
||||
"useBuiltIns": true
|
||||
}
|
||||
],
|
||||
"@babel/plugin-transform-classes",
|
||||
"@babel/plugin-transform-arrow-functions",
|
||||
"@babel/plugin-transform-parameters",
|
||||
"@babel/plugin-transform-destructuring",
|
||||
"@babel/plugin-transform-spread",
|
||||
"@babel/plugin-transform-for-of",
|
||||
"babel-plugin-macros",
|
||||
"@babel/plugin-proposal-optional-chaining",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator",
|
||||
[
|
||||
"babel-plugin-polyfill-corejs3",
|
||||
{
|
||||
"method": "usage-global",
|
||||
"absoluteImports": "core-js",
|
||||
"version": "3.21.1"
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
module.exports = {
|
||||
stories: [
|
||||
'../*.stories.mdx',
|
||||
'../../../packages/core/**/admin/src/**/*.stories.mdx',
|
||||
'../../../packages/core/**/admin/src/**/*.stories.@(js|jsx|ts|tsx)',
|
||||
'../../../packages/plugins/**/admin/src/**/*.stories.mdx',
|
||||
'../../../packages/plugins/**/admin/src/**/*.stories.@(js|jsx|ts|tsx)',
|
||||
],
|
||||
addons: [
|
||||
'@storybook/addon-links',
|
||||
'@storybook/addon-essentials',
|
||||
'@storybook/addon-interactions',
|
||||
],
|
||||
framework: '@storybook/react',
|
||||
};
|
||||
@ -1,27 +0,0 @@
|
||||
import { ThemeProvider, lightTheme } from '@strapi/design-system';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
|
||||
export const parameters = {
|
||||
actions: { argTypesRegex: '^on[A-Z].*' },
|
||||
controls: {
|
||||
matchers: {
|
||||
color: /(background|color)$/i,
|
||||
date: /Date$/,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const decorators = [
|
||||
Story => (
|
||||
<MemoryRouter>
|
||||
<ThemeProvider theme={lightTheme}>
|
||||
<IntlProvider messages={{}} textComponent="span" locale="en">
|
||||
<main>
|
||||
<Story />
|
||||
</main>
|
||||
</IntlProvider>
|
||||
</ThemeProvider>
|
||||
</MemoryRouter>
|
||||
),
|
||||
];
|
||||
@ -1,9 +0,0 @@
|
||||
import { Meta } from '@storybook/addon-docs';
|
||||
|
||||
<Meta title="Introduction" />
|
||||
|
||||
# Welcome to the documentation
|
||||
|
||||
Use this app to develop local components in plugins.
|
||||
|
||||
To do so just create a story in your plugins `./admin/src` folder
|
||||
@ -1,42 +0,0 @@
|
||||
{
|
||||
"name": "admin-development",
|
||||
"version": "4.3.2",
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.18.10",
|
||||
"@babel/plugin-proposal-class-properties": "7.16.7",
|
||||
"@babel/plugin-proposal-decorators": "7.16.7",
|
||||
"@babel/plugin-proposal-export-default-from": "7.16.7",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator": "7.16.7",
|
||||
"@babel/plugin-proposal-object-rest-spread": "7.16.7",
|
||||
"@babel/plugin-proposal-optional-chaining": "7.18.9",
|
||||
"@babel/plugin-proposal-private-methods": "7.16.7",
|
||||
"@babel/plugin-syntax-dynamic-import": "7.8.3",
|
||||
"@babel/plugin-transform-arrow-functions": "7.16.7",
|
||||
"@babel/plugin-transform-block-scoping": "7.16.7",
|
||||
"@babel/plugin-transform-classes": "7.16.7",
|
||||
"@babel/plugin-transform-destructuring": "7.17.7",
|
||||
"@babel/plugin-transform-for-of": "7.16.7",
|
||||
"@babel/plugin-transform-parameters": "7.16.7",
|
||||
"@babel/plugin-transform-shorthand-properties": "7.16.7",
|
||||
"@babel/plugin-transform-spread": "7.16.7",
|
||||
"@babel/preset-env": "7.18.10",
|
||||
"@babel/preset-typescript": "7.16.7",
|
||||
"@storybook/addon-actions": "6.4.10",
|
||||
"@storybook/addon-essentials": "6.4.10",
|
||||
"@storybook/addon-interactions": "6.4.10",
|
||||
"@storybook/addon-links": "6.4.10",
|
||||
"@storybook/react": "^6.3.7",
|
||||
"@storybook/testing-library": "^0.0.9",
|
||||
"babel-loader": "^8.2.4",
|
||||
"babel-plugin-macros": "3.1.0",
|
||||
"babel-plugin-polyfill-corejs3": "0.5.2",
|
||||
"core-js": "3.21.1"
|
||||
},
|
||||
"scripts": {
|
||||
"storybook": "start-storybook -p 6007",
|
||||
"build-storybook": "build-storybook"
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
'404': async (/* ctx */) => {
|
||||
404: async (/* ctx */) => {
|
||||
// return ctx.notFound('My custom message 404');
|
||||
},
|
||||
};
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "getstarted",
|
||||
"private": true,
|
||||
"version": "4.3.2",
|
||||
"version": "4.3.4",
|
||||
"description": "A Strapi application.",
|
||||
"scripts": {
|
||||
"develop": "strapi develop",
|
||||
@ -12,17 +12,15 @@
|
||||
"strapi": "strapi"
|
||||
},
|
||||
"dependencies": {
|
||||
"@strapi/admin": "4.3.2",
|
||||
"@strapi/plugin-documentation": "4.3.2",
|
||||
"@strapi/plugin-graphql": "4.3.2",
|
||||
"@strapi/plugin-i18n": "4.3.2",
|
||||
"@strapi/plugin-sentry": "4.3.2",
|
||||
"@strapi/plugin-users-permissions": "4.3.2",
|
||||
"@strapi/provider-email-mailgun": "4.3.2",
|
||||
"@strapi/provider-upload-aws-s3": "4.3.2",
|
||||
"@strapi/provider-upload-cloudinary": "4.3.2",
|
||||
"@strapi/strapi": "4.3.2",
|
||||
"@strapi/utils": "4.3.2",
|
||||
"@strapi/plugin-documentation": "4.3.4",
|
||||
"@strapi/plugin-graphql": "4.3.4",
|
||||
"@strapi/plugin-i18n": "4.3.4",
|
||||
"@strapi/plugin-sentry": "4.3.4",
|
||||
"@strapi/plugin-users-permissions": "4.3.4",
|
||||
"@strapi/provider-email-mailgun": "4.3.4",
|
||||
"@strapi/provider-upload-aws-s3": "4.3.4",
|
||||
"@strapi/provider-upload-cloudinary": "4.3.4",
|
||||
"@strapi/strapi": "4.3.4",
|
||||
"@vscode/sqlite3": "5.0.8",
|
||||
"better-sqlite3": "7.4.6",
|
||||
"lodash": "4.17.21",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = options => {
|
||||
module.exports = (options) => {
|
||||
return (ctx, next) => {
|
||||
ctx.set('X-Strapi-Test', 'Address Middleware');
|
||||
return next();
|
||||
|
||||
@ -4,7 +4,7 @@ module.exports = createCoreService('api::address.address', {
|
||||
async find(...args) {
|
||||
const { results, pagination } = await super.find(...args);
|
||||
|
||||
results.forEach(result => {
|
||||
results.forEach((result) => {
|
||||
result.counter = 1;
|
||||
});
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
{
|
||||
"kind": "collectionType",
|
||||
"collectionName": "reviews",
|
||||
"info": {
|
||||
"displayName": "Review",
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
module.exports = plugin => {
|
||||
module.exports = (plugin) => {
|
||||
return plugin;
|
||||
};
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* `test-middleware` middleware.
|
||||
* `test-middleware` middleware
|
||||
*/
|
||||
|
||||
module.exports = (config, { strapi }) => {
|
||||
|
||||
@ -29,7 +29,7 @@ export default {
|
||||
bootstrap() {},
|
||||
async registerTrads({ locales }) {
|
||||
const importedTrads = await Promise.all(
|
||||
locales.map(locale => {
|
||||
locales.map((locale) => {
|
||||
return import(
|
||||
/* webpackChunkName: "[pluginId]-[request]" */ `./translations/${locale}.json`
|
||||
)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import pluginId from '../pluginId';
|
||||
|
||||
const getTrad = id => `${pluginId}.${id}`;
|
||||
const getTrad = (id) => `${pluginId}.${id}`;
|
||||
|
||||
export default getTrad;
|
||||
|
||||
@ -4,7 +4,7 @@ module.exports = {
|
||||
default: {
|
||||
testConf: 1,
|
||||
},
|
||||
validator: config => {
|
||||
validator: (config) => {
|
||||
if (typeof config.testConf !== 'number') {
|
||||
throw new Error('testConfig has to be a number');
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* `test-policy` policy.
|
||||
* `test-policy` policy
|
||||
*/
|
||||
|
||||
module.exports = (policyCtx, config, { strapi }) => {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "kitchensink-ts",
|
||||
"private": true,
|
||||
"version": "4.3.2",
|
||||
"version": "4.3.4",
|
||||
"description": "A Strapi application",
|
||||
"scripts": {
|
||||
"develop": "strapi develop",
|
||||
@ -10,9 +10,9 @@
|
||||
"strapi": "strapi"
|
||||
},
|
||||
"dependencies": {
|
||||
"@strapi/plugin-i18n": "4.1.12",
|
||||
"@strapi/plugin-users-permissions": "4.1.12",
|
||||
"@strapi/strapi": "4.2.2",
|
||||
"@strapi/plugin-i18n": "4.3.4",
|
||||
"@strapi/plugin-users-permissions": "4.3.4",
|
||||
"@strapi/strapi": "4.3.4",
|
||||
"better-sqlite3": "7.4.6"
|
||||
},
|
||||
"author": {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "kitchensink",
|
||||
"private": true,
|
||||
"version": "4.3.2",
|
||||
"version": "4.3.4",
|
||||
"description": "A Strapi application.",
|
||||
"scripts": {
|
||||
"develop": "strapi develop",
|
||||
@ -12,12 +12,10 @@
|
||||
"strapi": "strapi"
|
||||
},
|
||||
"dependencies": {
|
||||
"@strapi/admin": "4.3.2",
|
||||
"@strapi/provider-email-mailgun": "4.3.2",
|
||||
"@strapi/provider-upload-aws-s3": "4.3.2",
|
||||
"@strapi/provider-upload-cloudinary": "4.3.2",
|
||||
"@strapi/strapi": "4.3.2",
|
||||
"@strapi/utils": "4.3.2",
|
||||
"@strapi/provider-email-mailgun": "4.3.4",
|
||||
"@strapi/provider-upload-aws-s3": "4.3.4",
|
||||
"@strapi/provider-upload-cloudinary": "4.3.4",
|
||||
"@strapi/strapi": "4.3.4",
|
||||
"lodash": "4.17.21",
|
||||
"mysql": "2.18.1",
|
||||
"passport-google-oauth2": "0.2.0",
|
||||
|
||||
@ -2,8 +2,7 @@ import theme from './extensions/theme';
|
||||
|
||||
const config = {
|
||||
auth: {
|
||||
logo:
|
||||
'https://images.unsplash.com/photo-1593642634367-d91a135587b5?ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80',
|
||||
logo: 'https://images.unsplash.com/photo-1593642634367-d91a135587b5?ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80',
|
||||
},
|
||||
head: {
|
||||
favicon:
|
||||
@ -12,8 +11,7 @@ const config = {
|
||||
},
|
||||
locales: ['fr', 'de'],
|
||||
menu: {
|
||||
logo:
|
||||
'https://images.unsplash.com/photo-1593642634367-d91a135587b5?ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80',
|
||||
logo: 'https://images.unsplash.com/photo-1593642634367-d91a135587b5?ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80',
|
||||
},
|
||||
theme,
|
||||
translations: {
|
||||
@ -29,7 +27,7 @@ const config = {
|
||||
notifications: { release: false },
|
||||
};
|
||||
|
||||
const bootstrap = app => {
|
||||
const bootstrap = (app) => {
|
||||
console.log(app);
|
||||
};
|
||||
|
||||
|
||||
@ -2,8 +2,7 @@ import theme from './extensions/theme';
|
||||
|
||||
const config = {
|
||||
auth: {
|
||||
logo:
|
||||
'https://images.unsplash.com/photo-1593642634367-d91a135587b5?ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80',
|
||||
logo: 'https://images.unsplash.com/photo-1593642634367-d91a135587b5?ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80',
|
||||
},
|
||||
head: {
|
||||
favicon:
|
||||
@ -12,8 +11,7 @@ const config = {
|
||||
},
|
||||
locales: ['fr', 'de'],
|
||||
menu: {
|
||||
logo:
|
||||
'https://images.unsplash.com/photo-1593642634367-d91a135587b5?ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80',
|
||||
logo: 'https://images.unsplash.com/photo-1593642634367-d91a135587b5?ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80',
|
||||
},
|
||||
theme,
|
||||
translations: {
|
||||
@ -29,7 +27,7 @@ const config = {
|
||||
notifications: { release: false },
|
||||
};
|
||||
|
||||
const bootstrap = app => {
|
||||
const bootstrap = (app) => {
|
||||
console.log(app);
|
||||
};
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "4.3.2",
|
||||
"version": "4.3.4",
|
||||
"packages": [
|
||||
"packages/*",
|
||||
"examples/*"
|
||||
|
||||
30
package.json
30
package.json
@ -67,37 +67,25 @@
|
||||
"eslint --fix"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/polyfill": "7.12.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc/core": "1.2.218",
|
||||
"@babel/core": "7.18.10",
|
||||
"@babel/eslint-parser": "7.18.9",
|
||||
"@babel/preset-react": "7.18.6",
|
||||
"@strapi/eslint-config": "0.1.1",
|
||||
"@swc/core": "1.2.224",
|
||||
"@swc/jest": "0.2.22",
|
||||
"@testing-library/react": "11.2.7",
|
||||
"@testing-library/react-hooks": "3.7.0",
|
||||
"@testing-library/user-event": "13.5.0",
|
||||
"axios-mock-adapter": "1.20.0",
|
||||
"babel-eslint": "10.1.0",
|
||||
"chalk": "4.1.2",
|
||||
"chokidar": "3.5.3",
|
||||
"cross-env": "7.0.3",
|
||||
"dotenv": "14.2.0",
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-airbnb": "18.2.1",
|
||||
"eslint-config-airbnb-base": "14.2.1",
|
||||
"eslint-config-prettier": "6.15.0",
|
||||
"eslint-plugin-import": "2.26.0",
|
||||
"eslint-plugin-jsdoc": "36.1.1",
|
||||
"eslint-plugin-jsx-a11y": "6.6.1",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-react": "7.30.1",
|
||||
"eslint-plugin-react-hooks": "4.6.0",
|
||||
"eslint-plugin-redux-saga": "1.3.2",
|
||||
"eslint": "8.21.0",
|
||||
"execa": "1.0.0",
|
||||
"fs-extra": "10.1.0",
|
||||
"get-port": "5.1.1",
|
||||
"glob": "7.2.3",
|
||||
"husky": "3.1.0",
|
||||
"inquirer": "8.2.4",
|
||||
"istanbul": "~0.4.2",
|
||||
"jest": "26.6.3",
|
||||
"jest-circus": "26.6.3",
|
||||
@ -106,13 +94,11 @@
|
||||
"lerna": "5.1.6",
|
||||
"lint-staged": "10.5.4",
|
||||
"lodash": "4.17.21",
|
||||
"msw": "0.42.3",
|
||||
"npm-run-all": "4.1.5",
|
||||
"nx": "14.4.2",
|
||||
"plop": "2.7.6",
|
||||
"prettier": "1.19.1",
|
||||
"prettier": "2.7.1",
|
||||
"qs": "6.11.0",
|
||||
"react-test-renderer": "17.0.2",
|
||||
"request": "2.88.2",
|
||||
"request-promise-native": "1.0.9",
|
||||
"rimraf": "3.0.2",
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
// eslint-disable-next-line node/no-extraneous-require
|
||||
const { combineReducers, createStore } = require('redux');
|
||||
|
||||
const reducers = {
|
||||
|
||||
@ -25,4 +25,4 @@ global.strapi = {
|
||||
|
||||
global.prompt = jest.fn();
|
||||
|
||||
global.URL.createObjectURL = file => `http://localhost:4000/assets/${file.name}`;
|
||||
global.URL.createObjectURL = (file) => `http://localhost:4000/assets/${file.name}`;
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
// needed for regenerator-runtime
|
||||
// (ES7 generator support is required by redux-saga)
|
||||
require('@babel/polyfill');
|
||||
|
||||
const noop = () => {};
|
||||
// eslint-disable-next-line no-undef
|
||||
Object.defineProperty(window, 'scrollTo', { value: noop, writable: true });
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strapi/admin-test-utils",
|
||||
"version": "4.3.2",
|
||||
"version": "4.3.4",
|
||||
"private": true,
|
||||
"description": "Test utilities for the Strapi administration panel",
|
||||
"license": "MIT",
|
||||
@ -17,12 +17,17 @@
|
||||
}
|
||||
],
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/polyfill": "7.12.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/jest-dom": "5.16.4",
|
||||
"jest-styled-components": "7.0.2"
|
||||
"@testing-library/jest-dom": "5.16.5",
|
||||
"jest-styled-components": "7.0.2",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-is": "^17.0.2",
|
||||
"styled-components": "5.3.3",
|
||||
"redux": "^4.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"redux": "^4.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
|
||||
@ -39,7 +39,7 @@ program
|
||||
.option('--template <templateurl>', 'Specify a Strapi template')
|
||||
.option('--ts, --typescript', 'Use TypeScript to generate the project')
|
||||
.description('create a new application')
|
||||
.action(directory => {
|
||||
.action((directory) => {
|
||||
initProject(directory, program);
|
||||
})
|
||||
.parse(process.argv);
|
||||
@ -62,7 +62,7 @@ async function initProject(projectName, program) {
|
||||
await checkInstallPath(resolve(projectName));
|
||||
}
|
||||
|
||||
const hasDatabaseOptions = databaseOptions.some(opt => program[opt]);
|
||||
const hasDatabaseOptions = databaseOptions.some((opt) => program[opt]);
|
||||
|
||||
if (program.quickstart && hasDatabaseOptions) {
|
||||
console.error(
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
require('./create-strapi-app');
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "create-strapi-app",
|
||||
"version": "4.3.2",
|
||||
"version": "4.3.4",
|
||||
"description": "Generate a new Strapi application.",
|
||||
"keywords": [
|
||||
"create-strapi-app",
|
||||
@ -38,7 +38,7 @@
|
||||
"test": "echo \"no tests yet\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@strapi/generate-new": "4.3.2",
|
||||
"@strapi/generate-new": "4.3.4",
|
||||
"commander": "6.1.0",
|
||||
"inquirer": "8.2.4"
|
||||
},
|
||||
|
||||
@ -57,7 +57,9 @@ function generateApp(projectArgs, programArgs) {
|
||||
}
|
||||
|
||||
async function initProject(projectArgs, program) {
|
||||
const hasIncompatibleQuickstartOptions = incompatibleQuickstartOptions.some(opt => program[opt]);
|
||||
const hasIncompatibleQuickstartOptions = incompatibleQuickstartOptions.some(
|
||||
(opt) => program[opt]
|
||||
);
|
||||
|
||||
if (program.quickstart && hasIncompatibleQuickstartOptions) {
|
||||
console.error(
|
||||
@ -96,7 +98,7 @@ async function initProject(projectArgs, program) {
|
||||
try {
|
||||
program.parse(process.argv);
|
||||
} catch (err) {
|
||||
if (err.exitCode && err.exitCode != 0) {
|
||||
if (err.exitCode && err.exitCode !== 0) {
|
||||
program.outputHelp();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
require('./create-strapi-starter');
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "create-strapi-starter",
|
||||
"version": "4.3.2",
|
||||
"version": "4.3.4",
|
||||
"description": "Generate a new Strapi application.",
|
||||
"keywords": [
|
||||
"create-strapi-starter",
|
||||
@ -38,9 +38,9 @@
|
||||
"test": "echo \"no tests yet\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@strapi/generate-new": "4.3.2",
|
||||
"@strapi/generate-new": "4.3.4",
|
||||
"chalk": "4.1.1",
|
||||
"ci-info": "3.1.1",
|
||||
"ci-info": "3.3.2",
|
||||
"commander": "7.1.0",
|
||||
"execa": "5.1.1",
|
||||
"fs-extra": "10.0.0",
|
||||
|
||||
@ -72,10 +72,7 @@ async function installWithLogs(path, options) {
|
||||
const installPrefix = chalk.yellow('Installing dependencies:');
|
||||
const loader = ora(installPrefix).start();
|
||||
const logInstall = (chunk = '') => {
|
||||
loader.text = `${installPrefix} ${chunk
|
||||
.toString()
|
||||
.split('\n')
|
||||
.join(' ')}`;
|
||||
loader.text = `${installPrefix} ${chunk.toString().split('\n').join(' ')}`;
|
||||
};
|
||||
|
||||
const runner = runInstall(path, options);
|
||||
@ -94,7 +91,7 @@ async function installWithLogs(path, options) {
|
||||
* @param {boolean} options.useYarn Use yarn instead of npm
|
||||
*/
|
||||
async function getStarterInfo(starter, { useYarn } = {}) {
|
||||
const isLocalStarter = ['./', '../', '/'].some(filePrefix => starter.startsWith(filePrefix));
|
||||
const isLocalStarter = ['./', '../', '/'].some((filePrefix) => starter.startsWith(filePrefix));
|
||||
|
||||
let starterPath;
|
||||
let starterParentPath;
|
||||
@ -125,12 +122,8 @@ async function getStarterInfo(starter, { useYarn } = {}) {
|
||||
*/
|
||||
module.exports = async function buildStarter({ projectName, starter }, program) {
|
||||
const hasYarnInstalled = await hasYarn();
|
||||
const {
|
||||
isLocalStarter,
|
||||
starterPath,
|
||||
starterParentPath,
|
||||
starterPackageInfo,
|
||||
} = await getStarterInfo(starter, { useYarn: hasYarnInstalled });
|
||||
const { isLocalStarter, starterPath, starterParentPath, starterPackageInfo } =
|
||||
await getStarterInfo(starter, { useYarn: hasYarnInstalled });
|
||||
|
||||
// Project directory
|
||||
const rootPath = resolve(projectName);
|
||||
|
||||
@ -27,12 +27,11 @@ function runApp(rootPath, { useYarn } = {}) {
|
||||
stdio: 'inherit',
|
||||
cwd: rootPath,
|
||||
});
|
||||
} else {
|
||||
return execa('npm', ['run', 'develop'], {
|
||||
stdio: 'inherit',
|
||||
cwd: rootPath,
|
||||
});
|
||||
}
|
||||
return execa('npm', ['run', 'develop'], {
|
||||
stdio: 'inherit',
|
||||
cwd: rootPath,
|
||||
});
|
||||
}
|
||||
|
||||
async function initGit(rootPath) {
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const logger = require('./logger');
|
||||
|
||||
module.exports = function stopProcess(message) {
|
||||
|
||||
@ -61,15 +61,15 @@ class StrapiApp {
|
||||
};
|
||||
}
|
||||
|
||||
addComponents = components => {
|
||||
addComponents = (components) => {
|
||||
if (Array.isArray(components)) {
|
||||
components.map(compo => this.library.components.add(compo));
|
||||
components.map((compo) => this.library.components.add(compo));
|
||||
} else {
|
||||
this.library.components.add(components);
|
||||
}
|
||||
};
|
||||
|
||||
addCorePluginMenuLink = link => {
|
||||
addCorePluginMenuLink = (link) => {
|
||||
const stringifiedLink = JSON.stringify(link);
|
||||
|
||||
invariant(link.to, `link.to should be defined for ${stringifiedLink}`);
|
||||
@ -89,15 +89,15 @@ class StrapiApp {
|
||||
this.menu.push(link);
|
||||
};
|
||||
|
||||
addFields = fields => {
|
||||
addFields = (fields) => {
|
||||
if (Array.isArray(fields)) {
|
||||
fields.map(field => this.library.fields.add(field));
|
||||
fields.map((field) => this.library.fields.add(field));
|
||||
} else {
|
||||
this.library.fields.add(fields);
|
||||
}
|
||||
};
|
||||
|
||||
addMenuLink = link => {
|
||||
addMenuLink = (link) => {
|
||||
const stringifiedLink = JSON.stringify(link);
|
||||
|
||||
invariant(link.to, `link.to should be defined for ${stringifiedLink}`);
|
||||
@ -121,14 +121,14 @@ class StrapiApp {
|
||||
this.menu.push(link);
|
||||
};
|
||||
|
||||
addMiddlewares = middlewares => {
|
||||
middlewares.forEach(middleware => {
|
||||
addMiddlewares = (middlewares) => {
|
||||
middlewares.forEach((middleware) => {
|
||||
this.middlewares.add(middleware);
|
||||
});
|
||||
};
|
||||
|
||||
addReducers = reducers => {
|
||||
Object.keys(reducers).forEach(reducerName => {
|
||||
addReducers = (reducers) => {
|
||||
Object.keys(reducers).forEach((reducerName) => {
|
||||
this.reducers.add(reducerName, reducers[reducerName]);
|
||||
});
|
||||
};
|
||||
@ -156,13 +156,13 @@ class StrapiApp {
|
||||
invariant(this.settings[sectionId], 'The section does not exist');
|
||||
invariant(Array.isArray(links), 'TypeError expected links to be an array');
|
||||
|
||||
links.forEach(link => {
|
||||
links.forEach((link) => {
|
||||
this.addSettingsLink(sectionId, link);
|
||||
});
|
||||
};
|
||||
|
||||
async bootstrap() {
|
||||
Object.keys(this.appPlugins).forEach(plugin => {
|
||||
Object.keys(this.appPlugins).forEach((plugin) => {
|
||||
const bootstrap = this.appPlugins[plugin].bootstrap;
|
||||
|
||||
if (bootstrap) {
|
||||
@ -208,7 +208,7 @@ class StrapiApp {
|
||||
if (this.customConfigurations?.locales) {
|
||||
this.configurations.locales = [
|
||||
'en',
|
||||
...this.customConfigurations.locales?.filter(loc => loc !== 'en'),
|
||||
...(this.customConfigurations.locales?.filter((loc) => loc !== 'en') || []),
|
||||
];
|
||||
}
|
||||
|
||||
@ -237,7 +237,7 @@ class StrapiApp {
|
||||
}
|
||||
};
|
||||
|
||||
createHook = name => {
|
||||
createHook = (name) => {
|
||||
this.hooksDict[name] = createHook();
|
||||
};
|
||||
|
||||
@ -253,7 +253,7 @@ class StrapiApp {
|
||||
|
||||
this.settings[section.id] = { ...section, links: [] };
|
||||
|
||||
links.forEach(link => {
|
||||
links.forEach((link) => {
|
||||
this.addSettingsLink(section.id, link);
|
||||
});
|
||||
};
|
||||
@ -274,12 +274,12 @@ class StrapiApp {
|
||||
}
|
||||
};
|
||||
|
||||
getPlugin = pluginId => {
|
||||
getPlugin = (pluginId) => {
|
||||
return this.plugins[pluginId];
|
||||
};
|
||||
|
||||
async initialize() {
|
||||
Object.keys(this.appPlugins).forEach(plugin => {
|
||||
Object.keys(this.appPlugins).forEach((plugin) => {
|
||||
this.appPlugins[plugin].register({
|
||||
addComponents: this.addComponents,
|
||||
addCorePluginMenuLink: this.addCorePluginMenuLink,
|
||||
@ -319,7 +319,7 @@ class StrapiApp {
|
||||
* @returns {Object} The imported admin translations
|
||||
*/
|
||||
async loadAdminTrads() {
|
||||
const arrayOfPromises = this.configurations.locales.map(locale => {
|
||||
const arrayOfPromises = this.configurations.locales.map((locale) => {
|
||||
return import(/* webpackChunkName: "[request]" */ `./translations/${locale}.json`)
|
||||
.then(({ default: data }) => {
|
||||
return { data, locale };
|
||||
@ -350,7 +350,7 @@ class StrapiApp {
|
||||
const adminTranslations = await this.loadAdminTrads();
|
||||
|
||||
const arrayOfPromises = Object.keys(this.appPlugins)
|
||||
.map(plugin => {
|
||||
.map((plugin) => {
|
||||
const registerTrads = this.appPlugins[plugin].registerTrads;
|
||||
|
||||
if (registerTrads) {
|
||||
@ -359,7 +359,7 @@ class StrapiApp {
|
||||
|
||||
return null;
|
||||
})
|
||||
.filter(a => a);
|
||||
.filter((a) => a);
|
||||
|
||||
const pluginsTrads = await Promise.all(arrayOfPromises);
|
||||
const mergedTrads = pluginsTrads.reduce((acc, currentPluginTrads) => {
|
||||
@ -369,7 +369,7 @@ class StrapiApp {
|
||||
return acc1;
|
||||
}, {});
|
||||
|
||||
Object.keys(pluginTrads).forEach(locale => {
|
||||
Object.keys(pluginTrads).forEach((locale) => {
|
||||
acc[locale] = { ...acc[locale], ...pluginTrads[locale] };
|
||||
});
|
||||
|
||||
@ -399,7 +399,7 @@ class StrapiApp {
|
||||
this.hooksDict[name].register(fn);
|
||||
};
|
||||
|
||||
registerPlugin = pluginConf => {
|
||||
registerPlugin = (pluginConf) => {
|
||||
const plugin = Plugin(pluginConf);
|
||||
|
||||
this.plugins[plugin.pluginId] = plugin;
|
||||
@ -414,7 +414,7 @@ class StrapiApp {
|
||||
: this.hooksDict[name].runWaterfall(initialValue, store);
|
||||
};
|
||||
|
||||
runHookParallel = name => this.hooksDict[name].runParallel();
|
||||
runHookParallel = (name) => this.hooksDict[name].runParallel();
|
||||
|
||||
render() {
|
||||
const store = this.createStore();
|
||||
|
||||
@ -56,9 +56,10 @@ const AuthenticatedApp = () => {
|
||||
},
|
||||
]);
|
||||
|
||||
const shouldUpdateStrapi = useMemo(() => checkLatestStrapiVersion(strapiVersion, tag_name), [
|
||||
tag_name,
|
||||
]);
|
||||
const shouldUpdateStrapi = useMemo(
|
||||
() => checkLatestStrapiVersion(strapiVersion, tag_name),
|
||||
[tag_name]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (userRoles) {
|
||||
@ -77,6 +78,16 @@ const AuthenticatedApp = () => {
|
||||
|
||||
const shouldShowLoader = isLoading || shouldShowNotDependentQueriesLoader;
|
||||
|
||||
const appInfosValue = useMemo(() => {
|
||||
return {
|
||||
...appInfos,
|
||||
latestStrapiReleaseTag: tag_name,
|
||||
setUserDisplayName,
|
||||
shouldUpdateStrapi,
|
||||
userDisplayName,
|
||||
};
|
||||
}, [appInfos, tag_name, shouldUpdateStrapi, userDisplayName]);
|
||||
|
||||
if (shouldShowLoader) {
|
||||
return <LoadingIndicatorPage />;
|
||||
}
|
||||
@ -87,15 +98,7 @@ const AuthenticatedApp = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<AppInfosContext.Provider
|
||||
value={{
|
||||
...appInfos,
|
||||
latestStrapiReleaseTag: tag_name,
|
||||
setUserDisplayName,
|
||||
shouldUpdateStrapi,
|
||||
userDisplayName,
|
||||
}}
|
||||
>
|
||||
<AppInfosContext.Provider value={appInfosValue}>
|
||||
<RBACProvider permissions={permissions} refetchPermissions={refetch}>
|
||||
<PluginsInitializer />
|
||||
</RBACProvider>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { render, waitFor } from '@testing-library/react';
|
||||
import { QueryClientProvider, QueryClient } from 'react-query';
|
||||
import { useGuidedTour } from '@strapi/helper-plugin';
|
||||
@ -35,9 +36,19 @@ jest.mock('../utils/api', () => ({
|
||||
fetchUserRoles: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock('../../PluginsInitializer', () => () => <div>PluginsInitializer</div>);
|
||||
jest.mock('../../PluginsInitializer', () => () => {
|
||||
return <div>PluginsInitializer</div>;
|
||||
});
|
||||
// eslint-disable-next-line react/prop-types
|
||||
jest.mock('../../RBACProvider', () => ({ children }) => <div>{children}</div>);
|
||||
jest.mock('../../RBACProvider', () => {
|
||||
const Compo = ({ children }) => <div>{children}</div>;
|
||||
|
||||
Compo.propTypes = {
|
||||
children: PropTypes.node.isRequired,
|
||||
};
|
||||
|
||||
return Compo;
|
||||
});
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
@ -47,11 +58,13 @@ const queryClient = new QueryClient({
|
||||
},
|
||||
});
|
||||
|
||||
const app = (
|
||||
const configurationContextValue = { showReleaseNotification: false };
|
||||
|
||||
const App = () => (
|
||||
<ThemeToggleProvider themes={{ light: lightTheme, dark: darkTheme }}>
|
||||
<Theme>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<ConfigurationsContext.Provider value={{ showReleaseNotification: false }}>
|
||||
<ConfigurationsContext.Provider value={configurationContextValue}>
|
||||
<AuthenticatedApp />
|
||||
</ConfigurationsContext.Provider>
|
||||
</QueryClientProvider>
|
||||
@ -81,7 +94,7 @@ describe('Admin | components | AuthenticatedApp', () => {
|
||||
);
|
||||
fetchCurrentUserPermissions.mockImplementation(() => Promise.resolve([]));
|
||||
|
||||
const { container } = render(app);
|
||||
const { container } = render(<App />);
|
||||
|
||||
expect(container.firstChild).toMatchInlineSnapshot(`
|
||||
.c0 {
|
||||
@ -147,7 +160,7 @@ describe('Admin | components | AuthenticatedApp', () => {
|
||||
});
|
||||
|
||||
it('should not fetch the latest release', () => {
|
||||
render(app);
|
||||
render(<App />);
|
||||
|
||||
expect(fetchStrapiLatestRelease).not.toHaveBeenCalled();
|
||||
});
|
||||
@ -157,7 +170,7 @@ describe('Admin | components | AuthenticatedApp', () => {
|
||||
const setGuidedTourVisibility = jest.fn();
|
||||
useGuidedTour.mockImplementation(() => ({ setGuidedTourVisibility }));
|
||||
|
||||
render(app);
|
||||
render(<App />);
|
||||
|
||||
await waitFor(() => expect(setGuidedTourVisibility).not.toHaveBeenCalled());
|
||||
});
|
||||
@ -166,7 +179,7 @@ describe('Admin | components | AuthenticatedApp', () => {
|
||||
fetchUserRoles.mockImplementationOnce(() => [{ code: 'strapi-super-admin' }]);
|
||||
const setGuidedTourVisibility = jest.fn();
|
||||
useGuidedTour.mockImplementation(() => ({ setGuidedTourVisibility }));
|
||||
render(app);
|
||||
render(<App />);
|
||||
|
||||
await waitFor(() => expect(setGuidedTourVisibility).toHaveBeenCalledWith(true));
|
||||
});
|
||||
|
||||
@ -6,7 +6,7 @@ import packageJSON from '../../../../../package.json';
|
||||
const strapiVersion = packageJSON.version;
|
||||
const showUpdateNotif = !JSON.parse(localStorage.getItem('STRAPI_UPDATE_NOTIF'));
|
||||
|
||||
const fetchStrapiLatestRelease = async toggleNotification => {
|
||||
const fetchStrapiLatestRelease = async (toggleNotification) => {
|
||||
try {
|
||||
const {
|
||||
data: { tag_name },
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { AutoReloadOverlayBockerContext } from '@strapi/helper-plugin';
|
||||
import Blocker from './Blocker';
|
||||
@ -13,7 +13,7 @@ const AutoReloadOverlayBlockerProvider = ({ children }) => {
|
||||
const lockAppWithAutoreload = (config = undefined) => {
|
||||
setIsOpen(true);
|
||||
setConfig(config);
|
||||
setState(prev => ({ ...prev, start: Date.now() }));
|
||||
setState((prev) => ({ ...prev, start: Date.now() }));
|
||||
};
|
||||
|
||||
const unlockAppWithAutoreload = () => {
|
||||
@ -36,7 +36,7 @@ const AutoReloadOverlayBlockerProvider = ({ children }) => {
|
||||
return null;
|
||||
}
|
||||
|
||||
setState(prev => ({ ...prev, elapsed: Math.round(Date.now() - prev.start) / 1000 }));
|
||||
setState((prev) => ({ ...prev, elapsed: Math.round(Date.now() - prev.start) / 1000 }));
|
||||
|
||||
return null;
|
||||
}, 1000);
|
||||
@ -75,10 +75,12 @@ const AutoReloadOverlayBlockerProvider = ({ children }) => {
|
||||
};
|
||||
}
|
||||
|
||||
const autoReloadValue = useMemo(() => {
|
||||
return { lockApp: lockApp.current, unlockApp: unlockApp.current };
|
||||
}, [lockApp, unlockApp]);
|
||||
|
||||
return (
|
||||
<AutoReloadOverlayBockerContext.Provider
|
||||
value={{ lockApp: lockApp.current, unlockApp: unlockApp.current }}
|
||||
>
|
||||
<AutoReloadOverlayBockerContext.Provider value={autoReloadValue}>
|
||||
<Blocker
|
||||
displayedIcon={displayedIcon}
|
||||
isOpen={isOpen}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import React, { useReducer, useRef } from 'react';
|
||||
import React, { useMemo, useReducer, useRef } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { ConfigurationsContext } from '../../contexts';
|
||||
import reducer, { initialState } from './reducer';
|
||||
@ -23,18 +23,27 @@ const ConfigurationsProvider = ({
|
||||
|
||||
const updateProjectSettingsRef = useRef(updateProjectSettings);
|
||||
|
||||
const configurationValue = useMemo(() => {
|
||||
return {
|
||||
logos: {
|
||||
menu: { custom: menuLogo, default: defaultMenuLogo },
|
||||
auth: { custom: null, default: authLogo },
|
||||
},
|
||||
updateProjectSettings: updateProjectSettingsRef.current,
|
||||
showReleaseNotification,
|
||||
showTutorials,
|
||||
};
|
||||
}, [
|
||||
authLogo,
|
||||
menuLogo,
|
||||
showReleaseNotification,
|
||||
showTutorials,
|
||||
updateProjectSettingsRef,
|
||||
defaultMenuLogo,
|
||||
]);
|
||||
|
||||
return (
|
||||
<ConfigurationsContext.Provider
|
||||
value={{
|
||||
logos: {
|
||||
menu: { custom: menuLogo, default: defaultMenuLogo },
|
||||
auth: { custom: null, default: authLogo },
|
||||
},
|
||||
updateProjectSettings: updateProjectSettingsRef.current,
|
||||
showReleaseNotification,
|
||||
showTutorials,
|
||||
}}
|
||||
>
|
||||
<ConfigurationsContext.Provider value={configurationValue}>
|
||||
{children}
|
||||
</ConfigurationsContext.Provider>
|
||||
);
|
||||
|
||||
@ -12,7 +12,7 @@ const initialState = {
|
||||
};
|
||||
|
||||
const reducer = (state = initialState, action) =>
|
||||
produce(state, draftState => {
|
||||
produce(state, (draftState) => {
|
||||
switch (action.type) {
|
||||
case 'UPDATE_PROJECT_SETTINGS': {
|
||||
Object.assign(draftState, action.values);
|
||||
|
||||
@ -19,7 +19,7 @@ const getType = (activeSectionIndex, index) => {
|
||||
};
|
||||
|
||||
const StepperHomepage = ({ sections, currentSectionKey }) => {
|
||||
const activeSectionIndex = sections.findIndex(section => section.key === currentSectionKey);
|
||||
const activeSectionIndex = sections.findIndex((section) => section.key === currentSectionKey);
|
||||
|
||||
return (
|
||||
<Box>
|
||||
|
||||
@ -31,7 +31,7 @@ const sections = [
|
||||
},
|
||||
];
|
||||
|
||||
const App = children => (
|
||||
const App = (children) => (
|
||||
<ThemeProvider theme={lightTheme}>
|
||||
<IntlProvider locale="en" messages={{}} textComponent="span">
|
||||
{children}
|
||||
|
||||
@ -29,12 +29,12 @@ const GuidedTourHomepage = () => {
|
||||
),
|
||||
}));
|
||||
|
||||
const enrichedSections = sections.map(section => ({
|
||||
const enrichedSections = sections.map((section) => ({
|
||||
isDone: Object.entries(guidedTourState[section.key]).every(([, value]) => value),
|
||||
...section,
|
||||
}));
|
||||
|
||||
const activeSection = enrichedSections.find(section => !section.isDone)?.key;
|
||||
const activeSection = enrichedSections.find((section) => !section.isDone)?.key;
|
||||
|
||||
const handleSkip = () => {
|
||||
setSkipped(true);
|
||||
|
||||
@ -3,7 +3,7 @@ import { render, screen } from '@testing-library/react';
|
||||
import { Router } from 'react-router-dom';
|
||||
import { createMemoryHistory } from 'history';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { useGuidedTour, TrackingContext } from '@strapi/helper-plugin';
|
||||
import { useGuidedTour, TrackingProvider } from '@strapi/helper-plugin';
|
||||
import { ThemeProvider, lightTheme } from '@strapi/design-system';
|
||||
import GuidedTourHomepage from '../index';
|
||||
|
||||
@ -31,7 +31,7 @@ jest.mock('@strapi/helper-plugin', () => ({
|
||||
const history = createMemoryHistory();
|
||||
|
||||
const App = (
|
||||
<TrackingContext.Provider value={{ uuid: null, telemetryProperties: undefined }}>
|
||||
<TrackingProvider>
|
||||
<ThemeProvider theme={lightTheme}>
|
||||
<IntlProvider locale="en" messages={{}} textComponent="span">
|
||||
<Router history={history}>
|
||||
@ -39,7 +39,7 @@ const App = (
|
||||
</Router>
|
||||
</IntlProvider>
|
||||
</ThemeProvider>
|
||||
</TrackingContext.Provider>
|
||||
</TrackingProvider>
|
||||
);
|
||||
|
||||
describe('GuidedTour Homepage', () => {
|
||||
|
||||
@ -18,7 +18,7 @@ const Content = ({ id, defaultMessage }) => {
|
||||
{formatMessage(
|
||||
{ id, defaultMessage },
|
||||
{
|
||||
documentationLink: children => (
|
||||
documentationLink: (children) => (
|
||||
<a
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
@ -27,15 +27,15 @@ const Content = ({ id, defaultMessage }) => {
|
||||
{children}
|
||||
</a>
|
||||
),
|
||||
b: children => <Typography fontWeight="semiBold">{children}</Typography>,
|
||||
p: children => <Typography>{children}</Typography>,
|
||||
light: children => <Typography textColor="neutral600">{children}</Typography>,
|
||||
ul: children => (
|
||||
b: (children) => <Typography fontWeight="semiBold">{children}</Typography>,
|
||||
p: (children) => <Typography>{children}</Typography>,
|
||||
light: (children) => <Typography textColor="neutral600">{children}</Typography>,
|
||||
ul: (children) => (
|
||||
<Box paddingLeft={6}>
|
||||
<ul>{children}</ul>
|
||||
</Box>
|
||||
),
|
||||
li: children => <LiStyled>{children}</LiStyled>,
|
||||
li: (children) => <LiStyled>{children}</LiStyled>,
|
||||
}
|
||||
)}
|
||||
</Stack>
|
||||
|
||||
@ -36,7 +36,7 @@ const Modal = ({ onClose, onSkip, children, hideSkip }) => {
|
||||
spacing={8}
|
||||
role="dialog"
|
||||
aria-modal
|
||||
onClick={e => e.stopPropagation()}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Flex justifyContent="flex-end">
|
||||
<IconButton
|
||||
|
||||
@ -16,10 +16,8 @@ const GuidedTourModal = () => {
|
||||
setSkipped,
|
||||
} = useGuidedTour();
|
||||
const [isVisible, setIsVisible] = useState(currentStep);
|
||||
const [
|
||||
{ stepContent, sectionIndex, stepIndex, hasSectionAfter, hasStepAfter },
|
||||
dispatch,
|
||||
] = useReducer(reducer, initialState);
|
||||
const [{ stepContent, sectionIndex, stepIndex, hasSectionAfter, hasStepAfter }, dispatch] =
|
||||
useReducer(reducer, initialState);
|
||||
const { trackUsage } = useTracking();
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@ -10,7 +10,7 @@ export const initialState = {
|
||||
};
|
||||
|
||||
const reducer = (state = initialState, action) =>
|
||||
produce(state, draftState => {
|
||||
produce(state, (draftState) => {
|
||||
switch (action.type) {
|
||||
case 'UPDATE_MODAL': {
|
||||
draftState.stepContent = action.content;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { useGuidedTour, TrackingContext } from '@strapi/helper-plugin';
|
||||
import { useGuidedTour, TrackingProvider } from '@strapi/helper-plugin';
|
||||
import { lightTheme, darkTheme } from '@strapi/design-system';
|
||||
import Theme from '../../../Theme';
|
||||
import ThemeToggleProvider from '../../../ThemeToggleProvider';
|
||||
@ -30,7 +30,7 @@ jest.mock('@strapi/helper-plugin', () => ({
|
||||
}));
|
||||
|
||||
const App = (
|
||||
<TrackingContext.Provider value={{ uuid: null, telemetryProperties: undefined }}>
|
||||
<TrackingProvider>
|
||||
<ThemeToggleProvider themes={{ light: lightTheme, dark: darkTheme }}>
|
||||
<Theme>
|
||||
<IntlProvider locale="en" messages={{}} defaultLocale="en" textComponent="span">
|
||||
@ -38,7 +38,7 @@ const App = (
|
||||
</IntlProvider>
|
||||
</Theme>
|
||||
</ThemeToggleProvider>
|
||||
</TrackingContext.Provider>
|
||||
</TrackingProvider>
|
||||
);
|
||||
|
||||
describe('<GuidedTourModal />', () => {
|
||||
|
||||
@ -15,7 +15,7 @@ const GuidedTour = ({ children }) => {
|
||||
init
|
||||
);
|
||||
|
||||
const setCurrentStep = step => {
|
||||
const setCurrentStep = (step) => {
|
||||
// if step is null it is intentional, we need to dispatch it
|
||||
if (step !== null) {
|
||||
const isStepAlreadyDone = get(guidedTourState, step);
|
||||
@ -34,7 +34,7 @@ const GuidedTour = ({ children }) => {
|
||||
});
|
||||
};
|
||||
|
||||
const setGuidedTourVisibility = value => {
|
||||
const setGuidedTourVisibility = (value) => {
|
||||
dispatch({
|
||||
type: 'SET_GUIDED_TOUR_VISIBILITY',
|
||||
value,
|
||||
@ -51,7 +51,7 @@ const GuidedTour = ({ children }) => {
|
||||
});
|
||||
};
|
||||
|
||||
const startSection = sectionName => {
|
||||
const startSection = (sectionName) => {
|
||||
const sectionSteps = guidedTourState[sectionName];
|
||||
|
||||
if (sectionSteps) {
|
||||
@ -67,7 +67,7 @@ const GuidedTour = ({ children }) => {
|
||||
return null;
|
||||
};
|
||||
|
||||
const setSkipped = value => {
|
||||
const setSkipped = (value) => {
|
||||
persistStateToLocaleStorage.setSkipped(value);
|
||||
|
||||
dispatch({
|
||||
|
||||
@ -5,14 +5,14 @@ import persistStateToLocaleStorage, {
|
||||
SKIPPED,
|
||||
} from './utils/persistStateToLocaleStorage';
|
||||
|
||||
const init = initialState => {
|
||||
const init = (initialState) => {
|
||||
const copyInitialState = { ...initialState };
|
||||
const guidedTourLocaleStorage = persistStateToLocaleStorage.get(COMPLETED_STEPS);
|
||||
const currentStepLocaleStorage = persistStateToLocaleStorage.get(CURRENT_STEP);
|
||||
const skippedLocaleStorage = persistStateToLocaleStorage.get(SKIPPED);
|
||||
|
||||
if (guidedTourLocaleStorage) {
|
||||
guidedTourLocaleStorage.forEach(step => {
|
||||
guidedTourLocaleStorage.forEach((step) => {
|
||||
const [sectionName, stepName] = step.split('.');
|
||||
set(copyInitialState, ['guidedTourState', sectionName, stepName], true);
|
||||
});
|
||||
|
||||
@ -22,7 +22,7 @@ export const initialState = {
|
||||
};
|
||||
|
||||
const reducer = (state = initialState, action) =>
|
||||
produce(state, draftState => {
|
||||
produce(state, (draftState) => {
|
||||
switch (action.type) {
|
||||
case 'SET_CURRENT_STEP': {
|
||||
draftState.currentStep = action.step;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
const isGuidedTourCompleted = guidedTourState =>
|
||||
const isGuidedTourCompleted = (guidedTourState) =>
|
||||
Object.entries(guidedTourState).every(([, section]) =>
|
||||
Object.entries(section).every(([, step]) => step)
|
||||
);
|
||||
|
||||
@ -9,7 +9,7 @@ const persistStateToLocaleStorage = {
|
||||
localStorage.removeItem(CURRENT_STEP);
|
||||
localStorage.removeItem(COMPLETED_STEPS);
|
||||
},
|
||||
addCompletedStep: completedStep => {
|
||||
addCompletedStep(completedStep) {
|
||||
const currentSteps = parse(localStorage.getItem(COMPLETED_STEPS))?.slice() || [];
|
||||
const isAlreadyStored = currentSteps.includes(completedStep);
|
||||
|
||||
@ -20,13 +20,13 @@ const persistStateToLocaleStorage = {
|
||||
currentSteps.push(completedStep);
|
||||
localStorage.setItem(COMPLETED_STEPS, stringify(currentSteps));
|
||||
},
|
||||
addCurrentStep: currentStep => {
|
||||
addCurrentStep(currentStep) {
|
||||
localStorage.setItem(CURRENT_STEP, stringify(currentStep));
|
||||
},
|
||||
setSkipped: value => {
|
||||
setSkipped(value) {
|
||||
localStorage.setItem(SKIPPED, stringify(value));
|
||||
},
|
||||
get: item => {
|
||||
get(item) {
|
||||
return parse(localStorage.getItem(item));
|
||||
},
|
||||
};
|
||||
|
||||
@ -23,7 +23,7 @@ const LanguageProvider = ({ children, localeNames, messages }) => {
|
||||
window.localStorage.setItem(localStorageKey, locale);
|
||||
}, [locale]);
|
||||
|
||||
const changeLocale = locale => {
|
||||
const changeLocale = (locale) => {
|
||||
dispatch({
|
||||
type: 'CHANGE_LOCALE',
|
||||
locale,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import localStorageKey from './utils/localStorageKey';
|
||||
|
||||
const init = localeNames => {
|
||||
const init = (localeNames) => {
|
||||
const languageFromLocaleStorage = window.localStorage.getItem(localStorageKey);
|
||||
const appLanguage = localeNames[languageFromLocaleStorage] ? languageFromLocaleStorage : 'en';
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { render, screen, act } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { useIntl } from 'react-intl';
|
||||
import useLocalesProvider from '../../LocalesProvider/useLocalesProvider';
|
||||
@ -29,7 +29,7 @@ describe('LanguageProvider', () => {
|
||||
`);
|
||||
});
|
||||
|
||||
it('should change the locale and set the strapi-admin-language item in the localStorage', () => {
|
||||
it('should change the locale and set the strapi-admin-language item in the localStorage', async () => {
|
||||
const Test = () => {
|
||||
const { locale } = useIntl();
|
||||
const { changeLocale } = useLocalesProvider();
|
||||
@ -54,7 +54,9 @@ describe('LanguageProvider', () => {
|
||||
|
||||
expect(screen.getByText('English')).toBeInTheDocument();
|
||||
|
||||
userEvent.click(screen.getByText('CHANGE'));
|
||||
act(() => {
|
||||
userEvent.click(screen.getByText('CHANGE'));
|
||||
});
|
||||
|
||||
expect(screen.getByText('Français')).toBeInTheDocument();
|
||||
expect(localStorage.getItem('strapi-admin-language')).toEqual('fr');
|
||||
|
||||
@ -62,18 +62,18 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
||||
|
||||
const initials = userDisplayName
|
||||
.split(' ')
|
||||
.map(name => name.substring(0, 1))
|
||||
.map((name) => name.substring(0, 1))
|
||||
.join('')
|
||||
.substring(0, 2);
|
||||
|
||||
const handleToggleUserLinks = () => setUserLinksVisible(prev => !prev);
|
||||
const handleToggleUserLinks = () => setUserLinksVisible((prev) => !prev);
|
||||
|
||||
const handleLogout = () => {
|
||||
auth.clearAppStorage();
|
||||
handleToggleUserLinks();
|
||||
};
|
||||
|
||||
const handleBlur = e => {
|
||||
const handleBlur = (e) => {
|
||||
if (
|
||||
!e.currentTarget.contains(e.relatedTarget) &&
|
||||
e.relatedTarget?.parentElement?.id !== 'main-nav-user-button'
|
||||
@ -121,7 +121,7 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
||||
defaultMessage: 'Plugins',
|
||||
})}
|
||||
>
|
||||
{pluginsSectionLinks.map(link => {
|
||||
{pluginsSectionLinks.map((link) => {
|
||||
const Icon = link.icon;
|
||||
|
||||
return (
|
||||
@ -140,7 +140,7 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
||||
defaultMessage: 'General',
|
||||
})}
|
||||
>
|
||||
{generalSectionLinks.map(link => {
|
||||
{generalSectionLinks.map((link) => {
|
||||
const LinkIcon = link.icon;
|
||||
|
||||
return (
|
||||
@ -201,7 +201,7 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
||||
</LinkUserWrapper>
|
||||
)}
|
||||
|
||||
<NavCondense onClick={() => setCondensed(s => !s)}>
|
||||
<NavCondense onClick={() => setCondensed((s) => !s)}>
|
||||
{condensed
|
||||
? formatMessage({
|
||||
id: 'app.components.LeftMenu.expand',
|
||||
|
||||
@ -8,7 +8,8 @@ const Notification = ({ dispatch, notification }) => {
|
||||
const { formatMessage } = useIntl();
|
||||
const { message, link, type, id, onClose, timeout, blockTransition } = notification;
|
||||
|
||||
const formattedMessage = msg => (typeof msg === 'string' ? msg : formatMessage(msg, msg.values));
|
||||
const formattedMessage = (msg) =>
|
||||
typeof msg === 'string' ? msg : formatMessage(msg, msg.values);
|
||||
const handleClose = useCallback(() => {
|
||||
if (onClose) {
|
||||
onClose();
|
||||
@ -66,9 +67,7 @@ const Notification = ({ dispatch, notification }) => {
|
||||
defaultMessage: link.label?.defaultMessage || link.label?.id || link.label,
|
||||
})}
|
||||
</Link>
|
||||
) : (
|
||||
undefined
|
||||
)
|
||||
) : undefined
|
||||
}
|
||||
onClose={handleClose}
|
||||
closeLabel="Close"
|
||||
|
||||
@ -8,7 +8,7 @@ import reducer, { initialState } from './reducer';
|
||||
const Notifications = ({ children }) => {
|
||||
const [{ notifications }, dispatch] = useReducer(reducer, initialState);
|
||||
|
||||
const displayNotification = config => {
|
||||
const displayNotification = (config) => {
|
||||
dispatch({
|
||||
type: 'SHOW_NOTIFICATION',
|
||||
config,
|
||||
@ -26,7 +26,7 @@ const Notifications = ({ children }) => {
|
||||
width={`${500 / 16}rem`}
|
||||
zIndex={10}
|
||||
>
|
||||
{notifications.map(notification => {
|
||||
{notifications.map((notification) => {
|
||||
return (
|
||||
<Notification key={notification.id} dispatch={dispatch} notification={notification} />
|
||||
);
|
||||
|
||||
@ -8,7 +8,7 @@ const initialState = {
|
||||
|
||||
const notificationReducer = (state = initialState, action) =>
|
||||
// eslint-disable-next-line consistent-return
|
||||
produce(state, draftState => {
|
||||
produce(state, (draftState) => {
|
||||
switch (action.type) {
|
||||
case 'SHOW_NOTIFICATION': {
|
||||
draftState.notifications.push({
|
||||
@ -28,7 +28,7 @@ const notificationReducer = (state = initialState, action) =>
|
||||
break;
|
||||
}
|
||||
case 'HIDE_NOTIFICATION': {
|
||||
const indexToRemove = state.notifications.findIndex(notif => notif.id === action.id);
|
||||
const indexToRemove = state.notifications.findIndex((notif) => notif.id === action.id);
|
||||
|
||||
if (indexToRemove !== -1) {
|
||||
draftState.notifications.splice(indexToRemove, 1);
|
||||
|
||||
@ -108,7 +108,9 @@ describe('<Notifications />', () => {
|
||||
expect(items).toHaveLength(1);
|
||||
|
||||
await act(async () => {
|
||||
await new Promise(resolve => setTimeout(resolve, 2500));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 2500);
|
||||
});
|
||||
});
|
||||
|
||||
const foundItems = screen.queryAllByText(/simple notif/);
|
||||
@ -151,7 +153,9 @@ describe('<Notifications />', () => {
|
||||
expect(items).toHaveLength(1);
|
||||
|
||||
await act(async () => {
|
||||
await new Promise(resolve => setTimeout(resolve, 2500));
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 2500);
|
||||
});
|
||||
});
|
||||
|
||||
const foundItems = screen.queryAllByText(/simple notif/);
|
||||
|
||||
@ -8,11 +8,13 @@ import reducer, { initialState } from './reducer';
|
||||
const PluginsInitializer = () => {
|
||||
const { plugins: appPlugins } = useStrapiApp();
|
||||
const [{ plugins }, dispatch] = useReducer(reducer, initialState, () => init(appPlugins));
|
||||
const setPlugin = useRef(pluginId => {
|
||||
const setPlugin = useRef((pluginId) => {
|
||||
dispatch({ type: 'SET_PLUGIN_READY', pluginId });
|
||||
});
|
||||
|
||||
const hasApluginNotReady = Object.keys(plugins).some(plugin => plugins[plugin].isReady === false);
|
||||
const hasApluginNotReady = Object.keys(plugins).some(
|
||||
(plugin) => plugins[plugin].isReady === false
|
||||
);
|
||||
|
||||
if (hasApluginNotReady) {
|
||||
const initializers = Object.keys(plugins).reduce((acc, current) => {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
const init = plugins => {
|
||||
const init = (plugins) => {
|
||||
return {
|
||||
plugins: Object.keys(plugins).reduce((acc, current) => {
|
||||
acc[current] = { ...plugins[current] };
|
||||
|
||||
@ -7,7 +7,7 @@ const initialState = {
|
||||
|
||||
const reducer = (state = initialState, action) =>
|
||||
/* eslint-disable-next-line consistent-return */
|
||||
produce(state, draftState => {
|
||||
produce(state, (draftState) => {
|
||||
switch (action.type) {
|
||||
case 'SET_PLUGIN_READY': {
|
||||
set(draftState, ['plugins', action.pluginId, 'isReady'], true);
|
||||
|
||||
@ -3,7 +3,9 @@ import { StrapiAppProvider } from '@strapi/helper-plugin';
|
||||
import { render } from '@testing-library/react';
|
||||
import PluginsInitializer from '../index';
|
||||
|
||||
jest.mock('../../../pages/Admin', () => () => <div>ADMIN</div>);
|
||||
jest.mock('../../../pages/Admin', () => () => {
|
||||
return <div>ADMIN</div>;
|
||||
});
|
||||
|
||||
describe('ADMIN | COMPONENTS | PluginsInitializer', () => {
|
||||
it('should not crash', () => {
|
||||
|
||||
@ -20,7 +20,7 @@ const PrivateRoute = ({ component: Component, path, ...rest }) => {
|
||||
return (
|
||||
<Route
|
||||
path={path}
|
||||
render={props =>
|
||||
render={(props) =>
|
||||
auth.getToken() !== null ? (
|
||||
<Component {...rest} {...props} />
|
||||
) : (
|
||||
|
||||
@ -2,7 +2,7 @@ import { RESET_STORE, SET_PERMISSIONS } from './constants';
|
||||
|
||||
const resetStore = () => ({ type: RESET_STORE });
|
||||
|
||||
const setPermissions = permissions => ({
|
||||
const setPermissions = (permissions) => ({
|
||||
type: SET_PERMISSIONS,
|
||||
permissions,
|
||||
});
|
||||
|
||||
@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
|
||||
import { resetStore, setPermissions } from './actions';
|
||||
|
||||
const RBACProvider = ({ children, permissions, refetchPermissions }) => {
|
||||
const { allPermissions } = useSelector(state => state.rbacProvider);
|
||||
const { allPermissions } = useSelector((state) => state.rbacProvider);
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user