Expand nx usage and migrate logger to ts (#15957)

This commit is contained in:
Alexandre BODIN 2023-03-22 11:21:33 +01:00 committed by GitHub
parent edc2bdcecd
commit aaeb988a0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
188 changed files with 1962 additions and 1688 deletions

View File

@ -1,18 +0,0 @@
**/node_modules/**
**/build/**
**/dist/**
**/OLD/**
testApp/**
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/**
packages/core/helper-plugin/lib/src/utils/**
packages/core/data-transfer/lib
.eslintrc.js
.eslintrc.front.js
.eslintrc.back.js

View File

@ -1,19 +0,0 @@
'use strict';
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.eslint.json',
},
plugins: ['@typescript-eslint'],
// TODO: This should be turned on but causes hundreds of violations in .d.ts files throughout Strapi that would need to be fixed
// extends: ['@strapi/eslint-config/typescript'],
globals: {
strapi: false,
},
// Instead of extending (which includes values that interfere with this configuration), only take the rules field
rules: {
...require('./.eslintrc.back.js').rules,
'import/no-extraneous-dependencies': ['error', { devDependencies: ['**/*.test.ts'] }],
},
};

View File

@ -1,42 +0,0 @@
const frontPaths = [
'packages/**/admin/src/**/*.js',
'packages/generators/app/lib/resources/files/admin/app.js',
'packages/**/ee/admin/**/*.js',
'packages/core/helper-plugin/**/*.js',
'packages/**/tests/front/**/*.js',
'test/config/front/**/*.js',
];
module.exports = {
parserOptions: {
ecmaVersion: 2020,
},
overrides: [
// Backend javascript
{
files: ['packages/**/*.js', 'test/**/*.js', 'scripts/**/*.js', 'jest.*.js'],
excludedFiles: frontPaths,
...require('./.eslintrc.back.js'),
},
// Backend typescript
{
files: ['packages/**/*.ts', 'test/**/*.ts', 'scripts/**/*.ts', 'jest.*.ts'],
excludedFiles: [...frontPaths, '**/*.d.ts'],
...require('./.eslintrc.back.typescript.js'),
},
// Type definitions
{
files: ['packages/**/*.d.ts', 'test/**/*.d.ts', 'scripts/**/*.d.ts'],
excludedFiles: frontPaths,
...require('./.eslintrc.back.type-definitions.js'),
},
// Frontend
{
files: frontPaths,
...require('./.eslintrc.front.js'),
},
],
};

View File

@ -0,0 +1,3 @@
node_modules/
.eslintrc.js
dist/

View File

@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ['custom/back'],
};

View File

@ -1,10 +1,11 @@
const action = require('../index');
'use strict';
jest.mock('@actions/github');
jest.mock('@actions/core');
const github = require('@actions/github');
const core = require('@actions/core');
const action = require('../index');
test.each(action.BLOCKING_LABELS)('Test blocking labels %s', async (label) => {
github.context = {

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,5 @@
'use strict';
const core = require('@actions/core');
const github = require('@actions/github');

View File

@ -6,11 +6,14 @@
"private": true,
"scripts": {
"build": "NODE_ENV=production ncc build index.js -o dist --minify",
"watch": "NODE_ENV=production ncc build index.js -w -o dist --minify"
"watch": "NODE_ENV=production ncc build index.js -w -o dist --minify",
"lint": "eslint ."
},
"dependencies": {
"@actions/core": "1.10.0",
"@actions/github": "5.1.1"
},
"devDependencies": {
"@actions/core": "1.10.0",
"@actions/github": "5.1.1",
"@vercel/ncc": "0.36.1"
}
}

View File

@ -15,6 +15,7 @@ concurrency:
permissions:
contents: read # to fetch code (actions/checkout)
actions: read
jobs:
lint:
@ -25,6 +26,8 @@ jobs:
node: [14, 16, 18]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
@ -32,12 +35,10 @@ jobs:
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('**/yarn.lock') }}
- uses: nrwl/nx-set-shas@v3
- run: yarn install --frozen-lockfile
- name: Build TypeScript packages # for lint we need to build ts, for rules checking if paths exist
run: yarn build:ts
- name: Run lint
run: yarn run -s lint
run: yarn nx affected --target=lint --parallel --nx-ignore-cycles
unit_back:
name: 'unit_back (node: ${{ matrix.node }})'
@ -48,6 +49,8 @@ jobs:
node: [14, 16, 18]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
@ -55,18 +58,10 @@ jobs:
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('**/yarn.lock') }}
- uses: nrwl/nx-set-shas@v3
- run: yarn install --frozen-lockfile
- name: Build TypeScript packages # for unit tests we need to build ts, for finding and mocking ts packages
run: yarn build:ts
- name: Run tests
run: yarn run -s test:unit --coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage
flags: back,unit_back
run: yarn nx affected --target=test:unit --nx-ignore-cycles
unit_front:
name: 'unit_front (node: ${{ matrix.node }})'
@ -77,6 +72,8 @@ jobs:
node: [18]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
@ -84,18 +81,10 @@ jobs:
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('**/yarn.lock') }}
- uses: nrwl/nx-set-shas@v3
- run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Run test
run: yarn run -s test:front --coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage
flags: front,unit_front
run: yarn nx affected --target=test:front --nx-ignore-cycles
build:
name: 'build (node: ${{ matrix.node }})'
@ -115,7 +104,7 @@ jobs:
key: ${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('**/yarn.lock') }}
- run: yarn install --frozen-lockfile
- name: Build
run: yarn build --scope @strapi/admin --scope @strapi/helper-plugin
run: yarn build --projects=@strapi/admin,@strapi/helper-plugin
api_ce_pg:
runs-on: ubuntu-latest

