chore: moved most configs to .config
This commit is contained in:
parent
396577342c
commit
9d12b715c7
38 changed files with 122 additions and 100 deletions
|
@ -1,4 +1,4 @@
|
|||
const baseConfig = require('./.eslintrc.js')
|
||||
const baseConfig = require('./eslint.cjs')
|
||||
|
||||
module.exports = {
|
||||
...baseConfig,
|
|
@ -169,7 +169,29 @@ module.exports = {
|
|||
'import/no-default-export': 'error',
|
||||
'no-console': ['error', { allow: ['warn', 'error'] }],
|
||||
},
|
||||
ignorePatterns: ['packages/client/utils.ts', 'packages/core/utils.ts'],
|
||||
ignorePatterns: [
|
||||
'node_modules/',
|
||||
'.config/',
|
||||
'.idea/',
|
||||
'.vscode/',
|
||||
|
||||
'private/',
|
||||
'docs/',
|
||||
'dist/',
|
||||
|
||||
'*.json',
|
||||
|
||||
// codegen
|
||||
'packages/tl/binary/rsa-keys.js',
|
||||
'packages/tl/binary/reader.js',
|
||||
'packages/tl/binary/writer.js',
|
||||
'packages/tl/index.js',
|
||||
'packages/tl/index.d.ts',
|
||||
'packages/tl/*.json',
|
||||
|
||||
'packages/client/utils.ts',
|
||||
'packages/core/utils.ts'
|
||||
],
|
||||
overrides: [
|
||||
{
|
||||
files: ['**/*.ts', '**/*.tsx'],
|
1
.config/husky/_/.gitignore
vendored
Normal file
1
.config/husky/_/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
husky.sh
|
4
.config/husky/commit-msg
Executable file
4
.config/husky/commit-msg
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
npx --no -- commitlint --edit ${1} --config .config/commitlint.js
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
pnpm exec lint-staged
|
||||
pnpm exec lint-staged -c .config/lint-stagedrc.cjs
|
|
@ -1,7 +1,7 @@
|
|||
const path = require('path')
|
||||
|
||||
const packagesDir = path.join(__dirname, 'packages')
|
||||
const eslintCiConfig = path.join(__dirname, '.eslintrc.ci.js')
|
||||
const packagesDir = path.join(__dirname, '../packages')
|
||||
const eslintCiConfig = path.join(__dirname, 'eslintrc.ci.js')
|
||||
|
||||
module.exports = {
|
||||
'*.{js,jsx,ts,tsx}': (filenames) => {
|
35
.config/prettier.cjs
Normal file
35
.config/prettier.cjs
Normal file
|
@ -0,0 +1,35 @@
|
|||
module.exports = {
|
||||
arrowParens: 'always',
|
||||
bracketSpacing: true,
|
||||
embeddedLanguageFormatting: 'auto',
|
||||
htmlWhitespaceSensitivity: 'css',
|
||||
insertPragma: false,
|
||||
jsxBracketSameLine: false,
|
||||
jsxSingleQuote: false,
|
||||
printWidth: 120,
|
||||
proseWrap: 'preserve',
|
||||
quoteProps: 'as-needed',
|
||||
requirePragma: false,
|
||||
semi: false,
|
||||
singleQuote: true,
|
||||
tabWidth: 4,
|
||||
trailingComma: 'all',
|
||||
useTabs: false,
|
||||
vueIndentScriptAndStyle: false,
|
||||
overrides: [
|
||||
{
|
||||
files: [
|
||||
// codegen
|
||||
'packages/tl/binary/rsa-keys.js',
|
||||
'packages/tl/binary/reader.js',
|
||||
'packages/tl/binary/writer.js',
|
||||
'packages/tl/index.js',
|
||||
'packages/tl/*.json',
|
||||
|
||||
'*.d.ts',
|
||||
'**/dist'
|
||||
],
|
||||
options: { requirePragma: true },
|
||||
}
|
||||
],
|
||||
}
|
7
.config/tsconfig.build.json
Normal file
7
.config/tsconfig.build.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"exclude": [
|
||||
"**/*.test.ts",
|
||||
"**/*.test-utils.ts"
|
||||
]
|
||||
}
|
|
@ -16,6 +16,6 @@ module.exports = {
|
|||
],
|
||||
externalPattern: ['**/dist/**'],
|
||||
plugin: [
|
||||
'./scripts/typedoc-external-links.cjs',
|
||||
'./plugin-external-links.cjs',
|
||||
],
|
||||
}
|
|
@ -2,13 +2,13 @@ const fs = require('fs')
|
|||
const path = require('path')
|
||||
|
||||
module.exports = {
|
||||
...require('./typedoc.base.cjs'),
|
||||
...require('./config.base.cjs'),
|
||||
name: 'mtcute',
|
||||
out: './docs',
|
||||
out: '../../docs',
|
||||
entryPoints: fs
|
||||
.readdirSync(path.join(__dirname, 'packages'))
|
||||
.readdirSync(path.join(__dirname, '../../packages'))
|
||||
.filter((it) => !['crypto', 'tl', 'create-bot'].includes(it))
|
||||
.map((it) => `packages/${it}`),
|
||||
.map((it) => `../../packages/${it}`),
|
||||
entryPointStrategy: 'packages',
|
||||
// logLevel: 'Verbose',
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
node_modules/
|
||||
.husky/
|
||||
.idea/
|
||||
|
||||
private/
|
||||
docs/
|
||||
dist/
|
||||
|
||||
*.json
|
||||
|
||||
packages/tl/errors.js
|
||||
packages/tl/errors.d.ts
|
||||
packages/tl/index.js
|
||||
packages/tl/index.d.ts
|
||||
packages/tl/binary/reader.js
|
||||
packages/tl/binary/writer.js
|
||||
packages/tl/binary/rsa-keys.js
|
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
npx --no -- commitlint --edit ${1}
|
|
@ -1,11 +0,0 @@
|
|||
# auto-generated files
|
||||
src/tl/errors.d.ts
|
||||
src/tl/errors.js
|
||||
src/tl/keys.js
|
||||
src/tl/types.d.ts
|
||||
src/tl/types.js
|
||||
src/tl/binary/reader.js
|
||||
src/tl/binary/writer.js
|
||||
|
||||
**/dist
|
||||
*.d.ts
|
19
.prettierrc
19
.prettierrc
|
@ -1,19 +0,0 @@
|
|||
{
|
||||
"arrowParens": "always",
|
||||
"bracketSpacing": true,
|
||||
"embeddedLanguageFormatting": "auto",
|
||||
"htmlWhitespaceSensitivity": "css",
|
||||
"insertPragma": false,
|
||||
"jsxBracketSameLine": false,
|
||||
"jsxSingleQuote": false,
|
||||
"printWidth": 120,
|
||||
"proseWrap": "preserve",
|
||||
"quoteProps": "as-needed",
|
||||
"requirePragma": false,
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"tabWidth": 4,
|
||||
"trailingComma": "all",
|
||||
"useTabs": false,
|
||||
"vueIndentScriptAndStyle": false
|
||||
}
|
20
package.json
20
package.json
|
@ -6,22 +6,22 @@
|
|||
"license": "MIT",
|
||||
"author": "Alina Sireneva <alina@tei.su>",
|
||||
"scripts": {
|
||||
"prepare": "husky install",
|
||||
"prepare": "husky install .config/husky",
|
||||
"postinstall": "node scripts/validate-deps-versions.mjs",
|
||||
"test": "vitest run && pnpm run -r test",
|
||||
"test:dev": "vitest watch",
|
||||
"test:ui": "vitest --ui",
|
||||
"test:coverage": "vitest run --coverage",
|
||||
"test:ci": "vitest run --coverage.enabled --coverage.reporter=json",
|
||||
"test": "vitest --config .config/vite.ts run && pnpm run -r test",
|
||||
"test:dev": "vitest --config .config/vite.mts watch",
|
||||
"test:ui": "vitest --config .config/vite.mts --ui",
|
||||
"test:coverage": "vitest --config .config/vite.mts run --coverage",
|
||||
"test:ci": "vitest --config .config/vite.mts run --coverage.enabled --coverage.reporter=json",
|
||||
"lint": "eslint .",
|
||||
"lint:ci": "NODE_OPTIONS=\"--max_old_space_size=8192\" eslint --config .eslintrc.ci.js .",
|
||||
"lint:ci": "NODE_OPTIONS=\\\"--max_old_space_size=8192\\\" eslint --config .config/eslint.ci.js .",
|
||||
"lint:tsc": "pnpm -r --parallel exec tsc --build",
|
||||
"lint:tsc:ci": "pnpm -r exec tsc --build",
|
||||
"lint:dpdm": "dpdm -T --no-warning --no-tree --exit-code circular:1 packages/*",
|
||||
"lint:fix": "eslint --fix .",
|
||||
"format": "prettier --write \"packages/**/*.ts\"",
|
||||
"publish-all": "node scripts/publish.js all",
|
||||
"docs": "typedoc",
|
||||
"docs": "typedoc --options .config/typedoc/config.cjs",
|
||||
"build-package": "node scripts/build-package.js"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -57,5 +57,9 @@
|
|||
"typescript": "5.0.4",
|
||||
"vite": "4.5.0",
|
||||
"vitest": "0.34.6"
|
||||
},
|
||||
"prettier": "./.config/prettier.cjs",
|
||||
"eslintConfig": {
|
||||
"extends": "./.config/eslint.cjs"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = {
|
||||
extends: ['../../typedoc.base.cjs'],
|
||||
extends: ['../../.config/typedoc/config.base.cjs'],
|
||||
entryPoints: [
|
||||
'./src/index.ts',
|
||||
'./src/utils/index.ts',
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
module.exports = {
|
||||
extends: ['../../typedoc.base.cjs'],
|
||||
extends: ['../../.config/typedoc/config.base.cjs'],
|
||||
entryPoints: [
|
||||
'./src/index.ts',
|
||||
'./src/utils/index.ts',
|
||||
'./src/utils/crypto/node-crypto.ts',
|
||||
'./src/utils/crypto/subtle.ts',
|
||||
'./src/utils/crypto/node.ts',
|
||||
'./src/utils/crypto/web.ts',
|
||||
'./src/network/transports/tcp.ts',
|
||||
'./src/network/transports/websocket.ts',
|
||||
],
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
extends: ['../../typedoc.base.cjs'],
|
||||
extends: ['../../.config/typedoc/config.base.cjs'],
|
||||
entryPoints: ['./src/index.ts'],
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
extends: ['../../typedoc.base.cjs'],
|
||||
extends: ['../../.config/typedoc/config.base.cjs'],
|
||||
entryPoints: ['./src/index.ts'],
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
extends: ['../../typedoc.base.cjs'],
|
||||
extends: ['../../.config/typedoc/config.base.cjs'],
|
||||
entryPoints: ['./src/index.ts'],
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
extends: ['../../typedoc.base.cjs'],
|
||||
extends: ['../../.config/typedoc/config.base.cjs'],
|
||||
entryPoints: ['./src/index.ts'],
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
extends: ['../../typedoc.base.cjs'],
|
||||
extends: ['../../.config/typedoc/config.base.cjs'],
|
||||
entryPoints: ['./index.ts'],
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = {
|
||||
extends: ['../../typedoc.base.cjs'],
|
||||
extends: ['../../.config/typedoc/config.base.cjs'],
|
||||
entryPoints: [
|
||||
'./src/index.ts',
|
||||
'./src/plurals/*.ts',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
extends: ['../../typedoc.base.cjs'],
|
||||
extends: ['../../.config/typedoc/config.base.cjs'],
|
||||
entryPoints: ['./src/index.ts'],
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
extends: ['../../typedoc.base.cjs'],
|
||||
extends: ['../../.config/typedoc/config.base.cjs'],
|
||||
entryPoints: ['./index.ts'],
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = {
|
||||
extends: ['../../typedoc.base.cjs'],
|
||||
extends: ['../../.config/typedoc/config.base.cjs'],
|
||||
entryPoints: ['./index.ts'],
|
||||
externalPattern: [
|
||||
'../client/**',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
extends: ['../../typedoc.base.cjs'],
|
||||
extends: ['../../.config/typedoc/config.base.cjs'],
|
||||
entryPoints: ['./index.ts'],
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
extends: ['../../typedoc.base.cjs'],
|
||||
extends: ['../../.config/typedoc/config.base.cjs'],
|
||||
entryPoints: ['./src/index.ts'],
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
extends: ['../../typedoc.base.cjs'],
|
||||
extends: ['../../.config/typedoc/config.base.cjs'],
|
||||
entryPoints: ['./src/index.ts'],
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
extends: ['../../typedoc.base.cjs'],
|
||||
extends: ['../../.config/typedoc/config.base.cjs'],
|
||||
entryPoints: ['./src'],
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
extends: ['../../typedoc.base.cjs'],
|
||||
extends: ['../../.config/typedoc/config.base.cjs'],
|
||||
entryPoints: ['./src/index.ts'],
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
extends: ['../../typedoc.base.cjs'],
|
||||
extends: ['../../.config/typedoc/config.base.cjs'],
|
||||
entryPoints: ['./src/index.ts'],
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ if (buildConfig.buildTs) {
|
|||
|
||||
let tsconfig = fs.readFileSync(path.join(packageDir, 'tsconfig.backup.json'), 'utf-8')
|
||||
// what the fuck
|
||||
tsconfig = tsconfig.replace(/(?<="extends": "\.\.\/\.\.\/)tsconfig\.json(?=",)/, 'tsconfig.build.json')
|
||||
tsconfig = tsconfig.replace(/(?<="extends": "\.\.\/\.\.\/)tsconfig\.json(?=",)/, '.config/tsconfig.build.json')
|
||||
fs.writeFileSync(path.join(packageDir, 'tsconfig.json'), tsconfig)
|
||||
|
||||
const restoreTsconfig = () => {
|
||||
|
|
|
@ -25,11 +25,18 @@ function getTsconfigFiles(pkg) {
|
|||
}
|
||||
|
||||
function isMeaningfulChange(pkg, path) {
|
||||
if (getTsconfigFiles(pkg).indexOf(path) > -1) return true
|
||||
|
||||
// some magic heuristics stuff
|
||||
if (path.match(/\.(md|\.test\.ts)$/i)) return false
|
||||
if (path.match(/^\/(scripts|dist|tests|private)/i)) return false
|
||||
|
||||
if (path.match(/\.(md|test(?:-utils)?\.ts)$/i)) return false
|
||||
|
||||
if (getTsconfigFiles(pkg).indexOf(path) > -1) {
|
||||
console.log('[i] %s: %s is in tsconfig', pkg, path)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
if (path.match(/typedoc\.cjs$/i)) return false
|
||||
if (path.match(/^(scripts|dist|tests|private)\//i)) return false
|
||||
|
||||
console.log('[i] %s: %s is a meaningful change', pkg, path)
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"exclude": [
|
||||
"**/*.test.ts",
|
||||
"**/*.test-utils.ts",
|
||||
]
|
||||
}
|
Loading…
Reference in a new issue