diff --git a/source/npm/util.js b/source/npm/util.js index 724271d6..02736fcb 100644 --- a/source/npm/util.js +++ b/source/npm/util.js @@ -138,12 +138,17 @@ export const checkIgnoreStrategy = async ({files}, rootDirectory) => { }; export const getFilesToBePacked = async rootDirectory => { - const {stdout} = await execa('npm', ['pack', '--dry-run', '--json', '--silent'], {cwd: rootDirectory}); + const {stdout} = await execa('npm', [ + 'pack', + '--dry-run', + '--json', + '--silent', + // TODO: Remove this once [npm/cli#7354](https://github.com/npm/cli/issues/7354) is resolved. + '--foreground-scripts=false', + ], {cwd: rootDirectory}); try { - // TODO: Remove this once [npm/cli#7354](https://github.com/npm/cli/issues/7354) is resolved. - const cleanStdout = stdout.replace(/^[^[]*\[/, '[').trim(); - const {files} = JSON.parse(cleanStdout).at(0); + const {files} = JSON.parse(stdout).at(0); return files.map(file => file.path); } catch (error) { throw new Error('Failed to parse output of npm pack', {cause: error});