Skip to content

Commit

Permalink
feat: ✨ add config and src files
Browse files Browse the repository at this point in the history
  • Loading branch information
AkashRajpurohit committed May 14, 2023
1 parent b3c7bd5 commit 1746ae4
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { add, subtract } from "./math";

export { add, subtract };

export default {
add,
subtract
};
7 changes: 7 additions & 0 deletions src/math.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export function add(a: number, b: number) {
return a + b;
}

export function subtract(a: number, b: number) {
return a - b;
}
21 changes: 21 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"baseUrl": ".",
"esModuleInterop": true,
"lib": ["ESNext", "DOM"],
"module": "ESNext",
"moduleResolution": "Node",
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"paths": {
"~/*": ["./src/*"]
},
"resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"target": "ESNext"
},
"include": ["./src/**/*.ts", "./tests/**/*.test.ts"],
"exclude": ["node_modules", "dist"]
}
16 changes: 16 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineConfig } from "tsup";

const isProduction = process.env.NODE_ENV === "production";

export default defineConfig(({ watch = false }) => ({
clean: true,
dts: true,
entry: {
index: "src/index.ts",
},
external: [],
format: ["cjs", "esm"],
minify: isProduction,
sourcemap: isProduction,
watch,
}));
22 changes: 22 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/// <reference types="vitest" />

import { defineConfig } from "vitest/config";
import { resolve } from "node:path";

export default defineConfig({
resolve: {
alias: {
"~": resolve(__dirname, "src"),
},
},
test: {
coverage: {
provider: 'c8',
reporter: ['text', 'json', 'json-summary', 'html'],
lines: 80,
branches: 80,
functions: 80,
statements: 80
},
},
});

0 comments on commit 1746ae4

Please sign in to comment.