0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

refactor: upgrade toolkit and update test config

This commit is contained in:
Gao Sun 2022-11-22 16:47:17 +08:00
parent e7b0de43b7
commit b48bfd3762
No known key found for this signature in database
GPG key ID: 13EBE123E4773688
17 changed files with 1001 additions and 1022 deletions

1
.npmrc
View file

@ -3,3 +3,4 @@ public-hoist-pattern[]=@parcel/*
public-hoist-pattern[]=postcss public-hoist-pattern[]=postcss
public-hoist-pattern[]=process public-hoist-pattern[]=process
public-hoist-pattern[]=*eslint* public-hoist-pattern[]=*eslint*
public-hoist-pattern[]=buffer

View file

@ -1,23 +1,16 @@
import type { Config } from '@silverhand/jest-config'; import type { Config } from '@silverhand/jest-config';
import { merge } from '@silverhand/jest-config'; import { merge } from '@silverhand/jest-config';
const config: Config.InitialOptions = merge({ const config: Config.InitialOptions = {
// Preset: 'ts-jest/presets/default-esm', ...merge({
// TransformIgnorePatterns: ['schemas'],
setupFilesAfterEnv: ['./jest.setup.ts'], setupFilesAfterEnv: ['./jest.setup.ts'],
roots: ['./src'], roots: ['./src'],
moduleNameMapper: { moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1', '^(\\.{1,2}/.*)\\.js$': '$1',
}, },
globals: { }),
'ts-jest': { // Will update common config soon
useESM: true, transformIgnorePatterns: ['node_modules/(?!(.*(nanoid|jose|ky|@logto))/)'],
diagnostics: { };
ignoreCodes: [1343],
},
},
},
// ExtensionsToTreatAsEsm: ['.ts', '.tsx'],
});
export default config; export default config;

View file

@ -19,17 +19,17 @@
}, },
"devDependencies": { "devDependencies": {
"@fontsource/roboto-mono": "^4.5.7", "@fontsource/roboto-mono": "^4.5.7",
"@logto/core-kit": "1.0.0-beta.21", "@logto/core-kit": "1.0.0-beta.25",
"@logto/language-kit": "1.0.0-beta.21", "@logto/language-kit": "1.0.0-beta.24",
"@logto/phrases": "workspace:^", "@logto/phrases": "workspace:^",
"@logto/phrases-ui": "workspace:^", "@logto/phrases-ui": "workspace:^",
"@logto/react": "1.0.0-beta.13", "@logto/react": "1.0.0-beta.13",
"@logto/schemas": "workspace:^", "@logto/schemas": "workspace:^",
"@mdx-js/react": "^1.6.22", "@mdx-js/react": "^1.6.22",
"@parcel/core": "2.7.0", "@parcel/core": "2.8.0",
"@parcel/transformer-mdx": "2.7.0", "@parcel/transformer-mdx": "2.8.0",
"@parcel/transformer-sass": "2.7.0", "@parcel/transformer-sass": "2.8.0",
"@parcel/transformer-svg-react": "2.7.0", "@parcel/transformer-svg-react": "2.8.0",
"@silverhand/eslint-config": "1.3.0", "@silverhand/eslint-config": "1.3.0",
"@silverhand/eslint-config-react": "1.3.0", "@silverhand/eslint-config-react": "1.3.0",
"@silverhand/essentials": "^1.3.0", "@silverhand/essentials": "^1.3.0",
@ -49,9 +49,9 @@
"clean-deep": "^3.4.0", "clean-deep": "^3.4.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"csstype": "^3.0.11", "csstype": "^3.0.11",
"date-fns": "^2.29.3",
"dayjs": "^1.10.5", "dayjs": "^1.10.5",
"deep-object-diff": "^1.1.7", "deep-object-diff": "^1.1.7",
"date-fns": "^2.29.3",
"deepmerge": "^4.2.2", "deepmerge": "^4.2.2",
"dnd-core": "^16.0.0", "dnd-core": "^16.0.0",
"eslint": "^8.21.0", "eslint": "^8.21.0",
@ -63,7 +63,7 @@
"lodash.get": "^4.4.2", "lodash.get": "^4.4.2",
"lodash.kebabcase": "^4.1.1", "lodash.kebabcase": "^4.1.1",
"nanoid": "^3.1.23", "nanoid": "^3.1.23",
"parcel": "2.7.0", "parcel": "2.8.0",
"postcss": "^8.4.6", "postcss": "^8.4.6",
"postcss-modules": "^4.3.0", "postcss-modules": "^4.3.0",
"prettier": "^2.7.1", "prettier": "^2.7.1",

View file

@ -1,13 +1,17 @@
import type { Config } from '@silverhand/jest-config'; import type { Config } from '@silverhand/jest-config';
import { merge } from '@silverhand/jest-config'; import { merge } from '@silverhand/jest-config';
const config: Config.InitialOptions = merge({ const config: Config.InitialOptions = {
...merge({
testPathIgnorePatterns: ['/core/connectors/'], testPathIgnorePatterns: ['/core/connectors/'],
setupFilesAfterEnv: ['jest-matcher-specific-error', './jest.setup.ts'], setupFilesAfterEnv: ['jest-matcher-specific-error', './jest.setup.ts'],
moduleNameMapper: { moduleNameMapper: {
'^#src/(.*)\\.js(x)?$': '<rootDir>/src/$1', '^#src/(.*)\\.js(x)?$': '<rootDir>/src/$1',
'^(\\.{1,2}/.*)\\.js$': '$1', '^(\\.{1,2}/.*)\\.js$': '$1',
}, },
}); }),
// Will update common config soon
transformIgnorePatterns: ['node_modules/(?!(.*(nanoid|jose|ky|@logto))/)'],
};
export default config; export default config;

View file

@ -24,9 +24,9 @@
}, },
"dependencies": { "dependencies": {
"@logto/cli": "workspace:^", "@logto/cli": "workspace:^",
"@logto/connector-kit": "1.0.0-beta.23", "@logto/connector-kit": "1.0.0-beta.25",
"@logto/core-kit": "^1.0.0-beta.18", "@logto/core-kit": "1.0.0-beta.25",
"@logto/language-kit": "1.0.0-beta.21", "@logto/language-kit": "1.0.0-beta.24",
"@logto/phrases": "workspace:^", "@logto/phrases": "workspace:^",
"@logto/phrases-ui": "workspace:^", "@logto/phrases-ui": "workspace:^",
"@logto/schemas": "workspace:^", "@logto/schemas": "workspace:^",

View file

@ -4,6 +4,7 @@ import { createMockPool, createMockQueryResult, sql } from 'slonik';
import { mockConnector } from '#src/__mocks__/index.js'; import { mockConnector } from '#src/__mocks__/index.js';
import envSet from '#src/env-set/index.js'; import envSet from '#src/env-set/index.js';
import { DeletionError } from '#src/errors/SlonikError/index.js';
import type { QueryType } from '#src/utils/test-utils.js'; import type { QueryType } from '#src/utils/test-utils.js';
import { expectSqlAssert } from '#src/utils/test-utils.js'; import { expectSqlAssert } from '#src/utils/test-utils.js';

View file

@ -16,13 +16,13 @@
"stylelint": "stylelint \"src/**/*.scss\"" "stylelint": "stylelint \"src/**/*.scss\""
}, },
"devDependencies": { "devDependencies": {
"@logto/core-kit": "1.0.0-beta.21", "@logto/core-kit": "1.0.0-beta.25",
"@logto/language-kit": "1.0.0-beta.21", "@logto/language-kit": "1.0.0-beta.24",
"@logto/phrases": "workspace:^", "@logto/phrases": "workspace:^",
"@logto/react": "1.0.0-beta.13", "@logto/react": "1.0.0-beta.13",
"@logto/schemas": "workspace:^", "@logto/schemas": "workspace:^",
"@parcel/core": "2.7.0", "@parcel/core": "2.8.0",
"@parcel/transformer-sass": "2.7.0", "@parcel/transformer-sass": "2.8.0",
"@silverhand/eslint-config": "1.3.0", "@silverhand/eslint-config": "1.3.0",
"@silverhand/eslint-config-react": "1.3.0", "@silverhand/eslint-config-react": "1.3.0",
"@silverhand/ts-config": "1.2.1", "@silverhand/ts-config": "1.2.1",
@ -34,14 +34,15 @@
"i18next": "^21.8.16", "i18next": "^21.8.16",
"i18next-browser-languagedetector": "^6.1.4", "i18next-browser-languagedetector": "^6.1.4",
"lint-staged": "^13.0.0", "lint-staged": "^13.0.0",
"parcel": "2.7.0", "parcel": "2.8.0",
"postcss": "^8.4.6", "postcss": "^8.4.6",
"prettier": "^2.7.1", "prettier": "^2.7.1",
"react": "^18.0.0", "react": "^18.0.0",
"react-dom": "^18.0.0", "react-dom": "^18.0.0",
"react-i18next": "^11.18.3", "react-i18next": "^11.18.3",
"stylelint": "^14.9.1", "stylelint": "^14.9.1",
"typescript": "^4.7.4" "typescript": "^4.7.4",
"zod": "^3.19.1"
}, },
"engines": { "engines": {
"node": "^16.13.0 || ^18.12.0" "node": "^16.13.0 || ^18.12.0"

View file

@ -1,8 +1,12 @@
import type { Config } from '@silverhand/jest-config'; import type { Config } from '@silverhand/jest-config';
import { merge } from '@silverhand/jest-config'; import { merge } from '@silverhand/jest-config';
const config: Config.InitialOptions = merge({ const config: Config.InitialOptions = {
...merge({
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'], setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
}); }),
// Will update common config soon
transformIgnorePatterns: ['node_modules/(?!(.*(nanoid|jose|ky|@logto))/)'],
};
export default config; export default config;

View file

@ -1,4 +1,5 @@
import { merge, Config } from '@silverhand/jest-config'; import type { Config } from '@silverhand/jest-config';
import { merge } from '@silverhand/jest-config';
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, unicorn/prefer-module // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, unicorn/prefer-module
const config: Config.InitialOptions = merge(require('jest-puppeteer/jest-preset')); const config: Config.InitialOptions = merge(require('jest-puppeteer/jest-preset'));

View file

@ -32,8 +32,8 @@
"url": "https://github.com/logto-io/logto/issues" "url": "https://github.com/logto-io/logto/issues"
}, },
"dependencies": { "dependencies": {
"@logto/core-kit": "1.0.0-beta.21", "@logto/core-kit": "1.0.0-beta.25",
"@logto/language-kit": "1.0.0-beta.21", "@logto/language-kit": "1.0.0-beta.24",
"@silverhand/essentials": "^1.3.0", "@silverhand/essentials": "^1.3.0",
"zod": "^3.19.1" "zod": "^3.19.1"
}, },

