Skip to content

Commit 9fdebd5

Browse files
authoredMar 13, 2024··
Fix compatibility with npm 10 (#737)
1 parent 3b6b9c8 commit 9fdebd5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎source/npm/util.js

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

140140
export const getFilesToBePacked = async rootDirectory => {
141-
const {stdout} = await execa('npm', ['pack', '--dry-run', '--json'], {cwd: rootDirectory});
141+
const {stdout} = await execa('npm', ['pack', '--dry-run', '--json', '--silent'], {cwd: rootDirectory});
142142

143-
const {files} = JSON.parse(stdout).at(0);
144-
return files.map(file => file.path);
143+
try {
144+
const {files} = JSON.parse(stdout).at(0);
145+
return files.map(file => file.path);
146+
} catch (error) {
147+
throw new Error('Failed to parse output of npm pack', {cause: error});
148+
}
145149
};

0 commit comments

Comments
 (0)
Please sign in to comment.