mirror of
https://github.com/strapi/strapi.git
synced 2025-12-05 11:32:13 +00:00
Revert "Migrate color-picker plugin to ts"
This commit is contained in:
parent
5eb94562f2
commit
f062ba1483
@ -22,13 +22,13 @@ module.exports = {
|
||||
moduleNameMapper,
|
||||
/* Tells jest to ignore duplicated manual mock files, such as index.js */
|
||||
modulePathIgnorePatterns: ['.*__mocks__.*'],
|
||||
testPathIgnorePatterns: ['node_modules/', '__tests__', 'dist/'],
|
||||
testPathIgnorePatterns: ['node_modules/', '__tests__'],
|
||||
globalSetup: '@strapi/admin-test-utils/global-setup',
|
||||
setupFiles: ['@strapi/admin-test-utils/environment'],
|
||||
setupFilesAfterEnv: ['@strapi/admin-test-utils/after-env'],
|
||||
testEnvironment: 'jsdom',
|
||||
transform: {
|
||||
'^.+\\.(j|t)s(x)?$': [
|
||||
'^.+\\.js$': [
|
||||
'@swc/jest',
|
||||
{
|
||||
env: {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
extends: ['custom/typescript'],
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
extends: ['custom/typescript'],
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
extends: ['custom/typescript'],
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
extends: ['custom/typescript'],
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
extends: ['custom/typescript'],
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
extends: ['custom/typescript'],
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
extends: ['custom/typescript'],
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
extends: ['custom/typescript'],
|
||||
};
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
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
|
||||
@ -1,3 +1,2 @@
|
||||
node_modules/
|
||||
.eslintrc.js
|
||||
dist/
|
||||
|
||||
@ -2,8 +2,12 @@ module.exports = {
|
||||
root: true,
|
||||
overrides: [
|
||||
{
|
||||
files: ['**'],
|
||||
excludedFiles: ['admin/**/*', 'server/**/*'],
|
||||
files: ['admin/**/*'],
|
||||
extends: ['custom/front'],
|
||||
},
|
||||
{
|
||||
files: ['**/*'],
|
||||
excludedFiles: ['admin/**/*'],
|
||||
extends: ['custom/back'],
|
||||
},
|
||||
],
|
||||
|
||||
@ -1,98 +0,0 @@
|
||||
############################
|
||||
# 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
|
||||
@ -1,7 +0,0 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/front/typescript'],
|
||||
parserOptions: {
|
||||
project: ['./admin/tsconfig.eslint.json'],
|
||||
},
|
||||
};
|
||||
@ -1,2 +0,0 @@
|
||||
declare module '@strapi/helper-plugin';
|
||||
declare module '@strapi/design-system';
|
||||
@ -1,11 +1,11 @@
|
||||
import { prefixPluginTranslations } from '@strapi/helper-plugin';
|
||||
|
||||
import ColorPickerIcon from './components/ColorPicker/ColorPickerIcon';
|
||||
import { pluginId } from './pluginId';
|
||||
import pluginId from './pluginId';
|
||||
import getTrad from './utils/getTrad';
|
||||
|
||||
export default {
|
||||
register(app: any) {
|
||||
register(app) {
|
||||
app.customFields.register({
|
||||
name: 'color',
|
||||
pluginId: 'color-picker',
|
||||
@ -64,7 +64,7 @@ export default {
|
||||
},
|
||||
});
|
||||
},
|
||||
async registerTrads({ locales }: { locales: string[] }) {
|
||||
async registerTrads({ locales }) {
|
||||
const importedTrads = await Promise.all(
|
||||
locales.map((locale) => {
|
||||
return import(`./translations/${locale}.json`)
|
||||
5
packages/plugins/color-picker/admin/src/pluginId.js
Normal file
5
packages/plugins/color-picker/admin/src/pluginId.js
Normal file
@ -0,0 +1,5 @@
|
||||
const pluginPkg = require('../../package.json');
|
||||
|
||||
const pluginId = pluginPkg.name.replace(/^(@[^-,.][\w,-]+\/|strapi-)plugin-/i, '');
|
||||
|
||||
module.exports = pluginId;
|
||||
@ -1,3 +0,0 @@
|
||||
import pluginPkg from '../../package.json';
|
||||
|
||||
export const pluginId = pluginPkg.name.replace(/^(@[^-,.][\w,-]+\/|strapi-)plugin-/i, '');
|
||||
@ -1,4 +1,4 @@
|
||||
import { pluginId } from '../pluginId';
|
||||
import pluginId from '../pluginId';
|
||||
|
||||
const getTrad = (id) => `${pluginId}.${id}`;
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
{
|
||||
"extends": "tsconfig/front.json",
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
@ -18,7 +18,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/react": "14.0.0",
|
||||
"@types/styled-components": "5.1.26",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-router-dom": "5.3.4",
|
||||
@ -31,18 +30,7 @@
|
||||
"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",
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
parserOptions: {
|
||||
project: ['./server/tsconfig.eslint.json'],
|
||||
},
|
||||
};
|
||||
7
packages/plugins/color-picker/server/index.js
Normal file
7
packages/plugins/color-picker/server/index.js
Normal file
@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const register = require('./register');
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
};
|
||||
@ -1,4 +1,6 @@
|
||||
export const register = ({ strapi }: any) => {
|
||||
'use strict';
|
||||
|
||||
module.exports = ({ strapi }) => {
|
||||
strapi.customFields.register({
|
||||
name: 'color',
|
||||
plugin: 'color-picker',
|
||||
@ -1,5 +0,0 @@
|
||||
import { register } from './register';
|
||||
|
||||
export default {
|
||||
register,
|
||||
};
|
||||
@ -1,8 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
{
|
||||
"extends": "tsconfig/base.json",
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./admin/src/index.ts');
|
||||
module.exports = require('./admin/src').default;
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./dist/server');
|
||||
module.exports = require('./server');
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
extends: ['custom/typescript'],
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
extends: ['custom/typescript'],
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
extends: ['custom/typescript'],
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
extends: ['custom/typescript'],
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
extends: ['custom/typescript'],
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
extends: ['custom/typescript'],
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
extends: ['custom/typescript'],
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
extends: ['custom/typescript'],
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
extends: ['custom/typescript'],
|
||||
};
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
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',
|
||||
},
|
||||
};
|
||||
@ -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
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['custom/back/typescript'],
|
||||
extends: ['custom/typescript'],
|
||||
};
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/tsconfig",
|
||||
"extends": "./base.json",
|
||||
"compilerOptions": {
|
||||
"module": "ESNext",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"jsx": "react-jsx",
|
||||
"noEmit": true
|
||||
}
|
||||
}
|
||||
14
yarn.lock
14
yarn.lock
@ -7884,7 +7884,6 @@ __metadata:
|
||||
"@strapi/helper-plugin": 4.11.7
|
||||
"@strapi/icons": 1.8.2
|
||||
"@testing-library/react": 14.0.0
|
||||
"@types/styled-components": 5.1.26
|
||||
prop-types: ^15.8.1
|
||||
react: ^18.2.0
|
||||
react-colorful: 5.6.1
|
||||
@ -8991,7 +8990,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/hoist-non-react-statics@npm:*, @types/hoist-non-react-statics@npm:^3.3.1":
|
||||
"@types/hoist-non-react-statics@npm:^3.3.1":
|
||||
version: 3.3.1
|
||||
resolution: "@types/hoist-non-react-statics@npm:3.3.1"
|
||||
dependencies:
|
||||
@ -9552,17 +9551,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/styled-components@npm:5.1.26":
|
||||
version: 5.1.26
|
||||
resolution: "@types/styled-components@npm:5.1.26"
|
||||
dependencies:
|
||||
"@types/hoist-non-react-statics": "*"
|
||||
"@types/react": "*"
|
||||
csstype: ^3.0.2
|
||||
checksum: 84f53b3101739b20d1731554fb7735bc2f3f5d050a8b392e9845403c8c8bbd729737d033978649f9195a97b557875b010d46e35a4538564a2d0dbcce661dbf76
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/tapable@npm:^1, @types/tapable@npm:^1.0.5":
|
||||
version: 1.0.8
|
||||
resolution: "@types/tapable@npm:1.0.8"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user