Skip to content

Commit b258fd6

Browse files
committed
Changed scopes in findUserJS() to work globally
1 parent d146823 commit b258fd6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

utils/bump/bump-utils.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,20 @@ export function fetchData(url) {
5959
return fetch(url)
6060
}
6161

62-
export async function findUserJS(dir = this.findUserJS.monorepoRoot) {
62+
export async function findUserJS(dir = global.monorepoRoot) {
6363
const userJSfiles = []
64-
if (!dir && !this.findUserJS.monorepoRoot) { // no arg passed, init monorepo root
64+
if (!dir && !global.monorepoRoot) { // no arg passed, init monorepo root
6565
dir = path.dirname(fileURLToPath(import.meta.url))
6666
while (!fs.existsSync(path.join(dir, 'package.json')))
6767
dir = path.dirname(dir) // traverse up to closest manifest dir
68-
this.findUserJS.monorepoRoot = dir
68+
global.monorepoRoot = dir
6969
}
7070
dir = path.resolve(dir)
7171
fs.readdirSync(dir).forEach(async entry => {
7272
if (/^(?:\.|node_modules$)/.test(entry)) return
7373
const entryPath = path.join(dir, entry)
7474
if (fs.statSync(entryPath).isDirectory()) // recursively search subdirs
75-
userJSfiles.push(...await this.findUserJS(entryPath))
75+
userJSfiles.push(...await findUserJS(entryPath))
7676
else if (entry.endsWith('.user.js')) {
7777
console.log(entryPath) ; userJSfiles.push(entryPath) }
7878
})

0 commit comments

Comments
 (0)