3
.gitignore vendored
View File

@ -79,7 +79,6 @@ $RECYCLE.BIN/
*#
.idea
nbproject
.vscode/
.eslintcache
@ -135,6 +134,8 @@ schema.graphql
# Visual Studio Code
############################
.vscode/
!.vscode/settings.json
front-workspace.code-workspace
.yarn
.yarnrc

View File

@ -1,4 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no lint-staged
yarn lint-staged
yarn nx affected:lint --uncommitted --nx-ignore-cycles

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"eslint.workingDirectories": [{ "mode": "auto" }]
}

85
jest-preset.front.js Normal file
View File

@ -0,0 +1,85 @@
'use strict';
const path = require('path');
const IS_EE = process.env.IS_EE === 'true';
const moduleNameMapper = {
'.*\\.(css|less|styl|scss|sass)$': path.join(
__dirname,
'packages/admin-test-utils/lib/mocks/cssModule.js'
),
'.*\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ico)$':
path.join(__dirname, 'packages/admin-test-utils/lib/mocks/image.js'),
'^ee_else_ce(/.*)$': IS_EE
? [
path.join(__dirname, 'packages/core/admin/ee/admin$1'),
path.join(__dirname, 'packages/core/content-manager/ee/admin/src$1'),
path.join(__dirname, 'packages/core/content-type-builder/ee/admin/src$1'),
path.join(__dirname, 'packages/core/upload/ee/admin/src$1'),
path.join(__dirname, 'packages/core/email/ee/admin/src$1'),
path.join(__dirname, 'packages/plugins/*/ee/admin/src$1'),
]
: [
path.join(__dirname, 'packages/core/admin/admin/src$1'),
path.join(__dirname, 'packages/core/content-manager/admin/src$1'),
path.join(__dirname, 'packages/core/content-type-builder/admin/src$1'),
path.join(__dirname, 'packages/core/upload/admin/src$1'),
path.join(__dirname, 'packages/core/email/admin/src$1'),
path.join(__dirname, 'packages/plugins/*/admin/src$1'),
],
};
module.exports = {
rootDir: __dirname,
moduleNameMapper,
testPathIgnorePatterns: ['/node_modules/', '__tests__'],
globalSetup: path.join(__dirname, 'test/config/front/global-setup.js'),
setupFiles: [
path.join(__dirname, 'packages/admin-test-utils/lib/setup/test-bundler.js'),
path.join(__dirname, 'packages/admin-test-utils/lib/mocks/fetch.js'),
path.join(__dirname, 'packages/admin-test-utils/lib/mocks/LocalStorageMock.js'),
path.join(__dirname, 'packages/admin-test-utils/lib/mocks/IntersectionObserver.js'),
path.join(__dirname, 'packages/admin-test-utils/lib/mocks/ResizeObserver.js'),
path.join(__dirname, 'packages/admin-test-utils/lib/mocks/windowMatchMedia.js'),
path.join(__dirname, 'packages/admin-test-utils/lib/mocks/mockRangeApi.js'),
],
setupFilesAfterEnv: [
path.join(__dirname, '/packages/admin-test-utils/lib/setup/styled-components.js'),
path.join(__dirname, '/packages/admin-test-utils/lib/setup/strapi.js'),
path.join(__dirname, '/packages/admin-test-utils/lib/setup/prop-types.js'),
],
testEnvironment: 'jsdom',
transform: {
'^.+\\.js$': [
'@swc/jest',
{
env: {
coreJs: '3.28.0',
mode: 'usage',
},
jsc: {
parser: {
jsx: true,
dynamicImport: true,
},
// this should match the minimum supported node.js version
target: 'es2020',
},
},
],
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
path.join(__dirname, 'fileTransformer.js'),
},
transformIgnorePatterns: [
'node_modules/(?!(react-dnd|dnd-core|react-dnd-html5-backend|@strapi/design-system|@strapi/icons|fractional-indexing)/)',
],
testMatch: ['/**/tests/**/?(*.)+(spec|test).[jt]s?(x)'],
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'],
};

View File

