From 9f969f1e0602d9b02cacabf86d00b377352c3235 Mon Sep 17 00:00:00 2001 From: Jimb Esser Date: Thu, 12 Dec 2024 11:45:11 -0800 Subject: [PATCH] build: fix yarn errors upon `npm install minidump` - Only run `git submodule update` when running out of a git working copy - Don't require `yarn` for end-user installation --- build.js | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/build.js b/build.js index 11b8adc..dadc6e1 100644 --- a/build.js +++ b/build.js @@ -27,6 +27,14 @@ function spawnSync (...args) { } } +if (fs.existsSync(path.join(__dirname, '.git'))) { + // this is a development working tree of `node-minidump`, not an end-user install of the `minidump` package + spawnSync('git', ['submodule', 'update', '--init', '--recursive'], { + cwd: __dirname, + stdio: 'inherit' + }) +} + const buildDir = path.join(__dirname, 'build', getEffectiveArch()) if (!fs.existsSync(buildDir)) { fs.mkdirSync(buildDir, { recursive: true }) diff --git a/package.json b/package.json index 73e59fe..36091b6 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ }, "scripts": { "prepublishOnly": "shx chmod -R +x ./bin", - "preinstall": "yarn submodule && node build.js", + "preinstall": "node build.js", "submodule": "git submodule update --init --recursive", "test": "mocha test && standard" },