├── src
├── main.spec.ts
└── main.ts
├── README.md
├── vitest.config.ts
├── .gitignore
├── .eslintrc.json
├── tsconfig.json
└── package.json
/src/main.spec.ts:
--------------------------------------------------------------------------------
1 | import { Main } from "./main";
2 |
3 | describe("Default test", () => {
4 | it("should work", () => {
5 | const main = new Main("Hello world");
6 | expect(main.getParam()).toBe("Hello world");
7 | });
8 | });
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TypeScript Boilerplate for Katas
2 |
3 | You can use it for Coding-Dojos, Katas or **reference** to build a new project.
4 |
5 | This boilerplate include:
6 |
7 | - 💬 TypeScript 3.6
8 | - 📙 Babel 7
9 | - ✅ Jest 24
10 | - 💅 Prettier & TSLint
11 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Main Class
3 | */
4 | export class Main {
5 | public static COMMANDS = 'Hello World';
6 |
7 | public param: string;
8 |
9 | constructor(param: string) {
10 | this.param = param;
11 | }
12 |
13 | public getParam(): string {
14 | return this.param;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/vitest.config.ts:
--------------------------------------------------------------------------------
1 | ///
2 | import { defineConfig } from "vitest/config";
3 |
4 | export default defineConfig({
5 | test: {
6 | globals: true,
7 | includeSource: ["./**/*.{js,ts}"],
8 | exclude: ["node_modules/**", "dist/**"],
9 | },
10 | resolve: {
11 | alias: {
12 | "@core": "src/core",
13 | },
14 | },
15 | });
16 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 |
6 | # Dependencies
7 | node_modules/
8 |
9 | # Coverage
10 | coverage
11 |
12 | # Transpiled files
13 | build/
14 |
15 | # VS Code
16 | .vscode
17 | !.vscode/tasks.js
18 |
19 | # JetBrains IDEs
20 | .idea/
21 |
22 | # Optional npm cache directory
23 | .npm
24 |
25 | # Optional eslint cache
26 | .eslintcache
27 |
28 | # Misc
29 | .DS_Store
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "browser": true,
4 | "es2021": true,
5 | "node": true
6 | },
7 | "overrides": [
8 | ],
9 | "parser": "@typescript-eslint/parser",
10 | "parserOptions": {
11 | "ecmaVersion": "latest",
12 | "sourceType": "module"
13 | },
14 | "plugins": [
15 | "@typescript-eslint"
16 | ],
17 | "rules": {
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ESNext",
4 | "baseUrl": "src",
5 | "paths": {
6 | "@core/*": ["core/*"]
7 | },
8 | "useDefineForClassFields": true,
9 | "lib": ["dom", "es2016", "esnext"],
10 | "module": "CommonJS",
11 | "moduleResolution": "node",
12 | "allowJs": false,
13 | "skipLibCheck": true,
14 | "esModuleInterop": false,
15 | "allowSyntheticDefaultImports": true,
16 | "strict": true,
17 | "forceConsistentCasingInFileNames": true,
18 | "resolveJsonModule": true,
19 | "isolatedModules": true,
20 | "noEmit": true,
21 | "types": ["vitest/globals"]
22 | },
23 | "include": ["src/**/*.ts"]
24 | }
25 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "typescript-boilerplate",
3 | "version": "3.0.0",
4 | "description": "Basic boilerplate project with TypeScript for Katas",
5 | "main": "build/index.js",
6 | "files": [
7 | "build",
8 | "!build/**/*.test.*"
9 | ],
10 | "contributors": [
11 | "Adrián Ferrera ",
12 | "Daniel Ramos ",
13 | "Michael Reyes ",
14 | "Airan Sanchez "
15 | ],
16 | "license": "ISC",
17 | "scripts": {
18 | "prepare": "npm run build",
19 | "prestart": "npm run build",
20 | "start": "node build/index.js",
21 | "build": "npm run lint && tsc --noEmit",
22 | "lint": "eslint . --ext .ts",
23 | "lint:fix": "npm run lint -- --fix",
24 | "test": "vitest run --reporter=verbose",
25 | "test:watch": "npm run test -- --watchAll",
26 | "test:coverage": "npm run test -- --coverage"
27 | },
28 | "devDependencies": {
29 | "@types/node": "^20.11.0",
30 | "@typescript-eslint/eslint-plugin": "^6.18.1",
31 | "@typescript-eslint/parser": "^6.18.1",
32 | "eslint": "^8.56.0",
33 | "typescript": "^5.3.3",
34 | "vitest": "^0.34.6"
35 | }
36 | }
37 |
--------------------------------------------------------------------------------