View file

@ -32,8 +32,8 @@
"url": "https://github.com/logto-io/logto/issues" "url": "https://github.com/logto-io/logto/issues"
}, },
"dependencies": { "dependencies": {
"@logto/core-kit": "1.0.0-beta.21", "@logto/core-kit": "1.0.0-beta.25",
"@logto/language-kit": "1.0.0-beta.21", "@logto/language-kit": "1.0.0-beta.24",
"@silverhand/essentials": "^1.3.0", "@silverhand/essentials": "^1.3.0",
"zod": "^3.19.1" "zod": "^3.19.1"
}, },

View file

@ -1,10 +1,16 @@
import type { Config } from '@silverhand/jest-config'; import type { Config } from '@silverhand/jest-config';
import { merge } from '@silverhand/jest-config'; import { merge } from '@silverhand/jest-config';
const config: Config.InitialOptions = merge({ const config: Config.InitialOptions = {
...merge({
// Will update common config soon
transformIgnorePatterns: ['node_modules/(?!(.*(nanoid|jose|ky|@logto))/)'],
moduleNameMapper: { moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1', '^(\\.{1,2}/.*)\\.js$': '$1',
}, },
}); }),
// Will update common config soon
transformIgnorePatterns: ['node_modules/(?!(.*(nanoid|jose|ky|@logto))/)'],
};
export default config; export default config;

