Skip to content

Commit b413ea8

Browse files
committed
fix!: refactor writePackageJson to not require path
1 parent 6fd2db1 commit b413ea8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ async function main (input, _opts = {}) {
217217
})()
218218

219219
opts = options.values()
220-
return write(path.resolve(opts.cwd, 'package.json'), opts, await format(opts, pkg), { log })
220+
return write(opts, await format(opts, pkg), { log })
221221
}
222222

223223
module.exports.options = initOpts().options
@@ -302,6 +302,8 @@ async function format (opts, pkg = {}) {
302302
pkg.peerDependencies = {}
303303

304304
await Promise.all(opts.peerDependencies.map(async (name) => {
305+
// @TODO we should align peer deps with the associated
306+
// devDep or prodDep semver range
305307
const spec = await npm.normalizePackageName(name)
306308
let ver
307309
switch (spec.type) {
@@ -320,7 +322,8 @@ async function format (opts, pkg = {}) {
320322

321323
module.exports.write = write
322324
// TODO: look at https://npm.im/json-file-plus for writing
323-
async function write (pkgPath, opts, pkg, { log } = {}) {
325+
async function write (opts, pkg, { log } = {}) {
326+
const pkgPath = path.resolve(opts.cwd, 'package.json')
324327
// Write package json
325328
log.info(`Writing package.json\n${pkgPath}`)
326329
await fs.outputJSON(pkgPath, pkg, {

0 commit comments

Comments
 (0)