Skip to content

Commit

Permalink
refactor: use tsc
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiralite committed Jan 21, 2025
1 parent 43540f3 commit 12900ef
Show file tree
Hide file tree
Showing 30 changed files with 138 additions and 25 deletions.
2 changes: 1 addition & 1 deletion packages/actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "A set of actions that we use for our workflows",
"private": true,
"scripts": {
"test": "vitest run",
"test": "vitest run && tsc --project ./tsconfig.test.json",
"build": "tsc --noEmit --lib ESNext,DOM && tsup",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
Expand Down
9 changes: 9 additions & 0 deletions packages/actions/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"include": ["__tests__/**/*.ts", "../../vitest.d.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion packages/brokers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.0.0",
"description": "Powerful set of message brokers",
"scripts": {
"test": "vitest run",
"test": "vitest run && tsc --project ./tsconfig.test.json",
"build": "tsc --noEmit --lib ESNext,DOM && tsup",
"build:docs": "tsc -p tsconfig.docs.json --lib ESNext,DOM",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
Expand Down
9 changes: 9 additions & 0 deletions packages/brokers/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"include": ["__tests__/**/*.ts", "../../vitest.d.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion packages/builders/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.9.0",
"description": "A set of builders that you can use when creating your bot",
"scripts": {
"test": "vitest run",
"test": "vitest run && tsc --project ./tsconfig.test.json",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
Expand Down
9 changes: 9 additions & 0 deletions packages/builders/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"include": ["__tests__/**/*.ts", "../../vitest.d.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion packages/collection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "2.1.1",
"description": "Utility data structure used in discord.js",
"scripts": {
"test": "vitest run",
"test": "vitest run && tsc --project ./tsconfig.test.json",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
Expand Down
9 changes: 9 additions & 0 deletions packages/collection/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"include": ["__tests__/**/*.ts", "../../vitest.d.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "2.0.0",
"description": "A thinly abstracted wrapper around the rest API, and gateway.",
"scripts": {
"test": "vitest run",
"test": "vitest run && tsc --project ./tsconfig.test.json",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.json",
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "bin", "__tests__", "../../vitest.d.ts"],
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.cjs", "src/**/*.mjs", "bin"],
"exclude": ["node_modules"]
}
9 changes: 9 additions & 0 deletions packages/core/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"include": ["__tests__/**/*.ts", "../../vitest.d.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion packages/formatters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.5.0",
"description": "A set of functions to format strings for Discord.",
"scripts": {
"test": "vitest run",
"test": "vitest run && tsc --project ./tsconfig.test.json",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
Expand Down
9 changes: 9 additions & 0 deletions packages/formatters/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"include": ["__tests__/**/*.ts", "../../vitest.d.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0",
"description": "A powerful TypeScript library for interacting with the Discord API",
"scripts": {
"test": "vitest run",
"test": "vitest run && tsc --project ./tsconfig.test.json",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
Expand Down
9 changes: 9 additions & 0 deletions packages/next/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"include": ["__tests__/**/*.ts", "../../vitest.d.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion packages/proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "2.1.1",
"description": "Tools for running an HTTP proxy for Discord's API",
"scripts": {
"test": "vitest run",
"test": "vitest run && tsc --project ./tsconfig.test.json",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
Expand Down
9 changes: 9 additions & 0 deletions packages/proxy/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"include": ["__tests__/**/*.ts", "../../vitest.d.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion packages/rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "2.4.0",
"description": "The REST API for discord.js",
"scripts": {
"test": "vitest run",
"test": "vitest run && tsc --project ./tsconfig.test.json",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
Expand Down
9 changes: 9 additions & 0 deletions packages/rest/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"include": ["__tests__/**/*.ts", "../../vitest.d.ts"],
"exclude": ["node_modules"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"test": "vitest run",
"test": "vitest run && tsc --project ./tsconfig.test.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"fmt": "pnpm run format",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"include": ["__tests__/**/*.ts", "../../vitest.d.ts"],
"exclude": ["node_modules"]
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expectType } from 'tsd';
import { assertType } from 'vitest';
import { isEquatable, type Equatable } from '../../src/index.js';

declare const unknownObj: unknown;

if (isEquatable(unknownObj)) {
expectType<Equatable<unknown>>(unknownObj);
expectType<boolean>(unknownObj.equals(unknownObj));
assertType<Equatable<unknown>>(unknownObj);
assertType<boolean>(unknownObj.equals(unknownObj));
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expectType } from 'tsd';
import { assertType } from 'vitest';
import { isJSONEncodable, type JSONEncodable } from '../../src/index.js';

declare const unknownObj: unknown;

if (isJSONEncodable(unknownObj)) {
expectType<JSONEncodable<unknown>>(unknownObj);
expectType<unknown>(unknownObj.toJSON());
assertType<JSONEncodable<unknown>>(unknownObj);
assertType<unknown>(unknownObj.toJSON());
}
2 changes: 1 addition & 1 deletion packages/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"test": "vitest run && tsd",
"test": "vitest run && tsc --project ./tsconfig.test.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"fmt": "pnpm run format",
Expand Down
9 changes: 9 additions & 0 deletions packages/util/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"include": ["__tests__/**/*.ts", "../../vitest.d.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion packages/voice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"build": "tsc --noEmit && tsup && node scripts/postbuild.mjs",
"build:docs": "tsc -p tsconfig.docs.json",
"test": "vitest run",
"test": "vitest run && tsc --project ./tsconfig.test.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"fmt": "pnpm run format",
Expand Down
9 changes: 9 additions & 0 deletions packages/voice/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"include": ["__tests__/**/*.ts", "../../vitest.d.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion packages/ws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "2.0.0",
"description": "Wrapper around Discord's gateway",
"scripts": {
"test": "vitest run",
"test": "vitest run && tsc --project ./tsconfig.test.json",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
Expand Down
9 changes: 9 additions & 0 deletions packages/ws/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"include": ["__tests__/**/*.ts", "../../vitest.d.ts"],
"exclude": ["node_modules"]
}
6 changes: 1 addition & 5 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
exclude: ['**/node_modules', '**/dist', '.idea', '.git', '.cache', '**/__tests__/types.test.ts'],
exclude: ['**/node_modules', '**/dist', '.idea', '.git', '.cache'],
passWithNoTests: true,
typecheck: {
enabled: true,
include: ['**/__tests__/types.test.ts'],
},
coverage: {
enabled: true,
all: true,
Expand Down

0 comments on commit 12900ef

Please sign in to comment.