forked from Azure/azure-sdk-for-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is especially useful when piped to grep to find specific filenames within all projects in the Rush workspace, in order to open those files in your editor.
- Loading branch information
Brandon Siegel
committed
May 8, 2019
1 parent
9ba2049
commit 10bd28a
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
|
||
function read(filename) { | ||
const txt = fs | ||
.readFileSync(filename, "utf8") | ||
.replace(/\r/gm, "") | ||
.replace(/\n/gm, "«") | ||
.replace(/\/\*.*?\*\//gm, "") | ||
.replace(/«/gm, "\n") | ||
.replace(/\s+\/\/.*/g, ""); | ||
return JSON.parse(txt); | ||
} | ||
|
||
function walk(dir) { | ||
var list = fs.readdirSync(dir); | ||
for (const fileName of list) { | ||
const filePath = path.join(dir, fileName); | ||
if (fileName == "node_modules") { | ||
continue; | ||
} | ||
|
||
const stat = fs.statSync(filePath); | ||
if (stat && stat.isDirectory()) { | ||
walk(filePath); | ||
} else { | ||
console.log(path.resolve(filePath)); | ||
} | ||
} | ||
} | ||
|
||
const rush = read(`${__dirname}/../../rush.json`); | ||
for (const each of rush.projects) { | ||
walk(each.projectFolder); | ||
} |