Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared config for prettier, eslint and tsconfig for bun #68

Merged
merged 5 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
**/node_modules
**/.env
**/.env
config.env
12 changes: 4 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
name: Build

on:
pull_request: # Trigger for pull requests.
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
push:
branches:
- main
workflow_dispatch: # Allows for manual triggering.
branches: [master]
tags: ["v*"]
pull_request:

jobs:
build:
Expand All @@ -32,4 +28,4 @@ jobs:
env:
PUBLIC_API_ENDPOINT: http://api
PUBLIC_STITCHER_ENDPOINT: http://stitcher
run: pnpm --filter="@mixwave/*" build
run: pnpm build
9 changes: 6 additions & 3 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ jobs:
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: pnpm --filter "docs" install
run: pnpm install
working-directory: ./docs
- name: Build with VitePress
run: pnpm --filter "docs" build
run: pnpm build
working-directory: ./docs
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
working-directory: ./docs
with:
path: docs/.vitepress/dist
path: .vitepress/dist
deploy:
environment:
name: github-pages
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
name: Lint

on:
pull_request: # Trigger for pull requests.
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
push:
branches:
- main
workflow_dispatch: # Allows for manual triggering.
branches: [master]
tags: ["v*"]
pull_request:

jobs:
lint:
Expand All @@ -28,5 +24,3 @@ jobs:
run: pnpm install
- name: Run lint
run: pnpm lint
- name: Run typecheck
run: pnpm typecheck
14 changes: 5 additions & 9 deletions .github/workflows/tests.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
name: Tests
name: Test

on:
pull_request: # Trigger for pull requests.
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
push:
branches:
- main
workflow_dispatch: # Allows for manual triggering.
branches: [master]
tags: ["v*"]
pull_request:

jobs:
test:
Expand All @@ -29,5 +25,5 @@ jobs:
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Run tests
- name: Run unit tests
run: pnpm test
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ dist-ssr
*.sln
*.sw?

config.env
config.env

vite.config.ts.timestamp*
*.tsbuildinfo
8 changes: 1 addition & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@
"dev": "turbo dev",
"build": "turbo build",
"lint": "turbo lint",
"typecheck": "turbo typecheck",
"test": "turbo test",
"install-bin": "turbo install-bin"
},
"packageManager": "pnpm@8.15.1",
"devDependencies": {
"@changesets/cli": "^2.27.9",
"@eslint/js": "^9.12.0",
"eslint": "^9.12.0",
"prettier": "^3.3.3",
"turbo": "^2.1.3",
"typescript": "^5.6.3",
"typescript-eslint": "^8.10.0"
"turbo": "^2.1.3"
}
}
1 change: 1 addition & 0 deletions packages/api/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "config/eslint.config.mjs";
12 changes: 7 additions & 5 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@
},
"scripts": {
"dev": "bun --watch ./src/index.ts",
"build": "bun build ./src/index.ts --target=bun --outdir=./dist",
"lint": "eslint \"./src/**/*.ts\" && prettier --check \"./src/**/*.ts\"",
"typecheck": "tsc"
"build": "tsc -b && bun build ./src/index.ts --target=bun --outdir=./dist",
"lint": "eslint"
},
"devDependencies": {
"@types/bun": "latest"
"@types/bun": "latest",
"config": "workspace:*",
"eslint": "^9.13.0",
"typescript": "^5.6.3"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.623.0",
"@elysiajs/cors": "^1.1.1",
"@elysiajs/swagger": "^1.1.5",
"@mixwave/artisan": "workspace:*",
"@mixwave/shared": "workspace:*",
"shared": "workspace:*",
"bullmq": "^5.12.0",
"elysia": "^1.1.20"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/env.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parseEnv } from "@mixwave/shared";
import { parseEnv } from "shared";

