Skip to content

Commit fab540a

Browse files
committed
refactor: to typescript
we introduce the typescript plugin to rollup and convert the js files to typescript without any meaningful changes to the code
1 parent 5a10eab commit fab540a

10 files changed

Lines changed: 37 additions & 4 deletions

File tree

.github/workflows/lint.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,27 @@ jobs:
4141
uses: pnpm/action-setup@v4
4242
- name: Install dependencies
4343
run: pnpm install
44-
- name: Lint JS files
44+
- name: Lint files
4545
run: pnpm run lint
46+
Typecheck:
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Checkout code
50+
uses: actions/checkout@v4
51+
- name: Setup Node
52+
uses: actions/setup-node@v4
53+
with:
54+
node-version: "20"
55+
- name: Restore node_modules cache
56+
uses: actions/cache@v4
57+
with:
58+
path: node_modules
59+
key: ${{ runner.os }}-node-modules-${{ hashFiles('package.json') }}
60+
restore-keys: |
61+
${{ runner.os }}-node-modules
62+
- name: Install pnpm
63+
uses: pnpm/action-setup@v4
64+
- name: Install dependencies
65+
run: pnpm install
66+
- name: Typecheck files
67+
run: pnpm run typecheck

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"vitest": "^3.2.4"
3333
},
3434
"scripts": {
35+
"typecheck": "tsc --noEmit",
3536
"build": "vite build",
3637
"lint": "prettier --check 'src/**/*.js'",
3738
"test": "vitest"

src/__tests__/alchemyApiDeserializer.spec.js renamed to src/__tests__/alchemyApiDeserializer.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { deserializePage, deserializePages } from "../alchemyApiDeserializer"
2+
import { describe, it, expect } from "vitest"
23

34
describe("deserializePage", () => {
45
it("does not return any deprecated elements for single page", () => {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { deserialize } from "../deserialize"
2+
import { describe, it, expect } from "vitest"
23

34
describe("deserialize", () => {
45
it("Complex serialize", () => {
File renamed without changes.

src/main.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from "./alchemyApiDeserializer"
2+
export * from "./deserialize"

tsconfig.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"compilerOptions": {
3+
"removeComments": true,
4+
"noImplicitAny": true,
5+
"skipLibCheck": true
6+
},
7+
"include": ["src/**/*"]
8+
}

vitest.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import { defineConfig } from "vitest/config"
22

33
export default defineConfig({
44
test: {
5-
globals: true
5+
globals: false
66
}
77
})

0 commit comments

Comments
 (0)