Skip to content

Commit 52b3766

Browse files
authored
fix: make private only effective when set to true, handle existing packages (#324)
- **fix: make private only effective when set to true, handle existing packages**
1 parent 39aa531 commit 52b3766

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/default-input.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ exports.type = yes ? type : prompt('type', type, (data) => {
267267
return data
268268
})
269269

270-
const initPrivate = getConfig('private')
271-
if (initPrivate !== undefined) {
272-
exports.private = initPrivate
270+
const initPrivate = package.private || getConfig('private')
271+
if (initPrivate === true) {
272+
exports.private = true
273273
}

test/private-defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ t.test('private field with init-private false', async (t) => {
1818
config: { yes: 'yes', 'init-private': false },
1919
})
2020

21-
t.equal(data.private, false, 'private field set to false in yes mode')
21+
t.equal(data.private, undefined, 'private field set to false is undefined')
2222
})
2323

2424
t.test('private field without init-private', async (t) => {

0 commit comments

Comments
 (0)