Force manual build to run lint to avoid unnecessary rebuilds (#16532)

This commit is contained in:
Alexandre BODIN 2023-04-28 15:20:20 +02:00 committed by GitHub
parent 7bbc3b8d3d
commit dceea7201b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 994 additions and 811 deletions

View File

@ -0,0 +1,6 @@
'use strict';
module.exports = {
preset: '../../../jest-preset.unit.js',
displayName: 'Github action check-pr-status',
};

14
.github/filters.yaml vendored Normal file
View File

@ -0,0 +1,14 @@
backend:
- 'packages/**/package.json'
- 'packages/**/server/**/*.(js|ts)'
- 'packages/**/strapi-server.js'
- 'packages/{utils,generators,cli,providers}/**'
- 'packages/core/*/{lib,bin,ee}/**'
- 'api-tests/**'
frontend:
- 'packages/**/package.json'
- 'packages/**/admin/src/**'
- 'packages/**/admin/ee/admin/**'
- 'packages/**/strapi-admin.js'
- 'packages/core/helper-plugin/**'
- 'packages/admin-test-utils/**'

View File

@ -1,3 +0,0 @@
module.exports = {
displayName: '.github',
};

View File

@ -11,12 +11,28 @@ concurrency:
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
nonDoc: ${{ steps.filter.outputs.nonDoc }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v2
id: filter
with:
filters: .github/filters.yaml
lint:
name: 'lint (node: ${{ matrix.node }})'
runs-on: ubuntu-latest
strategy:
matrix:
node: [14, 16, 18]
node: [18]
steps:
- run: echo "Skipped"
@ -34,6 +50,16 @@ jobs:
name: 'unit_front (node: ${{ matrix.node }})'
needs: [lint]
runs-on: ubuntu-latest
strategy:
matrix:
node: [18]
steps:
- run: echo "Skipped"
build:
name: 'build (node: ${{ matrix.node }})'
needs: [changes, lint, unit_front]
runs-on: ubuntu-latest
strategy:
matrix:
node: [14, 16, 18]

View File

@ -18,8 +18,25 @@ permissions:
actions: read
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
backend: ${{ steps.filter.outputs.backend }}
frontend: ${{ steps.filter.outputs.frontend }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: dorny/paths-filter@v2
id: filter
with:
filters: .github/filters.yaml
lint:
name: 'lint (node: ${{ matrix.node }})'
needs: [changes]
runs-on: ubuntu-latest
strategy:
matrix:
@ -44,7 +61,7 @@ jobs:
unit_back:
name: 'unit_back (node: ${{ matrix.node }})'
needs: [lint]
needs: [changes, lint]
runs-on: ubuntu-latest
strategy:
matrix:
@ -69,7 +86,7 @@ jobs:
unit_front:
name: 'unit_front (node: ${{ matrix.node }})'
needs: [lint]
needs: [changes, lint]
runs-on: ubuntu-latest
strategy:
matrix:
@ -88,13 +105,13 @@ jobs:
- uses: nrwl/nx-set-shas@v3
- run: yarn install --immutable
- name: Run build:ts for admin-test-utils
run: yarn build:ts --projects=@strapi/admin-test-utils --skip-nx-cache
run: yarn build --projects=@strapi/admin-test-utils,@strapi/helper-plugin --skip-nx-cache
- name: Run test
run: yarn nx affected --target=test:front --nx-ignore-cycles
build:
name: 'build (node: ${{ matrix.node }})'
needs: [lint, unit_front]
needs: [changes, lint, unit_front]
runs-on: ubuntu-latest
strategy:
matrix:
@ -113,8 +130,9 @@ jobs:
run: yarn build --projects=@strapi/admin,@strapi/helper-plugin
api_ce_pg:
if: needs.changes.outputs.backend == 'true'
runs-on: ubuntu-latest
needs: [lint, unit_back, unit_front]
needs: [changes, lint, unit_back, unit_front]
name: '[CE] API Integration (postgres, node: ${{ matrix.node }})'
strategy:
matrix:
@ -153,8 +171,9 @@ jobs:
dbOptions: '--dbclient=postgres --dbhost=localhost --dbport=5432 --dbname=strapi_test --dbusername=strapi --dbpassword=strapi'
api_ce_mysql:
if: needs.changes.outputs.backend == 'true'
runs-on: ubuntu-latest
needs: [lint, unit_back, unit_front]
needs: [changes, lint, unit_back, unit_front]
name: '[CE] API Integration (mysql:latest, client: ${{ matrix.db_client }}, node: ${{ matrix.node }})'
strategy:
matrix:
@ -192,8 +211,9 @@ jobs:
dbOptions: '--dbclient=${{ matrix.db_client }} --dbhost=localhost --dbport=3306 --dbname=strapi_test --dbusername=strapi --dbpassword=strapi'
api_ce_mysql_5:
if: needs.changes.outputs.backend == 'true'
runs-on: ubuntu-latest
needs: [lint, unit_back, unit_front]
needs: [changes, lint, unit_back, unit_front]
name: '[CE] API Integration (mysql:5, client: ${{ matrix.db_client }} , node: ${{ matrix.node }})'
strategy:
matrix:
@ -230,8 +250,9 @@ jobs:
dbOptions: '--dbclient=${{ matrix.db_client }} --dbhost=localhost --dbport=3306 --dbname=strapi_test --dbusername=strapi --dbpassword=strapi'
api_ce_sqlite:
if: needs.changes.outputs.backend == 'true'
runs-on: ubuntu-latest
needs: [lint, unit_back, unit_front]
needs: [changes, lint, unit_back, unit_front]
name: '[CE] API Integration (sqlite, client: ${{ matrix.sqlite_pkg }}, node: ${{ matrix.node }})'
strategy:
matrix:
@ -256,9 +277,9 @@ jobs:
# EE
api_ee_pg:
runs-on: ubuntu-latest
needs: [lint, unit_back, unit_front]
needs: [changes, lint, unit_back, unit_front]
name: '[EE] API Integration (postgres, node: ${{ matrix.node }})'
if: github.event.pull_request.head.repo.full_name == github.repository && !(github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]')
if: needs.changes.outputs.backend == 'true' && github.event.pull_request.head.repo.full_name == github.repository && !(github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]')
env:
STRAPI_LICENSE: ${{ secrets.strapiLicense }}
strategy:
@ -300,9 +321,9 @@ jobs:
api_ee_mysql:
runs-on: ubuntu-latest
needs: [lint, unit_back, unit_front]
needs: [changes, lint, unit_back, unit_front]
name: '[EE] API Integration (mysql:latest, client: ${{ matrix.db_client }}, node: ${{ matrix.node }})'
if: github.event.pull_request.head.repo.full_name == github.repository && !(github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]')
if: needs.changes.outputs.backend == 'true' && github.event.pull_request.head.repo.full_name == github.repository && !(github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]')
env:
STRAPI_LICENSE: ${{ secrets.strapiLicense }}
strategy:
@ -343,9 +364,9 @@ jobs:
api_ee_sqlite:
runs-on: ubuntu-latest
needs: [lint, unit_back, unit_front]
needs: [changes, lint, unit_back, unit_front]
name: '[EE] API Integration (sqlite, client: ${{ matrix.sqlite_pkg }}, node: ${{ matrix.node }})'
if: github.event.pull_request.head.repo.full_name == github.repository && !(github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]')
if: needs.changes.outputs.backend == 'true' && github.event.pull_request.head.repo.full_name == github.repository && !(github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]')
env:
STRAPI_LICENSE: ${{ secrets.strapiLicense }}
strategy:

View File

@ -2,4 +2,3 @@
. "$(dirname -- "$0")/_/husky.sh"
yarn lint-staged
yarn nx affected:lint --uncommitted --nx-ignore-cycles

12
jest.config.front.js Normal file
View File

@ -0,0 +1,12 @@
'use strict';
/** @type {import('jest').Config} */
const config = {
projects: [
'<rootDir>/packages/plugins/*/jest.config.front.js',
'<rootDir>/packages/core/*/jest.config.front.js',
'<rootDir>/scripts/*/jest.config.front.js',
],
};
module.exports = config;

15
jest.config.js Normal file
View File

@ -0,0 +1,15 @@
'use strict';
/** @type {import('jest').Config} */
const config = {
projects: [
'<rootDir>/packages/plugins/*/jest.config.js',
'<rootDir>/packages/utils/*/jest.config.js',
'<rootDir>/packages/generators/*/jest.config.js',
'<rootDir>/packages/core/*/jest.config.js',
'<rootDir>/packages/providers/*/jest.config.js',
'<rootDir>/.github/actions/*/jest.config.js',
],
};
module.exports = config;

50
lint-staged.config.js Normal file
View File

@ -0,0 +1,50 @@
'use strict';
const path = require('path');
const fs = require('fs');
const findUp = require('find-up');
const includes = ['packages', '.github'];
const root = path.resolve(__dirname);
function extractPackageName(pkgJsonPath) {
return JSON.parse(fs.readFileSync(pkgJsonPath).toString()).name;
}
function getLintCommand(files) {
const affectedFolders = new Set();
for (const file of files) {
const r = findUp.sync('package.json', { cwd: file });
const relPath = path.relative(root, r);
if (includes.some((incl) => relPath.startsWith(incl))) {
affectedFolders.add(r);
}
}
const affectedPackages = [...affectedFolders].map(extractPackageName);
if (affectedPackages.length === 0) {
return null;
}
return `nx run-many -t lint -p ${affectedPackages.join()}`;
}
function getCodeCommands(files) {
const lintCmd = getLintCommand(files);
const prettierCmd = `prettier --write ${files.join(' ')}`;
if (lintCmd) {
return [lintCmd, prettierCmd];
}
return [prettierCmd];
}
module.exports = {
'*.{js,ts}': getCodeCommands,
'*.{md,css,scss,yaml,yml}': ['prettier --write'],
};

View File

@ -29,12 +29,10 @@
"dependsOn": ["^build:ts"]
},
"test:unit": {
"inputs": ["default", "{workspaceRoot}/jest-preset.unit.js"],
"dependsOn": ["build:ts"]
"inputs": ["default", "{workspaceRoot}/jest-preset.unit.js"]
},
"test:front": {
"inputs": ["default", "{workspaceRoot}/jest-preset.front.js"],
"dependsOn": ["^build"]
"inputs": ["default", "{workspaceRoot}/jest-preset.front.js"]
},
"lint": {
"inputs": [
@ -44,8 +42,7 @@
"{projectRoot}/.eslintignore",
"{projectRoot}/tsconfig.eslint.json",
"{workspaceRoot}/packages/utils/eslint-config-custom/**/*"
],
"dependsOn": ["build:ts"]
]
}
},
"tasksRunnerOptions": {

View File

@ -45,23 +45,21 @@
"format:other": "yarn prettier:other --write",
"prettier:code": "prettier --cache --cache-strategy content \"**/*.{js,ts}\"",
"prettier:other": "prettier --cache --cache-strategy content \"**/*.{md,css,scss,yaml,yml}\"",
"test:front": "cross-env IS_EE=true nx run-many --target=test:front --nx-ignore-cycles",
"test:front:watch": "cross-env IS_EE=true nx run-many --target=test:front:watch --nx-ignore-cycles",
"test:front:update": "yarn test:front -u",
"test:front:ce": "cross-env IS_EE=false nx run-many --target=test:front --nx-ignore-cycles",
"test:front:watch:ce": "cross-env IS_EE=false nx run-many --target=test:front:watch --nx-ignore-cycles",
"test:front:all": "cross-env IS_EE=true nx run-many --target=test:front --nx-ignore-cycles",
"test:front": "cross-env IS_EE=true jest --config jest.config.front.js",
"test:front:watch": "cross-env IS_EE=true run test:front --watch",
"test:front:update": "run test:front -u",
"test:front:all:ce": "cross-env IS_EE=false nx run-many --target=test:front:ce --nx-ignore-cycles",
"test:front:ce": "cross-env IS_EE=false run test:front",
"test:front:watch:ce": "cross-env IS_EE=false run test:front --watch",
"test:front:update:ce": "yarn test:front:ce -u",
"test:unit": "nx run-many --target=test:unit --nx-ignore-cycles",
"test:unit:watch": "nx run-many --target=test:unit:watch --nx-ignore-cycles",
"test:unit:all": "nx run-many --target=test:unit --nx-ignore-cycles",
"test:unit": "jest --config jest.config.js",
"test:unit:watch": "run test:unit --watch",
"test:api": "node test/api.js",
"test:generate-app": "node test/create-test-app.js",
"doc:api": "node scripts/open-api/serve.js"
},
"lint-staged": {
"*.{js,ts,md,css,scss,yaml,yml}": [
"prettier --write"
]
},
"devDependencies": {
"@babel/core": "^7.20.12",
"@babel/eslint-parser": "^7.19.1",
@ -91,6 +89,7 @@
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"execa": "1.0.0",
"find-up": "5.0.0",
"fs-extra": "10.1.0",
"get-port": "5.1.1",
"glob": "7.2.3",

View File

@ -3,4 +3,5 @@
module.exports = {
preset: '../../../jest-preset.front.js',
collectCoverageFrom: ['<rootDir>/packages/core/admin/admin/**/*.js'],
displayName: 'Core admin',
};

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.unit.js',
displayName: 'Core admin',
};

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.unit.js',
displayName: 'Core content-manager',
};

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.front.js',
displayName: 'Core content-type-builder',
};

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.unit.js',
displayName: 'Core content-type-builder',
};

