Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions workspaces/arborist/lib/arborist/reify.js
Original file line number Diff line number Diff line change
Expand Up @@ -1369,13 +1369,18 @@ module.exports = cls => class Reifier extends cls {
devDependencies = {},
optionalDependencies = {},
peerDependencies = {},
// bundleDependencies is not required by PackageJson like the other fields here
// PackageJson also doesn't omit an empty array for this field so defaulting this
// to an empty array would add that field to every package.json file.
bundleDependencies,
} = tree.package

pkgJson.update({
dependencies,
devDependencies,
optionalDependencies,
peerDependencies,
bundleDependencies,
})
await pkgJson.save()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33164,6 +33164,10 @@ exports[`test/arborist/reify.js TAP save-prod, with optional > must match snapsh
{"dependencies":{"abbrev":"^1.1.1"}}
`

exports[`test/arborist/reify.js TAP saveBundle > must match snapshot 1`] = `
{"dependencies":{"abbrev":"^1.1.1"},"bundleDependencies":["abbrev"]}
`

exports[`test/arborist/reify.js TAP saving the ideal tree save some stuff > lock after save 1`] = `
Object {
"dependencies": Object {
Expand Down
11 changes: 11 additions & 0 deletions workspaces/arborist/test/arborist/reify.js
Original file line number Diff line number Diff line change
Expand Up @@ -1783,6 +1783,17 @@ t.test('save-prod, with optional', async t => {
t.matchSnapshot(fs.readFileSync(path + '/package.json', 'utf8'))
})

t.test('saveBundle', async t => {
const path = t.testdir({
'package.json': JSON.stringify({
dependencies: { abbrev: '*' },
}),
})
const arb = newArb({ path })
await arb.reify({ add: ['abbrev'], saveType: 'prod', saveBundle: true })
t.matchSnapshot(fs.readFileSync(path + '/package.json', 'utf8'))
})

t.test('no saveType: dev w/ compatible peer', async t => {
const path = t.testdir({
'package.json': JSON.stringify({
Expand Down