Skip to content

Commit 4b6c281

Browse files
committed
fix(utils): remove useless resolveRelativeFilePath method
1 parent aef3fc8 commit 4b6c281

File tree

4 files changed

+9
-22
lines changed

4 files changed

+9
-22
lines changed

lib/cli/cli-info.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
"use strict";
22

3-
var config = require("../config");
4-
var utils = require("../utils");
5-
var logger = require("../logger").logger;
3+
var config = require("../config");
4+
var logger = require("../logger").logger;
65

7-
var fs = require("fs");
8-
var _ = require("lodash");
9-
var path = require("path");
6+
var fs = require("fs");
7+
var _ = require("lodash");
8+
var path = require("path");
109

1110
var info = {
1211
/**
@@ -44,13 +43,10 @@ var info = {
4443
});
4544

4645
var file = fs.readFileSync(path.join(__dirname, config.template), "utf8");
47-
4846
file = file.replace("//OPTS", JSON.stringify(userOpts, null, 4));
4947

50-
var filePath = cwd + config.userFile;
51-
52-
fs.writeFile(filePath, file, function () {
53-
logger.info("Config file created {magenta:%s}", utils.resolveRelativeFilePath(filePath, cwd));
48+
fs.writeFile(path.resolve(cwd, config.userFile), file, function () {
49+
logger.info("Config file created {magenta:%s}", config.userFile);
5450
logger.info(
5551
"To use it, in the same directory run: " +
5652
"{cyan:browser-sync start --config bs-config.js}"

lib/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = {
1515
},
1616
socketIoScript: "/public/socket.io.js",
1717
configFile: "default-config.js",
18-
userFile: "/bs-config.js",
18+
userFile: "bs-config.js",
1919
template: "cli-template.js",
2020
httpProtocol: {
2121
path: "/__browser_sync__"

lib/logger.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ module.exports.callbacks = {
5050
return logger.info("{cyan:Reloading files that match: {magenta:%s", data.path);
5151
}
5252

53-
var path = utils.resolveRelativeFilePath(data.path, data.cwd);
54-
logger.info("{cyan:File changed: {magenta:%s", path);
53+
logger.info("{cyan:File changed: {magenta:%s", data.path);
5554
}
5655
},
5756
/**

lib/utils.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,6 @@ var utils = {
131131
getUaString: function (ua) {
132132
return parser.setUA(ua).getBrowser();
133133
},
134-
/**
135-
* @param {String} filepath
136-
* @param {String} cwd
137-
* @returns {String}
138-
*/
139-
resolveRelativeFilePath: function (filepath, cwd) {
140-
return filepath.replace(cwd + "/", "");
141-
},
142134
/**
143135
* Open the page in browser
144136
* @param {String} url

0 commit comments

Comments
 (0)