mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-15 20:16:07 -04:00
* chore(scripts): typecheck-only * feat: change all configuration * feat: include pnpm/ and pnpm/test/ * chore(deps): remove unused dependency * refactor(typescript-only): use find-packages * refactor(typescript-only): refactor paths * fix: typescript-only * fix: update compile-only * fix: compile pnpm * fix: windows * fix: windows * chore: meta-updater * refactor(tsconfig): remove explicit composite * fix: path in windows * feat: don't depend on cwd --------- Co-authored-by: Zoltan Kochan <z@kochan.io>
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import fs from 'fs'
|
|
import path from 'path'
|
|
import { audit } from '@pnpm/audit'
|
|
import { readWantedLockfile } from '@pnpm/lockfile.fs'
|
|
import { fixtures } from '@pnpm/test-fixtures'
|
|
|
|
const f = fixtures(__dirname)
|
|
|
|
async function writeResponse (lockfileDir: string, filename: string, opts: {
|
|
production?: boolean
|
|
dev?: boolean
|
|
optional?: boolean
|
|
}) {
|
|
const lockfile = await readWantedLockfile(lockfileDir, { ignoreIncompatible: true })
|
|
const include = {
|
|
dependencies: opts.production !== false,
|
|
devDependencies: opts.dev !== false,
|
|
optionalDependencies: opts.optional !== false,
|
|
}
|
|
// @ts-expect-error
|
|
const auditReport = await audit(lockfile!, {
|
|
agentOptions: {},
|
|
include,
|
|
registry: 'https://registry.npmjs.org/',
|
|
})
|
|
fs.writeFileSync(path.join(__dirname, filename), JSON.stringify(auditReport, null, 2))
|
|
}
|
|
|
|
// eslint-disable-next-line
|
|
; (async () => {
|
|
await writeResponse(f.find('has-vulnerabilities'), 'dev-vulnerabilities-only-response.json', {
|
|
dev: true,
|
|
production: false,
|
|
})
|
|
await writeResponse(f.find('has-vulnerabilities'), 'all-vulnerabilities-response.json', {})
|
|
await writeResponse(f.find('has-outdated-deps'), 'no-vulnerabilities-response.json', {})
|
|
})()
|