0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-10 22:22:45 -05:00

chore: use shared config

This commit is contained in:
Gao Sun 2021-07-11 17:59:44 +08:00 committed by Gao Sun
parent 91dafc3fef
commit 4778ccddd1
9 changed files with 390 additions and 1697 deletions

View file

@ -1,6 +1,6 @@
{ {
"recommendations": [ "recommendations": [
"samverschueren.linter-xo", "mikestead.dotenv",
"mikestead.dotenv" "dbaeumer.vscode-eslint"
] ]
} }

View file

@ -1,13 +1,4 @@
{ {
"typescript.tsdk": "node_modules/typescript/lib", "typescript.tsdk": "node_modules/typescript/lib",
"editor.defaultFormatter": "samverschueren.linter-xo", "editor.formatOnSave": true
"xo.enable": true,
"xo.format.enable": true,
"editor.formatOnSave": true,
"[typescriptreact]": {
"editor.defaultFormatter": "samverschueren.linter-xo"
},
"[javascript]": {
"editor.defaultFormatter": "samverschueren.linter-xo"
}
} }

View file

@ -8,12 +8,12 @@
"private": true, "private": true,
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"lint": "xo src/", "lint": "eslint --format pretty \"src/**\"",
"dev": "tsc-watch --onSuccess \"node ./build/index.js\"", "dev": "tsc-watch --onSuccess \"node ./build/index.js\"",
"prepare": "husky install" "prepare": "husky install"
}, },
"dependencies": { "dependencies": {
"@logto/essentials": "^1.1.0-rc.0", "@logto/essentials": "^1.1.0-rc.1",
"@logto/schemas": "^1.1.0-rc.1", "@logto/schemas": "^1.1.0-rc.1",
"dayjs": "^1.10.5", "dayjs": "^1.10.5",
"decamelize": "^5.0.0", "decamelize": "^5.0.0",
@ -38,18 +38,23 @@
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^12.1.4", "@commitlint/cli": "^12.1.4",
"@commitlint/config-conventional": "^12.1.4", "@commitlint/config-conventional": "^12.1.4",
"@logto/eslint-config": "^0.1.0-rc.6",
"@logto/ts-config": "^0.1.0-rc.6",
"@types/koa": "^2.13.3", "@types/koa": "^2.13.3",
"@types/koa-compose": "^3.2.5", "@types/koa-compose": "^3.2.5",
"@types/koa-logger": "^3.1.1", "@types/koa-logger": "^3.1.1",
"@types/koa-mount": "^4.0.0", "@types/koa-mount": "^4.0.0",
"@types/koa-router": "^7.4.2", "@types/koa-router": "^7.4.2",
"@types/lodash.pick": "^4.4.6", "@types/lodash.pick": "^4.4.6",
"@types/node": "^16.3.1",
"@types/oidc-provider": "^7.4.0", "@types/oidc-provider": "^7.4.0",
"eslint": "^7.30.0",
"eslint-formatter-pretty": "^4.1.0",
"husky": "^6.0.0", "husky": "^6.0.0",
"lint-staged": "^11.0.0", "lint-staged": "^11.0.0",
"prettier": "^2.3.2",
"tsc-watch": "^4.4.0", "tsc-watch": "^4.4.0",
"typescript": "^4.3.2", "typescript": "^4.3.5"
"xo": "0.39.1"
}, },
"engines": { "engines": {
"node": ">=14.15.0", "node": ">=14.15.0",
@ -58,5 +63,6 @@
"_moduleAliases": { "_moduleAliases": {
"@": "./build" "@": "./build"
}, },
"prettier": "@logto/essentials/.prettierrc.json" "eslintConfig": { "extends": "@logto" },
"prettier": "@logto/eslint-config/.prettierrc"
} }

View file

@ -1,6 +1,8 @@
import 'module-alias/register'; /* eslint-disable import/first */
import 'module-alias/register.js';
import dotenv from 'dotenv'; import dotenv from 'dotenv';
dotenv.config(); dotenv.config();
import Koa from 'koa'; import Koa from 'koa';

View file

@ -2,9 +2,9 @@ import Koa from 'koa';
import koaLogger from 'koa-logger'; import koaLogger from 'koa-logger';
import koaErrorHandler from '@/middleware/koa-error-handler'; import koaErrorHandler from '@/middleware/koa-error-handler';
import { port } from '@/consts';
import initOidc from './oidc'; import initOidc from './oidc';
import initRouter from './router'; import initRouter from './router';
import { port } from '@/consts';
export default async function initApp(app: Koa): Promise<void> { export default async function initApp(app: Koa): Promise<void> {
app.use(koaErrorHandler()); app.use(koaErrorHandler());

View file

@ -22,7 +22,7 @@ export const encryptPassword = (
'Unsupported password encryption method' 'Unsupported password encryption method'
); );
const sum = [...id].reduce((acc, current) => acc + current.charCodeAt(0), 0); const sum = [...id].reduce((accumulator, current) => accumulator + current.charCodeAt(0), 0);
const pepper = peppers[sum % peppers.length]; const pepper = peppers[sum % peppers.length];
assert(pepper, 'Password pepper not found'); assert(pepper, 'Password pepper not found');

View file

@ -1,11 +1,15 @@
{ {
"extends": "@logto/essentials/tsconfig.base", "extends": "@logto/ts-config/tsconfig.base",
"compilerOptions": { "compilerOptions": {
"outDir": "build", "outDir": "build",
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"@/*": ["src/*"] "@/*": [
"src/*"
]
} }
}, },
"include": ["src"] "include": [
"src"
]
} }

View file

@ -1 +0,0 @@
module.exports = require('@logto/essentials/.xo-config.json');

File diff suppressed because it is too large Load diff