Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING: Remove support for setting spaces for JSON writing #402

Merged
merged 1 commit into from Apr 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
}