diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 00000000..988992fd --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,26 @@ +name: Some pull request checks + +on: + pull_request: + +jobs: + type-check: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Install dependencies + run: yarn install --ignore-scripts + + - name: Run TypeScript compiler + run: yarn tsc + + # - name: Run Vitest + # run: yarn vitest:once diff --git a/src/virtual-drive.ts b/src/virtual-drive.ts index 08ee4de6..dc02ee32 100644 --- a/src/virtual-drive.ts +++ b/src/virtual-drive.ts @@ -150,11 +150,6 @@ class VirtualDrive { return BigInt(jsTime) * 10000n + 116444736000000000n; } - async getItemsIds(): Promise { - console.log("getItemsIdsSync"); - return addon.getItemsIds(this.syncRootPath); - } - async getFileIdentity(relativePath: string): Promise { const fullPath = path.join(this.syncRootPath, relativePath); return addon.getFileIdentity(fullPath); diff --git a/src/watcher/detect-context-menu-action.service.ts b/src/watcher/detect-context-menu-action.service.ts index d7e94979..8cdb9411 100644 --- a/src/watcher/detect-context-menu-action.service.ts +++ b/src/watcher/detect-context-menu-action.service.ts @@ -9,7 +9,7 @@ export class DetectContextMenuActionService { const status = await self.virtualDriveFn.CfGetPlaceHolderState(path); self.writeLog("status", status); - const attribute: Attributes = await self.virtualDriveFn.CfGetPlaceHolderAttributes(path); + const attribute = await self.virtualDriveFn.CfGetPlaceHolderAttributes(path); self.writeLog("attribute", attribute); const itemId = self.virtualDriveFn.CfGetPlaceHolderIdentity(path); diff --git a/src/watcher/watcher.interface.ts b/src/watcher/watcher.interface.ts index 122f259c..9e7df54d 100644 --- a/src/watcher/watcher.interface.ts +++ b/src/watcher/watcher.interface.ts @@ -1,4 +1,6 @@ +import { addonZod } from "@/addon/addon-zod"; import { Status } from "src/types/placeholder.type"; +import { z } from "zod"; export interface IVirtualDriveFunctions { CfHydrate?: () => void; @@ -14,6 +16,6 @@ export interface IVirtualDriveFunctions { CfUpdateItem?: () => void; CfGetPlaceHolderState: (path: string) => Status; CfGetPlaceHolderIdentity: (path: string) => string; - CfGetPlaceHolderAttributes: (path: string) => Promise; + CfGetPlaceHolderAttributes: (path: string) => z.infer; CfConverToPlaceholder: (path: string, fileIdentity: string) => void; } diff --git a/test/utils/setup.helper.test.ts b/test/utils/setup.helper.test.ts index f29db34f..f9e72a40 100644 --- a/test/utils/setup.helper.test.ts +++ b/test/utils/setup.helper.test.ts @@ -1,8 +1,7 @@ -import { mkdirSync, rmSync } from "fs"; +import { mkdirSync } from "fs"; import { join } from "path"; import { cwd } from "process"; export const TEST_FILES = join(cwd(), "test-files"); -rmSync(TEST_FILES, { recursive: true, force: true }); mkdirSync(TEST_FILES, { recursive: true }); diff --git a/tsconfig.json b/tsconfig.json index 760a843e..c153ad34 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,6 +9,7 @@ "outDir": "./dist", "baseUrl": ".", "resolveJsonModule": true, + "skipLibCheck": true, "types": ["vitest/globals"], "paths": { "@/*": ["./src/*"],