Skip to content

Commit

Permalink
Merge pull request #402 from jprichardson/spaces
Browse files Browse the repository at this point in the history
BREAKING: Remove support for setting spaces for JSON writing
  • Loading branch information
jprichardson committed Apr 10, 2017
2 parents b549b04 + c0f56ee commit 2a4ec71
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 53 deletions.
11 changes: 0 additions & 11 deletions lib/index.js
Expand Up @@ -24,14 +24,3 @@ assign(fs, require('./ensure'))
assign(fs, require('./output'))

module.exports = fs

// maintain backwards compatibility for awhile
const jsonfile = {}
Object.defineProperty(jsonfile, 'spaces', {
get: () => fs.spaces, // found in ./json
set: val => {
fs.spaces = val
}
})

module.exports.jsonfile = jsonfile // so users of fs-extra can modify jsonFile.spaces
7 changes: 1 addition & 6 deletions lib/json/__tests__/jsonfile-integration.test.js
Expand Up @@ -25,15 +25,10 @@ describe('jsonfile-integration', () => {
lastName: 'Richardson'
}

const oldSpaces = fse.jsonfile.spaces
fse.jsonfile.spaces = 4

const file = path.join(TEST_DIR, 'file.json')
fse.writeJsonSync(file, obj1)
const data = fs.readFileSync(file, 'utf8')
assert.strictEqual(data, JSON.stringify(obj1, null, 4) + '\n')

fse.jsonfile.spaces = oldSpaces
assert.strictEqual(data, JSON.stringify(obj1) + '\n')
})
})
})
34 changes: 0 additions & 34 deletions lib/json/__tests__/spaces.test.js

This file was deleted.

3 changes: 1 addition & 2 deletions lib/json/jsonfile.js
Expand Up @@ -11,6 +11,5 @@ module.exports = {
writeJson: jsonFile.writeFile,
writeJSON: jsonFile.writeFile,
writeJsonSync: jsonFile.writeFileSync,
writeJSONSync: jsonFile.writeFileSync,
spaces: 2 // default in fs-extra
writeJSONSync: jsonFile.writeFileSync
}

0 comments on commit 2a4ec71

Please sign in to comment.