@ -1,11 +1,9 @@
'use strict';
module.exports = {
rootDir: __dirname,
setupFilesAfterEnv: ['<rootDir>/test/unit.setup.js'],
setupFilesAfterEnv: [__dirname + '/test/unit.setup.js'],
modulePathIgnorePatterns: ['.cache', 'dist'],
testPathIgnorePatterns: ['.testdata.js', '.test.utils.js'],
// TODO: testMatch should only include files with (test|spec) even within __tests__ so that utilities can be included and ignored there
testMatch: ['/**/__tests__/**/*.[jt]s?(x)'],
// 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

View File

@ -1,91 +0,0 @@
'use strict';
const IS_EE = process.env.IS_EE === 'true';
const moduleNameMapper = {
'.*\\.(css|less|styl|scss|sass)$': '<rootDir>/packages/admin-test-utils/lib/mocks/cssModule.js',
'.*\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ico)$':
'<rootDir>/packages/admin-test-utils/lib/mocks/image.js',
'^ee_else_ce(/.*)$': IS_EE
? [
'<rootDir>/packages/core/admin/ee/admin$1',
'<rootDir>/packages/core/content-manager/ee/admin/src$1',
'<rootDir>/packages/core/content-type-builder/ee/admin/src$1',
'<rootDir>/packages/core/upload/ee/admin/src$1',
'<rootDir>/packages/core/email/ee/admin/src$1',
'<rootDir>/packages/plugins/*/ee/admin/src$1',
]
: [
'<rootDir>/packages/core/admin/admin/src$1',
'<rootDir>/packages/core/content-manager/admin/src$1',
'<rootDir>/packages/core/content-type-builder/admin/src$1',
'<rootDir>/packages/core/upload/admin/src$1',
'<rootDir>/packages/core/email/admin/src$1',
'<rootDir>/packages/plugins/*/admin/src$1',
],
};
module.exports = {
rootDir: __dirname,
moduleNameMapper,
collectCoverageFrom: [
'<rootDir>/packages/core/*/admin/src/**/*.js',
'<rootDir>/packages/core/admin/ee/admin/**/*.js',
'<rootDir>/packages/plugins/*/admin/src/**/*.js',
],
testPathIgnorePatterns: [
'/node_modules/',
'<rootDir>/examples/getstarted/',
'<rootDir>/examples/kitchensink/',
'<rootDir>/packages/strapi-helper-plugin/dist/',
'__tests__',
],
globalSetup: '<rootDir>/test/config/front/global-setup.js',
setupFiles: [
'<rootDir>/packages/admin-test-utils/lib/setup/test-bundler.js',
'<rootDir>/packages/admin-test-utils/lib/mocks/fetch.js',
'<rootDir>/packages/admin-test-utils/lib/mocks/LocalStorageMock.js',
'<rootDir>/packages/admin-test-utils/lib/mocks/IntersectionObserver.js',
'<rootDir>/packages/admin-test-utils/lib/mocks/ResizeObserver.js',
'<rootDir>/packages/admin-test-utils/lib/mocks/windowMatchMedia.js',
'<rootDir>/packages/admin-test-utils/lib/mocks/mockRangeApi.js',
],
setupFilesAfterEnv: [
'<rootDir>/packages/admin-test-utils/lib/setup/styled-components.js',
'<rootDir>/packages/admin-test-utils/lib/setup/strapi.js',
'<rootDir>/packages/admin-test-utils/lib/setup/prop-types.js',
],
testEnvironment: 'jsdom',
transform: {
'^.+\\.js$': [
'@swc/jest',
{
env: {
coreJs: '3.28.0',
mode: 'usage',
},
jsc: {
parser: {
jsx: true,
dynamicImport: true,
},
// this should match the minimum supported node.js version
target: 'es2020',
},
},
],
'\\.(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|@strapi/design-system|@strapi/icons|fractional-indexing)/)',
],
testMatch: ['/**/tests/**/?(*.)+(spec|test).[jt]s?(x)'],
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'],
};

View File

@ -1,11 +0,0 @@
'use strict';
const baseConfig = require('./jest.base-config.front');
module.exports = {
...baseConfig,
projects: [
'<rootDir>/packages/**/jest.config.front.js',
'<rootDir>/scripts/**/jest.config.front.js',
],
};

View File

@ -1,6 +0,0 @@
'use strict';
module.exports = {
coverageDirectory: '<rootDir>/coverage',
projects: ['<rootDir>/packages/**/jest.config.js', '<rootDir>/.github'],
};

53
nx.json Normal file
View File

@ -0,0 +1,53 @@
{
"namedInputs": {
"default": ["{projectRoot}/**/*"],
"production": [
"default",
"!{projectRoot}/**/*.test.ts",
"!{projectRoot}/**/*.test.js",
"!{projectRoot}/**/*.md"
]
},
"targetDefaults": {
"build": {
"inputs": ["production", "^production"],
"dependsOn": ["^build"],
"outputs": ["{projectRoot}/lib", "{projectRoot}/build", "{projectRoot}/dist"]
},
"build:ts": {
"inputs": ["production", "^production", "{workspaceRoot}/packages/utils/tsconfig/**/*"],
"dependsOn": ["^build:ts"],
"outputs": ["{projectRoot}/lib", "{projectRoot}/build", "{projectRoot}/dist"]
},
"test:unit": {
"inputs": ["default", "{projectRoot}/jest.config.js", "{workspaceRoot}/jest-preset.unit.js"],
"dependsOn": ["build:ts"]
},
"test:front": {
"inputs": [
"default",
"{projectRoot}/jest.config.front.js",
"{workspaceRoot}/jest-preset.front.js"
],
"dependsOn": ["^build"]
},
"lint": {
"inputs": [
"default",
"{projectRoot}/.eslintrc.js",
"{projectRoot}/.eslintignore",
"{projectRoot}/tsconfig.eslint.json",
"{workspaceRoot}/packages/utils/eslint-config-custom/**/*"
],
"dependsOn": ["build:ts"]
}
},
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "build:ts", "lint", "test:unit", "test:front"]
}
}
}
}

