Skip to content

Commit

Permalink
fix: npm 10 bug with npm pack; issue 740
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Apr 16, 2024
1 parent ad1a980 commit 4f1aa37
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion source/npm/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ export const getFilesToBePacked = async rootDirectory => {
const {stdout} = await execa('npm', ['pack', '--dry-run', '--json', '--silent'], {cwd: rootDirectory});

try {
const {files} = JSON.parse(stdout).at(0);
const cleanStdout = stdout.replace(/^[^[]*\[/, '[').trim();
const {files} = JSON.parse(cleanStdout).at(0);
return files.map(file => file.path);
} catch (error) {
throw new Error('Failed to parse output of npm pack', {cause: error});
Expand Down

0 comments on commit 4f1aa37

Please sign in to comment.