Skip to content

Commit

Permalink
chore: blocknumber setup (#9)
Browse files Browse the repository at this point in the history
# 🤖 Linear

Closes GRT-37

## Description

Set up `blocknumber` package with scripts, integration with monorepo and
testing framework.
  • Loading branch information
0xyaco authored Jul 23, 2024
1 parent 795bb9f commit 1efd810
Show file tree
Hide file tree
Showing 15 changed files with 421 additions and 23 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@
node_modules/

# Turbo
.turbo/
.turbo/

# Build
dist/

# Coverage
coverage/
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
"description": "",
"main": "index.js",
"scripts": {
"build": "turbo run build",
"test": "turbo run test",
"coverage": "turbo run coverage",
"prepare": "husky",
"lint": "turbo run lint",
"lint:fix": "turbo run lint:fix",
"format": "turbo run format",
"build": "turbo run build"
"format:fix": "turbo run format:fix"
},
"keywords": [],
"author": "",
Expand All @@ -19,6 +22,7 @@
"@ianvs/prettier-plugin-sort-imports": "4.3.1",
"@typescript-eslint/eslint-plugin": "7.16.1",
"@typescript-eslint/parser": "7.16.1",
"@vitest/coverage-v8": "^2.0.3",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.2.1",
Expand Down
Empty file removed packages/.gitkeep
Empty file.
3 changes: 3 additions & 0 deletions packages/blocknumber/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Generated files
node_modules
dist
19 changes: 19 additions & 0 deletions packages/blocknumber/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "blocknumber",
"version": "1.0.0",
"description": "",
"main": "index.ts",
"type": "module",
"scripts": {
"build": "tsc -p tsconfig.build.json",
"lint": "eslint .",
"lint:fix": "pnpm lint --fix",
"format": "prettier --check .",
"format:fix": "prettier --write .",
"test": "vitest run",
"coverage": "vitest run --coverage"
},
"keywords": [],
"author": "",
"license": "ISC"
}
11 changes: 11 additions & 0 deletions packages/blocknumber/src/helloWorld.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { describe, expect, it } from "vitest";

import foo from "./helloWorld.js";

describe("test", () => {
it("pass", () => {
const result = foo();

expect(result).toBe("bar");
});
});
3 changes: 3 additions & 0 deletions packages/blocknumber/src/helloWorld.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function foo() {
return "bar";
}
9 changes: 9 additions & 0 deletions packages/blocknumber/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.build.json",
"compilerOptions": {
"declaration": true,
"outDir": "dist"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "build", "tests", "vitest.config.ts"]
}
4 changes: 4 additions & 0 deletions packages/blocknumber/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.json",
"include": ["src/**/*"]
}
22 changes: 22 additions & 0 deletions packages/blocknumber/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import path from "path";
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
globals: true, // Use Vitest's global API without importing it in each file
environment: "node", // Use the Node.js environment
include: ["src/**/*.spec.ts"], // Include test files
exclude: ["node_modules", "dist"], // Exclude certain directories
coverage: {
provider: "v8",
reporter: ["text", "json", "html"], // Coverage reporters
exclude: ["node_modules", "dist", "src/**/*.d.ts"], // Files to exclude from coverage
},
},
resolve: {
alias: {
// Setup path alias based on tsconfig paths
"@": path.resolve(__dirname, "src"),
},
},
});
Loading

0 comments on commit 1efd810

Please sign in to comment.