View File

@ -25,61 +25,54 @@
"packages/*",
"packages/*/*",
"examples/*",
".github/actions/*"
".github/actions/*",
"scripts/*"
],
"scripts": {
"prepare": "husky install",
"setup": "yarn && yarn clean && yarn build",
"clean": "lerna run --stream clean --no-private",
"watch": "lerna run --stream watch --no-private --parallel",
"build": "lerna run --stream build --no-private",
"build:ts": "lerna run --stream build:ts --no-private",
"clean": "nx run-many --target=clean --nx-ignore-cycles",
"watch": "nx run-many --target=watch --nx-ignore-cycles",
"build": "nx run-many --target=build --nx-ignore-cycles",
"build:ts": "nx run-many --target=build:ts --nx-ignore-cycles",
"generate": "plop --plopfile ./packages/generators/admin/plopfile.js",
"lint": "npm-run-all -p lint:code lint:css",
"lint:code": "eslint --cache --cache-strategy content --cache-location ./node_modules/.cache/eslint .",
"lint": "nx run-many --target=lint --nx-ignore-cycles && yarn lint:css && yarn lint:other",
"lint:css": "stylelint packages/**/admin/src/**/*.js",
"lint:fix": "eslint --fix .",
"lint:fix": "nx run-many --target=lint --nx-ignore-cycles -- --fix",
"lint:other": "npm run prettier:other -- --check",
"format": "npm-run-all -p format:*",
"format:code": "npm run prettier:code -- --write",
"format:other": "npm run 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:clean": "rimraf ./coverage",
"test:front": "npm run test:clean && cross-env IS_EE=true jest --config ./jest.config.front.js",
"test:front:watch": "cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
"test:front:update": "cross-env IS_EE=true jest --config ./jest.config.front.js --u",
"test:front:ce": "npm run test:clean && cross-env IS_EE=false jest --config ./jest.config.front.js --coverage",
"test:front:watch:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll",
"test:front:update:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js --u",
"test:unit": "jest --verbose",
"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: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: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 --cache --cache-strategy content --write"
],
"*.{js,ts}": [
"eslint --cache --cache-strategy content --cache-location ./node_modules/.cache/eslint --fix"
"prettier --write"
]
},
"devDependencies": {
"@babel/core": "^7.20.12",
"@babel/eslint-parser": "^7.19.1",
"@babel/preset-react": "7.18.6",
"@strapi/eslint-config": "0.1.2",
"@swc/core": "1.3.35",
"@swc/cli": "0.1.62",
"@swc/core": "1.3.37",
"@swc/jest": "0.2.24",
"@typescript-eslint/parser": "5.43.0",
"babel-eslint": "10.1.0",
"chalk": "4.1.2",
"chokidar": "3.5.3",
"core-js": "3.28.0",
"cross-env": "7.0.3",
"dotenv": "14.2.0",
"eslint": "8.27.0",
"execa": "1.0.0",
"fs-extra": "10.1.0",
"get-port": "5.1.1",
@ -91,11 +84,11 @@
"jest-cli": "29.0.3",
"jest-environment-jsdom": "29.0.3",
"jest-watch-typeahead": "2.2.2",
"lerna": "5.4.3",
"lerna": "6.5.1",
"lint-staged": "13.0.3",
"lodash": "4.17.21",
"npm-run-all": "4.1.5",
"nx": "14.8.6",
"nx": "15.8.3",
"plop": "2.7.6",
"prettier": "2.8.4",
"qs": "6.11.0",
@ -106,6 +99,7 @@
"stylelint-processor-styled-components": "1.10.0",
"supertest": "6.3.3",
"ts-jest": "29.0.3",
"typedoc": "0.23.26",
"typescript": "4.6.2",
"yargs": "17.6.0"
},

View File

@ -0,0 +1,2 @@
node_modules/
.eslintrc.js

View File

@ -0,0 +1,7 @@
module.exports = {
root: true,
extends: ['custom/back'],
rules: {
'import/no-extraneous-dependencies': 'off',
},
};

View File

