({
config,
flatOptions,
localPrefix,
npm,
workspaces,
})
| 3 | const reifyFinish = require('../utils/reify-finish.js') |
| 4 | |
| 5 | async function updateWorkspaces ({ |
| 6 | config, |
| 7 | flatOptions, |
| 8 | localPrefix, |
| 9 | npm, |
| 10 | workspaces, |
| 11 | }) { |
| 12 | if (!flatOptions.workspacesUpdate || !workspaces.length) { |
| 13 | return |
| 14 | } |
| 15 | |
| 16 | // default behavior is to not save by default in order to avoid race condition problems when publishing multiple workspaces that have dependencies on one another |
| 17 | // it might still be useful in some cases, which then need to set --save |
| 18 | const save = config.isDefault('save') |
| 19 | ? false |
| 20 | : config.get('save') |
| 21 | |
| 22 | // runs a minimalistic reify update, targeting only the workspaces that had version updates and skipping fund/audit/save |
| 23 | const opts = { |
| 24 | ...flatOptions, |
| 25 | audit: false, |
| 26 | fund: false, |
| 27 | path: localPrefix, |
| 28 | save, |
| 29 | } |
| 30 | const Arborist = require('@npmcli/arborist') |
| 31 | const arb = new Arborist(opts) |
| 32 | |
| 33 | await arb.reify({ ...opts, update: workspaces }) |
| 34 | await reifyFinish(npm, arb) |
| 35 | } |
| 36 | |
| 37 | module.exports = updateWorkspaces |
no test coverage detected
searching dependent graphs…