Migrate color picker backend to ts and setup initial frontend configs

This commit is contained in:
Alexandre Bodin 2023-07-27 18:59:44 +02:00
parent 5981e7e7c3
commit eb5a97801d
34 changed files with 210 additions and 32 deletions

View File

@ -28,7 +28,7 @@ module.exports = {
setupFilesAfterEnv: ['@strapi/admin-test-utils/after-env'],
testEnvironment: 'jsdom',
transform: {
'^.+\\.js$': [
'^.+\\.(j|t)s(x)?$': [
'@swc/jest',
{
env: {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,16 @@
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[{package.json,*.yml}]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false

View File

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

View File

@ -7,7 +7,7 @@ module.exports = {
},
{
files: ['**/*'],
excludedFiles: ['admin/**/*'],
excludedFiles: ['admin/**/*', 'server/**/*'],
extends: ['custom/back'],
},
],

View File

@ -0,0 +1,98 @@
############################
# OS X
############################
.DS_Store
.AppleDouble
.LSOverride
Icon
.Spotlight-V100
.Trashes
._*
############################
# Linux
############################
*~
############################
# Windows
############################
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
*.cab
*.msi
*.msm
*.msp
############################
# Packages
############################
*.7z
*.csv
*.dat
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
*.com
*.class
*.dll
*.exe
*.o
*.seed
*.so
*.swo
*.swp
*.swn
*.swm
*.out
*.pid
############################
# Logs and databases
############################
.tmp
*.log
*.sql
*.sqlite
############################
# Misc.
############################
*#
.editorconfig
.idea
nbproject
############################
# Node.js
############################
lib-cov
lcov.info
pids
logs
results
build
node_modules
.node_history
############################
# Tests
############################
test
tests
__tests__
jest.config.js

View File

@ -30,7 +30,18 @@
"react-router-dom": "5.3.4",
"styled-components": "5.3.3"
},
"files": [
"./dist",
"./admin",
"strapi-admin.js",
"strapi-server.js"
],
"scripts": {
"build": "run -T tsc -p server/tsconfig.json --outDir ./dist/server",
"build:ts": "run build",
"watch": "run -T tsc -w --preserveWatchOutput",
"clean": "run -T rimraf ./dist",
"prepublishOnly": "yarn clean && yarn build",
"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",

View File

@ -0,0 +1,7 @@
module.exports = {
root: true,
extends: ['custom/back/typescript'],
parserOptions: {
project: ['./server/tsconfig.eslint.json'],
},
};

View File

@ -1,7 +0,0 @@
'use strict';
const register = require('./register');
module.exports = {
register,
};

View File

@ -0,0 +1,5 @@
import { register } from './register';
export default {
register,
};

View File

@ -1,6 +1,4 @@
'use strict';
module.exports = ({ strapi }) => {
export const register = ({ strapi }: any) => {
strapi.customFields.register({
name: 'color',
plugin: 'color-picker',

View File

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

View File

@ -0,0 +1,5 @@
{
"extends": "tsconfig/base.json",
"include": ["src"],
"exclude": ["node_modules"]
}

View File

@ -1,3 +1,3 @@
'use strict';
module.exports = require('./server');
module.exports = require('./dist/server');

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -14,7 +14,7 @@ module.exports = {
strapi: false,
},
rules: {
...require('./back').rules,
...require('../back').rules,
'node/no-unsupported-features/es-syntax': 'off',
'node/no-missing-import': 'off',
// TODO: The following rules from @strapi/eslint-config/typescript are disabled because they're causing problems we need to solve or fix

View File

@ -0,0 +1,26 @@
const path = require('path');
module.exports = {
root: true,
// TODO: create a front typescript config in eslint-config and use it here
extends: [
'airbnb-typescript/base',
'../front',
'plugin:@typescript-eslint/recommended',
/*'plugin:@typescript-eslint/recommended-requiring-type-checking'*/
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
parserOptions: {
project: ['./tsconfig.eslint.json'],
},
rules: {
'react/jsx-filename-extension': [
1,
{
extensions: ['tsx'],
},
],
'import/extensions': 'off',
},
};

View File

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

View File

@ -0,0 +1,10 @@
{
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "./base.json",
"compilerOptions": {
"module": "ESNext",
"lib": ["dom", "dom.iterable", "esnext"],
"jsx": "react-jsx",
"noEmit": true
}
}