export const env = parseEnv((t) => ({
// process
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
VideoCodecSchema,
AudioCodecSchema,
scalarCustomCss,
} from "@mixwave/shared";
} from "shared";
import { env } from "./env";
import { getJob, getJobs, getJobLogs } from "./jobs";
import { getStorageFolder, getStorageFile } from "./s3";
Expand Down
21 changes: 2 additions & 19 deletions packages/api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
{
"include": ["src"],
"compilerOptions": {
"lib": ["ESNext"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noPropertyAccessFromIndexSignature": true
}
"extends": "config/tsconfig.bun.json",
"include": ["src"]
}
1 change: 1 addition & 0 deletions packages/artisan/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "config/eslint.config.mjs";
12 changes: 7 additions & 5 deletions packages/artisan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
},
"scripts": {
"dev": "bun --watch ./src/consumer/index.ts",
"build": "bun build ./src/consumer/index.ts --target=bun --outdir=./dist",
"lint": "eslint \"./src/**/*.ts\" && prettier --check \"./src/**/*.ts\"",
"typecheck": "tsc",
"build": "tsc -b && bun build ./src/consumer/index.ts --target=bun --outdir=./dist",
"lint": "eslint",
"install-bin": "./scripts/install-bin.sh"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.623.0",
"@aws-sdk/lib-storage": "^3.669.0",
"@mixwave/shared": "workspace:*",
"shared": "workspace:*",
"@sinclair/typebox": "^0.33.16",
"bullmq": "^5.12.0",
"execa": "^9.4.0",
Expand All @@ -28,6 +27,9 @@
"devDependencies": {
"@types/bun": "latest",
"@types/mime-types": "^2.1.4",
"@types/parse-filepath": "^1.0.2"
"@types/parse-filepath": "^1.0.2",
"config": "workspace:*",
"eslint": "^9.13.0",
"typescript": "^5.6.3"
}
}
2 changes: 1 addition & 1 deletion packages/artisan/src/consumer/env.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parseEnv } from "@mixwave/shared";
import { parseEnv } from "shared";

export const env = parseEnv((t) => ({
// config.env
Expand Down
2 changes: 1 addition & 1 deletion packages/artisan/src/consumer/meta-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ export type MetaFile = {
*/
export async function getMetaFile(path: string): Promise<MetaFile> {
const text = await fs.readFile(`${path}/meta.json`, "utf8");
return JSON.parse(text);
return JSON.parse(text.toString());
}
2 changes: 1 addition & 1 deletion packages/artisan/src/producer/env.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parseEnv } from "@mixwave/shared";
import { parseEnv } from "shared";

export const env = parseEnv((t) => ({
// config.env
Expand Down
2 changes: 1 addition & 1 deletion packages/artisan/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LangCode, VideoCodec, AudioCodec } from "@mixwave/shared";
import type { LangCode, VideoCodec, AudioCodec } from "shared";

export type Stream =
| {
Expand Down
21 changes: 2 additions & 19 deletions packages/artisan/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
{
"include": ["src"],
"compilerOptions": {
"lib": ["ESNext"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noPropertyAccessFromIndexSignature": true
}
"extends": "config/tsconfig.bun.json",
"include": ["src"]
}
9 changes: 7 additions & 2 deletions eslint.config.mjs → packages/config/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import prettier from "eslint-plugin-prettier/recommended";

export default tseslint.config(
export default [
{
ignores: ["dist/*"],
},
eslint.configs.recommended,
...tseslint.configs.recommended,
);
prettier,
];
11 changes: 11 additions & 0 deletions packages/config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "config",
"private": true,
"version": "0.0.0",
"devDependencies": {
"@eslint/js": "^9.12.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"typescript-eslint": "^8.10.0"
}
}
23 changes: 23 additions & 0 deletions packages/config/tsconfig.bun.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Bun",
"exclude": ["node_modules"],
"compilerOptions": {
"lib": ["ESNext"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noPropertyAccessFromIndexSignature": true
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Vite",
"exclude": ["node_modules"],
"compilerOptions": {
"target": "es2020",
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["es2020", "dom", "dom.iterable"],
"module": "esnext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"baseUrl": "."
},
"include": ["src"]
"noFallthroughCasesInSwitch": true
}
}
4 changes: 2 additions & 2 deletions packages/dashboard/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "app/globals.css",
"css": "src/globals.css",
"baseColor": "stone",
"cssVariables": true,
"prefix": ""
Expand All @@ -14,4 +14,4 @@
"components": "@/components",
"utils": "@/lib/utils"
}
}
}
1 change: 1 addition & 0 deletions packages/dashboard/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "config/eslint.config.mjs";
Loading