Skip to content

Commit 34409be

Browse files
authored
Fix npm 10 compatibility for real (#744)
1 parent 5a83ad9 commit 34409be

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

source/npm/util.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,17 @@ export const checkIgnoreStrategy = async ({files}, rootDirectory) => {
138138
};
139139

140140
export const getFilesToBePacked = async rootDirectory => {
141-
const {stdout} = await execa('npm', ['pack', '--dry-run', '--json', '--silent'], {cwd: rootDirectory});
141+
const {stdout} = await execa('npm', [
142+
'pack',
143+
'--dry-run',
144+
'--json',
145+
'--silent',
146+
// TODO: Remove this once [npm/cli#7354](https://github.com/npm/cli/issues/7354) is resolved.
147+
'--foreground-scripts=false',
148+
], {cwd: rootDirectory});
142149

143150
try {
144-
// TODO: Remove this once [npm/cli#7354](https://github.com/npm/cli/issues/7354) is resolved.
145-
const cleanStdout = stdout.replace(/^[^[]*\[/, '[').trim();
146-
const {files} = JSON.parse(cleanStdout).at(0);
151+
const {files} = JSON.parse(stdout).at(0);
147152
return files.map(file => file.path);
148153
} catch (error) {
149154
throw new Error('Failed to parse output of npm pack', {cause: error});

0 commit comments

Comments
 (0)