Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.

Commit 41e4c18

Browse files
author
Lucas Rojas
committed
Clean comments from ProjectTools.js
1 parent 3a56918 commit 41e4c18

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

lib/projectTools.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,23 @@ function openVisualStudioProject (visualStudioFilePath, callback) {
1818
.nodeify(callback);
1919
}
2020

21-
// searches for the telemetry file present in every platform project
2221
function searchForTelemetryFile (dir) {
2322
var telemetryFile = path.join(dir, constants.TELEMETRY_FILE_NAME);
2423
return Q.nfcall(fs.stat, telemetryFile).then(function (info) {
25-
// return current directory if the name matches and it's a file
2624
if (info.isFile()) {
2725
return dir;
2826
}
2927
})
3028
.catch (function (err) {
31-
// report any error other than not found
3229
if (err.code !== 'ENOENT') {
3330
throw err;
3431
}
3532
})
3633
.then (function (root) {
37-
// if a result was found, return it
3834
if (root) {
3935
return root;
4036
}
4137

42-
// search parent directory unless we are already at the root
4338
var parentPath = path.resolve(dir, '..');
4439
if (parentPath !== dir) {
4540
return searchForTelemetryFile(parentPath);
@@ -48,13 +43,9 @@ function searchForTelemetryFile (dir) {
4843
}
4944

5045
function isProjectRoot (dir) {
51-
// get available app categories
5246
var appTypes = [ constants.PWA_FOLDER, constants.POLYFILLS_FOLDER ];
53-
54-
// get available platform IDs
5547
var platforms = platformTools.listPlatforms();
5648

57-
// search child platform folders
5849
return Q.nfcall(fs.readdir, dir).then(function (files) {
5950
var searchTasks = files.map(function (file) {
6051

@@ -68,7 +59,6 @@ function isProjectRoot (dir) {
6859
return Q.resolve(false);
6960
}
7061

71-
// search for telemetry file in the platform folder
7262
var platformDir = path.join(dir, file);
7363
return searchForTelemetryFile(platformDir).then(function (result) {
7464
return result;
@@ -84,23 +74,19 @@ function isProjectRoot (dir) {
8474
});
8575
}
8676

87-
// given a path within a pwabuilder project, returns its root
8877
function getProjectRoot (dir) {
8978
var insidePWA = new RegExp(constants.PWA_FOLDER + '$');
9079
var insidePolyfills = new RegExp(constants.POLYFILLS_FOLDER + '$');
9180

92-
// check if this is the project root
9381
return isProjectRoot(dir).then(function (isRoot) {
9482
if (isRoot) {
9583
return dir;
9684
} else if (dir.match(insidePWA) || dir.match(insidePolyfills)) {
9785
return getProjectRoot(path.resolve(dir, '..'));
9886
}
9987

100-
// search for a platform folder containing telemetry file
10188
return searchForTelemetryFile(dir).then(function (filePath) {
10289
if (filePath) {
103-
// start search for project root from the platform folder
10490
var parentPath = path.resolve(filePath, '..');
10591
if (parentPath !== dir) {
10692
return getProjectRoot(parentPath);
@@ -125,7 +111,6 @@ function getProjectRoot (dir) {
125111
function getProjectPlatformsRecursivelly (dir, configuredPlatforms, foundPlatforms) {
126112
if (!foundPlatforms) { foundPlatforms = []; }
127113

128-
// search recursivelly for telemetry files or known platform folders with telemetry matching info inside
129114
return Q.nfcall(fs.readdir, dir).then(function (files) {
130115
var searchPlatformTasks = files.map(function (file) {
131116
var extendedDir = path.join(dir, file);
@@ -141,7 +126,6 @@ function getProjectPlatformsRecursivelly (dir, configuredPlatforms, foundPlatfor
141126
});
142127
}
143128
} else if (configuredPlatforms[file]) {
144-
// try to open telemetry file within folder (if exists - otherwise not interesting folder)
145129
var telemetryFile = path.join(extendedDir, constants.TELEMETRY_FILE_NAME);
146130
return Q.nfcall(fs.readFile, telemetryFile, 'utf8').then(function(data) {
147131
var generationInfo = JSON.parse(data);
@@ -164,7 +148,6 @@ function getProjectPlatformsRecursivelly (dir, configuredPlatforms, foundPlatfor
164148
}
165149

166150
function getProjectPlatforms (dir) {
167-
// get available platform IDs
168151
var configuredPlatforms = platformTools.getConfiguredPlatforms();
169152

170153
return getProjectRoot(dir || process.cwd()).then(function (rootDir) {

0 commit comments

Comments
 (0)