diff --git a/package.json b/package.json index 0c82b0327..865801ae4 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,7 @@ "build": "yarn plugin-helpers build", "plugin-helpers": "node ../../scripts/plugin_helpers", "postbuild": "echo Renaming build artifact to [$npm_package_config_id-$npm_package_version.zip] && mv build/$npm_package_config_id*.zip build/$npm_package_config_id-$npm_package_version.zip", - "run:postinstall": "pwd && node ../../../scripts/postinstall_alerting", - "postinstall": "yarn run:postinstall" + "postinstall": "node ./scripts/postinstall_alerting" }, "devDependencies": { "@babel/plugin-transform-modules-commonjs": "^7.22.9", diff --git a/scripts/postinstall_alerting.js b/scripts/postinstall_alerting.js index 47ca3be23..d1e5ebe00 100644 --- a/scripts/postinstall_alerting.js +++ b/scripts/postinstall_alerting.js @@ -3,10 +3,12 @@ * SPDX-License-Identifier: Apache-2.0 */ -const { exec } = require('child_process'); +const { exec, execSync } = require('child_process'); -function run() { - exec('husky install', (_error) => {}); -} +const { INIT_CWD, PWD = process.cwd() } = process.env; -run(); +if (INIT_CWD?.startsWith?.(PWD)) { + try { + execSync('husky install'); + } catch (error) {} +}