Skip to content

Commit

Permalink
fix boolean logic
Browse files Browse the repository at this point in the history
  • Loading branch information
edwmurph committed Jan 26, 2021
1 parent b230660 commit d9a7fdc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const upgradeDeps = async({ breaking }) => {
dependencies.map(([name, version]) => {
const prevVersion = packageJSON.dependencies[name];
const majorBump = prevVersion.split('.')[0] !== version.split('.')[0];
return [name, breaking && majorBump ? version : prevVersion];
return [name, !majorBump || breaking ? version : prevVersion];
}),
);
}
Expand All @@ -103,12 +103,12 @@ const upgradeDeps = async({ breaking }) => {
devDependencies.map(([name, version]) => {
const prevVersion = packageJSON.devDependencies[name];
const majorBump = prevVersion.split('.')[0] !== version.split('.')[0];
return [name, breaking && majorBump ? version : prevVersion];
return [name, !majorBump || breaking ? version : prevVersion];
}),
);
}

await writeFileAsync( 'package.json', JSON.stringify( updated, null, 2 ) );
await writeFileAsync( 'package.json', JSON.stringify( updated, null, 2 ).trim() );

await execAsync( `rm -rf ${ storage }` );

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "upgrade-deps",
"version": "0.0.3",
"version": "0.0.4",
"description": "CLI for automating updating package.json dependencies",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit d9a7fdc

Please sign in to comment.