Skip to content

Commit

Permalink
feat: only sort unsorted package.json file. (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
agirorn authored and keithamus committed Apr 4, 2017
1 parent df11601 commit 415bfa4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ if (require.main === module) {
var fs = require('fs');
var packageJsonPath = process.cwd() + '/package.json';
var packageJson = fs.readFileSync(packageJsonPath, 'utf8');
fs.writeFileSync(packageJsonPath, sortPackageJson(packageJson), 'utf8');
console.log('Ok, your package.json is sorted');
var sorted = sortPackageJson(packageJson);
if (sorted !== packageJson) {
fs.writeFileSync(packageJsonPath, sorted, 'utf8');
console.log('Ok, your package.json is sorted');
}
}

0 comments on commit 415bfa4

Please sign in to comment.