Skip to content

Commit

Permalink
Use --foreground-scripts=false for npm v10 support
Browse files Browse the repository at this point in the history
  • Loading branch information
karlhorky committed Apr 17, 2024
1 parent 5a83ad9 commit 0011731
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions source/npm/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,14 @@ 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',

Check failure on line 142 in source/npm/util.js

View workflow job for this annotation

GitHub Actions / Node.js 21

There should be a linebreak after this element.

Check failure on line 142 in source/npm/util.js

View workflow job for this annotation

GitHub Actions / Node.js 21

There should be a linebreak after this element.

Check failure on line 142 in source/npm/util.js

View workflow job for this annotation

GitHub Actions / Node.js 21

There should be a linebreak after this element.

Check failure on line 142 in source/npm/util.js

View workflow job for this annotation

GitHub Actions / Node.js 20

There should be a linebreak after this element.

Check failure on line 142 in source/npm/util.js

View workflow job for this annotation

GitHub Actions / Node.js 20

There should be a linebreak after this element.

Check failure on line 142 in source/npm/util.js

View workflow job for this annotation

GitHub Actions / Node.js 20

There should be a linebreak after this element.

Check failure on line 142 in source/npm/util.js

View workflow job for this annotation

GitHub Actions / Node.js 18

There should be a linebreak after this element.

Check failure on line 142 in source/npm/util.js

View workflow job for this annotation

GitHub Actions / Node.js 18

There should be a linebreak after this element.

Check failure on line 142 in source/npm/util.js

View workflow job for this annotation

GitHub Actions / Node.js 18

There should be a linebreak after this element.
// 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});
Expand Down

0 comments on commit 0011731

Please sign in to comment.