View File

@ -34,7 +34,6 @@
"@strapi/generators": "4.10.1",
"@strapi/helper-plugin": "4.10.1",
"@strapi/icons": "1.6.6",
"@strapi/strapi": "4.10.1",
"@strapi/utils": "4.10.1",
"fs-extra": "10.0.0",
"immer": "9.0.19",

View File

@ -6,4 +6,5 @@ module.exports = {
transform: {
'^.+\\.ts$': ['@swc/jest'],
},
displayName: 'Core data-transfer',
};

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.unit.js',
displayName: 'Core database',
};

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.front.js',
displayName: 'Core email',
};

View File

@ -1,4 +1,5 @@
module.exports = {
preset: '../../../jest-preset.front.js',
collectCoverageFrom: ['<rootDir>/packages/core/helper-plugin/src/**/*.js'],
displayName: 'Helper plugin',
};

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.unit.js',
displayName: 'Core permissions',
};

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.unit.js',
displayName: 'Core Strapi',
};

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.front.js',
displayName: 'Core upload',
};

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.unit.js',
displayName: 'Core upload',
};

View File

@ -3,4 +3,5 @@
module.exports = {
preset: '../../../jest-preset.unit.js',
testMatch: ['<rootDir>/**/*.test.js'],
displayName: 'Core utils',
};