@ -31,7 +31,7 @@
"redux": "^4.2.1"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"lint": "eslint ."
},
"engines": {
"node": ">=14.19.1 <=18.x.x"

View File

@ -0,0 +1,2 @@
node_modules/
.eslintrc.js

View File

@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ['custom/back'],
};

View File

@ -40,7 +40,7 @@
"create-strapi-app": "./index.js"
},
"scripts": {
"test": "echo \"no tests yet\""
"lint": "eslint ."
},
"engines": {
"node": ">=14.19.1 <=18.x.x",

View File

@ -0,0 +1,2 @@
node_modules/
.eslintrc.js

View File

@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ['custom/back'],
};

View File

@ -35,7 +35,7 @@
"create-strapi-starter": "./index.js"
},
"scripts": {
"test": "echo \"no tests yet\""
"lint": "eslint ."
},
"dependencies": {
"@strapi/generate-new": "4.8.2",

View File

@ -0,0 +1,4 @@
node_modules/
.eslintrc.js
build/
admin/src/plugins.js

View File

@ -0,0 +1,14 @@
module.exports = {
root: true,
overrides: [
{
files: ['admin/**/*', 'ee/admin/**/*'],
extends: ['custom/front'],
},
{
files: ['**/*'],
excludedFiles: ['admin/**/*', 'ee/admin/**/*'],
extends: ['custom/back'],
},
],
};

View File

@ -1,11 +1,6 @@
'use strict';
const baseConfig = require('../../../jest.base-config.front');
const pkg = require('./package.json');
module.exports = {
...baseConfig,
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
roots: [__dirname],
preset: '../../../jest-preset.front.js',
collectCoverageFrom: ['<rootDir>/packages/core/admin/admin/**/*.js'],
};

View File

@ -1,10 +1,5 @@
'use strict';
const baseConfig = require('../../../jest.base-config');
const pkg = require('./package.json');
module.exports = {
...baseConfig,
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
roots: [__dirname],
preset: '../../../jest-preset.unit.js',
};

View File

@ -30,12 +30,14 @@
"build": "rimraf build && node ./scripts/build.js",
"build:mesure": "rimraf build && cross-env MESURE_BUILD_SPEED=true node ./scripts/build.js",
"test": "echo \"no tests yet\"",
"test:unit": "jest --verbose",
"test:unit": "jest",
"test:unit:watch": "jest --watch",
"test:front": "cross-env IS_EE=true jest --config ./jest.config.front.js",
"test:front:watch": "cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
"test:front:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js",
"test:front:watch:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll",
"test:front:ce:cov": "cross-env IS_EE=false jest --config ./jest.config.front.js --coverage"
"test:front:ce:cov": "cross-env IS_EE=false jest --config ./jest.config.front.js --coverage",
"lint": "eslint ."
},
"dependencies": {
"@babel/core": "^7.20.12",

View File

@ -90,7 +90,7 @@ describe('Admin Controller', () => {
['uuid', null],
]);
expect(result.data).toBeDefined();
expect(result.data).toStrictEqual({
expect(result.data).toMatchObject({
currentEnvironment: 'development',
autoReload: false,
strapiVersion: '1.0.0',
@ -100,7 +100,6 @@ describe('Admin Controller', () => {
},
nodeVersion: process.version,
communityEdition: false,
useYarn: true,
});
});
});

View File

@ -0,0 +1,2 @@
node_modules/
.eslintrc.js

View File

@ -0,0 +1,14 @@
module.exports = {
root: true,
overrides: [
{
files: ['admin/**/*'],
extends: ['custom/front'],
},
{
files: ['**/*'],
excludedFiles: ['admin/**/*'],
extends: ['custom/back'],
},
],
};

View File

@ -1,10 +1,5 @@
'use strict';
const baseConfig = require('../../../jest.base-config');
const pkg = require('./package.json');
module.exports = {
...baseConfig,
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
roots: [__dirname],
preset: '../../../jest-preset.unit.js',
};

View File

@ -20,7 +20,9 @@
}
],
"scripts": {
"test:unit": "jest --verbose"
"test:unit": "jest",
"test:unit:watch": "jest --watch",
"lint": "eslint ."
},
"dependencies": {
"@sindresorhus/slugify": "1.1.0",

View File

@ -0,0 +1,2 @@
node_modules/
.eslintrc.js

View File

@ -0,0 +1,14 @@
module.exports = {
root: true,
overrides: [
{
files: ['admin/**/*'],
extends: ['custom/front'],
},
{
files: ['**/*'],
excludedFiles: ['admin/**/*'],
extends: ['custom/back'],
},
],
};

View File

@ -1,10 +1,5 @@
'use strict';
const baseConfig = require('../../../jest.base-config.front');
const pkg = require('./package.json');
module.exports = {
...baseConfig,
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
roots: [__dirname],
preset: '../../../jest-preset.front.js',
};

View File

@ -1,10 +1,5 @@
'use strict';
const baseConfig = require('../../../jest.base-config');
const pkg = require('./package.json');
module.exports = {
...baseConfig,
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
roots: [__dirname],
preset: '../../../jest-preset.unit.js',
};

View File

@ -20,11 +20,13 @@
}
],
"scripts": {
"test:unit": "jest --verbose",
"test:unit": "jest",
"test:unit:watch": "jest --watch",
"test:front": "cross-env IS_EE=true jest --config ./jest.config.front.js",
"test:front:watch": "cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
"test:front:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js",
"test:front:watch:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll"
"test:front:watch:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll",
"lint": "eslint ."
},
"dependencies": {
"@sindresorhus/slugify": "1.1.0",

View File

@ -0,0 +1,5 @@
node_modules/
lib/
.eslintrc.js
jest.config.js
coverage/

View File

@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ['custom/typescript'],
};

