build: update npx.py to support npx@7 (#26662)
* build: update npx.py to support npx@7 * build: set npm_config_yes for all npx callsites
This commit is contained in:
parent
e455a79218
commit
b894151745
6 changed files with 17 additions and 6 deletions
|
@ -40,7 +40,7 @@ DevToolsSecurity -enable
|
||||||
# security import "$dir"/public.key -k $KEY_CHAIN
|
# security import "$dir"/public.key -k $KEY_CHAIN
|
||||||
|
|
||||||
# Generate Trust Settings
|
# Generate Trust Settings
|
||||||
npx ts-node "$(dirname $0)"/gen-trust.ts "$dir"/certificate.cer "$dir"/trust.xml
|
npm_config_yes=true npx ts-node "$(dirname $0)"/gen-trust.ts "$dir"/certificate.cer "$dir"/trust.xml
|
||||||
|
|
||||||
# Import Trust Settings
|
# Import Trust Settings
|
||||||
sudo security trust-settings-import -d "$dir/trust.xml"
|
sudo security trust-settings-import -d "$dir/trust.xml"
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def npx(*npx_args):
|
def npx(*npx_args):
|
||||||
|
npx_env = os.environ.copy()
|
||||||
|
npx_env['npm_config_yes'] = 'true'
|
||||||
call_args = [__get_executable_name()] + list(npx_args)
|
call_args = [__get_executable_name()] + list(npx_args)
|
||||||
subprocess.check_call(call_args)
|
subprocess.check_call(call_args, env=npx_env)
|
||||||
|
|
||||||
|
|
||||||
def __get_executable_name():
|
def __get_executable_name():
|
||||||
|
|
|
@ -22,7 +22,8 @@ async function main () {
|
||||||
const env = Object.assign({}, process.env, {
|
const env = Object.assign({}, process.env, {
|
||||||
npm_config_nodedir: nodeDir,
|
npm_config_nodedir: nodeDir,
|
||||||
npm_config_msvs_version: '2019',
|
npm_config_msvs_version: '2019',
|
||||||
npm_config_arch: process.env.NPM_CONFIG_ARCH
|
npm_config_arch: process.env.NPM_CONFIG_ARCH,
|
||||||
|
npm_config_yes: 'true'
|
||||||
});
|
});
|
||||||
const { status: buildStatus } = cp.spawnSync(NPX_CMD, ['node-gyp', 'rebuild', '--directory', 'test', '-j', 'max'], {
|
const { status: buildStatus } = cp.spawnSync(NPX_CMD, ['node-gyp', 'rebuild', '--directory', 'test', '-j', 'max'], {
|
||||||
env,
|
env,
|
||||||
|
|
|
@ -46,9 +46,11 @@ def main():
|
||||||
|
|
||||||
for symbol_file in files:
|
for symbol_file in files:
|
||||||
print("Generating Sentry src bundle for: " + symbol_file)
|
print("Generating Sentry src bundle for: " + symbol_file)
|
||||||
|
npx_env = os.environ.copy()
|
||||||
|
npx_env['npm_config_yes'] = 'true'
|
||||||
subprocess.check_output([
|
subprocess.check_output([
|
||||||
NPX_CMD, '@sentry/cli@1.51.1', 'difutil', 'bundle-sources',
|
NPX_CMD, '@sentry/cli@1.51.1', 'difutil', 'bundle-sources',
|
||||||
symbol_file])
|
symbol_file], env=npx_env)
|
||||||
|
|
||||||
files += glob.glob(SYMBOLS_DIR + '/*/*/*.src.zip')
|
files += glob.glob(SYMBOLS_DIR + '/*/*/*.src.zip')
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,8 @@ async function installSpecModules (dir) {
|
||||||
const nodeDir = path.resolve(BASE, `out/${utils.getOutDir({ shouldLog: true })}/gen/node_headers`);
|
const nodeDir = path.resolve(BASE, `out/${utils.getOutDir({ shouldLog: true })}/gen/node_headers`);
|
||||||
const env = Object.assign({}, process.env, {
|
const env = Object.assign({}, process.env, {
|
||||||
npm_config_nodedir: nodeDir,
|
npm_config_nodedir: nodeDir,
|
||||||
npm_config_msvs_version: '2019'
|
npm_config_msvs_version: '2019',
|
||||||
|
npm_config_yes: 'true'
|
||||||
});
|
});
|
||||||
if (fs.existsSync(path.resolve(dir, 'node_modules'))) {
|
if (fs.existsSync(path.resolve(dir, 'node_modules'))) {
|
||||||
await fs.remove(path.resolve(dir, 'node_modules'));
|
await fs.remove(path.resolve(dir, 'node_modules'));
|
||||||
|
|
|
@ -11,7 +11,11 @@ if (process.mainModule === module) {
|
||||||
const NPX_CMD = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
const NPX_CMD = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
||||||
|
|
||||||
const child = cp.spawn(NPX_CMD, [`yarn@${YARN_VERSION}`, ...process.argv.slice(2)], {
|
const child = cp.spawn(NPX_CMD, [`yarn@${YARN_VERSION}`, ...process.argv.slice(2)], {
|
||||||
stdio: 'inherit'
|
stdio: 'inherit',
|
||||||
|
env: {
|
||||||
|
...process.env,
|
||||||
|
npm_config_yes: 'true'
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
child.on('exit', code => process.exit(code));
|
child.on('exit', code => process.exit(code));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue