diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 683d1a4..43910a4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,15 +29,15 @@ jobs: strategy: matrix: os: [ macos-10.15, macos-11, macos-12, ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, windows-2019, windows-2022 ] - node: [ 14, 16, 18 ] + node: [ 18, 20 ] exclude: - os: ubuntu-18.04 node: 18 steps: - name: Fetch Codebase - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} check-latest: true @@ -61,7 +61,7 @@ jobs: curl -sLO https://github.com/ApsarasX/llvm-windows/releases/download/llvmorg-$LLVM_VERSION/$LLVM_PREBUILT_FILE Expand-Archive -Path $LLVM_PREBUILT_FILE -DestinationPath . $LLVM_CMAKE_DIR = "$pwd\\LLVM-$LLVM_VERSION-win64\\lib\\cmake\\llvm" - npm config set cmake_LLVM_DIR $LLVM_CMAKE_DIR + echo "cmake_LLVM_DIR=$LLVM_CMAKE_DIR"> .npmrc - name: Install Dependencies run: npm install --ignore-scripts - name: CMake Build Debug and Test @@ -74,4 +74,4 @@ jobs: run: | npm run clear npm run build:release - npm test \ No newline at end of file + npm test diff --git a/.gitignore b/.gitignore index 64379b3..aad3d1e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ .idea/ -.vscode/ +.vscode/* +!.vscode/launch.json +!.vscode/settings.json cmake-build-*/ diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..11b8f44 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +cmake_LLVM_DIR=/opt/homebrew/opt/llvm@14/lib/cmake/llvm/ diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..0c46cc6 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,56 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Jest: Run tests in current file", + "type": "node", + "request": "launch", + "runtimeExecutable": "npx", + "program": "jest", + "args": [ + "${relativeFile}", + ], + "console": "integratedTerminal", + "skipFiles": [ + "/**" + ], + "outFiles": [ + "${workspaceFolder}/**/*.js" + ] + }, + { + "name": "Vitest: Run tests in current file", + "type": "node", + "request": "launch", + "runtimeExecutable": "npx", + "program": "vitest", + "args": [ + "run", + "${relativeFile}", + ], + "console": "integratedTerminal", + "skipFiles": [ + "/**" + ], + "outFiles": [ + "${workspaceFolder}/**/*.js" + ] + }, + { + /* execute npm build:debug before running this! */ + "name": "LLDB: Debug LLVM-binding native parts during Vitest execution", + "type": "lldb", + "request": "launch", + "program": "node", + "sourceLanguages": ["cpp", "javascript"], + "args": [ + "${workspaceFolder}/node_modules/vitest/dist/cli-wrapper.js", + "run", + "${relativeFile}", + ], + }, + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..fed2f37 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,18 @@ +{ + "C_Cpp.default.cStandard": "c17", + "C_Cpp.default.cppStandard": "c++17", + "C_Cpp.default.includePath": [ + "/opt/homebrew/opt/llvm@14/include", + "${userHome}/.cmake-js/node-*/v*/include/node", + "${workspaceFolder}/node_modules/node-addon-api", + "${workspaceFolder}/include", + ], + "clangd.fallbackFlags": [ + "-std=c++17", + "-xc++-header", + "-I/opt/homebrew/opt/llvm@14/include", + "-I${userHome}/.cmake-js/node-arm64/v18.18.2/include/node/", /* switch to your arch & version here! */ + "-I${workspaceFolder}/node_modules/node-addon-api", + "-I${workspaceFolder}/include", + ] +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 83668c9..594c169 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,11 +5,13 @@ "tests/**/*.ts", ], "compilerOptions": { + "noEmit": true, "target": "ES5", "module": "commonjs", "strict": true, "moduleResolution": "node", "esModuleInterop": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "skipLibCheck": true } } diff --git a/vitest.config.mts b/vitest.config.mts new file mode 100644 index 0000000..934cbed --- /dev/null +++ b/vitest.config.mts @@ -0,0 +1,20 @@ +//import { defineConfig } from "vitest/config" + +export default /*defineConfig*/({ + test: { + deps: { + interopDefault: true + }, + include: ['**/*.{test,spec}.ts'], + exclude: ['**/node_modules/**', '**/dist/**'], + globals: true, + typecheck: { + //enabled: false + }, + poolOptions: { + threads: { + singleThread: true + } + } + } +}); \ No newline at end of file