View File

@ -6,4 +6,5 @@ module.exports = {
transform: {
'^.+\\.ts$': ['@swc/jest'],
},
displayName: 'Generators',
};

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.front.js',
displayName: 'Color picker plugin',
};

View File

@ -4,7 +4,7 @@ import { rest } from 'msw';
const handlers = [
rest.get('*/getInfos', (req, res, ctx) => {
return res(
ctx.delay(1000),
ctx.delay(100),
ctx.status(200),
ctx.json({
currentVersion: '1.0.0',

View File

@ -56,6 +56,34 @@ describe('Plugin | Documentation | SettingsPage', () => {
});
expect(firstChild).toMatchInlineSnapshot(`
.c1 {
background: #f6f6f9;
padding-top: 40px;
padding-right: 56px;
padding-bottom: 40px;
padding-left: 56px;
}
.c3 {
min-width: 0;
}
.c7 {
background: #4945ff;
padding: 8px;
padding-right: 16px;
padding-left: 16px;
border-radius: 4px;
border-color: #4945ff;
border: 1px solid #4945ff;
cursor: pointer;
}
.c13 {
padding-right: 56px;
padding-left: 56px;
}
.c14 {
background: #ffffff;
padding-top: 24px;
@ -66,46 +94,196 @@ describe('Plugin | Documentation | SettingsPage', () => {
box-shadow: 0px 1px 4px rgba(33,33,52,0.1);
}
.c11 {
font-weight: 600;
color: #32324d;
font-size: 0.75rem;
line-height: 1.33;
}
.c8 {
padding-right: 8px;
}
.c5 {
.c25 {
background: #f6f6f9;
padding: 4px;
border-radius: 4px;
border-style: solid;
border-width: 1px;
border-color: #dcdce4;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
cursor: pointer;
padding: 8px;
}
.c27 {
padding-right: 12px;
padding-left: 12px;
border-radius: 4px;
background: #ffffff;
border: 1px solid #dcdce4;
}
.c2 {
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
justify-content: space-between;
}
.c4 {
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
}
.c8 {
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
gap: 8px;
}
.c15 {
-webkit-align-items: stretch;
-webkit-box-align: stretch;
-ms-flex-align: stretch;
align-items: stretch;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
gap: 16px;
}
.c20 {
-webkit-align-items: stretch;
-webkit-box-align: stretch;
-ms-flex-align: stretch;
align-items: stretch;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
gap: 4px;
}
.c28 {
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
}
.c6 {
font-weight: 600;
font-size: 2rem;
line-height: 1.25;
color: #32324d;
}
.c11 {
font-size: 0.75rem;
line-height: 1.33;
font-weight: 600;
color: #ffffff;
}
.c12 {
font-size: 1rem;
line-height: 1.5;
color: #666687;
}
.c16 {
font-weight: 500;
font-size: 1rem;
line-height: 1.25;
color: #32324d;
}
.c21 {
font-size: 0.75rem;
line-height: 1.33;
font-weight: 600;
color: #32324d;
}
.c30 {
font-size: 0.75rem;
line-height: 1.33;
font-weight: 600;
color: #b72b1a;
text-transform: uppercase;
}
.c32 {
font-size: 0.75rem;
line-height: 1.33;
font-weight: 600;
color: #666687;
text-transform: uppercase;
}
.c34 {
font-size: 0.75rem;
line-height: 1.33;
color: #666687;
}
.c9 {
position: relative;
outline: none;
}
.c5 svg {
.c9 svg {
height: 12px;
width: 12px;
}
.c5 svg > g,
.c5 svg path {
.c9 svg > g,
.c9 svg path {
fill: #ffffff;
}
.c5[aria-disabled='true'] {
.c9[aria-disabled='true'] {
pointer-events: none;
}
.c5:after {
.c9:after {
-webkit-transition-property: all;
transition-property: all;
-webkit-transition-duration: 0.2s;
@ -120,11 +298,11 @@ describe('Plugin | Documentation | SettingsPage', () => {
border: 2px solid transparent;
}
.c5:focus-visible {
.c9:focus-visible {
outline: none;
}
.c5:focus-visible:after {
.c9:focus-visible:after {
border-radius: 8px;
content: '';
position: absolute;
@ -135,164 +313,6 @@ describe('Plugin | Documentation | SettingsPage', () => {
border: 2px solid #4945ff;
}
.c9 {
height: 100%;
}
.c6 {
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
padding: 8px 16px;
background: #4945ff;
border: none;
border: 1px solid #4945ff;
background: #4945ff;
}
.c6 .c7 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.c6 .c10 {
color: #ffffff;
}
.c6[aria-disabled='true'] {
border: 1px solid #dcdce4;
background: #eaeaef;
}
.c6[aria-disabled='true'] .c10 {
color: #666687;
}
.c6[aria-disabled='true'] svg > g,
.c6[aria-disabled='true'] svg path {
fill: #666687;
}
.c6[aria-disabled='true']:active {
border: 1px solid #dcdce4;
background: #eaeaef;
}
.c6[aria-disabled='true']:active .c10 {
color: #666687;
}
.c6[aria-disabled='true']:active svg > g,
.c6[aria-disabled='true']:active svg path {
fill: #666687;
}
.c6:hover {
border: 1px solid #7b79ff;
background: #7b79ff;
}
.c6:active {
border: 1px solid #4945ff;
background: #4945ff;
}
.c15 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
.c15 > * {
margin-top: 0;
margin-bottom: 0;
}
.c15 > * + * {
margin-top: 16px;
}
.c22 {
font-weight: 600;
color: #32324d;
font-size: 0.75rem;
line-height: 1.33;
}
.c29 {
font-weight: 600;
color: #b72b1a;
font-size: 0.75rem;
line-height: 1.33;
}
.c33 {
color: #666687;
font-size: 0.75rem;
line-height: 1.33;
}
.c25 {
background: #ffffff;
border-radius: 4px;
}
.c27 {
background: #fcecea;
padding-right: 32px;
padding-left: 32px;
}
.c30 {
background: #ffffff;
padding-right: 32px;
padding-left: 32px;
}
.c21 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.c20 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
.c20 > * {
margin-top: 0;
margin-bottom: 0;
}
.c20 > * + * {
margin-top: 4px;
}
.c24 {
border: 0;
-webkit-clip: rect(0 0 0 0);
@ -305,19 +325,89 @@ describe('Plugin | Documentation | SettingsPage', () => {
width: 1px;
}
.c10 {
height: 2rem;
}
.c10[aria-disabled='true'] {
border: 1px solid #dcdce4;
background: #eaeaef;
}
.c10[aria-disabled='true'] .c5 {
color: #666687;
}
.c10[aria-disabled='true'] svg > g,.c10[aria-disabled='true'] svg path {
fill: #666687;
}
.c10[aria-disabled='true']:active {
border: 1px solid #dcdce4;
background: #eaeaef;
}
.c10[aria-disabled='true']:active .c5 {
color: #666687;
}
.c10[aria-disabled='true']:active svg > g,.c10[aria-disabled='true']:active svg path {
fill: #666687;
}
.c10:hover {
border: 1px solid #7b79ff;
background: #7b79ff;
}
.c10:active {
border: 1px solid #4945ff;
background: #4945ff;
}
.c10 svg > g,
.c10 svg path {
fill: #ffffff;
}
.c22 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.c17 {
display: grid;
grid-template-columns: repeat(12,1fr);
gap: 16px;
}
.c18 {
grid-column: span 6;
max-width: 100%;
}
.c0:focus-visible {
outline: none;
}
.c23 {
position: relative;
display: inline-block;
z-index: 0;
width: 100%;
}
.c26 {
height: 2.5rem;
border: 1px solid #dcdce4;
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
overflow: hidden;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
outline: none;
box-shadow: 0;
-webkit-transition-property: border-color,box-shadow,fill;
@ -331,109 +421,50 @@ describe('Plugin | Documentation | SettingsPage', () => {
box-shadow: #4945ff 0px 0px 0px 2px;
}
.c29 {
background-color: #ffffff;
border: 1px solid #dcdce4;
position: relative;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
z-index: 2;
-webkit-flex: 1 1 50%;
-ms-flex: 1 1 50%;
flex: 1 1 50%;
padding-top: 6px;
padding-bottom: 6px;
}
.c31 {
text-transform: uppercase;
background-color: transparent;
border: 1px solid #f6f6f9;
position: relative;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
z-index: 2;
-webkit-flex: 1 1 50%;
-ms-flex: 1 1 50%;
flex: 1 1 50%;
padding-top: 6px;
padding-bottom: 6px;
}
.c28 {
text-transform: uppercase;
border-right: 1px solid #dcdce4;
position: relative;
z-index: 2;
}
.c32 {
.c33 {
height: 100%;
left: 0;
opacity: 0;
position: absolute;
top: 0;
z-index: 1;
left: 4px;
top: 4px;
width: 100%;
}
.c19 {
width: -webkit-fit-content;
width: -moz-fit-content;
width: fit-content;
}
.c16 {
color: #32324d;
font-weight: 500;
font-size: 1rem;
line-height: 1.25;
}
.c1 {
background: #f6f6f9;
padding-top: 40px;
padding-right: 56px;
padding-bottom: 40px;
padding-left: 56px;
}
.c13 {
padding-right: 56px;
padding-left: 56px;
}
.c2 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.c3 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.c4 {
color: #32324d;
font-weight: 600;
font-size: 2rem;
line-height: 1.25;
}
.c12 {
color: #666687;
font-size: 1rem;
line-height: 1.5;
}
.c0:focus-visible {
outline: none;
}
.c17 {
display: grid;
grid-template-columns: repeat(12,1fr);
gap: 16px;
}
.c18 {
grid-column: span 6;
max-width: 320px;
}
@media (max-width:68.75rem) {
@ -469,45 +500,45 @@ describe('Plugin | Documentation | SettingsPage', () => {
class="c2"
>
<div
class="c3"
class="c3 c4"
>
<h1
class="c4"
class="c5 c6"
>
Documentation
</h1>
</div>
<button
aria-disabled="false"
class="c5 c6"
class="c7 c8 c9 c10"
type="submit"
>
<div
aria-hidden="true"
class="c7 c8 c9"
class=""
>
<svg
fill="none"
height="1em"
height="1rem"
viewBox="0 0 24 24"
width="1em"
width="1rem"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M20.727 2.97a.2.2 0 01.286 0l2.85 2.89a.2.2 0 010 .28L9.554 20.854a.2.2 0 01-.285 0l-9.13-9.243a.2.2 0 010-.281l2.85-2.892a.2.2 0 01.284 0l6.14 6.209L20.726 2.97z"
d="M20.727 2.97a.2.2 0 0 1 .286 0l2.85 2.89a.2.2 0 0 1 0 .28L9.554 20.854a.2.2 0 0 1-.285 0l-9.13-9.243a.2.2 0 0 1 0-.281l2.85-2.892a.2.2 0 0 1 .284 0l6.14 6.209L20.726 2.97Z"
fill="#212134"
/>
</svg>
</div>
<span
class="c10 c11"
class="c5 c11"
>
Save
</span>
</button>
</div>
<p
class="c12"
class="c5 c12"
>
Configure the documentation plugin
</p>
@ -523,7 +554,7 @@ describe('Plugin | Documentation | SettingsPage', () => {
class="c15"
>
<h2
class="c16"
class="c5 c16"
>
Settings
</h2>
@ -543,11 +574,11 @@ describe('Plugin | Documentation | SettingsPage', () => {
class="c20"
>
<div
class="c21"
class="c4"
>
<label
class="c22"
for="field-1"
class="c5 c21 c22"
for="1"
>
Restricted Access
</label>
@ -562,38 +593,42 @@ describe('Plugin | Documentation | SettingsPage', () => {
</div>
<div
class="c25 c26"
display="flex"
>
<div
aria-hidden="true"
class="c27 c21 c28"
class="c27 c28 c29"
>
<span
class="c29"
class="c5 c30"
>
Off
</span>
</div>
<div
aria-hidden="true"
class="c30 c21 c31"
class="c27 c28 c31"
>
<span
class="c22"
class="c5 c32"
>
On
</span>
</div>
<input
aria-describedby="1-hint"
aria-disabled="false"
class="c32"
aria-required="false"
class="c33"
id="1"
name="restrictedAccess"
type="checkbox"
/>
</div>
</label>
<p
class="c33"
id="field-1-hint"
class="c5 c34"
id="1-hint"
>
Make the documentation endpoint private
</p>

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.front.js',
displayName: 'Documentation plugin',
};

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.unit.js',
displayName: 'Documentation plugin',
};

View File

@ -22,7 +22,12 @@
],
"scripts": {
"lint": "run -T eslint .",
"test:unit": "jest --verbose"
"test:unit": "jest --verbose",
"test:unit:watch": "run -T jest --watch",
"test:front": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js",
"test:front:watch": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
"test:front:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js",
"test:front:watch:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll"
},
"dependencies": {
"@strapi/design-system": "1.6.6",

View File

@ -89,11 +89,6 @@ describe('i18n | middlewares | addCommonFieldsToInitialDataMiddleware', () => {
expect(nextAction).toEqual({
type: 'ContentManager/CrudReducer/INIT_FORM',
rawQuery: '?plugins[i18n][relatedEntityId]=1',
data: {
name: 'test',
localizations: ['test'],
common: 'test',
},
});
});
});

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.front.js',
displayName: 'I18N plugin',
};

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.unit.js',
displayName: 'I18N plugin',
};

View File

@ -23,6 +23,10 @@
"scripts": {
"test:unit": "run -T jest",
"test:unit:watch": "run -T jest --watch",
"test:front": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js",
"test:front:watch": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
"test:front:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js",
"test:front:watch:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll",
"lint": "run -T eslint ."
},
"dependencies": {

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.unit.js',
displayName: 'Sentry plugin',
};

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.front.js',
displayName: 'Users & Permissions plugin',
};

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.unit.js',
displayName: 'Users & Permissions plugin',
};

View File

@ -5,4 +5,5 @@ module.exports = {
transform: {
'^.+\\.ts$': ['@swc/jest'],
},
displayName: 'Mailgun email provider',
};

View File

@ -5,4 +5,5 @@ module.exports = {
transform: {
'^.+\\.ts$': ['@swc/jest'],
},
displayName: 'S3 upload provider',
};

View File

@ -5,4 +5,5 @@ module.exports = {
transform: {
'^.+\\.ts$': ['@swc/jest'],
},
displayName: 'Local upload provider',
};

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../../jest-preset.unit.js',
displayName: 'Typescript utils',
};

View File

@ -2,4 +2,5 @@
module.exports = {
preset: '../../jest-preset.front.js',
displayName: 'Front scripts',
};

View File

@ -7686,7 +7686,6 @@ __metadata:
"@strapi/generators": 4.10.1
"@strapi/helper-plugin": 4.10.1
"@strapi/icons": 1.6.6
"@strapi/strapi": 4.10.1
"@strapi/utils": 4.10.1
"@testing-library/react": 12.1.4
"@testing-library/react-hooks": 8.0.1
@ -16935,6 +16934,16 @@ __metadata:
languageName: node
linkType: hard
"find-up@npm:5.0.0, find-up@npm:^5.0.0":
version: 5.0.0
resolution: "find-up@npm:5.0.0"
dependencies:
locate-path: ^6.0.0
path-exists: ^4.0.0
checksum: 07955e357348f34660bde7920783204ff5a26ac2cafcaa28bace494027158a97b9f56faaf2d89a6106211a8174db650dd9f503f9c0d526b1202d5554a00b9095
languageName: node
linkType: hard
"find-up@npm:^1.0.0":
version: 1.1.2
resolution: "find-up@npm:1.1.2"
@ -16973,16 +16982,6 @@ __metadata:
languageName: node
linkType: hard
"find-up@npm:^5.0.0":
version: 5.0.0
resolution: "find-up@npm:5.0.0"
dependencies:
locate-path: ^6.0.0
path-exists: ^4.0.0
checksum: 07955e357348f34660bde7920783204ff5a26ac2cafcaa28bace494027158a97b9f56faaf2d89a6106211a8174db650dd9f503f9c0d526b1202d5554a00b9095
languageName: node
linkType: hard
"find-versions@npm:^5.0.0":
version: 5.1.0
resolution: "find-versions@npm:5.1.0"
@ -29668,6 +29667,7 @@ __metadata:
eslint-plugin-react: ^7.32.2
eslint-plugin-react-hooks: ^4.6.0
execa: 1.0.0
find-up: 5.0.0
fs-extra: 10.1.0
get-port: 5.1.1
glob: 7.2.3