From c6fb9f82a7780b1d68a85b732e448bf3d7e8e63f Mon Sep 17 00:00:00 2001 From: Bill Mill Date: Wed, 29 May 2024 12:57:16 -0400 Subject: [PATCH 1/6] fix: remove gyp exception --- .npmignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.npmignore b/.npmignore index 1a87c3d5f..17cd756ca 100644 --- a/.npmignore +++ b/.npmignore @@ -10,9 +10,6 @@ /src/ /vendor/ -# we do need the libgit2.gyp file though, so node-gyp can run -!/vendor/libgit2.gyp - .astylerc .editorconfig .gitignore From 1a972dab247a3ff55b0e980f87dcd5dc943245bd Mon Sep 17 00:00:00 2001 From: Bill Mill Date: Wed, 29 May 2024 12:57:30 -0400 Subject: [PATCH 2/6] move preinstall out of install script --- .github/workflows/tests.yml | 2 ++ package.json | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 357caebcd..f56072b85 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -46,6 +46,7 @@ jobs: eval "$(ssh-agent -s)" ssh-add ~/.ssh_tests/id_rsa + npm run generate npm install npm test @@ -81,5 +82,6 @@ jobs: eval "$(ssh-agent -s)" ssh-add ~/.ssh_tests/id_rsa + npm run generate npm install npm test diff --git a/package.json b/package.json index 0151cee72..c085e2b52 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,8 @@ "generateJson": "node generate/scripts/generateJson", "generateMissingTests": "node generate/scripts/generateMissingTests", "generateNativeCode": "node generate/scripts/generateNativeCode", - "install": "node lifecycleScripts/preinstall.js && node-gyp-build", + "generate": "node lifecycleScripts/preinstall.js", + "install": "node-gyp-build", "installDebug": "BUILD_DEBUG=true npm install", "lint": "jshint lib test/tests test/utils lifecycleScripts", "mergecov": "lcov-result-merger 'test/**/*.info' 'test/coverage/merged.lcov' && ./lcov-1.10/bin/genhtml test/coverage/merged.lcov --output-directory test/coverage/report", From eb1a2968f3151902ec3f172e0ca17122bd66af21 Mon Sep 17 00:00:00 2001 From: Bill Mill Date: Wed, 29 May 2024 13:08:09 -0400 Subject: [PATCH 3/6] install without scripts first --- .github/workflows/tests.yml | 2 ++ lifecycleScripts/preinstall.js | 47 +++++++++------------------------- 2 files changed, 14 insertions(+), 35 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f56072b85..3bfe34450 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -46,6 +46,7 @@ jobs: eval "$(ssh-agent -s)" ssh-add ~/.ssh_tests/id_rsa + npm install --ignore-scripts npm run generate npm install npm test @@ -82,6 +83,7 @@ jobs: eval "$(ssh-agent -s)" ssh-add ~/.ssh_tests/id_rsa + npm install --ignore-scripts npm run generate npm install npm test diff --git a/lifecycleScripts/preinstall.js b/lifecycleScripts/preinstall.js index 870cf1558..f5dd770c2 100755 --- a/lifecycleScripts/preinstall.js +++ b/lifecycleScripts/preinstall.js @@ -4,44 +4,21 @@ var local = path.join.bind(path, __dirname); var exec = require(local("../utils/execPromise")); var buildFlags = require(local("../utils/buildFlags")); -module.exports = function prepareForBuild() { - console.log("[nodegit] Running pre-install script"); - - return exec("npm -v") - .then( - function(npmVersion) { - if (npmVersion.split(".")[0] < 3) { - console.log( - "[nodegit] npm@2 installed, pre-loading required packages" - ); - return exec("npm install --ignore-scripts"); - } - - return Promise.resolve(); - }, - function() { - // We're installing via yarn, so don't - // care about compability with npm@2 - } - ) - .then(function() { - if (buildFlags.isGitRepo) { - var submodules = require(local("submodules")); - var generate = require(local("../generate")); - return submodules() - .then(function() { - return generate(); - }); - } +module.exports = async function prepareForBuild() { + if (buildFlags.isGitRepo) { + var submodules = require(local("submodules")); + var generate = require(local("../generate")); + return submodules().then(function () { + return generate(); }); + } }; // Called on the command line if (require.main === module) { - module.exports() - .catch(function(e) { - console.error("[nodegit] ERROR - Could not finish preinstall"); - console.error(e); - process.exit(1); - }); + module.exports().catch(function (e) { + console.error("[nodegit] ERROR - Could not finish preinstall"); + console.error(e); + process.exit(1); + }); } From c4fdd73fc3fae20e32ca36f45056824e2150d5f0 Mon Sep 17 00:00:00 2001 From: Bill Mill Date: Wed, 29 May 2024 13:08:39 -0400 Subject: [PATCH 4/6] remove unnecessary async --- lifecycleScripts/preinstall.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lifecycleScripts/preinstall.js b/lifecycleScripts/preinstall.js index f5dd770c2..39761cb4c 100755 --- a/lifecycleScripts/preinstall.js +++ b/lifecycleScripts/preinstall.js @@ -4,7 +4,7 @@ var local = path.join.bind(path, __dirname); var exec = require(local("../utils/execPromise")); var buildFlags = require(local("../utils/buildFlags")); -module.exports = async function prepareForBuild() { +module.exports = function prepareForBuild() { if (buildFlags.isGitRepo) { var submodules = require(local("submodules")); var generate = require(local("../generate")); From 563370d86144fa81ab1e33c5b3ffba1ffc6ad48f Mon Sep 17 00:00:00 2001 From: Bill Mill Date: Thu, 30 May 2024 08:19:55 -0400 Subject: [PATCH 5/6] remove unused exec --- lifecycleScripts/preinstall.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lifecycleScripts/preinstall.js b/lifecycleScripts/preinstall.js index 39761cb4c..085a5aff5 100755 --- a/lifecycleScripts/preinstall.js +++ b/lifecycleScripts/preinstall.js @@ -1,7 +1,6 @@ var path = require("path"); var local = path.join.bind(path, __dirname); -var exec = require(local("../utils/execPromise")); var buildFlags = require(local("../utils/buildFlags")); module.exports = function prepareForBuild() { From 25d0dd567db4d1c19d9042e64128a5e4c1741b8b Mon Sep 17 00:00:00 2001 From: Bill Mill Date: Thu, 30 May 2024 08:31:23 -0400 Subject: [PATCH 6/6] in order to get an arm build, we need to use macos-14 https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source/ --- .github/workflows/publish.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 87d4022f0..56e310c47 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,11 +14,9 @@ jobs: node: [20] os: - name: darwin - architecture: arm64 - host: macos-13 + host: macos-14 - name: linux - architecture: x86-64 host: ubuntu-20.04 env: CC: clang