diff --git a/.devcontainer b/.devcontainer new file mode 160000 index 000000000..57229e338 --- /dev/null +++ b/.devcontainer @@ -0,0 +1 @@ +Subproject commit 57229e33846c3e7a6551fc586caed80b8b213cb8 diff --git a/.github/workflows/ci-win.yml b/.github/workflows/ci-win.yml index 9bdc87f5d..3a1e9f871 100644 --- a/.github/workflows/ci-win.yml +++ b/.github/workflows/ci-win.yml @@ -1,6 +1,6 @@ name: Node.js CI Windows Platform -on: [push, pull_request] +on: [workflow_dispatch] env: PYTHON_VERSION: '3.11' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93b3595a3..1d4b14729 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: Node.js CI Unix Platform -on: [push, pull_request] +on: [workflow_dispatch] env: PYTHON_VERSION: '3.11' diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index d0aa2289d..41ac6f31c 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -7,7 +7,7 @@ # # Source repository: https://github.com/actions/dependency-review-action name: 'Dependency Review' -on: [pull_request] +on: [workflow_dispatch] permissions: contents: read diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index e3f307c5f..ff0d27926 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -1,6 +1,6 @@ name: Style Checks -on: [push, pull_request] +on: [workflow_dispatch] permissions: contents: read diff --git a/.github/workflows/node-api-headers.yml b/.github/workflows/node-api-headers.yml index 5cc8bbdd8..5cee168a3 100644 --- a/.github/workflows/node-api-headers.yml +++ b/.github/workflows/node-api-headers.yml @@ -1,6 +1,6 @@ name: Node.js CI with node-api-headers -on: [push, pull_request] +on: [workflow_dispatch] env: PYTHON_VERSION: '3.11' diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 9efdeb9d3..a3cfd49bc 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,7 +1,5 @@ name: "Close stale issues" -on: - schedule: - - cron: "0 0 * * *" +on: [workflow_dispatch] permissions: contents: read diff --git a/.github/workflows/xpbuild.yml b/.github/workflows/xpbuild.yml new file mode 100644 index 000000000..fb5575822 --- /dev/null +++ b/.github/workflows/xpbuild.yml @@ -0,0 +1,30 @@ +name: Build +on: + push: + branches: [ "dev" ] + pull_request: + branches: [ "dev" ] + workflow_dispatch: +jobs: + linux: + uses: externpro/externpro/.github/workflows/build-linux.yml@25.05.1 + with: + cmake-workflow-preset: LinuxRelease + runon: ubuntu-latest + secrets: inherit + linux-arm64: + uses: externpro/externpro/.github/workflows/build-linux.yml@25.05.1 + with: + cmake-workflow-preset: LinuxRelease + runon: ubuntu-24.04-arm + secrets: inherit + macos: + uses: externpro/externpro/.github/workflows/build-macos.yml@25.05.1 + with: + cmake-workflow-preset: DarwinRelease + secrets: inherit + windows: + uses: externpro/externpro/.github/workflows/build-windows.yml@25.05.1 + with: + cmake-workflow-preset: WindowsRelease + secrets: inherit diff --git a/.github/workflows/xprelease.yml b/.github/workflows/xprelease.yml new file mode 100644 index 000000000..f868a82e5 --- /dev/null +++ b/.github/workflows/xprelease.yml @@ -0,0 +1,20 @@ +name: Release +on: + workflow_dispatch: + inputs: + workflow_run_url: + description: 'URL of the workflow run containing artifacts to upload (e.g., https://github.com/owner/repo/actions/runs/123456789)' + required: true + type: string +jobs: + # Upload build artifacts as release assets + release-from-build: + uses: externpro/externpro/.github/workflows/release-from-build.yml@25.05.1 + with: + workflow_run_url: ${{ github.event.inputs.workflow_run_url }} + artifact_pattern: "*.tar.xz" + permissions: + contents: write + id-token: write + attestations: write + secrets: inherit diff --git a/.gitignore b/.gitignore index a154db646..b28a7c62f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,11 @@ /test/require_basic_finalizers/addons /.vscode +# externpro +.env +_bld*/ +docker-compose.override.yml + # ignore node-gyp generated files outside its build directory /test/*.Makefile /test/*.mk diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..18932abfb --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule ".devcontainer"] + path = .devcontainer + url = https://github.com/externpro/externpro diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..e76c68a25 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.31) +set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES .devcontainer/cmake/xproinc.cmake) +project(node-addon-api VERSION 8.5.0) +include(xpflags) +include(GNUInstallDirs) +set(XP_INSTALL_CMAKEDIR ${CMAKE_INSTALL_DATADIR}/cmake) # xpPackageDevel +set(XP_NAMESPACE xpro) +set(targetsFile ${PROJECT_NAME}-targets) +set(lib_name ${PROJECT_NAME}) +xpFindPkg(PKGS nodexp) +xpPackageDevel(TARGETS_FILE ${targetsFile} DEPS nodexp LIBRARIES ${XP_NAMESPACE}::${lib_name}) +######################################## +set(libsrcs + napi-inl.deprecated.h + napi-inl.h + napi.h + ) +######################################## +add_library(${lib_name} INTERFACE ${libsrcs}) +target_include_directories(${lib_name} INTERFACE $) +target_compile_definitions(${lib_name} INTERFACE NODE_ADDON_API_DISABLE_DEPRECATED NAPI_CPP_EXCEPTIONS) +target_link_libraries(${lib_name} INTERFACE ${XP_NAMESPACE}::node) +######################################## +install(TARGETS ${lib_name} EXPORT ${targetsFile}) +install(FILES ${libsrcs} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}) +install(EXPORT ${targetsFile} DESTINATION ${XP_INSTALL_CMAKEDIR} NAMESPACE ${XP_NAMESPACE}::) +install(FILES CHANGELOG.md LICENSE.md README.md DESTINATION ${CMAKE_INSTALL_DATADIR}) +install(DIRECTORY doc DESTINATION ${CMAKE_INSTALL_DATADIR}) diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 000000000..f82cfdd2c --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,8 @@ +{ + "version": 8, + "include": [ + ".devcontainer/cmake/presets/xpLinuxNinja.json", + ".devcontainer/cmake/presets/xpDarwinNinja.json", + ".devcontainer/cmake/presets/xpWindowsVs2022.json" + ] +} diff --git a/CMakePresetsBase.json b/CMakePresetsBase.json new file mode 100644 index 000000000..09653d8ae --- /dev/null +++ b/CMakePresetsBase.json @@ -0,0 +1,10 @@ +{ + "version": 8, + "configurePresets": [ + { + "name": "config-base", + "hidden": true, + "binaryDir": "${sourceDir}/_bld-${presetName}" + } + ] +} diff --git a/docker-compose.sh b/docker-compose.sh new file mode 120000 index 000000000..85f182f0b --- /dev/null +++ b/docker-compose.sh @@ -0,0 +1 @@ +.devcontainer/compose.pro.sh \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 120000 index 000000000..46c1f8918 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1 @@ +.devcontainer/compose.bld.yml \ No newline at end of file