mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 07:03:38 +00:00
Merge branch 'main' into fix/i18n-locale-queries-forbidden-access
This commit is contained in:
commit
d71ffb2f5d
@ -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,39 @@
|
||||
'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',
|
||||
parserOptions: {
|
||||
ecmaVersion: 2020,
|
||||
},
|
||||
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',
|
||||
'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': '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'],
|
||||
'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',
|
||||
},
|
||||
};
|
||||
|
||||
@ -9,7 +9,7 @@ const frontPaths = [
|
||||
|
||||
module.exports = {
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018,
|
||||
ecmaVersion: 2020,
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
|
||||
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.`);
|
||||
|
||||
4
.github/actions/check-pr-status/package.json
vendored
4
.github/actions/check-pr-status/package.json
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "check-pr-status",
|
||||
"version": "4.2.2",
|
||||
"version": "4.3.6",
|
||||
"main": "dist/index.js",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
@ -9,7 +9,7 @@
|
||||
"watch": "NODE_ENV=production ncc build index.js -w -o dist --minify"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@actions/core": "1.9.0",
|
||||
"@actions/core": "1.9.1",
|
||||
"@actions/github": "5.0.0",
|
||||
"@vercel/ncc": "0.34.0"
|
||||
}
|
||||
|
||||
16
.github/dependabot.yml
vendored
16
.github/dependabot.yml
vendored
@ -1,13 +1,21 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: 'npm'
|
||||
directory: '/'
|
||||
- package-ecosystem: npm
|
||||
directory: /
|
||||
schedule:
|
||||
interval: 'daily'
|
||||
interval: daily
|
||||
versioning-strategy: increase
|
||||
ignore:
|
||||
# Only allow patch as minor babel versions need to be upgraded all together
|
||||
- dependency-name: '@babel/*'
|
||||
update-types:
|
||||
- 'version-update:semver-major'
|
||||
- 'version-update:semver-minor'
|
||||
|
||||
- dependency-name: '*'
|
||||
update-types: ['version-update:semver-major']
|
||||
update-types:
|
||||
- 'version-update:semver-major'
|
||||
|
||||
labels:
|
||||
- 'source: dependencies'
|
||||
- 'pr: chore'
|
||||
|
||||
3
.github/jest.config.js
vendored
Normal file
3
.github/jest.config.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
displayName: '.github',
|
||||
};
|
||||
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:
|
||||
|
||||
24
.github/workflows/nightly.yml
vendored
Normal file
24
.github/workflows/nightly.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
name: 'Nightly Releases'
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * 2-6'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: 'Publish'
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'strapi/strapi'
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup npmrc
|
||||
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
- run: yarn
|
||||
- run: ./scripts/pre-publish.sh --yes
|
||||
env:
|
||||
VERSION: '0.0.0-${{ github.sha }}'
|
||||
DIST_TAG: experimental
|
||||
44
.github/workflows/pages.yml
vendored
Normal file
44
.github/workflows/pages.yml
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
name: Deploy static content to Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: 'pages'
|
||||
cancel-in-progress: true
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: docs
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
cache: yarn
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Build website
|
||||
run: yarn build
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./docs/build
|
||||
user_name: github-actions[bot]
|
||||
user_email: 41898282+github-actions[bot]@users.noreply.github.com
|
||||
9
.github/workflows/tests.yml
vendored
9
.github/workflows/tests.yml
vendored
@ -3,8 +3,15 @@ name: 'Tests'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- '**.mdx?'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref_name }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
|
||||
@ -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:
|
||||
@ -132,9 +132,11 @@ $ yarn test:generate-app mysql
|
||||
|
||||
A new app is required every time you run the end-to-end tests otherwise, the test suite will fail. A script is available to make this process easier: `node test/e2e.js`. It will delete the current test app, generate a new one and run the test suite.
|
||||
|
||||
The script takes a path as optional argument (e.g. `node test/e2e.js path/to/test`). Options for jest can be passed using the double-dash notion: e.g. to update snapshots `node test/e2e.js -- -u`.
|
||||
|
||||
### Changing the database
|
||||
|
||||
By default the script `test/e2e,js` creates an app that uses `sqlite`. But you can run the test suites using different databases:
|
||||
By default the script `test/e2e.js` creates an app that uses `sqlite`. But you can run the test suites using different databases:
|
||||
|
||||
```bash
|
||||
$ node test/e2e.js --db=sqlite
|
||||
|
||||
@ -17,11 +17,14 @@
|
||||
<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" />
|
||||
</a>
|
||||
<a href="https://github.com/strapi/strapi/actions/workflows/nightly.yml">
|
||||
<img src="https://github.com/strapi/strapi/actions/workflows/nightly.yml/badge.svg" alt="Strapi Nightly Release Build Status" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
||||
@ -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*
|
||||
29
docs/README.md
Normal file
29
docs/README.md
Normal file
@ -0,0 +1,29 @@
|
||||
# Strapi contributor documentation
|
||||
|
||||
> If you are looking for the official Strapi documentation, it is available [here](https://docs.strapi.io)
|
||||
|
||||
This documentation is a contributor documentation made for anyone that wants to contribute to the project.
|
||||
|
||||
To run the documentation website, follow the instructions below.
|
||||
|
||||
### 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
|
||||
17
docs/docs/core/content-manager/intro.md
Normal file
17
docs/docs/core/content-manager/intro.md
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
title: Introduction
|
||||
slug: /content-manager
|
||||
tags:
|
||||
- content-manager
|
||||
---
|
||||
|
||||
# Content Manager
|
||||
|
||||
This section is an overview of all the features realted to the Content Manager:
|
||||
|
||||
```mdx-code-block
|
||||
import DocCardList from '@theme/DocCardList';
|
||||
import { useCurrentSidebarCategory } from '@docusaurus/theme-common';
|
||||
|
||||
<DocCardList items={useCurrentSidebarCategory().items} />
|
||||
```
|
||||
17
docs/docs/core/content-type-builder/intro.md
Normal file
17
docs/docs/core/content-type-builder/intro.md
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
title: Introduction
|
||||
tags:
|
||||
- content-type-builder
|
||||
---
|
||||
|
||||
# Content Type Builder
|
||||
|
||||
This section is an overview of all the features realted to the Content Type Builder:
|
||||
|
||||
```mdx-code-block
|
||||
import DocCardList from '@theme/DocCardList';
|
||||
import { useCurrentSidebarCategory } from '@docusaurus/theme-common';
|
||||
|
||||
<DocCardList items={useCurrentSidebarCategory().items} />
|
||||
```
|
||||
37
docs/docs/example.md
Normal file
37
docs/docs/example.md
Normal file
@ -0,0 +1,37 @@
|
||||
---
|
||||
title: Example
|
||||
tags:
|
||||
- content-manager
|
||||
---
|
||||
|
||||
# Example doc
|
||||
|
||||
## Summary
|
||||
|
||||
_Description of the sofware system / component._
|
||||
|
||||
## Detailed design
|
||||
|
||||
- _Explaining the software design and reasoning._
|
||||
- _Api specifications._
|
||||
- _Benchmarks_
|
||||
- _Add necessary diagrams and code examples._
|
||||
- _Think about edge-cases and include examples._
|
||||
|
||||
## Tradeoffs
|
||||
|
||||
_What potential tradeoffs are involved with this system/implementation._
|
||||
|
||||
- _Complexity._
|
||||
- _Limitations of the feature itself._
|
||||
- _How does this proposal integrate with the current features implemented._
|
||||
|
||||
## Alternatives
|
||||
|
||||
_What other approaches did we consider?_
|
||||
|
||||
## Resources
|
||||
|
||||
- _Link to product documents._
|
||||
- _Link to user documentation._
|
||||
- _Any usefull research used for it_
|
||||
6
docs/docs/index.md
Normal file
6
docs/docs/index.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
sidebar_label: Introduction
|
||||
---
|
||||
|
||||
# Strapi contributor documentation
|
||||
77
docs/docusaurus.config.js
Normal file
77
docs/docusaurus.config.js
Normal file
@ -0,0 +1,77 @@
|
||||
// @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://strapi.github.io/strapi',
|
||||
baseUrl: '/strapi/',
|
||||
onBrokenLinks: 'throw',
|
||||
onBrokenMarkdownLinks: 'warn',
|
||||
favicon: 'img/favicon.ico',
|
||||
organizationName: 'strapi',
|
||||
projectName: 'strapi',
|
||||
trailingSlash: false,
|
||||
|
||||
// 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/',
|
||||
},
|
||||
blog: false,
|
||||
},
|
||||
],
|
||||
],
|
||||
|
||||
themeConfig:
|
||||
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
|
||||
{
|
||||
navbar: {
|
||||
title: 'Contributor documentation',
|
||||
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.1",
|
||||
"@docusaurus/preset-classic": "2.0.1",
|
||||
"@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"
|
||||
]
|
||||
}
|
||||
}
|
||||
51
docs/sidebars.js
Normal file
51
docs/sidebars.js
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* 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',
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Core',
|
||||
link: {
|
||||
type: 'generated-index',
|
||||
},
|
||||
collapsible: false,
|
||||
items: [
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Content Manager',
|
||||
link: {
|
||||
type: 'doc',
|
||||
id: 'core/content-manager/intro',
|
||||
},
|
||||
items: ['example'],
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Content Type Builder',
|
||||
link: {
|
||||
type: 'doc',
|
||||
id: 'core/content-type-builder/intro',
|
||||
},
|
||||
items: ['example'],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
api: [{ type: 'autogenerated', dirName: 'api' }],
|
||||
};
|
||||
|
||||
module.exports = sidebars;
|
||||
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 |
8034
docs/yarn.lock
Normal file
8034
docs/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@ -17,7 +17,7 @@ module.exports = {
|
||||
*/
|
||||
// '0 0 1 * * 1': async function({ strapi }) {
|
||||
// // Add your own logic here (e.g. send a queue of email, create a database backup, etc.).
|
||||
// }
|
||||
// },
|
||||
// 'myJob': {
|
||||
// task: ({ strapi }) => { /* Add your own logic here */ },
|
||||
// options: {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
'404': async (/* ctx */) => {
|
||||
404: async (/* ctx */) => {
|
||||
// return ctx.notFound('My custom message 404');
|
||||
},
|
||||
};
|
||||
|
||||
11
examples/getstarted/global.d.ts
vendored
11
examples/getstarted/global.d.ts
vendored
@ -1,11 +0,0 @@
|
||||
interface Restaurant {
|
||||
name: string;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface AllTypes {
|
||||
restaurant: Restaurant;
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "getstarted",
|
||||
"private": true,
|
||||
"version": "4.2.2",
|
||||
"version": "4.3.6",
|
||||
"description": "A Strapi application.",
|
||||
"scripts": {
|
||||
"develop": "strapi develop",
|
||||
@ -12,24 +12,22 @@
|
||||
"strapi": "strapi"
|
||||
},
|
||||
"dependencies": {
|
||||
"@strapi/admin": "4.2.2",
|
||||
"@strapi/plugin-documentation": "4.2.2",
|
||||
"@strapi/plugin-graphql": "4.2.2",
|
||||
"@strapi/plugin-i18n": "4.2.2",
|
||||
"@strapi/plugin-sentry": "4.2.2",
|
||||
"@strapi/plugin-users-permissions": "4.2.2",
|
||||
"@strapi/provider-email-mailgun": "4.2.2",
|
||||
"@strapi/provider-upload-aws-s3": "4.2.2",
|
||||
"@strapi/provider-upload-cloudinary": "4.2.2",
|
||||
"@strapi/strapi": "4.2.2",
|
||||
"@strapi/utils": "4.2.2",
|
||||
"@strapi/plugin-documentation": "4.3.6",
|
||||
"@strapi/plugin-graphql": "4.3.6",
|
||||
"@strapi/plugin-i18n": "4.3.6",
|
||||
"@strapi/plugin-sentry": "4.3.6",
|
||||
"@strapi/plugin-users-permissions": "4.3.6",
|
||||
"@strapi/provider-email-mailgun": "4.3.6",
|
||||
"@strapi/provider-upload-aws-s3": "4.3.6",
|
||||
"@strapi/provider-upload-cloudinary": "4.3.6",
|
||||
"@strapi/strapi": "4.3.6",
|
||||
"@vscode/sqlite3": "5.0.8",
|
||||
"better-sqlite3": "7.4.6",
|
||||
"lodash": "4.17.21",
|
||||
"mysql": "2.18.1",
|
||||
"passport-google-oauth2": "0.2.0",
|
||||
"pg": "8.6.0",
|
||||
"sqlite3": "5.0.2"
|
||||
"sqlite3": "5.0.11"
|
||||
},
|
||||
"strapi": {
|
||||
"uuid": "getstarted"
|
||||
|
||||
9
examples/getstarted/src/admin/app.example.js
Normal file
9
examples/getstarted/src/admin/app.example.js
Normal file
@ -0,0 +1,9 @@
|
||||
const config = {
|
||||
locales: ['fr'],
|
||||
};
|
||||
const bootstrap = () => {};
|
||||
|
||||
export default {
|
||||
config,
|
||||
bootstrap,
|
||||
};
|
||||
@ -1,6 +0,0 @@
|
||||
export default {
|
||||
config: {
|
||||
locales: ['fr'],
|
||||
},
|
||||
bootstrap() {},
|
||||
};
|
||||
@ -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;
|
||||
});
|
||||
|
||||
|
||||
@ -38,23 +38,6 @@
|
||||
"localized": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": {
|
||||
"pluginOptions": {
|
||||
"i18n": {
|
||||
"localized": true
|
||||
}
|
||||
},
|
||||
"type": "string",
|
||||
"maxLength": 3
|
||||
},
|
||||
"time": {
|
||||
"pluginOptions": {
|
||||
"i18n": {
|
||||
"localized": true
|
||||
}
|
||||
},
|
||||
"type": "time"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 }) => {
|
||||
|
||||
8
examples/kitchensink-ts/config/admin.ts
Normal file
8
examples/kitchensink-ts/config/admin.ts
Normal file
@ -0,0 +1,8 @@
|
||||
export default ({ env }) => ({
|
||||
auth: {
|
||||
secret: env('ADMIN_JWT_SECRET', 'example-token'),
|
||||
},
|
||||
apiToken: {
|
||||
salt: env('API_TOKEN_SALT', 'example-salt'),
|
||||
},
|
||||
});
|
||||
7
examples/kitchensink-ts/config/api.ts
Normal file
7
examples/kitchensink-ts/config/api.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export default {
|
||||
rest: {
|
||||
defaultLimit: 25,
|
||||
maxLimit: 100,
|
||||
withCount: true,
|
||||
},
|
||||
};
|
||||
11
examples/kitchensink-ts/config/database.ts
Normal file
11
examples/kitchensink-ts/config/database.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import path from 'path';
|
||||
|
||||
export default ({ env }) => ({
|
||||
connection: {
|
||||
client: 'sqlite',
|
||||
connection: {
|
||||
filename: path.join(__dirname, '..', '..', env('DATABASE_FILENAME', '.tmp/data.db')),
|
||||
},
|
||||
useNullAsDefault: true,
|
||||
},
|
||||
});
|
||||
12
examples/kitchensink-ts/config/middlewares.ts
Normal file
12
examples/kitchensink-ts/config/middlewares.ts
Normal file
@ -0,0 +1,12 @@
|
||||
export default [
|
||||
'strapi::errors',
|
||||
'strapi::security',
|
||||
'strapi::cors',
|
||||
'strapi::poweredBy',
|
||||
'strapi::logger',
|
||||
'strapi::query',
|
||||
'strapi::body',
|
||||
'strapi::session',
|
||||
'strapi::favicon',
|
||||
'strapi::public',
|
||||
];
|
||||
7
examples/kitchensink-ts/config/server.ts
Normal file
7
examples/kitchensink-ts/config/server.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export default ({ env }) => ({
|
||||
host: env('HOST', '0.0.0.0'),
|
||||
port: env.int('PORT', 1337),
|
||||
app: {
|
||||
keys: env.array('APP_KEYS'),
|
||||
},
|
||||
});
|
||||
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
29
examples/kitchensink-ts/package.json
Normal file
29
examples/kitchensink-ts/package.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "kitchensink-ts",
|
||||
"private": true,
|
||||
"version": "4.3.6",
|
||||
"description": "A Strapi application",
|
||||
"scripts": {
|
||||
"develop": "strapi develop",
|
||||
"start": "strapi start",
|
||||
"build": "strapi build",
|
||||
"strapi": "strapi"
|
||||
},
|
||||
"dependencies": {
|
||||
"@strapi/plugin-i18n": "4.3.6",
|
||||
"@strapi/plugin-users-permissions": "4.3.6",
|
||||
"@strapi/strapi": "4.3.6",
|
||||
"better-sqlite3": "7.4.6"
|
||||
},
|
||||
"author": {
|
||||
"name": "A Strapi developer"
|
||||
},
|
||||
"strapi": {
|
||||
"uuid": "getstarted"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.19.1 <=16.x.x",
|
||||
"npm": ">=6.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
5
examples/kitchensink-ts/src/admin/tsconfig.json
Normal file
5
examples/kitchensink-ts/src/admin/tsconfig.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": "@strapi/typescript-utils/tsconfigs/admin",
|
||||
"include": ["../plugins/**/admin/src/**/*", "./"],
|
||||
"exclude": ["node_modules/", "build/", "dist/", "**/*.test.ts"]
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
export default (config, webpack) => {
|
||||
// Note: we provide webpack above so you should not `require` it
|
||||
// Perform customizations to webpack config
|
||||
// Important: return the modified config
|
||||
return config;
|
||||
};
|
||||
20
examples/kitchensink-ts/src/index.ts
Normal file
20
examples/kitchensink-ts/src/index.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import '@strapi/strapi';
|
||||
|
||||
export default {
|
||||
/**
|
||||
* An asynchronous register function that runs before
|
||||
* your application is initialized.
|
||||
*
|
||||
* This gives you an opportunity to extend code.
|
||||
*/
|
||||
register(/*{ strapi }*/) {},
|
||||
|
||||
/**
|
||||
* An asynchronous bootstrap function that runs before
|
||||
* your application gets started.
|
||||
*
|
||||
* This gives you an opportunity to set up your data model,
|
||||
* run jobs, or perform some special logic.
|
||||
*/
|
||||
bootstrap(/*{ strapi }*/) {},
|
||||
};
|
||||
18
examples/kitchensink-ts/tsconfig.json
Normal file
18
examples/kitchensink-ts/tsconfig.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"extends": "@strapi/typescript-utils/tsconfigs/server",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": ["./", "src/**/*.json"],
|
||||
"exclude": [
|
||||
"node_modules/",
|
||||
"build/",
|
||||
"dist/",
|
||||
".cache/",
|
||||
".tmp/",
|
||||
"src/admin/",
|
||||
"**/*.test.ts",
|
||||
"src/plugins/**"
|
||||
]
|
||||
}
|
||||
4
examples/kitchensink/config/plugins.js
Normal file
4
examples/kitchensink/config/plugins.js
Normal file
@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
// ...
|
||||
// ...
|
||||
};
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "kitchensink",
|
||||
"private": true,
|
||||
"version": "4.2.2",
|
||||
"version": "4.3.6",
|
||||
"description": "A Strapi application.",
|
||||
"scripts": {
|
||||
"develop": "strapi develop",
|
||||
@ -12,17 +12,15 @@
|
||||
"strapi": "strapi"
|
||||
},
|
||||
"dependencies": {
|
||||
"@strapi/admin": "4.2.2",
|
||||
"@strapi/provider-email-mailgun": "4.2.2",
|
||||
"@strapi/provider-upload-aws-s3": "4.2.2",
|
||||
"@strapi/provider-upload-cloudinary": "4.2.2",
|
||||
"@strapi/strapi": "4.2.2",
|
||||
"@strapi/utils": "4.2.2",
|
||||
"@strapi/provider-email-mailgun": "4.3.6",
|
||||
"@strapi/provider-upload-aws-s3": "4.3.6",
|
||||
"@strapi/provider-upload-cloudinary": "4.3.6",
|
||||
"@strapi/strapi": "4.3.6",
|
||||
"lodash": "4.17.21",
|
||||
"mysql": "2.18.1",
|
||||
"passport-google-oauth2": "0.2.0",
|
||||
"pg": "8.6.0",
|
||||
"sqlite3": "5.0.2"
|
||||
"sqlite3": "5.0.11"
|
||||
},
|
||||
"strapi": {
|
||||
"uuid": "getstarted"
|
||||
|
||||
@ -1,33 +1,37 @@
|
||||
import theme from './extensions/theme';
|
||||
|
||||
export default {
|
||||
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',
|
||||
},
|
||||
head: {
|
||||
favicon:
|
||||
'https://images.unsplash.com/photo-1593642634367-d91a135587b5?ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80',
|
||||
title: 'Strapi test',
|
||||
},
|
||||
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',
|
||||
},
|
||||
theme,
|
||||
translations: {
|
||||
fr: {
|
||||
'Auth.form.email.label': 'test',
|
||||
Users: 'Utilisateurs',
|
||||
City: 'CITY FRENCH',
|
||||
// Customize the label of the CM table..
|
||||
Id: 'ID french',
|
||||
},
|
||||
},
|
||||
tutorials: false,
|
||||
notifications: { release: false },
|
||||
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',
|
||||
},
|
||||
bootstrap() {},
|
||||
head: {
|
||||
favicon:
|
||||
'https://images.unsplash.com/photo-1593642634367-d91a135587b5?ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80',
|
||||
title: 'Strapi test',
|
||||
},
|
||||
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',
|
||||
},
|
||||
theme,
|
||||
translations: {
|
||||
fr: {
|
||||
'Auth.form.email.label': 'test',
|
||||
Users: 'Utilisateurs',
|
||||
City: 'CITY FRENCH',
|
||||
// Customize the label of the CM table..
|
||||
Id: 'ID french',
|
||||
},
|
||||
},
|
||||
tutorials: false,
|
||||
notifications: { release: false },
|
||||
};
|
||||
|
||||
const bootstrap = (app) => {
|
||||
console.log(app);
|
||||
};
|
||||
|
||||
export default {
|
||||
config,
|
||||
bootstrap,
|
||||
};
|
||||
|
||||
37
examples/kitchensink/src/admin/app.js
Normal file
37
examples/kitchensink/src/admin/app.js
Normal file
@ -0,0 +1,37 @@
|
||||
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',
|
||||
},
|
||||
head: {
|
||||
favicon:
|
||||
'https://images.unsplash.com/photo-1593642634367-d91a135587b5?ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80',
|
||||
title: 'Strapi tesrrt',
|
||||
},
|
||||
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',
|
||||
},
|
||||
theme,
|
||||
translations: {
|
||||
fr: {
|
||||
'Auth.form.email.label': 'test',
|
||||
Users: 'Utilisateurs',
|
||||
City: 'CITY FRENCH',
|
||||
// Customize the label of the CM table..
|
||||
Id: 'ID french',
|
||||
},
|
||||
},
|
||||
tutorials: false,
|
||||
notifications: { release: false },
|
||||
};
|
||||
|
||||
const bootstrap = (app) => {
|
||||
console.log(app);
|
||||
};
|
||||
|
||||
export default {
|
||||
config,
|
||||
bootstrap,
|
||||
};
|
||||
@ -52,13 +52,15 @@ module.exports = {
|
||||
'<rootDir>/packages/admin-test-utils/lib/setup/strapi.js',
|
||||
],
|
||||
transform: {
|
||||
'^.+\\.js$': ['@swc-node/jest', { jsx: true, dynamicImport: true }],
|
||||
'^.+\\.js$': ['@swc/jest', { jsc: { parser: { jsx: true, dynamicImport: true } } }],
|
||||
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
|
||||
'<rootDir>/fileTransformer.js',
|
||||
},
|
||||
transformIgnorePatterns: ['node_modules/(?!(react-dnd|dnd-core|react-dnd-html5-backend)/)'],
|
||||
testMatch: ['/**/tests/**/?(*.)+(spec|test).[jt]s?(x)'],
|
||||
testURL: 'http://localhost:1337/admin',
|
||||
testEnvironmentOptions: {
|
||||
url: 'http://localhost:1337/admin',
|
||||
},
|
||||
// Use `jest-watch-typeahead` version 0.6.5. Newest version 1.0.0 does not support jest@26
|
||||
// Reference: https://github.com/jest-community/jest-watch-typeahead/releases/tag/v1.0.0
|
||||
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
module.exports = {
|
||||
name: 'API integration tests',
|
||||
displayName: 'API integration tests',
|
||||
testMatch: ['**/?(*.)+(spec|test).e2e.js'],
|
||||
testEnvironment: 'node',
|
||||
setupFilesAfterEnv: ['<rootDir>/test/jest2e2.setup.js'],
|
||||
|
||||
@ -2,5 +2,8 @@ const baseConfig = require('./jest.base-config.front');
|
||||
|
||||
module.exports = {
|
||||
...baseConfig,
|
||||
projects: ['<rootDir>/packages/**/jest.config.front.js'],
|
||||
projects: [
|
||||
'<rootDir>/packages/**/jest.config.front.js',
|
||||
'<rootDir>/scripts/**/jest.config.front.js',
|
||||
],
|
||||
};
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const baseConfig = require('./jest.base-config');
|
||||
|
||||
module.exports = {
|
||||
...baseConfig,
|
||||
projects: ['<rootDir>/.github', '<rootDir>/packages/**/jest.config.js'],
|
||||
projects: ['<rootDir>/packages/**/jest.config.js', '<rootDir>/.github'],
|
||||
};
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
{
|
||||
"version": "4.2.2",
|
||||
"version": "4.3.6",
|
||||
"packages": [
|
||||
"packages/*",
|
||||
"examples/*"
|
||||
],
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true
|
||||
"useWorkspaces": true,
|
||||
"useNx": true
|
||||
}
|
||||
|
||||
18
nx.json
Normal file
18
nx.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"implicitDependencies": {
|
||||
"package.json": "*"
|
||||
},
|
||||
"tasksRunnerOptions": {
|
||||
"default": {
|
||||
"runner": "nx/tasks-runners/default",
|
||||
"options": {
|
||||
"cacheableOperations": ["build"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"pluginsConfig": {
|
||||
"@nrwl/js": {
|
||||
"analyzeSourceFiles": false
|
||||
}
|
||||
}
|
||||
}
|
||||
36
package.json
36
package.json
@ -67,50 +67,38 @@
|
||||
"eslint --fix"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/polyfill": "7.12.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc-node/jest": "1.5.0",
|
||||
"@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/core": "7.18.10",
|
||||
"@babel/eslint-parser": "7.18.9",
|
||||
"@babel/preset-react": "7.18.6",
|
||||
"@strapi/eslint-config": "0.1.2",
|
||||
"@swc/core": "1.2.224",
|
||||
"@swc/jest": "0.2.22",
|
||||
"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.0",
|
||||
"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",
|
||||
"jest-cli": "26.6.3",
|
||||
"jest-watch-typeahead": "0.6.5",
|
||||
"lerna": "4.0.0",
|
||||
"lerna": "5.4.3",
|
||||
"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",
|
||||
@ -118,7 +106,7 @@
|
||||
"stylelint-config-recommended": "3.0.0",
|
||||
"stylelint-config-styled-components": "0.1.1",
|
||||
"stylelint-processor-styled-components": "1.10.0",
|
||||
"supertest": "5.0.0",
|
||||
"supertest": "6.2.4",
|
||||
"yargs": "13.3.2"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
// eslint-disable-next-line node/no-extraneous-require
|
||||
const { combineReducers, createStore } = require('redux');
|
||||
|
||||
const reducers = {
|
||||
admin_app: jest.fn(() => ({ status: 'init' })),
|
||||
'content-manager_app': jest.fn(() => ({
|
||||
components: [],
|
||||
status: 'loading',
|
||||
|
||||
@ -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.2.2",
|
||||
"version": "4.3.6",
|
||||
"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",
|
||||
"redux": "^4.0.1",
|
||||
"styled-components": "5.3.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"redux": "^4.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
|
||||
@ -37,8 +37,9 @@ program
|
||||
.option('--dbfile <dbfile>', 'Database file path for sqlite')
|
||||
.option('--dbforce', 'Overwrite database content if any')
|
||||
.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);
|
||||
@ -61,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.2.2",
|
||||
"version": "4.3.6",
|
||||
"description": "Generate a new Strapi application.",
|
||||
"keywords": [
|
||||
"create-strapi-app",
|
||||
@ -38,9 +38,9 @@
|
||||
"test": "echo \"no tests yet\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@strapi/generate-new": "4.2.2",
|
||||
"@strapi/generate-new": "4.3.6",
|
||||
"commander": "6.1.0",
|
||||
"inquirer": "8.2.0"
|
||||
"inquirer": "8.2.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.19.1 <=16.x.x",
|
||||
|
||||
@ -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.2.2",
|
||||
"version": "4.3.6",
|
||||
"description": "Generate a new Strapi application.",
|
||||
"keywords": [
|
||||
"create-strapi-starter",
|
||||
@ -38,14 +38,14 @@
|
||||
"test": "echo \"no tests yet\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@strapi/generate-new": "4.2.2",
|
||||
"@strapi/generate-new": "4.3.6",
|
||||
"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",
|
||||
"inquirer": "8.2.0",
|
||||
"ora": "5.4.0"
|
||||
"inquirer": "8.2.4",
|
||||
"ora": "5.4.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.19.1 <=16.x.x",
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
export default {
|
||||
config: {
|
||||
locales: ['fr'],
|
||||
},
|
||||
bootstrap() {},
|
||||
const config = {
|
||||
locales: ['fr'],
|
||||
};
|
||||
const bootstrap = () => {};
|
||||
|
||||
export default {
|
||||
config,
|
||||
bootstrap,
|
||||
};
|
||||
|
||||
@ -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));
|
||||
});
|
||||
|
||||
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