converting prettydiff to prettydiff2

This commit is contained in:
Austin Cheney 2017-06-30 11:31:34 -05:00
parent c87e3c386e
commit d57c90c2e3
3 changed files with 8 additions and 9 deletions

View File

@ -175,7 +175,7 @@
"node-dir": "0.1.17", "node-dir": "0.1.17",
"node-uuid": "1.4.8", "node-uuid": "1.4.8",
"open": "0.0.5", "open": "0.0.5",
"prettydiff": "1.16.37", "prettydiff2": "2.2.3",
"pug-beautify": "^0.1.1", "pug-beautify": "^0.1.1",
"remark": "6.0.1", "remark": "6.0.1",
"season": "6.0.0", "season": "6.0.0",
@ -422,7 +422,7 @@
"typescript-formatter", "typescript-formatter",
"tidy-markdown", "tidy-markdown",
"underscore-plus", "underscore-plus",
"prettydiff" "prettydiff2"
] ]
} }
}, },
@ -434,7 +434,7 @@
"typescript-formatter", "typescript-formatter",
"tidy-markdown", "tidy-markdown",
"underscore-plus", "underscore-plus",
"prettydiff" "prettydiffi2"
] ]
} }
} }

View File

@ -73,7 +73,7 @@ module.exports = class PrettyDiff extends Beautifier
beautify: (text, language, options) -> beautify: (text, language, options) ->
options.crlf = @getDefaultLineEnding(true,false,options.end_of_line) options.crlf = @getDefaultLineEnding(true,false,options.end_of_line)
return new @Promise((resolve, reject) => return new @Promise((resolve, reject) =>
prettydiff = require("prettydiff") prettydiff = require("prettydiff2")
_ = require('lodash') _ = require('lodash')
# Select Prettydiff language # Select Prettydiff language
@ -127,8 +127,7 @@ module.exports = class PrettyDiff extends Beautifier
# Beautify # Beautify
@verbose('prettydiff', options) @verbose('prettydiff', options)
output = prettydiff.api(options) result = prettydiff(options)
result = output[0]
# Return beautified text # Return beautified text
resolve(result) resolve(result)

View File

@ -10,7 +10,7 @@ module.exports = class VueBeautifier extends Beautifier
beautify: (text, language, options) -> beautify: (text, language, options) ->
return new @Promise((resolve, reject) => return new @Promise((resolve, reject) =>
prettydiff = require("prettydiff") prettydiff = require("prettydiff2")
_ = require('lodash') _ = require('lodash')
regexp = /(^<(template|script|style)[^>]*>)((\s|\S)*?)^<\/\2>/gim regexp = /(^<(template|script|style)[^>]*>)((\s|\S)*?)^<\/\2>/gim
@ -37,14 +37,14 @@ module.exports = class VueBeautifier extends Beautifier
lang: "scss" lang: "scss"
mode: "beautify" mode: "beautify"
) )
prettydiff.api(options)[0] prettydiff(options)
when "less" when "less"
options = _.merge(options, options = _.merge(options,
source: text source: text
lang: "less" lang: "less"
mode: "beautify" mode: "beautify"
) )
prettydiff.api(options)[0] prettydiffoptions)
when undefined when undefined
require("js-beautify").css(text, options) require("js-beautify").css(text, options)
else else