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

Commit 7b4e565

Browse files
committed
add logs
1 parent 8970461 commit 7b4e565

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

dist/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,21 @@ const detector = {
107107
};
108108
function searchForFile(filename) {
109109
return __awaiter(this, void 0, void 0, function* () {
110-
console.log(`searching for ${filename} in ${__dirname}`);
110+
console.log(`searching for ${filename} in ${process.cwd()}`);
111111
const { stdout } = yield (0, execa_1.default)('find', [
112112
'.',
113113
'-name',
114114
`'${filename}'`
115-
]);
115+
], {
116+
cwd: process.cwd()
117+
});
116118
const dirs = stdout
117119
.split('\n')
118120
.filter(s => s.length > 0)
119121
// remove the file name
120122
.map((filename) => path.dirname(filename))
121123
// map to absolute path
122-
.map((pathname) => path.resolve(__dirname, pathname));
124+
.map((pathname) => path.resolve(process.cwd(), pathname));
123125
console.log(dirs);
124126
return dirs;
125127
});

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,24 @@ const detector = {
1616
}
1717

1818
async function searchForFile (filename:string) {
19-
console.log(`searching for ${filename} in ${__dirname}`)
19+
console.log(`searching for ${filename} in ${process.cwd()}`)
2020

2121
const { stdout } = await execa('find', [
2222
'.',
2323
'-name',
2424
`'${filename}'`
25-
])
25+
],
26+
{
27+
cwd: process.cwd()
28+
})
2629

2730
const dirs = stdout
2831
.split('\n')
2932
.filter(s => s.length > 0)
3033
// remove the file name
3134
.map((filename) => path.dirname(filename))
3235
// map to absolute path
33-
.map((pathname) => path.resolve(__dirname, pathname))
36+
.map((pathname) => path.resolve(process.cwd(), pathname))
3437

3538
console.log(dirs)
3639

0 commit comments

Comments
 (0)