View File

@ -1,12 +1,7 @@
'use strict';
const baseConfig = require('../../../jest.base-config');
const pkg = require('./package.json');
module.exports = {
...baseConfig,
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
roots: [__dirname],
preset: '../../../jest-preset.unit.js',
testMatch: ['**/__tests__/**/*.test.ts'],
transform: {
'^.+\\.(t|j)sx?$': ['@swc/jest'],

View File

@ -27,13 +27,14 @@
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"scripts": {
"build": "yarn build:ts",
"build:ts": "tsc -p tsconfig.json",
"build:clean": "yarn clean && yarn build",
"build": "tsc",
"build:ts": "tsc",
"clean": "rimraf ./lib",
"prepublishOnly": "yarn build:clean",
"test:unit": "jest --verbose",
"watch": "yarn build:ts -w --preserveWatchOutput"
"prepublishOnly": "yarn clean && yarn build",
"test:unit": "jest",
"test:unit:watch": "jest --watch",
"watch": "tsc -w --preserveWatchOutput",
"lint": "eslint ."
},
"directories": {
"lib": "./lib"

View File

@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": true,
},
"include": ["types", "src"],
"exclude": ["node_modules"]
}

View File

@ -1,15 +1,8 @@
{
"extends": "@tsconfig/node16/tsconfig.json",
"extends": "tsconfig/base.json",
"compilerOptions": {
"strict": true,
"lib": ["ES2020"],
"target": "ES2020",
"skipLibCheck": true,
"outDir": "lib",
"declaration": true,
"sourceMap": true,
"esModuleInterop": true
"outDir": "lib"
},
"include": ["types", "src/**/*.ts"],
"exclude": ["node_modules", "src/**/__tests__"]
"include": ["types", "src"],
"exclude": ["node_modules", "**/__tests__/**"]
}

View File

@ -1,3 +1,4 @@
import type { PipelineSource, PipelineDestination, Readable, Writable } from 'stream';
import type {
IDestinationProviderTransferResults,
IProviderTransferResults,
@ -6,7 +7,6 @@ import type {
MaybePromise,
} from './utils';
import type { IMetadata } from './common-entities';
import type { PipelineSource, PipelineDestination, Readable, Writable } from 'stream';
type ProviderType = 'source' | 'destination';

View File

@ -1,11 +1,6 @@
import type { PassThrough } from 'stream';
import type { IAsset, IEntity, ILink } from './common-entities';
import type { ITransferResults, TransferTransform, TransferTransforms } from './utils';
import type { ITransferResults, TransferTransforms, TransferProgress } from './utils';
import type { ISourceProvider, IDestinationProvider } from './providers';
import type { Schema } from '@strapi/strapi';
import type { ITransferResults, TransferTransform, TransferProgress } from './utils';
import type { ISourceProvider, IDestinationProvider } from './providers';
import type { Severity } from '../src/errors';
import type { DiagnosticReporter } from '../src/engine/diagnostic';
export type TransferFilterPreset = 'content' | 'files' | 'config';

View File

@ -1,9 +1,9 @@
/* eslint-disable @typescript-eslint/ban-types */
import type { Readable, Writable, Duplex, Transform } from 'stream';
import type { Schema } from '@strapi/strapi';
import type { KnexTransaction } from 'knex';
import type { IDestinationProvider, ISourceProvider } from './providers';
import type { IAsset, IEntity, ILink } from './common-entities';
import type { Schema } from '@strapi/strapi';
import type { ITransferEngineOptions } from './transfer-engine';
import type { KnexTransaction } from 'knex';
export type MaybePromise<T> = T | Promise<T>;
@ -30,7 +30,7 @@ export type TransferMap<T> = {
map: (data: T) => T;
};
type Stream = Readable | Writable | Duplex | Transform;
export type Stream = Readable | Writable | Duplex | Transform;
export type TransformFunction = (chunk: any, encoding?: string) => any;
export type StreamItem = Stream | TransformFunction;
@ -48,18 +48,18 @@ export type TransferTransforms = {
[key in TransferTransformOption]?: TransferTransformArray<key>;
};
/**
/*
* Filters
**/
*/
export type TransferFilterArray<T> = TransferFilter<TransferStageTypeMap[T]>[];
export type TransferFilters = {
[key in TransferTransformOption]?: boolean | TransferFilterArray<key>;
};
/**
/*
* Progress
**/
*/
export type TransferProgress = {
[key in TransferStage]?: {
count: number;
@ -86,7 +86,7 @@ export type IProviderTransferResults = {};
export type ISourceProviderTransferResults = {};
export type IDestinationProviderTransferResults = {};
export type KnexTransaction = KnexTransaction;
export type { KnexTransaction };
export type TransactionCallback = (trx?: KnexTransaction) => Promise<void>;
export type Transaction = {
attach<T = undefined>(callback: TransactionCallback): Promise<T | undefined>;

View File

@ -0,0 +1,2 @@
node_modules/
.eslintrc.js

View File

@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ['custom/back'],
};

View File

@ -1,10 +1,5 @@
'use strict';
const baseConfig = require('../../../jest.base-config');
const pkg = require('./package.json');
module.exports = {
...baseConfig,
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
roots: [__dirname],
preset: '../../../jest-preset.unit.js',
};

View File

@ -28,7 +28,9 @@
"lib": "./lib"
},
"scripts": {
"test:unit": "jest --verbose"
"test:unit": "jest",
"test:unit:watch": "jest --watch",
"lint": "eslint ."
},
"dependencies": {
"date-fns": "2.29.3",

View File

@ -0,0 +1,2 @@
node_modules/
.eslintrc.js

View File

@ -0,0 +1,14 @@
module.exports = {
root: true,
overrides: [
{
files: ['admin/**/*'],
extends: ['custom/front'],
},
{
files: ['**/*'],
excludedFiles: ['admin/**/*'],
extends: ['custom/back'],
},
],
};

View File

@ -1,10 +1,5 @@
'use strict';
const baseConfig = require('../../../jest.base-config.front');
const pkg = require('./package.json');
module.exports = {
...baseConfig,
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
roots: [__dirname],
preset: '../../../jest-preset.front.js',
};

View File

@ -23,7 +23,8 @@
"test:front": "cross-env IS_EE=true jest --config ./jest.config.front.js",
"test:front:watch": "cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
"test:front:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js",
"test:front:watch:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll"
"test:front:watch:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll",
"lint": "eslint ."
},
"dependencies": {
"@strapi/design-system": "1.6.6",

View File

@ -0,0 +1,4 @@
node_modules/
.eslintrc.js
build/
lib/src/utils/**

View File

@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ['custom/front'],
};

View File

@ -1,9 +1,4 @@
const baseConfig = require('../../../jest.base-config.front');
const pkg = require('./package.json');
module.exports = {
...baseConfig,
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
roots: [__dirname],
preset: '../../../jest-preset.front.js',
collectCoverageFrom: ['<rootDir>/packages/core/helper-plugin/lib/src/**/*.js'],
};

View File

@ -40,7 +40,8 @@
"test:front": "jest --config ./jest.config.front.js",
"test:front:cov": "jest --config ./jest.config.front.js --coverage",
"test:front:watch": "jest --config ./jest.config.front.js --watchAll",
"watch": "cross-env NODE_ENV=development webpack-cli -w"
"watch": "cross-env NODE_ENV=development webpack-cli -w",
"lint": "eslint ."
},
"dependencies": {
"axios": "1.3.4",

View File

@ -0,0 +1,2 @@
node_modules/
.eslintrc.js

View File

@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ['custom/back'],
};

View File

@ -1,10 +1,5 @@
'use strict';
const baseConfig = require('../../../jest.base-config');
const pkg = require('./package.json');
module.exports = {
...baseConfig,
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
roots: [__dirname],
preset: '../../../jest-preset.unit.js',
};

View File

@ -21,7 +21,9 @@
],
"main": "./lib/index.js",
"scripts": {
"test:unit": "jest --verbose"
"test:unit": "jest",
"test:unit:watch": "jest --watch",
"lint": "eslint ."
},
"dependencies": {
"@casl/ability": "5.4.4",

View File

@ -0,0 +1,2 @@
node_modules/
.eslintrc.js

View File

@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ['custom/back'],
};

View File

@ -1,10 +1,5 @@
'use strict';
const baseConfig = require('../../../jest.base-config');
const pkg = require('./package.json');
module.exports = {
...baseConfig,
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
roots: [__dirname],
preset: '../../../jest-preset.unit.js',
};

View File

@ -76,7 +76,9 @@
},
"scripts": {
"postinstall": "node lib/utils/success.js",
"test:unit": "jest --verbose"
"test:unit": "jest",
"test:unit:watch": "jest --watch",
"lint": "eslint ."
},
"dependencies": {
"@koa/cors": "3.4.3",

View File

@ -0,0 +1,2 @@
node_modules/
.eslintrc.js

View File

@ -0,0 +1,14 @@
module.exports = {
root: true,
overrides: [
{
files: ['admin/**/*'],
extends: ['custom/front'],
},
{
files: ['**/*'],
excludedFiles: ['admin/**/*'],
extends: ['custom/back'],
},
],
};

View File

@ -1,10 +1,5 @@
'use strict';
const baseConfig = require('../../../jest.base-config.front');
const pkg = require('./package.json');
module.exports = {
...baseConfig,
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
roots: [__dirname],
preset: '../../../jest-preset.front.js',
};

View File

@ -1,10 +1,5 @@
'use strict';
const baseConfig = require('../../../jest.base-config');
const pkg = require('./package.json');
module.exports = {
...baseConfig,
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
roots: [__dirname],
preset: '../../../jest-preset.unit.js',
};

View File

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

View File

@ -0,0 +1,2 @@
node_modules/
.eslintrc.js

View File

@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ['custom/back'],
};

