Change cross-spawn dependency to be optionalDependency

Closes #573, #795, #922, #858, #925, #761, #902, #740.

If cross-spawn fails to install, atom-beautify will still continue to
install and work without it, with degraded support for Windows, such as
ignoring PATHEXT.
This commit is contained in:
Glavin Wiechert 2016-04-16 19:55:13 -03:00
parent 1e282de280
commit c950557438
2 changed files with 9 additions and 2 deletions

View File

@ -88,7 +88,6 @@
"coffee-fmt": "0.11.0",
"coffee-formatter": "^0.1.2",
"coffee-script": "^1.10.0",
"cross-spawn": "^2.0.0",
"csscomb": "^3.1.7",
"diff": "^2.1.0",
"editorconfig": "^0.12.2",
@ -117,6 +116,9 @@
"winston": "^1.0.0",
"yaml-front-matter": "^3.2.3"
},
"optionalDependencies": {
"cross-spawn": "^2.0.0"
},
"activationCommands": {
"atom-workspace": [
"atom-beautify:help-debug-editor",

View File

@ -2,9 +2,14 @@ Promise = require("bluebird")
_ = require('lodash')
fs = require("fs")
temp = require("temp").track()
spawn = require('cross-spawn')
readFile = Promise.promisify(fs.readFile)
which = require('which')
# Get optional dependency cross-spawn
spawn = null
try
spawn = require('cross-spawn')
catch err
spawn = require('child_process').spawn
module.exports = class Beautifier