-
Notifications
You must be signed in to change notification settings - Fork 28
Added support for pnpm package manager #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| const unparse = require('../unparse') | ||
| const skipArgs = require('../skipArgs') | ||
|
|
||
| function getCommand(action) { | ||
| // Derived from pnpm-audit-report | ||
| // TODO: share the code | ||
| if (action.action === 'install') { | ||
| const isDev = action.resolves[0].dev | ||
| return `pnpm install ${isDev ? '--save-dev ' : ''}${action.module}@${action.target}` | ||
| } else { | ||
| return `pnpm update ${action.module} --depth ${action.depth}` | ||
| } | ||
| } | ||
|
|
||
| module.exports = { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't look like it's any different from npm. Is this just 'p' added to every 'npm' in the code, or I missed the changes? Is that enough for it to work? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @naugtur PNPM commands are almost similar to NPM. It works. We are using my fork in production. |
||
| version: 1, | ||
| getAudit({ promiseCommand, argv, shellOptions }) { | ||
| const unparsed = unparse(argv, skipArgs) | ||
|
|
||
| return promiseCommand(`pnpm audit --json ${unparsed}`, shellOptions) | ||
| .then(output => { | ||
| try { | ||
| return JSON.parse(output) | ||
| } catch (e) { | ||
| console.error('failed to parse output') | ||
| console.error(output) | ||
| throw e; | ||
| } | ||
| }) | ||
| .then(parsed => { | ||
| if (parsed.error) { | ||
| throw Error(`'pnpm audit' failed with ${parsed.error.code}. Check the log above for more details.`); | ||
| } | ||
| return parsed | ||
| }) | ||
| //TODO: retries on ENOAUDIT | ||
| }, | ||
| fix({ promiseCommand, argv, shellOptions, action }) { | ||
|
|
||
| return promiseCommand(getCommand(action), shellOptions) | ||
| }, | ||
| remove({ promiseCommand, argv, shellOptions, names }) { | ||
| //TODO: include the fact that some of them are dev dependencies and we don't know which, because we shouldn't have to at this point | ||
| //FIXME: this command might not delete everything as expected | ||
| return promiseCommand(`pnpm rm ${names.join(' ')}`, shellOptions) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| module.exports = ['json', 'migrate', 'yarn', 'mock', 'fix'] | ||
| module.exports = ['json', 'migrate', 'yarn', 'pnpm', 'mock', 'fix'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks familiar. Is this comment section true?