View file

@ -68,9 +68,9 @@
}, },
"prettier": "@silverhand/eslint-config/.prettierrc", "prettier": "@silverhand/eslint-config/.prettierrc",
"dependencies": { "dependencies": {
"@logto/connector-kit": "1.0.0-beta.23", "@logto/connector-kit": "1.0.0-beta.25",
"@logto/core-kit": "1.0.0-beta.21", "@logto/core-kit": "1.0.0-beta.25",
"@logto/language-kit": "1.0.0-beta.21", "@logto/language-kit": "1.0.0-beta.24",
"@logto/phrases": "workspace:^", "@logto/phrases": "workspace:^",
"@logto/phrases-ui": "workspace:^", "@logto/phrases-ui": "workspace:^",
"zod": "^3.19.1" "zod": "^3.19.1"

View file

@ -1,11 +1,15 @@
import type { Config } from '@silverhand/jest-config'; import type { Config } from '@silverhand/jest-config';
import { merge } from '@silverhand/jest-config'; import { merge } from '@silverhand/jest-config';
const config: Config.InitialOptions = merge({ const config: Config.InitialOptions = {
...merge({
roots: ['./src'], roots: ['./src'],
moduleNameMapper: { moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1', '^(\\.{1,2}/.*)\\.js$': '$1',
}, },
}); }),
// Will update common config soon
transformIgnorePatterns: ['node_modules/(?!(.*(nanoid|jose|ky|@logto))/)'],
};
export default config; export default config;

View file

@ -1,11 +1,16 @@
import { merge, Config } from '@silverhand/jest-config'; import type { Config } from '@silverhand/jest-config';
import { merge } from '@silverhand/jest-config';
const config: Config.InitialOptions = merge({ const config: Config.InitialOptions = {
...merge({
testEnvironment: 'jsdom', testEnvironment: 'jsdom',
setupFilesAfterEnv: ['<rootDir>/src/jest.setup.ts'], setupFilesAfterEnv: ['<rootDir>/src/jest.setup.ts'],
transform: { transform: {
'\\.(svg)$': 'jest-transformer-svg', '\\.(svg)$': 'jest-transformer-svg',
}, },
}); }),
// Will update common config soon
transformIgnorePatterns: ['node_modules/(?!(.*(nanoid|jose|ky|@logto))/)'],
};
export default config; export default config;

View file

@ -17,14 +17,14 @@
"test": "jest" "test": "jest"
}, },
"devDependencies": { "devDependencies": {
"@logto/core-kit": "1.0.0-beta.21", "@logto/core-kit": "1.0.0-beta.25",
"@logto/language-kit": "1.0.0-beta.21", "@logto/language-kit": "1.0.0-beta.24",
"@logto/phrases": "workspace:^", "@logto/phrases": "workspace:^",
"@logto/phrases-ui": "workspace:^", "@logto/phrases-ui": "workspace:^",
"@logto/schemas": "workspace:^", "@logto/schemas": "workspace:^",
"@parcel/core": "2.7.0", "@parcel/core": "2.8.0",
"@parcel/transformer-sass": "2.7.0", "@parcel/transformer-sass": "2.8.0",
"@parcel/transformer-svg-react": "2.7.0", "@parcel/transformer-svg-react": "2.8.0",
"@peculiar/webcrypto": "^1.3.3", "@peculiar/webcrypto": "^1.3.3",
"@silverhand/eslint-config": "1.3.0", "@silverhand/eslint-config": "1.3.0",
"@silverhand/eslint-config-react": "1.3.0", "@silverhand/eslint-config-react": "1.3.0",
@ -53,7 +53,7 @@
"ky": "^0.31.0", "ky": "^0.31.0",
"libphonenumber-js": "^1.9.49", "libphonenumber-js": "^1.9.49",
"lint-staged": "^13.0.0", "lint-staged": "^13.0.0",
"parcel": "2.7.0", "parcel": "2.8.0",
"postcss": "^8.4.6", "postcss": "^8.4.6",
"postcss-modules": "^4.3.0", "postcss-modules": "^4.3.0",
"prettier": "^2.7.1", "prettier": "^2.7.1",
@ -68,7 +68,8 @@
"stylelint": "^14.9.1", "stylelint": "^14.9.1",
"superstruct": "^0.16.0", "superstruct": "^0.16.0",
"typescript": "^4.7.4", "typescript": "^4.7.4",
"use-debounced-loader": "^0.1.1" "use-debounced-loader": "^0.1.1",
"zod": "^3.19.1"
}, },
"engines": { "engines": {
"node": "^16.13.0 || ^18.12.0" "node": "^16.13.0 || ^18.12.0"

File diff suppressed because it is too large Load diff