View File

@ -1,11 +1,6 @@
'use strict';
const baseConfig = require('../../../jest.base-config');
const pkg = require('./package.json');
module.exports = {
...baseConfig,
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
roots: [__dirname],
preset: '../../../jest-preset.unit.js',
testMatch: ['<rootDir>/**/*.test.js'],
};

View File

@ -32,7 +32,9 @@
"lib": "./lib"
},
"scripts": {
"test:unit": "jest --verbose"
"test:unit": "jest",
"test:unit:watch": "jest --watch",
"lint": "eslint ."
},
"dependencies": {
"@sindresorhus/slugify": "1.1.0",

View File

@ -0,0 +1,3 @@
node_modules/
.eslintrc.js
lib/resources/files/

View File

@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ['custom/back'],
};

View File

@ -33,7 +33,8 @@
"lib": "./lib"
},
"scripts": {
"test": "echo \"no tests yet\""
"test": "echo \"no tests yet\"",
"lint": "eslint ."
},
"dependencies": {
"@sentry/node": "6.19.7",

View File

@ -0,0 +1,3 @@
node_modules/
.eslintrc.js
lib/files/

View File

@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ['custom/back'],
};

View File

@ -28,6 +28,9 @@
}
],
"main": "lib/index.js",
"scripts": {
"lint": "eslint ."
},
"dependencies": {
"@sindresorhus/slugify": "1.1.0",
"@strapi/typescript-utils": "4.8.2",

View File

@ -0,0 +1,2 @@
node_modules/
.eslintrc.js

View File

@ -0,0 +1,14 @@
module.exports = {
root: true,
overrides: [
{
files: ['admin/**/*'],
extends: ['custom/front'],
},
{
files: ['**/*'],
excludedFiles: ['admin/**/*'],
extends: ['custom/back'],
},
],
};

View File

@ -1,10 +1,5 @@
'use strict';
const baseConfig = require('../../../jest.base-config.front');
const pkg = require('./package.json');
module.exports = {
...baseConfig,
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
roots: [__dirname],
preset: '../../../jest-preset.front.js',
};

View File

@ -1,10 +0,0 @@
'use strict';
const baseConfig = require('../../../jest.base-config');
const pkg = require('./package.json');
module.exports = {
...baseConfig,
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
roots: [__dirname],
};

View File

@ -30,6 +30,13 @@
"react-router-dom": "5.3.4",
"styled-components": "5.3.3"
},
"scripts": {
"test:front": "cross-env IS_EE=true jest --config ./jest.config.front.js",
"test:front:watch": "cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
"test:front:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js",
"test:front:watch:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll",
"lint": "eslint ."
},
"repository": {
"type": "git",
"url": "https://github.com/strapi/strapi.git",

View File

@ -0,0 +1,2 @@
node_modules/
.eslintrc.js

View File

@ -0,0 +1,14 @@
module.exports = {
root: true,
overrides: [
{
files: ['admin/**/*'],
extends: ['custom/front'],
},
{
files: ['**/*'],
excludedFiles: ['admin/**/*'],
extends: ['custom/back'],
},
],
};

View File

@ -21,7 +21,7 @@
}
],
"scripts": {
"test": "echo \"no tests yet\""
"lint": "eslint ."
},
"dependencies": {
"@strapi/design-system": "1.6.6",

View File

@ -0,0 +1,2 @@
node_modules/
.eslintrc.js

View File

@ -0,0 +1,14 @@
module.exports = {
root: true,
overrides: [
{
files: ['admin/**/*'],
extends: ['custom/front'],
},
{
files: ['**/*'],
excludedFiles: ['admin/**/*'],
extends: ['custom/back'],
},
],
};

View File

@ -1,10 +0,0 @@
'use strict';
const baseConfig = require('../../../jest.base-config');
const pkg = require('./package.json');
module.exports = {
...baseConfig,
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
roots: [__dirname],
};

View File

@ -21,10 +21,7 @@
}
],
"scripts": {
"test:front": "cross-env IS_EE=true jest --config ./jest.config.front.js",
"test:front:watch": "cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
"test:front:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js",
"test:front:watch:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll"
"lint": "eslint ."
},
"dependencies": {
"@graphql-tools/schema": "8.5.1",

Some files were not shown because too many files have changed in this diff Show More