diff --git a/packages/std/.gitignore b/packages/std/.gitignore new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/packages/std/.gitignore @@ -0,0 +1 @@ + diff --git a/packages/std/README.md b/packages/std/README.md new file mode 100644 index 00000000..98b58841 --- /dev/null +++ b/packages/std/README.md @@ -0,0 +1,3 @@ +# `@kampus/std` + +Standard library for kampus projects: group of utilities that can we use in every other workspace. diff --git a/packages/std/assert-never.ts b/packages/std/assert-never.ts new file mode 100644 index 00000000..0a3c533c --- /dev/null +++ b/packages/std/assert-never.ts @@ -0,0 +1,7 @@ +export function assertNever(value: never, message?: string) { + if (!message) { + return value; + } + + throw new Error(message); +} \ No newline at end of file diff --git a/packages/std/index.ts b/packages/std/index.ts new file mode 100644 index 00000000..7ca23fab --- /dev/null +++ b/packages/std/index.ts @@ -0,0 +1 @@ +export * from "./assert-never"; diff --git a/packages/std/package.json b/packages/std/package.json new file mode 100644 index 00000000..86ea8b55 --- /dev/null +++ b/packages/std/package.json @@ -0,0 +1,26 @@ +{ + "name": "@kampus/std", + "version": "0.0.0", + "description": "", + "main": "index.ts", + "types": "index.ts", + "scripts": { + "test": "vitest", + "test:ui": "vitest --ui", + "test:cov": "vitest --coverage" + }, + "author": "", + "license": "MIT", + "volta": { + "extends": "../../package.json" + }, + "dependencies": { + }, + "devDependencies": { + "@vitest/coverage-v8": "0.32.2", + "@vitest/ui": "0.32.2", + "vite-tsconfig-paths": "4.2.0", + "vitest": "0.32.2", + "vitest-mock-extended": "1.1.3" + } +} diff --git a/packages/std/tsconfig.json b/packages/std/tsconfig.json new file mode 100644 index 00000000..4e89d8ca --- /dev/null +++ b/packages/std/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "../../tsconfig.json", + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + "exclude": ["dist", "build", "node_modules"] +} diff --git a/packages/std/vitest.config.ts b/packages/std/vitest.config.ts new file mode 100644 index 00000000..5f5a285c --- /dev/null +++ b/packages/std/vitest.config.ts @@ -0,0 +1,6 @@ +import tsconfigPaths from "vite-tsconfig-paths"; +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + plugins: [tsconfigPaths()], +});